Skip to content

ZJIT: Avoid inlining Hash#[] if it's called through alias #987

@k0kubun

Description

@k0kubun

The following incompatibility has been reported by @jhawthorn on Slack:

class Hash
  alias get []
end

def foo(h) = h.get(1)

h = Hash.new { caller(1) }
1000.times { foo(h) }
puts foo(h)
❯ ruby test_zjit_aref.rb
test_zjit_aref.rb:5:in 'Hash#[]'
test_zjit_aref.rb:5:in 'Object#foo'
test_zjit_aref.rb:9:in '<main>'

❯ ruby --zjit test_zjit_aref.rb
test_zjit_aref.rb:5:in 'Object#foo'
test_zjit_aref.rb:9:in '<main>'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions