RJIT: Handle include_all argument of respond_to?
This commit is contained in:
parent
66fe64b269
commit
9bef39de74
@ -3162,17 +3162,21 @@ module RubyVM::RJIT
|
|||||||
end
|
end
|
||||||
mid = C.rb_sym2id(mid_sym)
|
mid = C.rb_sym2id(mid_sym)
|
||||||
|
|
||||||
|
# This represents the value of the "include_all" argument and whether it's known
|
||||||
|
allow_priv = if argc == 1
|
||||||
|
# Default is false
|
||||||
|
false
|
||||||
|
else
|
||||||
|
# Get value from type information (may or may not be known)
|
||||||
|
ctx.get_opnd_type(StackOpnd[0]).known_truthy
|
||||||
|
end
|
||||||
|
|
||||||
target_cme = C.rb_callable_method_entry_or_negative(recv_class, mid)
|
target_cme = C.rb_callable_method_entry_or_negative(recv_class, mid)
|
||||||
|
|
||||||
# Should never be null, as in that case we will be returned a "negative CME"
|
# Should never be null, as in that case we will be returned a "negative CME"
|
||||||
assert_equal(false, target_cme.nil?)
|
assert_equal(false, target_cme.nil?)
|
||||||
|
|
||||||
cme_def_type =
|
cme_def_type = C.UNDEFINED_METHOD_ENTRY_P(target_cme) ? C::VM_METHOD_TYPE_UNDEF : target_cme.def.type
|
||||||
if C.UNDEFINED_METHOD_ENTRY_P(target_cme)
|
|
||||||
C::VM_METHOD_TYPE_UNDEF
|
|
||||||
else
|
|
||||||
target_cme.def.type
|
|
||||||
end
|
|
||||||
|
|
||||||
if cme_def_type == C::VM_METHOD_TYPE_REFINED
|
if cme_def_type == C::VM_METHOD_TYPE_REFINED
|
||||||
return false
|
return false
|
||||||
@ -3185,13 +3189,11 @@ module RubyVM::RJIT
|
|||||||
end
|
end
|
||||||
|
|
||||||
result =
|
result =
|
||||||
case visibility
|
case [visibility, allow_priv]
|
||||||
in C::METHOD_VISI_UNDEF
|
in C::METHOD_VISI_UNDEF, _ then Qfalse # No method => false
|
||||||
Qfalse # No method => false
|
in C::METHOD_VISI_PUBLIC, _ then Qtrue # Public method => true regardless of include_all
|
||||||
in C::METHOD_VISI_PUBLIC
|
in _, true then Qtrue # include_all => always true
|
||||||
Qtrue # Public method => true regardless of include_all
|
else return false # not public and include_all not known, can't compile
|
||||||
else
|
|
||||||
return false # not public and include_all not known, can't compile
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if result != Qtrue
|
if result != Qtrue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user