summaryrefslogtreecommitdiff
path: root/libguile/jit.h
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2018-08-20 08:48:00 +0200
committerAndy Wingo <wingo@pobox.com>2018-08-20 08:56:35 +0200
commitdca1e9d7bd36cad32e2165918194b522ed30e67d (patch)
tree1d0cb4964bb568fdd4d8266838216c7768ee789e /libguile/jit.h
parent698bff8748492c10d9935d7837776c323dc4f383 (diff)
downloadguile-dca1e9d7bd36cad32e2165918194b522ed30e67d.tar.gz
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.
Diffstat (limited to 'libguile/jit.h')
-rw-r--r--libguile/jit.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/libguile/jit.h b/libguile/jit.h
index 325ec35ed..ae5c9da21 100644
--- a/libguile/jit.h
+++ b/libguile/jit.h
@@ -27,6 +27,7 @@
struct scm_jit_function_data;
+struct scm_jit_state;
#ifdef BUILDING_LIBGUILE
struct scm_jit_function_data
@@ -55,6 +56,7 @@ SCM_INTERNAL const uint8_t *scm_jit_compute_mcode (scm_thread *thread,
struct scm_jit_function_data *data);
SCM_INTERNAL void scm_jit_enter_mcode (scm_thread *thread,
const uint8_t *mcode);
+SCM_INTERNAL void scm_jit_state_free (struct scm_jit_state *j);
SCM_INTERNAL void scm_init_jit (void);