mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
the indirection should be done in the evaluate_expr_thunk gate instead of in the pgf_evaluate_expr_thunk function. this ensures lazyness
This commit is contained in:
@@ -72,10 +72,6 @@ repeat:;
|
||||
val->args[i] = args[n_args-i-1];
|
||||
}
|
||||
|
||||
PgfIndirection* indir = (PgfIndirection*) thunk;
|
||||
indir->header.code = state->eval_gates->evaluate_indirection;
|
||||
indir->val = &val->header;
|
||||
|
||||
res = &val->header;
|
||||
break;
|
||||
}
|
||||
@@ -165,10 +161,6 @@ repeat:;
|
||||
|
||||
lambda->expr = expr;
|
||||
}
|
||||
|
||||
PgfIndirection* indir = (PgfIndirection*) thunk;
|
||||
indir->header.code = state->eval_gates->evaluate_indirection;
|
||||
indir->val = res;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -190,10 +182,6 @@ repeat:;
|
||||
|
||||
res = tmp_env->closure;
|
||||
|
||||
PgfIndirection* indir = (PgfIndirection*) thunk;
|
||||
indir->header.code = state->eval_gates->evaluate_indirection;
|
||||
indir->val = res;
|
||||
|
||||
if (n_args > 0) {
|
||||
PgfValuePAP* val = gu_new_flex(state->pool, PgfValuePAP, args, n_args);
|
||||
val->header.code = state->eval_gates->evaluate_value_pap;
|
||||
|
||||
@@ -444,17 +444,6 @@ pgf_jit_gates(PgfReader* rdr)
|
||||
|
||||
pgf_jit_make_space(rdr, JIT_CODE_WINDOW);
|
||||
|
||||
gates->evaluate_expr_thunk = jit_get_ip().ptr;
|
||||
jit_prepare(2);
|
||||
jit_pusharg_p(JIT_VCLOS);
|
||||
jit_pusharg_p(JIT_VSTATE);
|
||||
jit_finish(pgf_evaluate_expr_thunk);
|
||||
jit_retval(JIT_VCLOS);
|
||||
jit_ldr_p(JIT_R0, JIT_VCLOS);
|
||||
jit_jmpr(JIT_R0);
|
||||
|
||||
pgf_jit_make_space(rdr, JIT_CODE_WINDOW);
|
||||
|
||||
gates->evaluate_value_lit = jit_get_ip().ptr;
|
||||
jit_movr_p(JIT_VHEAP, JIT_VCLOS);
|
||||
jit_prepare(1);
|
||||
@@ -566,6 +555,23 @@ pgf_jit_gates(PgfReader* rdr)
|
||||
|
||||
pgf_jit_make_space(rdr, JIT_CODE_WINDOW);
|
||||
|
||||
gates->evaluate_expr_thunk = jit_get_ip().ptr;
|
||||
jit_prepare(2);
|
||||
jit_pusharg_p(JIT_VCLOS);
|
||||
jit_pusharg_p(JIT_VSTATE);
|
||||
jit_finish(pgf_evaluate_expr_thunk);
|
||||
ref = jit_beqr_p(jit_forward(), JIT_VCLOS, JIT_RET);
|
||||
jit_pushr_p(JIT_VCLOS);
|
||||
jit_pushr_p(JIT_FP);
|
||||
jit_movi_p(JIT_R1, gates->update_closure);
|
||||
jit_pushr_p(JIT_R1);
|
||||
jit_retval(JIT_VCLOS);
|
||||
jit_patch(ref);
|
||||
jit_ldr_p(JIT_R0, JIT_VCLOS);
|
||||
jit_jmpr(JIT_R0);
|
||||
|
||||
pgf_jit_make_space(rdr, JIT_CODE_WINDOW);
|
||||
|
||||
gates->evaluate_value_lambda = jit_get_ip().ptr;
|
||||
jit_subr_p(JIT_R0, JIT_FP, JIT_SP);
|
||||
jit_blti_i(gates->update_pap, JIT_R0, 2*sizeof(PgfClosure*));
|
||||
|
||||
Reference in New Issue
Block a user