[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 02/03: JIT fixes for arena overflow
From: |
Andy Wingo |
Subject: |
[Guile-commits] 02/03: JIT fixes for arena overflow |
Date: |
Thu, 4 Apr 2019 09:00:00 -0400 (EDT) |
wingo pushed a commit to branch lightening
in repository guile.
commit 891e7600f4383680c4d8d2375f1fe9b57fcd9abd
Author: Andy Wingo <address@hidden>
Date: Thu Apr 4 14:32:05 2019 +0200
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.
---
libguile/jit.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/libguile/jit.c b/libguile/jit.c
index 0d87f66..a01e10e 100644
--- a/libguile/jit.c
+++ b/libguile/jit.c
@@ -4687,9 +4687,10 @@ analyze (scm_jit_state *j)
static void
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->ip = (uint32_t *) j->start;
set_register_state (j, SP_IN_REGISTER | FP_IN_REGISTER);
@@ -4706,6 +4707,9 @@ compile (scm_jit_state *j)
j->register_state = state;
}
compile1 (j);
+
+ if (jit_has_overflow (j->jit))
+ return;
}
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,
j->entry - j->start);
+ analyze (j);
+
data->mcode = emit_code (j, compile);
if (data->mcode)
entry_mcode = j->labels[j->entry - j->start];