On Tue, 12 May 2026 13:43:01 GMT, Tobias Hartmann <[email protected]> wrote:

> Mainline fix [JDK-8373248](https://bugs.openjdk.org/browse/JDK-8373248) added 
> additional code to verify that a `CastPPNode` does not change the type and we 
> now assert when casting the value of an unsafe flat access to the proper 
> type. The `CastPP` should be replaced by a `CheckCastPP`.
> 
> Thanks,
> Tobias
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Thanks for the review Marc.

> What do we have in value vs value_type when that goes wrong?

The intrinsic has an Object type in its signature:

  do_signature(putFlatValue_signature,    
"(Ljava/lang/Object;JILjava/lang/Class;Ljava/lang/Object;)V")                 \


https://github.com/openjdk/valhalla/blob/873f02d2d521108f8883341350315991b592e733/src/java.base/share/classes/jdk/internal/misc/Unsafe.java#L384

So `value` is an Object and `value_type` is a value class type. We cast `value` 
to that value class type.

Of course, we could / should add type checks (at some point). But it's Unsafe 
and therefore good enough for now.

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

PR Comment: https://git.openjdk.org/valhalla/pull/2425#issuecomment-4432084293
PR Comment: https://git.openjdk.org/valhalla/pull/2425#issuecomment-4432090060

Reply via email to