From: eregontp@... Date: 2021-02-27T16:36:56+00:00 Subject: [ruby-core:102643] [Ruby master Feature#17660] Expose information about which basic methods have been redefined Issue #17660 has been updated by Eregon (Benoit Daloze). @marcandre the information about redefined basic methods is not available to Ruby or C extensions AFAIK (since it is some kind of VM implementation detail). I guess your reply reinforces my point that we should clarify this is only about basic methods (e.g., that have their own bytecode instruction in CRuby, or are AST-inlined in TruffleRuby), and where checking if a method is redefined is enough to perform the logic inline (typically used for "leaf" classes). ---------------------------------------- Feature #17660: Expose information about which basic methods have been redefined https://bugs.ruby-lang.org/issues/17660#change-90635 * Author: tenderlovemaking (Aaron Patterson) * Status: Open * Priority: Normal ---------------------------------------- I would like to tell if code is redefining methods that can impact MRI's optimizations. This commit exposes which basic methods have been redefined. For example: ```ruby class Integer def +(x); x ** self; end end p RubyVM.redefined_methods # => {Integer=>[:+]} ``` This will allow us to prevent basic method redefinitions from happening by checking for them in CI environments. For example: ```ruby Minitest.after_run { fail "Basic methods have been redefine" if RubyVM.redefined_methods.any? } ``` ---Files-------------------------------- 0001-Expose-information-about-which-basic-methods-have-be.patch (3.89 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: