-
Notifications
You must be signed in to change notification settings - Fork 15.5k
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
Ruby: Implement Write Barriers #11793
Ruby: Implement Write Barriers #11793
Conversation
d1645d3
to
7d5c0b9
Compare
I just noticed the For context, here's we have a couple thousands of these instances in our heap that need to be mark on every minor GC:
|
@JasonLunn @haberman sorry for the ping, but is this on your radar? We have about 3.5k of these objects on our heap, and we'd love if we didn't have to mark them on every minor GC. |
It looks like there is an assertion failure on Ruby 2.7:
Also could you rebase the PR from main? There have been some fixes to the tests in the meantime. |
It would be helpful to add comments above the struct members that must only be changed through |
7d5c0b9
to
eb42642
Compare
@haberman done. I rebased and added a comment above each reference to WB_PROTECTED. |
Also could you rebase once more (sorry for the trouble, you caught us in the middle of a migration to GitHub Actions). |
eb42642
to
fe71722
Compare
Write barrier protected objects are allowed to be promoted to the old generation, which means they only get marked on major GC. The downside is that the `RB_BJ_WRITE` macro MUST be used to set references, otherwise the referenced object may be garbaged collected. But the `*Descriptor` classes and `Arena` have very few references and are only set in a few places, so it's relatively easy to implement.
fe71722
to
215e8fa
Compare
@haberman done |
Sorry to be a bother, but is there any other blockers I can help with? |
This was merged in d82d8a4 |
🙌 Thank you! |
Write barrier protected objects are allowed to be promoted to the old generation, which means they only get marked on major GC.
The downside is that the
RB_BJ_WRITE
macro MUST be used to set references, otherwise the referenced object may be garbaged collected.But the
*Descriptor
classes andArena
have very few references and are only set in a few places, so it's relatively easy to implement.cc @peterzhu2118