mirror of
https://github.com/ruby/ruby.git
synced 2026-01-26 12:14:51 +00:00
This implements Shopify#854: - Splits boot-time and enable-time initialization, tracks progress with `InitializationState` enum - Introduces `RubyVM::ZJIT.enable` Ruby method for enabling the JIT lazily, if not already enabled - Introduces `--zjit-disable` flag, which can be used alongside the other `--zjit-*` flags but prevents enabling the JIT at boot time - Adds ZJIT infra to support JIT hooks, but this is not currently exercised (Shopify/ruby#667) Left for future enhancements: - Support kwargs for overriding the CLI flags in `RubyVM::ZJIT.enable` Closes Shopify#854
13 lines
502 B
Ruby
13 lines
502 B
Ruby
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:
|
|
# ZJIT currently doesn't compile Array#each properly, so it's disabled for now.
|
|
if defined?(RubyVM::ZJIT) && false # TODO: remove `&& false` (Shopify/ruby#667)
|
|
RubyVM::ZJIT.send(:add_jit_hook, block)
|
|
elsif defined?(RubyVM::YJIT)
|
|
RubyVM::YJIT.send(:add_jit_hook, block)
|
|
end
|
|
end
|
|
end
|