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

Ensure reference objects are either traced or cleared #1126

Merged
merged 10 commits into from
Apr 23, 2024

Conversation

wks
Copy link
Collaborator

@wks wks commented Apr 20, 2024

After retaining soft references, we postpone the scanning of soft references until the transitive closure from retained soft references is fully expanded. While tracing and scanning new objects reached from the referents of soft references, new soft references may be discovered, and they will be added to the reference processor. By postponing the scanning, we ensure the newly discovered soft references are scanned, too.

To ensure we do not accidentally enqueue more objects than we should, we no longer call trace_object when scanning soft, weak and phantom references. Instead, we call ObjectReference::get_forwarded_object to get the forwarded references and referents. We still call trace_object when retaining soft references, and when forwarding references in MarkCompact during the second transitive closure.

Fixes: #1125

@wks wks marked this pull request as ready for review April 23, 2024 05:15
@wks wks added the PR-extended-testing Run extended tests for the pull request label Apr 23, 2024
@wks
Copy link
Collaborator Author

wks commented Apr 23, 2024

I marked this PR as ready for review. This fixes some obvious problems described in #1125, but there are still crashes when running mmtk-openjdk with the reference processor in mmtk-core. For example, running lusearch with StickyImmix with DaCapo Chopin with reference processing enabled will still crash due to SIGSEGV, regardless whether this PR is applied to the master branch or not.

As we discussed yesterday, we should enable binding-side reference processing for the OpenJDK binding ASAP.

@wks wks requested a review from qinsoon April 23, 2024 05:20
src/util/reference_processor.rs Outdated Show resolved Hide resolved
src/util/finalizable_processor.rs Outdated Show resolved Hide resolved
wks added 3 commits April 23, 2024 14:02
Only conditionally add the rescan packet.

Add it to the right bucket.
@wks
Copy link
Collaborator Author

wks commented Apr 23, 2024

The Ruby test failed due to a known problem mmtk/ruby#67 I'll re-run the Ruby test.

Copy link
Member

@qinsoon qinsoon left a comment

Choose a reason for hiding this comment

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

LGTM

@wks wks enabled auto-merge April 23, 2024 08:44
@wks wks added this pull request to the merge queue Apr 23, 2024
Merged via the queue into mmtk:master with commit 5a01555 Apr 23, 2024
24 checks passed
@wks wks deleted the fix/soft-ref-retain branch April 23, 2024 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-extended-testing Run extended tests for the pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ReferenceProcessor does not trace transitively discovered SoftReference instances
2 participants