Skip to content

8385728: Serial: Check empty MemRegion in maintain_old_to_young_invariant#31341

Open
albertnetymk wants to merge 1 commit into
openjdk:masterfrom
albertnetymk:sgc-memregion-empty
Open

8385728: Serial: Check empty MemRegion in maintain_old_to_young_invariant#31341
albertnetymk wants to merge 1 commit into
openjdk:masterfrom
albertnetymk:sgc-memregion-empty

Conversation

@albertnetymk
Copy link
Copy Markdown
Member

@albertnetymk albertnetymk commented Jun 1, 2026

Add explicit is_empty() checks before calling clear_MemRegion() and dirty_MemRegion() in maintain_old_to_young_invariant to avoid passing empty MemRegions.

The alternative would be adding early returns in those two shared methods, but inspecting all existing callers shows they never pass empty regions, so I chose to fix the Serial GC caller rather than modify shared code.

Test: tier1-3



Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)

Issue

  • JDK-8385728: Serial: Check empty MemRegion in maintain_old_to_young_invariant (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/31341/head:pull/31341
$ git checkout pull/31341

Update a local copy of the PR:
$ git checkout pull/31341
$ git pull https://git.openjdk.org/jdk.git pull/31341/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 31341

View PR using the GUI difftool:
$ git pr show -t 31341

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/31341.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper Bot commented Jun 1, 2026

👋 Welcome back ayang! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Jun 1, 2026

@albertnetymk This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8385728: Serial: Check empty MemRegion in maintain_old_to_young_invariant

Reviewed-by: tschatzl, jsikstro, gli

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 59 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk Bot changed the title 8385728 8385728: Serial: Check empty MemRegion in maintain_old_to_young_invariant Jun 1, 2026
@openjdk openjdk Bot added the hotspot-gc hotspot-gc-dev@openjdk.org label Jun 1, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented Jun 1, 2026

@albertnetymk The following label will be automatically applied to this pull request:

  • hotspot-gc

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Jun 1, 2026

The total number of required reviews for this PR has been set to 2 based on the presence of this label: hotspot-gc. This can be overridden with the /reviewers command.

@openjdk openjdk Bot added the rfr Pull request is ready for review label Jun 1, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge Bot commented Jun 1, 2026

Webrevs

Copy link
Copy Markdown
Contributor

@tschatzl tschatzl left a comment

Choose a reason for hiding this comment

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

Lgtm, but I would somewhat strongly consider adding at least an assert(!mr.is_empty()) to both CardTable methods - in the worst case it will crash the VM (passing MemRegion() accidentally.

@albertnetymk
Copy link
Copy Markdown
Member Author

I would somewhat strongly consider adding at least an assert(!mr.is_empty()) to both CardTable methods

Sure; will do so in a followup PR. Wanna avoid adding risky logic in shared code as part of Serial-only PR.

Copy link
Copy Markdown
Member

@jsikstro jsikstro left a comment

Choose a reason for hiding this comment

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

Looks good.

I agree with Thomas' review, it would be nice with asserts in the shared CardTable functions.

@openjdk openjdk Bot added the ready Pull request is ready to be integrated label Jun 3, 2026
Copy link
Copy Markdown
Member

@lgxbslgx lgxbslgx left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot-gc hotspot-gc-dev@openjdk.org ready Pull request is ready to be integrated rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

4 participants