ZJIT: Prepare for sharing JIT hooks with ZJIT (#14044)

This commit is contained in:
Takashi Kokubun 2025-07-30 10:11:10 -07:00 committed by GitHub
parent 4263c49d1c
commit 2cd10de330
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 142 additions and 118 deletions

13
vm.c
View file

@ -4509,14 +4509,21 @@ Init_vm_objects(void)
vm->cc_refinement_table = rb_set_init_numtable();
}
#if USE_ZJIT
extern VALUE rb_zjit_option_enabled_p(rb_execution_context_t *ec, VALUE self);
#else
static VALUE rb_zjit_option_enabled_p(rb_execution_context_t *ec, VALUE self) { return Qfalse; }
#endif
// Whether JIT is enabled or not, we need to load/undef `#with_jit` for other builtins.
#include "jit_hook.rbinc"
#include "jit_undef.rbinc"
// Stub for builtin function when not building YJIT units
#if !USE_YJIT
void Init_builtin_yjit(void) {}
#endif
// Whether YJIT is enabled or not, we load yjit_hook.rb to remove Kernel#with_yjit.
#include "yjit_hook.rbinc"
// Stub for builtin function when not building ZJIT units
#if !USE_ZJIT
void Init_builtin_zjit(void) {}