summaryrefslogtreecommitdiff
path: root/zjit.c
diff options
context:
space:
mode:
authorTakashi Kokubun <[email protected]>2025-02-06 11:35:55 -0500
committerTakashi Kokubun <[email protected]>2025-04-18 21:52:56 +0900
commit0bb709718b023457a490efe222ce19cb2a1dce07 (patch)
treeace8a9e2b48aa35c6fe6db7f6a2d5498866882bc /zjit.c
parent26d1aa40292b33c3dc35f4ce8ccca10f1efbd5a1 (diff)
Hook ZJIT compilation
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13131
Diffstat (limited to 'zjit.c')
-rw-r--r--zjit.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/zjit.c b/zjit.c
index e69de29bb2..bebad7b005 100644
--- a/zjit.c
+++ b/zjit.c
@@ -0,0 +1,48 @@
+#include "internal.h"
+#include "internal/sanitizers.h"
+#include "internal/string.h"
+#include "internal/hash.h"
+#include "internal/variable.h"
+#include "internal/compile.h"
+#include "internal/class.h"
+#include "internal/fixnum.h"
+#include "internal/numeric.h"
+#include "internal/gc.h"
+#include "internal/vm.h"
+#include "vm_core.h"
+#include "vm_callinfo.h"
+#include "builtin.h"
+#include "insns.inc"
+#include "insns_info.inc"
+#include "vm_sync.h"
+#include "yjit.h"
+#include "vm_insnhelper.h"
+#include "probes.h"
+#include "probes_helper.h"
+#include "iseq.h"
+#include "ruby/debug.h"
+#include "internal/cont.h"
+
+// For mmapp(), sysconf()
+#ifndef _WIN32
+#include <unistd.h>
+#include <sys/mman.h>
+#endif
+
+#include <errno.h>
+
+void
+rb_zjit_compile_iseq(const rb_iseq_t *iseq, rb_execution_context_t *ec, bool jit_exception)
+{
+ RB_VM_LOCK_ENTER();
+ rb_vm_barrier();
+
+ // Compile a block version starting at the current instruction
+ uint8_t *rb_zjit_iseq_gen_entry_point(const rb_iseq_t *iseq, rb_execution_context_t *ec); // defined in Rust
+ uintptr_t code_ptr = (uintptr_t)rb_zjit_iseq_gen_entry_point(iseq, ec);
+
+ // TODO: support jit_exception
+ iseq->body->jit_entry = (rb_jit_func_t)code_ptr;
+
+ RB_VM_LOCK_LEAVE();
+}