windows workaround for longjmp crash - not sure why this works!

pull/81/head
Dibyendu Majumdar 9 years ago
parent 14f82f722a
commit f5ff7ea0e1

@ -462,8 +462,10 @@ RaviCodeGenerator::create_function(llvm::IRBuilder<> &builder,
return func;
}
void RaviCodeGenerator::emit_raise_lua_error(RaviFunctionDef *def, const char *str) {
def->builder->CreateCall2(def->luaG_runerrorF, def->L, def->builder->CreateGlobalStringPtr(str));
void RaviCodeGenerator::emit_raise_lua_error(RaviFunctionDef *def,
const char *str) {
def->builder->CreateCall2(def->luaG_runerrorF, def->L,
def->builder->CreateGlobalStringPtr(str));
}
void RaviCodeGenerator::emit_extern_declarations(RaviFunctionDef *def) {
@ -689,11 +691,11 @@ void RaviCodeGenerator::compile(lua_State *L, Proto *p) {
llvm::LLVMContext &context = jitState_->context();
llvm::IRBuilder<> builder(context);
// std::unique_ptr<RaviFunctionDef> definition =
// std::unique_ptr<RaviFunctionDef>(new RaviFunctionDef());
// RaviFunctionDef *def = definition.get();
RaviFunctionDef definition = {0};
RaviFunctionDef *def = &definition;
std::unique_ptr<RaviFunctionDef> definition =
std::unique_ptr<RaviFunctionDef>(new RaviFunctionDef());
RaviFunctionDef *def = definition.get();
// RaviFunctionDef definition = {0};
// RaviFunctionDef *def = &definition;
// printf("compiling function\n");
auto f = create_function(builder, def);

@ -118,18 +118,18 @@ RaviJITFunctionImpl::RaviJITFunctionImpl(
function_ = llvm::Function::Create(type, linkage, name, module_);
//TODO add stack checks as debug more
// function_->addFnAttr(llvm::Attribute::StackProtectReq);
// TODO add stack checks as debug more
// function_->addFnAttr(llvm::Attribute::StackProtectReq);
#if defined(_WIN32)
// TODO On 32-bit Windows we need to force
// 16-byte alignment
// llvm::AttrBuilder attr;
// attr.addStackAlignmentAttr(16);
// function_->addAttributes(
// llvm::AttributeSet::FunctionIndex,
// llvm::AttributeSet::get(owner_->context(),
// llvm::AttributeSet::FunctionIndex, attr));
// TODO On 32-bit Windows we need to force
// 16-byte alignment
// llvm::AttrBuilder attr;
// attr.addStackAlignmentAttr(16);
// function_->addAttributes(
// llvm::AttributeSet::FunctionIndex,
// llvm::AttributeSet::get(owner_->context(),
// llvm::AttributeSet::FunctionIndex, attr));
#endif
std::string errStr;
#if LLVM_VERSION_MINOR > 5
@ -331,7 +331,7 @@ int raviV_compile(struct lua_State *L, struct Proto *p, int manual_request) {
if (!G->ravi_state->jit->is_enabled()) {
return 0;
}
#ifdef _WIN32
#if 0
// For some reason on Windows we sometimes get
// an exception in luaD_throw() when JIT compilation
// is ON.
@ -437,8 +437,7 @@ static int ravi_auto(lua_State *L) {
lua_pushboolean(L, 0);
lua_pushinteger(L, -1);
lua_pushinteger(L, -1);
}
else {
} else {
lua_pushboolean(L, G->ravi_state->jit->is_auto());
lua_pushinteger(L, G->ravi_state->jit->get_mincodesize());
lua_pushinteger(L, G->ravi_state->jit->get_minexeccount());

Loading…
Cancel
Save