Skip to content

8383421: ZGC: Problematic interactions between JVMTI_EVENT_SAMPLED_OBJECT_ALLOC and clone#31149

Open
xmas92 wants to merge 3 commits into
openjdk:masterfrom
xmas92:JDK-8383421
Open

8383421: ZGC: Problematic interactions between JVMTI_EVENT_SAMPLED_OBJECT_ALLOC and clone#31149
xmas92 wants to merge 3 commits into
openjdk:masterfrom
xmas92:JDK-8383421

Conversation

@xmas92
Copy link
Copy Markdown
Member

@xmas92 xmas92 commented May 13, 2026

This changes our runtime clone barriers to unconditionally handle tenured destination objects.

We already had a solution for object arrays as they were something ZGCs own allocator could tenure, however we assumed no safepoints for normal object clones. However because of JVMTI_EVENT_SAMPLED_OBJECT_ALLOC arbitrary java code may be ran between the allocation and the clone barrier.

This patch creates a lock-step iterator, which iterates over the object, copies everything between the oops incrementally and does the proper load, and store barriers.

The only thing the implementation currently rely on is that our oop_oop_iterate iterator visits the fields or elements in address order, which I do not see changing, but is currently not an explicit contract but an implementation detail.

The initial implementation used this new construction for tenured object clone. By the fact is that the new cloner can handle cloning any object with the same or better overhead than the three different implementations. So added a commit which generalised and uses this cloner for all objects: e7e4de6

Also added a JVMTI_EVENT_SAMPLED_OBJECT_ALLOC reproducer, which verifies that we can handle tenured object and object array clones.

Currently running testing.



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-8383421: ZGC: Problematic interactions between JVMTI_EVENT_SAMPLED_OBJECT_ALLOC and clone (Bug - P2)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 31149

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper Bot commented May 13, 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 May 13, 2026

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

@openjdk openjdk Bot added serviceability serviceability-dev@openjdk.org hotspot-gc hotspot-gc-dev@openjdk.org labels May 13, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented May 13, 2026

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

  • hotspot-gc
  • serviceability

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

@openjdk
Copy link
Copy Markdown

openjdk Bot commented May 13, 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 May 13, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge Bot commented May 13, 2026

Webrevs

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 rfr Pull request is ready for review serviceability serviceability-dev@openjdk.org

Development

Successfully merging this pull request may close these issues.

1 participant