From 072ef7a1aad9c2a9296d1df29996da4068c50b94 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Wed, 19 Apr 2023 10:40:40 -0700 Subject: [PATCH] YJIT: invokesuper: Remove cme mid matching check This check was introduced to match an assertion in the C YJIT when this was originally introduced. I don't believe it's necessary for correctness of the generated code. Co-authored-by: Adam Hess Co-authored-by: Daniel Colson Co-authored-by: Luan Vieira --- test/ruby/test_yjit.rb | 19 +++++++++++++++++++ yjit/src/codegen.rs | 7 ------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb index af7309385f..6700e58176 100644 --- a/test/ruby/test_yjit.rb +++ b/test/ruby/test_yjit.rb @@ -777,6 +777,25 @@ class TestYJIT < Test::Unit::TestCase RUBY end + def test_super_with_alias + assert_compiles(<<~'RUBY', insns: %i[invokesuper opt_plus opt_mult], result: 15) + class A + def foo = 1 + 2 + end + + module M + def foo = super() * 5 + alias bar foo + + def foo = :bad + end + + A.prepend M + + A.new.bar + RUBY + end + def test_super_cfunc assert_compiles(<<~'RUBY', insns: %i[invokesuper], result: "Hello") class Gnirts < String diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs index 10544ea902..280b4e2c4c 100644 --- a/yjit/src/codegen.rs +++ b/yjit/src/codegen.rs @@ -7034,13 +7034,6 @@ fn gen_invokesuper( let current_defined_class = unsafe { (*me).defined_class }; let mid = unsafe { get_def_original_id((*me).def) }; - if me != unsafe { rb_callable_method_entry(current_defined_class, (*me).called_id) } { - // Though we likely could generate this call, as we are only concerned - // with the method entry remaining valid, assume_method_lookup_stable - // below requires that the method lookup matches as well - return None; - } - // vm_search_normal_superclass let rbasic_ptr: *const RBasic = current_defined_class.as_ptr(); if current_defined_class.builtin_type() == RUBY_T_ICLASS