RJIT: Use imemo_type_p instead
which seems safer. It seems like imemo_type can cause SEGV.
This commit is contained in:
parent
35fd79ac37
commit
4afe9c09a0
@ -139,7 +139,7 @@ module RubyVM::RJIT
|
|||||||
def invalidate_block(block)
|
def invalidate_block(block)
|
||||||
iseq = block.iseq
|
iseq = block.iseq
|
||||||
# Avoid touching GCed ISEQs. We assume it won't be re-entered.
|
# Avoid touching GCed ISEQs. We assume it won't be re-entered.
|
||||||
return if C.imemo_type(iseq) != C.imemo_iseq
|
return unless C.imemo_type_p(iseq, C.imemo_iseq)
|
||||||
|
|
||||||
# Remove this block from the version array
|
# Remove this block from the version array
|
||||||
remove_block(iseq, block)
|
remove_block(iseq, block)
|
||||||
@ -296,7 +296,8 @@ module RubyVM::RJIT
|
|||||||
|
|
||||||
def rjit_blocks(iseq)
|
def rjit_blocks(iseq)
|
||||||
# Guard against ISEQ GC at random moments
|
# Guard against ISEQ GC at random moments
|
||||||
if C.imemo_type(iseq) != C.imemo_iseq
|
|
||||||
|
unless C.imemo_type_p(iseq, C.imemo_iseq)
|
||||||
return Hash.new { |h, k| h[k] = {} }
|
return Hash.new { |h, k| h[k] = {} }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ module RubyVM::RJIT
|
|||||||
def compile_branch_stub(ctx, asm, branch_stub, target0_p)
|
def compile_branch_stub(ctx, asm, branch_stub, target0_p)
|
||||||
# Call rb_rjit_branch_stub_hit
|
# Call rb_rjit_branch_stub_hit
|
||||||
iseq = branch_stub.iseq
|
iseq = branch_stub.iseq
|
||||||
if C.rjit_opts.dump_disasm && C.imemo_type(iseq) == C.imemo_iseq # Guard against ISEQ GC at random moments
|
if C.rjit_opts.dump_disasm && C.imemo_type_p(iseq, C.imemo_iseq) # Guard against ISEQ GC at random moments
|
||||||
asm.comment("branch stub hit: #{iseq.body.location.label}@#{C.rb_iseq_path(iseq)}:#{iseq_lineno(iseq, target0_p ? branch_stub.target0.pc : branch_stub.target1.pc)}")
|
asm.comment("branch stub hit: #{iseq.body.location.label}@#{C.rb_iseq_path(iseq)}:#{iseq_lineno(iseq, target0_p ? branch_stub.target0.pc : branch_stub.target1.pc)}")
|
||||||
end
|
end
|
||||||
asm.mov(:rdi, to_value(branch_stub))
|
asm.mov(:rdi, to_value(branch_stub))
|
||||||
|
@ -259,9 +259,9 @@ module RubyVM::RJIT # :nodoc: all
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def imemo_type(ptr)
|
def imemo_type_p(ptr, type)
|
||||||
_ptr = ptr.to_i
|
_ptr = ptr.to_i
|
||||||
Primitive.cexpr! 'UINT2NUM(imemo_type((VALUE)NUM2SIZET(_ptr)))'
|
Primitive.cexpr! 'RBOOL(imemo_type_p((VALUE)NUM2SIZET(_ptr), NUM2UINT(type)))'
|
||||||
end
|
end
|
||||||
|
|
||||||
def rb_iseq_only_optparam_p(iseq)
|
def rb_iseq_only_optparam_p(iseq)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user