Skip to content

8380541: G1: Add g1CollectorState.inline.hpp file#30399

Closed
tschatzl wants to merge 22 commits intoopenjdk:masterfrom
tschatzl:submit/8380541-g1collectorstate-inline-hpp
Closed

8380541: G1: Add g1CollectorState.inline.hpp file#30399
tschatzl wants to merge 22 commits intoopenjdk:masterfrom
tschatzl:submit/8380541-g1collectorstate-inline-hpp

Conversation

@tschatzl
Copy link
Copy Markdown
Contributor

@tschatzl tschatzl commented Mar 24, 2026

Hi all,

please review this change that moves the implementations of the G1CollectorState functions into a .inline.hpp file to reduce the clutter there.

Testing: gha

Thanks,
Thomas


Progress

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

Issue

  • JDK-8380541: G1: Add g1CollectorState.inline.hpp file (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 30399

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

Using diff file

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

Using Webrev

Link to Webrev Comment

Thomas Schatzl and others added 16 commits March 10, 2026 09:32
Hi all,

  please review this change that makes `G1CollectorState` get the concurrent cycle state directly from `G1ConcurrentMark[Thread]` instead of, in multiple places set the current state separately. This is kind of error-prone, as https://bugs.openjdk.org/browse/JDK-8378952, which this change also implicitly fixes, shows.

Other notes:
  * I expanded the `ServiceState` in `G1ConcurrentMarkThread` instead of adding a separate variable holding whether this is a full or undo concurrent cycle. This avoids potential races between those two too.
  * be more consistent with `Concurrent Cycle` (the whole thing) vs. `Concurrent Marking` throughout
  * renamed the "clear bitmap" state to "reset for next cycle` since clearing the bitmap is only one part of that subphase of the concurrent cycle.
  * made concurrent cycle state queries always go through `G1CollectorState`
  * fixed `in_something` to `is_in_something` for `G1CollectorState` as per style guideline
  * extended evacuation failure injection to include reset for next cycle for the `G1GCAllocationFailureALotDuringConcMark` value; I thought it does not hurt and it already covered both mark and rebuild or scrub

Testing: tier1-5

Thanks,
  Thomas
Hi all,

  please review this change that changes `G1CollectorState` to use a single state variable for GC pause phasing instead of multiple bools.

This reduces clutter checking validity of these flags, and imo makes the state very explicit with the usual advantages in readability.

This is based on PR#30144, so please review that one first.

Testing: tier1-5, gha

Thanks,
  Thomas
…ause_type()` because it covers all types of pauses now
Hi all,

  please review this change that removes the "Last Young" nomenclature for the "Prepare Mixed" gc. The additional name just confuses.

Testing: gha

Thanks,
  Thomas
* reorder elements in Pause type to correspond to typical execution (i.e. Prepare Mixed last)
Hi all,

  please review this change that moves implementations from the g1CollectorState.hpp file into a .inline.hpp file.

Testing: gha

Thanks,
  Thomas
@bridgekeeper
Copy link
Copy Markdown

bridgekeeper bot commented Mar 24, 2026

👋 Welcome back tschatzl! A progress list of the required criteria for merging this PR into pr/30336 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 Mar 24, 2026

@tschatzl 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:

8380541: G1: Add g1CollectorState.inline.hpp file

Reviewed-by: ayang, stefank

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 28 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 8380541 8380541: G1: Add g1CollectorState.inline.hpp file Mar 24, 2026
@openjdk openjdk bot added the hotspot-gc hotspot-gc-dev@openjdk.org label Mar 24, 2026
@openjdk
Copy link
Copy Markdown

openjdk bot commented Mar 24, 2026

@tschatzl 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-notifier openjdk-notifier bot changed the base branch from pr/30336 to master March 24, 2026 15:57
@openjdk-notifier
Copy link
Copy Markdown

The parent pull request that this pull request depends on has now been integrated and the target branch of this pull request has been updated. This means that changes from the dependent pull request can start to show up as belonging to this pull request, which may be confusing for reviewers. To remedy this situation, simply merge the latest changes from the new target branch into this pull request by running commands similar to these in the local repository for your personal fork:

git checkout submit/8380541-g1collectorstate-inline-hpp
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# if there are conflicts, follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk
Copy link
Copy Markdown

openjdk bot commented Mar 24, 2026

@tschatzl this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout submit/8380541-g1collectorstate-inline-hpp
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Mar 24, 2026
@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Mar 25, 2026
@tschatzl tschatzl marked this pull request as ready for review March 25, 2026 08:41
@openjdk openjdk bot added the rfr Pull request is ready for review label Mar 25, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge bot commented Mar 25, 2026

Webrevs

Copy link
Copy Markdown
Member

@stefank stefank 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 saw an unused include of g1CollectedHeap.inline.hpp. That file is expensive to compile, so it could be worth skipping that include.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 25, 2026
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Mar 26, 2026
@openjdk openjdk bot added the hotspot hotspot-dev@openjdk.org label Mar 26, 2026
@openjdk
Copy link
Copy Markdown

openjdk bot commented Mar 26, 2026

@tschatzl hotspot has been added to this pull request based on files touched in new commit(s).

Comment on lines +96 to +98
assert(type != Pause::Full, "must be");
assert(type != Pause::Remark, "must be");
assert(type != Pause::Cleanup, "must be");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think positive assertion here is easier to read.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 26, 2026
@tschatzl
Copy link
Copy Markdown
Contributor Author

Thanks @stefank @albertnetymk for your reviews
/integrate

@openjdk
Copy link
Copy Markdown

openjdk bot commented Mar 27, 2026

Going to push as commit cee1e04.
Since your change was applied there have been 41 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Mar 27, 2026
@openjdk openjdk bot closed this Mar 27, 2026
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Mar 27, 2026
@openjdk
Copy link
Copy Markdown

openjdk bot commented Mar 27, 2026

@tschatzl Pushed as commit cee1e04.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@tschatzl tschatzl deleted the submit/8380541-g1collectorstate-inline-hpp branch March 27, 2026 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot hotspot-dev@openjdk.org hotspot-gc hotspot-gc-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants