Skip to content

Commit

Permalink
remove the local variable base in libgccjit version
Browse files Browse the repository at this point in the history
  • Loading branch information
dibyendumajumdar committed Jul 5, 2015
1 parent d75af6a commit 02681b1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion include/ravi_gccjit.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ typedef struct ravi_function_def_t {
/* The Lua stack base - this can change during execution so needs to be lvalue
*/
gcc_jit_rvalue *base_ref;
gcc_jit_lvalue *base;
// gcc_jit_lvalue *base;

/* Reference to lua_closure->p - never changes */
gcc_jit_rvalue *proto;
Expand Down
14 changes: 8 additions & 6 deletions src/ravi_gcccodegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ static bool create_function(ravi_gcc_codegen_t *codegen,
def->entry_block = gcc_jit_function_new_block(def->jit_function, "entry");
def->current_block = def->entry_block;

def->base = gcc_jit_function_new_local(def->jit_function, NULL,
def->ravi->types->pTValueT, "base");
// def->base = gcc_jit_function_new_local(def->jit_function, NULL,
// def->ravi->types->pTValueT, "base");
def->lua_closure_val = gcc_jit_function_new_local(
def->jit_function, NULL, def->ravi->types->pLClosureT, "cl");

Expand Down Expand Up @@ -370,8 +370,9 @@ static void emit_getL_ci_value(ravi_function_def_t *def) {

/* Refresh local copy of L->ci->u.l.base */
void ravi_emit_load_base(ravi_function_def_t *def) {
gcc_jit_block_add_assignment(def->current_block, NULL, def->base,
def->base_ref);
(void)def;
//gcc_jit_block_add_assignment(def->current_block, NULL, def->base,
// def->base_ref);
}

// L->top = ci->top
Expand Down Expand Up @@ -413,7 +414,8 @@ gcc_jit_lvalue *ravi_emit_array_get_ptr(ravi_function_def_t *def,
gcc_jit_rvalue *ravi_emit_get_register(ravi_function_def_t *def, int A) {
/* Note we assume that base is correct */
gcc_jit_lvalue *reg = gcc_jit_context_new_array_access(
def->function_context, NULL, gcc_jit_lvalue_as_rvalue(def->base),
// def->function_context, NULL, gcc_jit_lvalue_as_rvalue(def->base),
def->function_context, NULL, def->base_ref,
gcc_jit_context_new_rvalue_from_int(def->function_context,
def->ravi->types->C_intT, A));
return gcc_jit_lvalue_get_address(reg, NULL);
Expand Down Expand Up @@ -867,7 +869,7 @@ static void init_def(ravi_function_def_t *def, ravi_gcc_context_t *ravi,
def->current_block = NULL;
def->proto = NULL;
def->k = NULL;
def->base = NULL;
// def->base = NULL;
def->current_block_terminated = false;
def->buf[0] = 0;
def->counter = 1;
Expand Down
2 changes: 1 addition & 1 deletion src/ravi_gccjit.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,4 @@ bool ravi_jit_has_errored(ravi_gcc_context_t *ravi) {
return true;
}
return false;
}
}
3 changes: 2 additions & 1 deletion src/ravi_gccreturn.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ void ravi_emit_RETURN(ravi_function_def_t *def, int A, int B, int pc) {
def->current_block, NULL,
ravi_function_call2_rvalue(def, def->ravi->types->luaF_closeT,
gcc_jit_param_as_rvalue(def->L),
gcc_jit_lvalue_as_rvalue(def->base)));
def->base_ref));
// gcc_jit_lvalue_as_rvalue(def->base)));

ravi_emit_branch(def, else_block);
ravi_set_current_block(def, else_block);
Expand Down

0 comments on commit 02681b1

Please sign in to comment.