Eliminate global flags#9095
Merged
Merged
Conversation
463fc93 to
02d3ce3
Compare
Member
Author
|
StringIO needs changes to support this, since it accesses and mutates RubyBasicObject.flags directly. |
Member
Author
|
StringIO fixed in ruby/stringio#182 and pending release. |
This is a first step toward eliminating the global "flags" field in favor of type-specific flags.
The implementation of nil and false as a flag should not be visible from outside the object.
Only NEEDSIMPL is accessed from outside of RubyModule, by Kernel, but this flag is only used for visibility checking and may be eliminated at some point.
Frozen as a boolean would still consume a byte, so even if we eliminated the other two flags (nil and false) it would not save us any space compared to just leaving all three in a byte-sized flags field. And obviously without eliminating the other two flags, we still need to store them. We may revisit this if we can show that polymorphic "nil" and "false" tests show some benefit (and no detriment) but ultimately we won't get smaller than 8 bits of space for the unavoidable frozen flag.
c1226d8 to
5280fbf
Compare
headius
added a commit
to headius/jruby
that referenced
this pull request
Dec 2, 2025
With compressed OOPS on HotSpot, we have 4 bytes of slack currently that can be used to store the full long hash. This may change with jruby#9095 and jruby#9091 land, which will greatly reduce the flag overhead of all objects.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an experiment to remove or greatly reduce in size the global RubyBasicObject.flags field.
See #9088.