Repository navigation
Set the pin bit on pinned roots during moving GCs - #133
Open
eightbitraptor wants to merge 2 commits into
Open
eightbitraptor wants to merge 2 commits into
eightbitraptor wants to merge 2 commits into
Conversation
Roots reported through rb_gc_impl_mark_and_pin and rb_gc_impl_mark_maybe were processed as pinning roots. That keeps them in place for the current GC, but it does not set the pin bit, so rb_gc_impl_pinned_p returned false for them. When it updates references, Ruby re-embeds strings and arrays whose pinned_p is false and frees their heap buffer, even when a C frame still holds RSTRING_PTR. Since ruby/ruby 0b7838e23b, File.read returns a heap string that fits its slot, so String#scan in template/exts.mk.tmpl raised "string modified" under Immix and StickyImmix. In this commit we set the pin bit on roots reported with pin during moving GCs, and record them in the PinningRegistry so that the existing UnpinPinnedObjects work unpins them in VMRefClosure. Roots marked with rb_gc_mark_movable stay movable, so they can still be re-embedded.
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.
Roots reported through rb_gc_impl_mark_and_pin and rb_gc_impl_mark_maybe were processed as pinning roots. That keeps them in place for the current GC, but it does not set the pin bit, so rb_gc_impl_pinned_p returned false for them. When it updates references, Ruby re-embeds strings and arrays whose pinned_p is false and frees their heap buffer, even when a C frame still holds RSTRING_PTR.
Since ruby/ruby 0b7838e23b, File.read returns a heap string that fits its slot, so String#scan in template/exts.mk.tmpl raised "string modified" under Immix and StickyImmix.
In this commit we set the pin bit on roots reported with pin during moving GCs, and record them in the PinningRegistry so that the existing UnpinPinnedObjects work unpins them in VMRefClosure. Roots marked with rb_gc_mark_movable stay movable, so they can still be re-embedded.