From c44367265daccc504e6ee35eb2ae5712563246c3 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Tue, 21 Mar 2023 00:10:14 -0700 Subject: [PATCH] RJIT: Fix invokesuper --- lib/ruby_vm/rjit/insn_compiler.rb | 8 +------- rjit_c.rb | 4 ++++ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/ruby_vm/rjit/insn_compiler.rb b/lib/ruby_vm/rjit/insn_compiler.rb index 80d09376d3..f3448ec426 100644 --- a/lib/ruby_vm/rjit/insn_compiler.rb +++ b/lib/ruby_vm/rjit/insn_compiler.rb @@ -3876,7 +3876,7 @@ module RubyVM::RJIT C::FL_TEST_RAW(rbasic_klass, C::RMODULE_IS_REFINEMENT) != 0 return CantCompile end - comptime_superclass = C.rb_class_get_superclass(current_defined_class) + comptime_superclass = C.rb_class_get_superclass(C.RCLASS_ORIGIN(current_defined_class)) # Don't JIT calls that aren't simple # Note, not using VM_CALL_ARGS_SIMPLE because sometimes we pass a block. @@ -3907,12 +3907,6 @@ module RubyVM::RJIT return CantCompile end - # workaround -- TODO: Why does this happen? - if me.to_i == cme.to_i - asm.incr_counter(:invokesuper_same_me) - return CantCompile - end - # Check that we'll be able to write this method dispatch before generating checks cme_def_type = cme.def.type if cme_def_type != C::VM_METHOD_TYPE_ISEQ && cme_def_type != C::VM_METHOD_TYPE_CFUNC diff --git a/rjit_c.rb b/rjit_c.rb index d87dbb8aab..9a7999f18b 100644 --- a/rjit_c.rb +++ b/rjit_c.rb @@ -329,6 +329,10 @@ module RubyVM::RJIT # :nodoc: all _cme_addr = cme.to_i Primitive.cexpr! 'RBOOL(UNDEFINED_METHOD_ENTRY_P((const rb_callable_method_entry_t *)NUM2SIZET(_cme_addr)))' end + + def RCLASS_ORIGIN(klass) + Primitive.cexpr! 'RCLASS_ORIGIN(klass)' + end end #