oracle / truffleruby

A high performance implementation of the Ruby programming language, built on GraalVM.
https://www.graalvm.org/ruby/
Other
3.01k stars 184 forks source link

Emit a performance warning when redefining methods in CoreMethodAssumptions #3538

Closed eregon closed 5 months ago

eregon commented 5 months ago

Let's do the same as https://github.com/ruby/ruby/pull/10532, it seems a useful way to diagnose problematic redefinitions (which e.g. cause Inlined*Node to not be used, which is a big footprint + interpreter & tier1 overhead).

Also see https://bugs.ruby-lang.org/issues/20429 (as noted there, we already have --engine.TraceAssumptions but that's less user-friendly).

CRuby will have it for Ruby 3.4 but I think there is no harm to do it earlier in TruffleRuby.

FWIW, the list is in CoreMethodAssumptions. Let's warn from org.truffleruby.core.module.ModuleFields#changedMethod and org.truffleruby.core.module.ModuleFields#invalidateBuiltinsAssumptions

andrykonchin commented 5 months ago

Fixed in 1ee958f355db44a95bf961aa626b7f7120d39425