Details
-
Sub-task
-
Resolution: Fixed
-
P4
-
None
-
None
-
None
Description
For some reason, VarHandles are significantly slower than either the plain calls or unsafe calls when compiled with C1.
This is not specific to int tests, but reproduces on all primitive tests like this:
http://cr.openjdk.java.net/~shade/8130920/IntTest.java
o.o.v.get.acc.IntTest.plain avgt 15 16.380 ± 0.008 ns/op
o.o.v.get.acc.IntTest.unsafe avgt 15 18.903 ± 0.007 ns/op
o.o.v.get.acc.IntTest.varHandle avgt 15 44.113 ± 0.026 ns/op
Disassembly points fingers at non-inlined MH::linkToStatic:
http://cr.openjdk.java.net/~shade/8130920/c1.perfasm
http://cr.openjdk.java.net/~shade/8130920/c2.perfasm
2029 239 java.lang.invoke.VarHandleGuards::guard_L_I (38 bytes)
@ 13 java.lang.invoke.VarHandleGuards::checkExactType (12 bytes) force inline by annotation
@ 7 java.lang.invoke.Invokers::newWrongMethodTypeException (36 bytes) callee is too large
@ 31 java.lang.invoke.VarHandleGuards::checkMemberName (12 bytes) force inline by annotation
@ 6 java.lang.invoke.VarHandle::unsupported (8 bytes)
@ 4 java/lang/UnsupportedOperationException::<init> (not loaded) not inlineable
@ 34 java.lang.invoke.MethodHandle::linkToStatic(LLL)I (0 bytes) MemberName not constant
This is not specific to int tests, but reproduces on all primitive tests like this:
http://cr.openjdk.java.net/~shade/8130920/IntTest.java
o.o.v.get.acc.IntTest.plain avgt 15 16.380 ± 0.008 ns/op
o.o.v.get.acc.IntTest.unsafe avgt 15 18.903 ± 0.007 ns/op
o.o.v.get.acc.IntTest.varHandle avgt 15 44.113 ± 0.026 ns/op
Disassembly points fingers at non-inlined MH::linkToStatic:
http://cr.openjdk.java.net/~shade/8130920/c1.perfasm
http://cr.openjdk.java.net/~shade/8130920/c2.perfasm
2029 239 java.lang.invoke.VarHandleGuards::guard_L_I (38 bytes)
@ 13 java.lang.invoke.VarHandleGuards::checkExactType (12 bytes) force inline by annotation
@ 7 java.lang.invoke.Invokers::newWrongMethodTypeException (36 bytes) callee is too large
@ 31 java.lang.invoke.VarHandleGuards::checkMemberName (12 bytes) force inline by annotation
@ 6 java.lang.invoke.VarHandle::unsupported (8 bytes)
@ 4 java/lang/UnsupportedOperationException::<init> (not loaded) not inlineable
@ 34 java.lang.invoke.MethodHandle::linkToStatic(LLL)I (0 bytes) MemberName not constant
Attachments
Issue Links
- relates to
-
JDK-8130923 C1 trouble in VarHandle.getObject tests
-
- Resolved
-