summaryrefslogtreecommitdiff
path: root/jit_hook.rb
diff options
context:
space:
mode:
Diffstat (limited to 'jit_hook.rb')
-rw-r--r--jit_hook.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/jit_hook.rb b/jit_hook.rb
new file mode 100644
index 0000000000..c605d6e26d
--- /dev/null
+++ b/jit_hook.rb
@@ -0,0 +1,12 @@
+class Module
+ # Internal helper for built-in initializations to define methods only when JIT is enabled.
+ # This method is removed in jit_undef.rb.
+ private def with_jit(&block) # :nodoc:
+ if defined?(RubyVM::ZJIT)
+ RubyVM::ZJIT.send(:add_jit_hook, block)
+ end
+ if defined?(RubyVM::YJIT)
+ RubyVM::YJIT.send(:add_jit_hook, block)
+ end
+ end
+end