summaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2015-12-19 17:30:41 +0000
committerkrasimir <krasimir@chalmers.se>2015-12-19 17:30:41 +0000
commit0b9395fd7006592d0434503751a88ef95ab47603 (patch)
tree2a50ca07471781a79ec36706c9495324abe56477 /src/runtime
parent6947d36e1a703ca33bb98eb64050262d6101a068 (diff)
a fix that should solve the segmentation fault on MacOS with the exhaustive generator
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/c/pgf/jit.c13
-rw-r--r--src/runtime/c/pgf/reasoner.h1
2 files changed, 13 insertions, 1 deletions
diff --git a/src/runtime/c/pgf/jit.c b/src/runtime/c/pgf/jit.c
index 39860c46a..36a6bb1fe 100644
--- a/src/runtime/c/pgf/jit.c
+++ b/src/runtime/c/pgf/jit.c
@@ -242,7 +242,7 @@ pgf_jit_predicate(PgfReader* rdr, PgfAbstr* abstr,
pgf_jit_make_space(rdr, JIT_CODE_WINDOW);
jit_patch_movi(ref,jit_get_label());
} else {
- jit_patch_movi(ref,pgf_reasoner_complete);
+ jit_patch_movi(ref,abstr->eval_gates->complete);
}
}
} else {
@@ -351,7 +351,9 @@ pgf_jit_gates(PgfReader* rdr)
jit_getarg_p(JIT_VCLOS, closure_arg);
jit_stxi_p(offsetof(PgfReasoner, enter_stack_ptr), JIT_VSTATE, JIT_SP);
jit_ldr_p(JIT_R0, JIT_VCLOS);
+ jit_pushr_i(JIT_R0); // this is just for stack alignment on System V
jit_callr(JIT_R0);
+ jit_popr_i(JIT_R0); // this is just for stack alignment on System V
jit_movr_p(JIT_RET, JIT_VHEAP);
jit_ret();
@@ -595,6 +597,15 @@ pgf_jit_gates(PgfReader* rdr)
jit_finish(pgf_reasoner_combine2);
jit_bare_ret();
+ pgf_jit_make_space(rdr, JIT_CODE_WINDOW);
+
+ gates->complete = (void*) jit_get_ip().ptr;
+ jit_prepare(2);
+ jit_pusharg_p(JIT_VCLOS);
+ jit_pusharg_p(JIT_VSTATE);
+ jit_finish(pgf_reasoner_complete);
+ jit_ret();
+
gates->fin.fn = pgf_jit_finalize_cafs;
gates->cafs = NULL;
gu_pool_finally(rdr->opool, &gates->fin);
diff --git a/src/runtime/c/pgf/reasoner.h b/src/runtime/c/pgf/reasoner.h
index 7826ef2a3..21dcd6997 100644
--- a/src/runtime/c/pgf/reasoner.h
+++ b/src/runtime/c/pgf/reasoner.h
@@ -106,6 +106,7 @@ struct PgfEvalGates {
PgfFunction combine1;
PgfFunction combine2;
+ PgfFunction complete;
PgfClosure* (*enter)(PgfReasoner* rs, PgfClosure* closure);