Skip to content

8382616: Create GCArguments::set_heap_size interface#30848

Open
xmas92 wants to merge 4 commits intoopenjdk:masterfrom
xmas92:zgc_ahs_upstream_gcarguments_refactor
Open

8382616: Create GCArguments::set_heap_size interface#30848
xmas92 wants to merge 4 commits intoopenjdk:masterfrom
xmas92:zgc_ahs_upstream_gcarguments_refactor

Conversation

@xmas92
Copy link
Copy Markdown
Member

@xmas92 xmas92 commented Apr 21, 2026

Move the static Arguments::set_heap_size() to be a virtual interface on GCArguments via GCArguments::set_heap_size() with a a base implementation which is the same as the current Arguments::set_heap_size().

The main motivation is to allow the GCs to modify the behaviour of heap selection. This is something we rely on for the automatic heap sizing implementation in ZGC (JDK-8380289).

To keep the code motion minimal here Arguments friends GCArguments so it can use shared code without expanding its public interface. There is probably room for improvement here. But unless someone has a strong objections, or a trivial solution here, I would prefer keeping that to separate RFE.

Testing:

  • GHA
  • Tier 1-3 Oracle supported platforms


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-8382616: Create GCArguments::set_heap_size interface (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 30848

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper Bot commented Apr 21, 2026

👋 Welcome back aboldtch! 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 Apr 21, 2026

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk Bot added the hotspot hotspot-dev@openjdk.org label Apr 21, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 21, 2026

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

  • hotspot

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 Apr 21, 2026

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

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

mlbridge Bot commented Apr 21, 2026

Webrevs

@jsikstro
Copy link
Copy Markdown
Member

We should update the comment here to reflect that the function has moved from Arguments to GCArguments:

// If an overflow happened in Arguments::set_heap_size(), MaxHeapSize will have too large a value.

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.

When #30768 is integrated we can move limit_heap_by_allocatable_memory to GCArguments.

@albertnetymk
Copy link
Copy Markdown
Member

/cc hotspot-gc

@openjdk openjdk Bot added the hotspot-gc hotspot-gc-dev@openjdk.org label Apr 22, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 22, 2026

@albertnetymk
The hotspot-gc label was successfully added.

@xmas92
Copy link
Copy Markdown
Member Author

xmas92 commented Apr 22, 2026

Merged in JDK-8381829 / #30768 and moved limit_heap_by_allocatable_memory to GCArguments and removed the friend class declaration.

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 rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

3 participants