> 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: 
> https://github.com/openjdk/jdk/commit/e7e4de633204d50d2a8b153a590dc82d02bdf6f7
> 
> Also added a `JVMTI_EVENT_SAMPLED_OBJECT_ALLOC` reproducer, which verifies 
> that we can handle tenured object and object array clones. 
> 
> Currently running testing.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Axel Boldt-Christmas has updated the pull request with a new target base due to 
a merge or a rebase. The incremental webrev excludes the unrelated changes 
brought in by the merge/rebase. The pull request contains four additional 
commits since the last revision:

 - Merge remote-tracking branch 'upstream_jdk/master' into JDK-8383421
 - More generalized alternative
 - Add ZCloneWithTenuredAllocation test
 - 8383421: ZGC: Problematic interactions between 
`JVMTI_EVENT_SAMPLED_OBJECT_ALLOC` and `clone`

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/31149/files
  - new: https://git.openjdk.org/jdk/pull/31149/files/e7e4de63..90bd7bcb

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=31149&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=31149&range=00-01

  Stats: 3758 lines in 1243 files changed: 1667 ins; 408 del; 1683 mod
  Patch: https://git.openjdk.org/jdk/pull/31149.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/31149/head:pull/31149

PR: https://git.openjdk.org/jdk/pull/31149

Reply via email to