-
Type:
Enhancement
-
Resolution: Unresolved
-
Priority:
P2
-
Affects Version/s: repo-valhalla
-
Component/s: hotspot
Performance of System.identityHashCode(...) is bad for value objects. Here's a plan on how to improve this:
(1) Enable storing the hash code in the mark word of value objects withJDK-8376171. JDK-8372268 will then make sure that we keep the buffer object at scalarized calls, and therefore the stored hash code.
(2) Add a fast path for value objects with only one primitive field but otherwise unknown layout to speedup (re-)computation of the hash for primitive boxes and therefore avoid regressions in legacy code.
(3) Intrinsify the hash code computation in C2 when the receiver is scalarized and no buffer object is available to load the cached hash from (for example, when loading from a flat array).
We should also add comprehensive benchmarks / tests for all these cases.
(1) Enable storing the hash code in the mark word of value objects with
(2) Add a fast path for value objects with only one primitive field but otherwise unknown layout to speedup (re-)computation of the hash for primitive boxes and therefore avoid regressions in legacy code.
(3) Intrinsify the hash code computation in C2 when the receiver is scalarized and no buffer object is available to load the cached hash from (for example, when loading from a flat array).
We should also add comprehensive benchmarks / tests for all these cases.
- is blocked by
-
JDK-8375319 [lworld] System.identityHashCode wrong for Wrapper classes with -XX:+UseAltSubstitutabilityMethod
-
- Resolved
-
- relates to
-
JDK-8206077 [lworld] improve hashcode implementation for value classes
-
- Open
-
-
JDK-8252061 [lworld] Support Object::toString for inline type
-
- Resolved
-
-
JDK-8370714 [lworld] Reimplement System.identityHashCode for Value Objects
-
- Resolved
-
-
JDK-8244975 [lworld] Default implementation of Object::hashCode supports inline class
-
- Resolved
-