summaryrefslogtreecommitdiff
path: root/libguile/jit.h
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2018-07-23 12:43:30 +0200
committerAndy Wingo <wingo@pobox.com>2018-07-29 15:47:03 +0200
commit87da1c8d20591a9a7dad28eb106161c4f508a2b6 (patch)
treec54081b0e20bb8706a523cb02739841242f88b69 /libguile/jit.h
parent4b7af0b7fd22183a2c1ba6d48f338ce03e6faf59 (diff)
downloadguile-87da1c8d20591a9a7dad28eb106161c4f508a2b6.tar.gz
Add instrument-call, instrument-loop VM instructions
* libguile/jit.h (struct scm_jit_function_data) (enum scm_jit_counter_value): New data types. * libguile/jit.c (scm_jit_compute_mcode, scm_jit_enter_mcode): New function stubs. Adapt label/offset compilers to take pointers. * libguile/vm-engine.c (instrument-call, instrument-loop): New instructions. * libguile/vm.c: Add jit.h include. * module/system/vm/assembler.scm (emit-instrument-call) (emit-instrument-loop): New exports.
Diffstat (limited to 'libguile/jit.h')
-rw-r--r--libguile/jit.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/libguile/jit.h b/libguile/jit.h
index 1c27e8628..5067b61f6 100644
--- a/libguile/jit.h
+++ b/libguile/jit.h
@@ -26,6 +26,35 @@
+struct scm_jit_function_data;
+
+#ifdef BUILDING_LIBGUILE
+struct scm_jit_function_data
+{
+ uint8_t *mcode;
+ uint32_t counter;
+ uint32_t start;
+ uint32_t end;
+#if SCM_SIZEOF_UINTPTR_T == 4
+#elif SCM_SIZEOF_UINTPTR_T == 8
+ uint32_t pad;
+#else
+#error unhandled sizeof(uintptr_t)
+#endif
+};
+
+enum scm_jit_counter_value
+{
+ SCM_JIT_COUNTER_CALL_INCREMENT = 15,
+ SCM_JIT_COUNTER_LOOP_INCREMENT = 1,
+ SCM_JIT_COUNTER_THRESHOLD = 50
+};
+#endif
+
+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_init_jit (void);
#endif /* SCM_JIT_H */