issue #56 check the type definitions

pull/81/head
Dibyendu Majumdar 9 years ago
parent 58de0d874f
commit 84b5b6476c

@ -68,6 +68,14 @@ extern "C" {
namespace ravi {
/*
** Lua typecode have certain bits that are used to
** indicate variants or subtypes, or whether the type
** is collectible. The enumerated values below
** reflect the way these type codes get set within
** Lua values - these are the codes the JIT code must
** use.
*/
enum LuaTypeCode {
LUA__TNIL = LUA_TNIL,
LUA__TBOOLEAN = LUA_TBOOLEAN,
@ -93,15 +101,20 @@ struct LuaLLVMTypes {
LuaLLVMTypes(llvm::LLVMContext &context);
void dump();
llvm::Type *C_voidT;
// Following are standard C types
// Must ensure that these types match
// between JIT and the C compiler
llvm::Type *C_voidT;
llvm::Type *C_doubleT;
llvm::Type *C_intptr_t;
llvm::Type *C_size_t;
llvm::PointerType *C_psize_t;
llvm::PointerType *C_psize_t; /* pointer to size_t */
llvm::Type *C_ptrdiff_t;
llvm::Type *C_int64_t;
llvm::Type *C_shortT;
llvm::Type *C_intT;
llvm::PointerType *C_pintT; /* pointer to int */
llvm::PointerType *C_pcharT; /* pointer to char */
llvm::Type *lua_NumberT;
llvm::PointerType *plua_NumberT;
@ -133,10 +146,6 @@ struct LuaLLVMTypes {
llvm::Type *lu_byteT;
llvm::Type *L_UmaxalignT;
llvm::PointerType *C_pcharT;
llvm::Type *C_intT;
llvm::PointerType *C_pintT;
llvm::StructType *lua_StateT;
llvm::PointerType *plua_StateT;

@ -30,7 +30,7 @@ The project was kicked off in January 2015.
JIT Implementation
++++++++++++++++++
The LLVM JIT compiler functional. The Lua and Ravi bytecodes currently implemented in LLVM are described in `JIT Status <http://the-ravi-programming-language.readthedocs.org/en/latest/ravi-jit-status.html>`_ page.
The LLVM JIT compiler is functional. The Lua and Ravi bytecodes currently implemented in LLVM are described in `JIT Status <http://the-ravi-programming-language.readthedocs.org/en/latest/ravi-jit-status.html>`_ page.
Ravi also provides an `LLVM binding <http://the-ravi-programming-language.readthedocs.org/en/latest/llvm-bindings.html>`_; this is still work in progress so please check documentation for the latest status.

@ -51,6 +51,7 @@ LuaLLVMTypes::LuaLLVMTypes(llvm::LLVMContext &context) : mdbuilder(context) {
C_intptr_t = llvm::Type::getIntNTy(context, sizeof(intptr_t) * 8);
C_size_t = llvm::Type::getIntNTy(context, sizeof(size_t) * 8);
C_psize_t = llvm::PointerType::get(C_size_t, 0);
C_ptrdiff_t = llvm::Type::getIntNTy(context, sizeof(ptrdiff_t) * 8);
C_int64_t = llvm::Type::getIntNTy(context, sizeof(int64_t) * 8);
C_intT = llvm::Type::getIntNTy(context, sizeof(int) * 8);
@ -69,12 +70,15 @@ LuaLLVMTypes::LuaLLVMTypes(llvm::LLVMContext &context) : mdbuilder(context) {
static_assert(sizeof(L_Umaxalign) == sizeof(double),
"L_Umaxalign is not same size as double");
L_UmaxalignT = llvm::Type::getDoubleTy(context);
L_UmaxalignT = C_doubleT;
static_assert(sizeof(lu_byte) == sizeof(char),
"lu_byte is not same size as char");
lu_byteT = llvm::Type::getInt8Ty(context);
C_pcharT = llvm::Type::getInt8PtrTy(context);
C_psize_t = llvm::PointerType::get(C_size_t, 0);
static_assert(sizeof(Instruction) == sizeof(int),
"Instruction is not same size as int");
InstructionT = C_intT;
pInstructionT = llvm::PointerType::get(InstructionT, 0);

Loading…
Cancel
Save