Skip to content

Conversation

@wks
Copy link
Contributor

@wks wks commented Dec 3, 2025

If an nmethod is in the mature roots and the nmethod is re-registered due to code patching, the nmethod will appear in both the nursery roots and the mature roots for one collection, causing some roots to be scanned twice. This PR removes an nmethod from the mature roots, when the nmethod is re-registered, so that the nmethod will only be present in the nursery.

This PR is ported from #336 for the jdk-21 branch.

If an nmethod is in the mature roots and the nmethod is re-registered
due to code patching, the nmethod will appear in both the nursery roots
and the mature roots for one collection, causing some roots to be
scanned twice. This PR removes an nmethod from the mature roots, when
the nmethod is re-registered, so that the nmethod will only be present
in the nursery.
@wks wks requested a review from qinsoon December 3, 2025 06:57
@wks
Copy link
Contributor Author

wks commented Dec 3, 2025

@no-defun-allowed Benchmarks show that it is still possible for OpenJDK 21 to re-registers nmethods. So this change is still needed for OpenJDK 21.

@wks wks merged commit bf3be7e into mmtk:jdk-21 Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants