mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
ZJIT: Prepare for sharing JIT hooks with ZJIT (#14044)
This commit is contained in:
parent
4263c49d1c
commit
2cd10de330
20 changed files with 142 additions and 118 deletions
14
yjit.rb
14
yjit.rb
|
@ -264,23 +264,23 @@ module RubyVM::YJIT
|
|||
end
|
||||
|
||||
# Blocks that are called when YJIT is enabled
|
||||
@yjit_hooks = []
|
||||
@jit_hooks = []
|
||||
|
||||
class << self
|
||||
# :stopdoc:
|
||||
private
|
||||
|
||||
# Register a block to be called when YJIT is enabled
|
||||
def add_yjit_hook(hook)
|
||||
@yjit_hooks << hook
|
||||
def add_jit_hook(hook)
|
||||
@jit_hooks << hook
|
||||
end
|
||||
|
||||
# Run YJIT hooks registered by RubyVM::YJIT.with_yjit
|
||||
def call_yjit_hooks
|
||||
# Run YJIT hooks registered by `#with_jit`
|
||||
def call_jit_hooks
|
||||
# Skip using builtin methods in Ruby if --yjit-c-builtin is given
|
||||
return if Primitive.yjit_c_builtin_p
|
||||
@yjit_hooks.each(&:call)
|
||||
@yjit_hooks.clear
|
||||
@jit_hooks.each(&:call)
|
||||
@jit_hooks.clear
|
||||
end
|
||||
|
||||
# Print stats and dump exit locations
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue