Skip to content

Conversation

@afshin-zafari
Copy link
Contributor

@afshin-zafari afshin-zafari commented Sep 8, 2025

The structures CommittedMemoryRegion and ReservedMemoryRegion are merged into the VirtualMemoryRegion.

Tests:
tiers1-5, main platforms, debug/product


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-8366241: NMT: Consolidate [Virtual/Committed/Reserved]Regions into one structure (Enhancement - P4)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 27137

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 8, 2025

👋 Welcome back azafari! 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

openjdk bot commented Sep 8, 2025

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

@openjdk
Copy link

openjdk bot commented Sep 8, 2025

@afshin-zafari The following label will be automatically applied to this pull request:

  • hotspot-runtime

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 openjdk bot added hotspot-runtime hotspot-runtime-dev@openjdk.org rfr Pull request is ready for review labels Sep 8, 2025
@afshin-zafari
Copy link
Contributor Author

Waiting for 8366363 to be integrated. Those changes to be merged here.

@mlbridge
Copy link

mlbridge bot commented Sep 8, 2025

Webrevs

@afshin-zafari afshin-zafari marked this pull request as draft September 9, 2025 07:59
@openjdk openjdk bot removed the rfr Pull request is ready for review label Sep 9, 2025
@afshin-zafari afshin-zafari marked this pull request as ready for review September 9, 2025 10:07
@openjdk
Copy link

openjdk bot commented Sep 9, 2025

@afshin-zafari 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 _8366241_nmt_consolidate_structures
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 merge-conflict Pull request has merge conflict with target branch rfr Pull request is ready for review labels Sep 9, 2025
@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Sep 9, 2025
@afshin-zafari afshin-zafari marked this pull request as draft September 9, 2025 10:56
@openjdk openjdk bot removed the rfr Pull request is ready for review label Sep 9, 2025
@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Sep 29, 2025
@afshin-zafari afshin-zafari marked this pull request as ready for review September 29, 2025 09:33
@openjdk openjdk bot added rfr Pull request is ready for review and removed merge-conflict Pull request has merge conflict with target branch labels Sep 29, 2025

bool is_valid() const { return base() != nullptr && size() != 0;}

inline void set_reserved_call_stack(const NativeCallStack& stack) { _reserved_stack = stack; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this used? Doesn't it make more sense for these values to be constant and the VMR to be an immutable object (in essence).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No it is not used anymore. Removed.
We cannot make VMR immutable, since we need to return a VMR from tree->find_reseved_region(). We need it to be COPYABLE.

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Sep 30, 2025
@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Sep 30, 2025
@bridgekeeper
Copy link

bridgekeeper bot commented Oct 29, 2025

@afshin-zafari This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply issue a /touch or /keepalive command to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@afshin-zafari
Copy link
Contributor Author

/keepalive

@openjdk
Copy link

openjdk bot commented Oct 29, 2025

@afshin-zafari The pull request is being re-evaluated and the inactivity timeout has been reset.

private:
NativeCallStack _stack;
MemTag _mem_tag;
bool is_valid() const { return base() != nullptr && size() != 0;}
Copy link
Member

Choose a reason for hiding this comment

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

The old structures had the base address and size by default initialised to 1. I think the new "invalid" values of 0 and 0 are more ergonomic, but I'm wondering, what's the reason we used 1 originally?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IIRC, they were used for debugging and tracing some cases that happened during VMATree implementation.

}
}

VirtualMemoryRegion(address addr, size_t size, const NativeCallStack& stack, bool committed) :
Copy link
Member

Choose a reason for hiding this comment

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

Correct me if I'm wrong but is this committed only ever true? And then we use the presence of this constructor parameter to decide whether we are creating a committed or a reserved region?

If so, at the very least we should assert that committed is true. But I think it would be nicer to make the constructor private and make some static factory methods akin to VirtualMemoryRegion::committed and VirtualMemoryRegion::reserved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. The committed is used here to distinguish signatures of the VMR constructor.
VMR(address, size_t, NativeCallStack) without this parameter would have been resolved to VMR(address, size_t, NCS, MemTag= mtNone). Actually it doesn't matter if the value of the parameter be true or false, the bool type does the work for us.
There is only one instance that uses this signature: regionsTree.inline.hpp:41.
Regarding your suggestion, we can provide a static method to build a Committed memory region and pass into it the required values. Something like:

VMR cmr;
VMR::create_cmr(addr, size, stack, cmr);// cmr is passed by ref and filled in 

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

Labels

hotspot-runtime hotspot-runtime-dev@openjdk.org rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

3 participants