[lworld] RFR: 8244975: [lworld] Investigate if VM can implement Object::hashCode by calling ValueBootstrapMethods for inline types
Mandy Chung
mchung at openjdk.java.net
Wed Aug 5 19:39:40 UTC 2020
On Wed, 5 Aug 2020 11:32:15 GMT, David Simms <dsimms at openjdk.org> wrote:
> Use ValueBootstrapMethods for Object::hashCode()
src/java.base/share/classes/java/lang/invoke/ValueBootstrapMethods.java line 486:
> 485: @Override protected MethodHandle computeValue(Class<?> type) {
> 486: return MethodHandleBuilder.hashCodeForType(type);
> 487: }
@MrSimms thanks for working on this.
I expect this to call the existing `hashCodeInvoker` if the type is an inline type. `hashCodeForType` is the method
handle invoking `java.util.Objects::hashCode`. The existing `hashCodeInvoker` should be changed to take `Class<?>
type` once javac no longer generates `equals` and `hashCode` method for inline type.
Maybe I should take this patch and make the coordinated changes??
src/hotspot/share/runtime/globals.hpp line 2474:
> 2473: \
> 2474: product(bool, InlineTypeIHashCodeViaMethod, true, \
> 2475: "Use generated hashCode for identity hash code") \
Do you anticipate this VM flag is needed?
-------------
PR: https://git.openjdk.java.net/valhalla/pull/136
More information about the valhalla-dev
mailing list