1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-14 15:40:19 +02:00

Speed up returns in JIT

This patch is a bit unfortunate, in the sense that it exposes some of
the JIT guts to the rest of the VM.  Code needs to treat "machine return
addresses" as valid if non-NULL (as before) and also not equal to a
tier-down trampoline.  This is because tier-down at a return needs the
old frame pointer to load the "virtual return address", and the way this
patch works is that it passes the vra in a well-known register.  It's a
custom calling convention for a certain kind of return.

* libguile/jit.h (scm_jit_return_to_interpreter_trampoline): New
  internal global.
* libguile/jit.c: (scm_jit_clear_mcode_return_addresses): Move here,
  from vm.c.  Instead of zeroing return addresses, set them to the
  return-to-interpreter trampoline.
* libguile/vm-engine.c (return-values): Don't enter mcode if the mra is
  scm_jit_return_to_interpreter_trampoline.
* libguile/vm.c (capture_continuation): Treat the tier-down trampoline
  as NULL.
This commit is contained in:
Andy Wingo 2019-06-18 21:40:55 +02:00
parent e8203a3f8c
commit af72d01de8
4 changed files with 49 additions and 27 deletions

View file

@ -551,7 +551,7 @@ VM_NAME (scm_thread *thread)
if (!VP->disable_mcode)
{
mcode = SCM_FRAME_MACHINE_RETURN_ADDRESS (old_fp);
if (mcode)
if (mcode && mcode != scm_jit_return_to_interpreter_trampoline)
{
scm_jit_enter_mcode (thread, mcode);
CACHE_REGISTER ();