fix gcc compilation

pull/81/head
dibyendumajumdar 8 years ago
parent 37759ee08e
commit ed8bf0a206

@ -915,8 +915,12 @@ static void init_def(ravi_function_def_t *def, ravi_gcc_context_t *ravi,
int raviV_compile_n(struct lua_State *L, struct Proto *p[], int n,
ravi_compile_options_t *options) {
// FIXME implement
return 0;
int count = 0;
for (int i = 0; i < n; i++) {
if (raviV_compile(L, p[i], options))
count++;
}
return count > 0;
}
// Compile a Lua function

@ -67,33 +67,6 @@ static bool l_table_get_integer(lua_State *L, int tab, const char *key,
return rc;
}
// Try to JIT compile the given function
// Optional boolean (second) parameter specifies whether
// to dump the code generation
static int ravi_compile(lua_State *L) {
int n = lua_gettop(L);
luaL_argcheck(L, n >= 1, 1, "1 or 2 arguments expected");
luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), 1,
"argument must be a Lua function");
void *p = (void *)lua_topointer(L, 1);
LClosure *l = reinterpret_cast<LClosure *>(p);
ravi_compile_options_t options = {0};
options.manual_request = 1;
if (lua_istable(L, 2)) {
lua_Integer do_dump, do_verify, omit_arrayget_rangecheck;
l_table_get_integer(L, 2, "dump", &do_dump, 0);
l_table_get_integer(L, 2, "verify", &do_verify, 0);
l_table_get_integer(L, 2, "omitArrayGetRangeCheck",
&omit_arrayget_rangecheck, 0);
options.omit_array_get_range_check = (int)omit_arrayget_rangecheck;
options.dump_level = (int)do_dump;
options.verification_level = (int)do_verify;
}
int result = raviV_compile(L, l->p, &options);
lua_pushboolean(L, result);
return 1;
}
static int ravi_compile_n(lua_State *L) {
enum { MAX_COMPILES = 100 };
Proto *functions[MAX_COMPILES];

Loading…
Cancel
Save