mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
Maybe enter JIT when returning from interpreted functions
* libguile/jit.c (scm_jit_compute_mcode): Minor optimization. * libguile/vm-engine.c (return-values): Maybe return to JIT code.
This commit is contained in:
parent
c03e2bbbb4
commit
24d09b16b6
2 changed files with 18 additions and 14 deletions
|
@ -4425,14 +4425,11 @@ scm_sys_jit_compile (SCM fn)
|
|||
const uint8_t *
|
||||
scm_jit_compute_mcode (scm_thread *thread, struct scm_jit_function_data *data)
|
||||
{
|
||||
const uint32_t *start = (const uint32_t *) (((char *)data) + data->start);
|
||||
uint8_t *mcode_start = data->mcode;
|
||||
const uint32_t *vcode_start = (const uint32_t *) (((char *)data) + data->start);
|
||||
|
||||
/* Until the JIT is tested, don't automatically JIT-compile code.
|
||||
Just return whatever code is already there. If we decide to buy
|
||||
later, replace with something that wires up a call to
|
||||
"compute_mcode". */
|
||||
if (start == thread->vm.ip)
|
||||
return data->mcode;
|
||||
if (mcode_start && vcode_start == thread->vm.ip)
|
||||
return mcode_start;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -565,19 +565,26 @@ VM_NAME (scm_thread *thread)
|
|||
{
|
||||
union scm_vm_stack_element *old_fp;
|
||||
size_t frame_size = 3;
|
||||
uint8_t *mcode;
|
||||
|
||||
RETURN_HOOK ();
|
||||
|
||||
old_fp = VP->fp;
|
||||
ip = SCM_FRAME_VIRTUAL_RETURN_ADDRESS (VP->fp);
|
||||
VP->fp = SCM_FRAME_DYNAMIC_LINK (VP->fp);
|
||||
|
||||
/* Clear stack frame. */
|
||||
while (frame_size--)
|
||||
old_fp[frame_size].as_scm = SCM_BOOL_F;
|
||||
VP->fp = SCM_FRAME_DYNAMIC_LINK (old_fp);
|
||||
|
||||
mcode = SCM_FRAME_MACHINE_RETURN_ADDRESS (old_fp);
|
||||
if (mcode)
|
||||
{
|
||||
scm_jit_enter_mcode (thread, mcode);
|
||||
CACHE_REGISTER ();
|
||||
NEXT (0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ip = SCM_FRAME_VIRTUAL_RETURN_ADDRESS (old_fp);
|
||||
NEXT (0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue