mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-31 01:10:24 +02:00
Fix JIT tier-up from within loops for already-JIT-compiled functions
* libguile/jit.c (scm_jit_compute_mcode): If a caller wants mcode for a loop but the function already has mcode, instead of punting, just compile again.
This commit is contained in:
parent
d14e8fabb3
commit
a1e88ebc12
1 changed files with 32 additions and 28 deletions
|
@ -4916,15 +4916,20 @@ scm_jit_compute_mcode (scm_thread *thread, struct scm_jit_function_data *data)
|
||||||
if (vcode_start == thread->vm.ip)
|
if (vcode_start == thread->vm.ip)
|
||||||
return data->mcode;
|
return data->mcode;
|
||||||
|
|
||||||
/* FIXME: The function has mcode, compiled via some other
|
/* The function has mcode, compiled via some other activation
|
||||||
activation (possibly in another thread), but right now we're
|
(possibly in another thread), but right now we're currently in
|
||||||
currently in an interpreted loop (not at the beginning of the
|
an interpreted loop (not at the beginning of the function). It
|
||||||
function). We should re-compute the offset into the mcode.
|
would be nice if we could jump into the already-compiled
|
||||||
For now though, just punt. */
|
function, but we don't know the offset. You'd think we could
|
||||||
return NULL;
|
just compile again without writing bytes to find out the offset
|
||||||
|
into the old code, but we're not guaranteed to get the same
|
||||||
|
compiled code, for example due to variations on whether direct
|
||||||
|
callees have mcode at the time of the compile, or different
|
||||||
|
encodings for relative references. So oh well: we're just
|
||||||
|
going to compile another copy and update the mcode pointer,
|
||||||
|
hoping this is a rare occurence. */
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
uint8_t *mcode = compute_mcode (thread, thread->vm.ip, data);
|
uint8_t *mcode = compute_mcode (thread, thread->vm.ip, data);
|
||||||
|
|
||||||
if (!mcode)
|
if (!mcode)
|
||||||
|
@ -4947,7 +4952,6 @@ scm_jit_compute_mcode (scm_thread *thread, struct scm_jit_function_data *data)
|
||||||
|
|
||||||
return mcode;
|
return mcode;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
scm_jit_enter_mcode (scm_thread *thread, const uint8_t *mcode)
|
scm_jit_enter_mcode (scm_thread *thread, const uint8_t *mcode)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue