From dca1e9d7bd36cad32e2165918194b522ed30e67d Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Mon, 20 Aug 2018 08:48:00 +0200 Subject: Manual JIT interface via %jit-compile * libguile/init.c (scm_i_init_guile): Call scm_init_jit (). * libguile/jit.c (enter_mcode, exit_mcode): New static members; code pointers for the JIT trampoline. (emit_exit): New helper. The Lightning tramp/frame mechanism that we use needs to exit via a jmp instead of a return. Adapt callers of jit_ret. (emit_entry_trampoline): Use the "frame" mechanism to enter the JIT. (compile1): Add missing "break" after case statements. Oops! (compile): Add prolog and "tramp" to compiled functions. (initialize_jit): New local routine to init the JIT on demand. (compute_mcode): New helper, to compile a function. (scm_sys_jit_compile): New function, exported to Scheme as %jit-compile. (scm_jit_compute_mcode): Return the existing mcode if the function is at the start. (scm_jit_enter_mcode): Call the enter_mcode trampoline. * libguile/jit.h (struct scm_jit_state): Declare, so we can make pointers to it. * libguile/threads.h (struct scm_thread): Add jit_state member. * libguile/threads.c (on_thread_exit): Free the jit state. --- libguile/init.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libguile/init.c') diff --git a/libguile/init.c b/libguile/init.c index 031a8af4c..78fa6a045 100644 --- a/libguile/init.c +++ b/libguile/init.c @@ -83,6 +83,7 @@ #include "instructions.h" #include "intrinsics.h" #include "ioext.h" +#include "jit.h" #include "keywords.h" #include "list.h" #include "load.h" @@ -512,6 +513,7 @@ scm_i_init_guile (void *base) scm_bootstrap_i18n (); scm_init_script (); scm_init_unicode (); + scm_init_jit (); scm_init_goops (); -- cgit v1.2.3