Skip to content

Commit

Permalink
issue #100
Browse files Browse the repository at this point in the history
  • Loading branch information
Dibyendu Majumdar committed Sep 23, 2016
1 parent 80feef4 commit 2fcea1c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,12 @@ if (NOT LLVM_JIT AND NOT GCC_JIT)
target_link_libraries(ravidebug libravistatic)

set(RAVI_DEBUGGER_TARGET ravidebug)
set(RAVI_STATIC_LIBRARY_TARGET libravistatic)
endif()

install(FILES ${LUA_HEADERS}
DESTINATION include/ravi)
install(TARGETS libravi ravi ${RAVI_DEBUGGER_TARGET}
install(TARGETS libravi ravi ${RAVI_DEBUGGER_TARGET} ${RAVI_STATIC_LIBRARY_TARGET}
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
2 changes: 2 additions & 0 deletions include/ravi_llvmcodegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ struct LuaLLVMTypes {
llvm::FunctionType *luaV_executeT;
llvm::FunctionType *luaV_gettableT;
llvm::FunctionType *luaV_settableT;
llvm::FunctionType *luaV_finishgetT;

// Following are functions that handle specific bytecodes
// We cheat for these bytecodes by calling the function that
Expand Down Expand Up @@ -619,6 +620,7 @@ struct RaviFunctionDef {
llvm::Function *luaH_getstrF;
llvm::Function *luaH_getintF;
llvm::Function *luaH_setintF;
llvm::Function *luaV_finishgetF;

// Some cheats - these correspond to OPCODEs that
// are not inlined as of now
Expand Down
1 change: 1 addition & 0 deletions ravi-tests/ravi_tests1.ravi
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,7 @@ function event_test()
end
event_test();
compile(event_test)
--ravi.dumpllvm(event_test)
event_test();
print 'Test 51 OK'

Expand Down
3 changes: 3 additions & 0 deletions src/ravi_llvmcodegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,9 @@ void RaviCodeGenerator::emit_extern_declarations(RaviFunctionDef *def) {
def->luaH_getstrF = def->raviF->addExternFunction(
def->types->luaH_getstrT, reinterpret_cast<void *>(&luaH_getstr),
"luaH_getstr");
def->luaV_finishgetF = def->raviF->addExternFunction(
def->types->luaV_finishgetT, reinterpret_cast<void *>(&luaV_finishget),
"luaV_finishget");

def->raviV_op_loadnilF = def->raviF->addExternFunction(
def->types->raviV_op_loadnilT,
Expand Down
3 changes: 2 additions & 1 deletion src/ravi_llvmtable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ void RaviCodeGenerator::emit_finish_GETTABLE(RaviFunctionDef *def, llvm::Value *

// If value is nil Lua requires that an index event be
// generated - so we fall back on slow path for that
CreateCall4(def->builder, def->raviV_finishgetF, def->L, rb, rc, ra);
//CreateCall4(def->builder, def->raviV_finishgetF, def->L, rb, rc, ra);
CreateCall5(def->builder, def->luaV_finishgetF, def->L, rb, rc, ra, phi);
def->builder->CreateBr(if_end_block);

// Merge results from the two branches above
Expand Down
5 changes: 5 additions & 0 deletions src/ravi_llvmtypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,11 @@ LuaLLVMTypes::LuaLLVMTypes(llvm::LLVMContext &context) : mdbuilder(context) {
// void raviV_finishget(lua_State *L, const TValue *t, TValue *key, StkId val);
raviV_finishgetT =
llvm::FunctionType::get(llvm::Type::getVoidTy(context), elements, false);
// void luaV_finishget (lua_State *L, const TValue *t, TValue *key,
// StkId val, const TValue *slot);
elements.push_back(pTValueT);
luaV_finishgetT =
llvm::FunctionType::get(llvm::Type::getVoidTy(context), elements, false);

// void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2,
// StkId res, TMS event);
Expand Down

0 comments on commit 2fcea1c

Please sign in to comment.