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). ------------- Commit messages: - More generalized alternative - Add ZCloneWithTenuredAllocation test - 8383421: ZGC: Problematic interactions between `JVMTI_EVENT_SAMPLED_OBJECT_ALLOC` and `clone` Changes: https://git.openjdk.org/jdk/pull/31149/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=31149&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8383421 Stats: 462 lines in 7 files changed: 430 ins; 19 del; 13 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
