On Thu, 7 May 2026 22:51:22 GMT, Dan Smith <[email protected]> wrote:

>> Two changes:
>> 
>> - Remove the `Class.isIdentity` method, which is redundant given the 
>> `Class.isValue` method
>> - Clean up `Class.isValue` so that it only returns true for value classes, 
>> not other non-identity things (interfaces, primitives)
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Dan Smith has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   compare-and-set checks don't need to look at field type

src/java.base/share/classes/jdk/internal/misc/Unsafe.java line 1734:

> 1732:                                                     V expected,
> 1733:                                                     V x) {
> 1734:         if (isValueObject(expected)) {

Discussed with Fred: all we're trying to do here is quickly check for cases 
where a pointer comparison won't work as a stand-in for `==`. If `expected` is 
not a value object, a pointer comparison is just fine. No need to consider the 
type of the container.

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2397#discussion_r3205179411

Reply via email to