mirror of
https://github.com/ruby/ruby.git
synced 2025-09-16 17:14:01 +02:00
MJIT: Check if self is T_OBJECT before opt_pc jump
This commit is contained in:
parent
ae70d2d786
commit
60d75a5665
1 changed files with 7 additions and 7 deletions
|
@ -75,6 +75,13 @@ class RubyVM::MJIT::Compiler # :nodoc: all
|
||||||
src << "#undef GET_SELF\n"
|
src << "#undef GET_SELF\n"
|
||||||
src << "#define GET_SELF() cfp_self\n"
|
src << "#define GET_SELF() cfp_self\n"
|
||||||
|
|
||||||
|
# Generate merged ivar guards first if needed
|
||||||
|
if !status.compile_info.disable_ivar_cache && using_ivar?(iseq.body)
|
||||||
|
src << " if (UNLIKELY(!RB_TYPE_P(GET_SELF(), T_OBJECT))) {"
|
||||||
|
src << " goto ivar_cancel;\n"
|
||||||
|
src << " }\n"
|
||||||
|
end
|
||||||
|
|
||||||
# Simulate `opt_pc` in setup_parameters_complex. Other PCs which may be passed by catch tables
|
# Simulate `opt_pc` in setup_parameters_complex. Other PCs which may be passed by catch tables
|
||||||
# are not considered since vm_exec doesn't call jit_exec for catch tables.
|
# are not considered since vm_exec doesn't call jit_exec for catch tables.
|
||||||
if iseq.body.param.flags.has_opt
|
if iseq.body.param.flags.has_opt
|
||||||
|
@ -88,13 +95,6 @@ class RubyVM::MJIT::Compiler # :nodoc: all
|
||||||
src << " }\n"
|
src << " }\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Generate merged ivar guards first if needed
|
|
||||||
if !status.compile_info.disable_ivar_cache && using_ivar?(iseq.body)
|
|
||||||
src << " if (UNLIKELY(!RB_TYPE_P(GET_SELF(), T_OBJECT))) {"
|
|
||||||
src << " goto ivar_cancel;\n"
|
|
||||||
src << " }\n"
|
|
||||||
end
|
|
||||||
|
|
||||||
compile_insns(0, 0, status, iseq.body, src)
|
compile_insns(0, 0, status, iseq.body, src)
|
||||||
compile_cancel_handler(src, iseq.body, status)
|
compile_cancel_handler(src, iseq.body, status)
|
||||||
src << "#undef GET_SELF\n"
|
src << "#undef GET_SELF\n"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue