Skip to content

Commit

Permalink
Update identityHashCode() in System.java for Value type
Browse files Browse the repository at this point in the history
System.IdentityHashCode() should always return the same hash as
Object.hashCode(), no matter the object is VT or not.

Signed-off-by: Hang Shao <[email protected]>
  • Loading branch information
hangshao0 committed Nov 8, 2024
1 parent 5889012 commit ddd7c88
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions jcl/src/java.base/share/classes/java/lang/System.java
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,11 @@ public static int identityHashCode(Object anObject) {
if (anObject == null) {
return 0;
}
/*[IF INLINE-TYPES]*/
if (anObject.getClass().isValue()) {
return J9VMInternals.valueHashCode(anObject);
}
/*[ENDIF] INLINE-TYPES */
return J9VMInternals.fastIdentityHashCode(anObject);
}

Expand Down

0 comments on commit ddd7c88

Please sign in to comment.