diff options
author | Alan Wu <XrXr@users.noreply.github.com> | 2021-06-21 20:18:54 -0400 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:36 -0400 |
commit | 0cd3b97e027332236625835578329580be12023c (patch) | |
tree | 33c8a15ff604c22bbc476a32e8d8774ead48eeee /tool/ruby_vm | |
parent | 89110590a3864e4af1fd62df0182396b86ab17f3 (diff) |
Handle non-material empty singleton class properly
As an optimization, multiple objects could share the same singleton
class. The optimization introduced in 6698e433934d810b16ee3636b63974c0a75c07f0
wasn't handling this correctly so was generating guards that never pass
for the inputs we defer compilation to wait for. After generating
identical code multiple times and failing, the call site is falsely
recognized as megamorphic and it side exits. See disassembly for the
following before this commit:
def foo(obj)
obj.itself
end
o = Object.new.singleton_class
foo(o)
puts YJIT.disasm(method(:foo))
See also: comment in rb_singleton_class_clone_and_attach().
Diffstat (limited to 'tool/ruby_vm')
0 files changed, 0 insertions, 0 deletions