1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-18 01:30:27 +02:00

JIT fixes for arena overflow

* libguile/jit.c (compute_mcode): Move analysis outside the code
emitter, as it doesn't need to re-run on overflow.
(compile): Clear labels before emitting, as they may have changed if we
overflowed.
This commit is contained in:
Andy Wingo 2019-04-04 14:32:05 +02:00
parent 9ff21412ff
commit 891e7600f4

View file

@ -4687,9 +4687,10 @@ analyze (scm_jit_state *j)
static void static void
compile (scm_jit_state *j) compile (scm_jit_state *j)
{ {
analyze (j); for (ptrdiff_t offset = 0; j->ip + offset < j->end; offset++)
j->labels[offset] = NULL;
j->reloc_idx = 0; j->reloc_idx = 0;
j->ip = (uint32_t *) j->start; j->ip = (uint32_t *) j->start;
set_register_state (j, SP_IN_REGISTER | FP_IN_REGISTER); set_register_state (j, SP_IN_REGISTER | FP_IN_REGISTER);
@ -4706,6 +4707,9 @@ compile (scm_jit_state *j)
j->register_state = state; j->register_state = state;
} }
compile1 (j); compile1 (j);
if (jit_has_overflow (j->jit))
return;
} }
for (size_t i = 0; i < j->reloc_idx; i++) for (size_t i = 0; i < j->reloc_idx; i++)
@ -4811,6 +4815,8 @@ compute_mcode (scm_thread *thread, uint32_t *entry_ip,
INFO ("vcode: start=%p,+%zu entry=+%zu\n", j->start, j->end - j->start, INFO ("vcode: start=%p,+%zu entry=+%zu\n", j->start, j->end - j->start,
j->entry - j->start); j->entry - j->start);
analyze (j);
data->mcode = emit_code (j, compile); data->mcode = emit_code (j, compile);
if (data->mcode) if (data->mcode)
entry_mcode = j->labels[j->entry - j->start]; entry_mcode = j->labels[j->entry - j->start];