[lworld] RFR: 8378375: [lworld] System.identityHashCode for value objects should vary by its class

Chen Liang liach at openjdk.org
Fri Feb 27 16:16:25 UTC 2026


On Wed, 25 Feb 2026 18:10:40 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

> System.identityHashCode for value instance should include a salt value that varies by class.
> This improves the distribution of hashcodes for value classes with similar primitive fields.
> The class hashCode is a decent salt value and is readily available.

Seems hotspot compiler tests don't break with your change. I wonder if they have any test verifying consistency across interpreter and C1/C2.

Yep, this patch need to fix its title to remove the colon.

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

Marked as reviewed by liach (Committer).

PR Review: https://git.openjdk.org/valhalla/pull/2169#pullrequestreview-3857273378
PR Comment: https://git.openjdk.org/valhalla/pull/2169#issuecomment-3973409436


More information about the valhalla-dev mailing list