On Mon, 2 Nov 2026 17:46:08 GMT, Leonid Mesnik <[email protected]> wrote:

> Hi 
> 
> During testing of 
> [JDK-8383787](https://bugs.openjdk.org/browse/JDK-8383787): 
> JVMTI_EVENT_SAMPLED_OBJECT_ALLOC may make a cloned object accessible to Java 
> before clone
> 
> I find that clone() intrinsic doesn't call JVMTI VMObjectAlloc as well as 
> SampledObjecAlloc. There is no requirement for SampledObjectAlloc to be 
> triggered by any allocation. While VMObjectAlloc should be called. 
> I find 2 compiler optimizations that allocated object during clone without 
> corresponding notification.
> 
> I applied fix similar to
> [JDK-8307462](https://bugs.openjdk.org/browse/JDK-8307462) [REDO] 
> VmObjectAlloc is not generated by intrinsics methods which allocate objects
> 
> The allocation check if notification are enabled using 
> JvmtiExport::_should_notify_object_alloc and deoptimize clone in this case.
> 
> I verified that VMObjectAllocCloneTest.java failed with `-Xcomp 
> -XX:-TieredCompilation `and -`Xcomp -XX:TieredStopAtLevel=1`. However I 
> haven't added them as separate testcases.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

This pull request has now been integrated.

Changeset: 46255d55
Author:    Leonid Mesnik <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/46255d551fb4a230bbd016882aebe6bb63f25bd0
Stats:     295 lines in 15 files changed: 293 ins; 0 del; 2 mod

8396399: VMObjectAlloc is not called from clone() intrinsic

Reviewed-by: kvn, sspitsyn

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

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

Reply via email to