summaryrefslogtreecommitdiff
path: root/jit_hook.rb
blob: c605d6e26d3e7aaab81881784337046daf6dcab2 (plain)
1
2
3
4
5
6
7
8
9
10
11
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