Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hashes need to deoptimize based on their contents #2016

Merged
merged 1 commit into from
Dec 8, 2023

Conversation

tenderlove
Copy link
Member

If a hash has children that are not "basic" types of objects, then we can't consider the hash to be a static literal.

Fixes: #2015

I didn't see how to add tests for this, so I didn't. I think this is the fix, but I don't understand how to test.

If a hash has children that are not "basic" types of objects, then we
can't consider the hash to be a static literal.

Fixes: ruby#2015
@jemmaissroff
Copy link
Collaborator

jemmaissroff commented Dec 8, 2023

To test, we'd usually make this change within ruby/ruby (src/prism.c maps to prism/prism.c over there), and add the tests to test/ruby/test_compile_prism.rb. If that all works, we'd merge this, and then merge the PR in ruby/ruby which tests it

Copy link
Collaborator

@kddnewton kddnewton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This definitely looks right.

We need to expose these flags to Ruby/serialization in order to properly test it. But for now this mirrors what we do with arrays, so it makes sense to do it here.

@kddnewton kddnewton merged commit 71a768d into ruby:main Dec 8, 2023
@kddnewton
Copy link
Collaborator

Oh shoot sorry @jemmaissroff I wasn't paying attention and just saw your comment. I'm hoping that since the tests passed on CI here that everything should be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[COMPILER] Compiling array within a hash
3 participants