On Wed, 27 May 2026 14:04:08 GMT, Axel Boldt-Christmas <[email protected]> 
wrote:

>> 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 incrementally with one 
> additional commit since the last revision:
> 
>   Revert on_slowpath_allocation_exit changes

Looks good!

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

Marked as reviewed by jsikstro (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/31149#pullrequestreview-4378957865

Reply via email to