-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Store object age in a bitmap #7938
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
Conversation
6a84634
to
7696a6f
Compare
7696a6f
to
9fbc7cc
Compare
Given that accessing these bits from the heap adds extra performance overhead, can you provide more background as to why these bits are being maintained in a separate location in addition to the flag bits? |
f140a43
to
6f0d4fe
Compare
@maximecb @byroot @peterzhu2118 and I discussed this outside of Github, but for context I'll summarise here: We're not maintaining these bits in two separate places. The age of the object is now only being stored in the bitmap attached to a heap page, and the only part of the code that should have to access or modify this bitmap is the age related GC code. This data should be ignored by the rest of the VM. The Currently
Conceptually, This approach also does not negatively impact performance, as can be seen by the benchmark results on the bug tracker ticket |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Assuming we go ahead with this, can I humbly request one of the available flag bits for immutability? |
Only one of the two bits is being freed, and we plan to use it to embed T_DATA objects. |
Okay. Fortunately we are going to be able to free up |
This has nothing to do with
|
Of course, but if it comes to it, it should at least be a discussion. |
b2d7d6f
to
f05e427
Compare
f05e427
to
96ab1ab
Compare
Closes [Feature #19729] Previously 2 bits of the flags on each RVALUE are reserved to store the number of GC cycles that each object has survived. This commit introduces a new bit array on the heap page, called age_bits, to store that information instead. This patch still reserves one of the age bits in the flags (the old FL_PROMOTED0 bit, now renamed FL_PROMOTED). This is set to 0 for young objects and 1 for old objects, and is used as a performance optimisation for the write barrier. Fetching the age_bits from the heap page and doing the required math to calculate if the object was old or not would slow down the write barrier. So we keep this bit synced in the flags for fast access.
96ab1ab
to
203e4d6
Compare
Previously 2 bits of the flags on each RVALUE are reserved to store the number of GC cycles that each object has survived. This commit introduces a new bit array on the heap page, called age_bits, to store that information instead.
This patch still reserves one of the age bits in the flags (the old FL_PROMOTED0 bit, now renamed FL_PROMOTED).
This is set to 0 for young objects and 1 for old objects, and is used as a performance optimisation for the write barrier. Fetching the age_bits from the heap page and doing the required math to calculate if the object was old or not would slow down the write barrier. So we keep this bit synced in the flags for fast access.