RFR: 8281168: Micro-optimize VarForm.getMemberName for interpreter

Aleksey Shipilev shade at openjdk.java.net
Thu Feb 3 07:28:34 UTC 2022


I was looking for easy things to do to improve `java.lang.invoke` cold performance. One of the things is inlining `VarForm.getMemberName` a bit, so that interpreter does not have to call through `getMemberNameOrNull`.

There is direct VarHandle benchmark in our corpus:


$ CONF=linux-x86_64-server-release make run-test TEST=micro:java.lang.invoke.VarHandleExact MICRO="TIME=200ms;WARMUP_TIME=200ms;VM_OPTIONS=-Xint"

Benchmark                                 Mode  Cnt     Score    Error  Units

# -Xint
# Baseline
VarHandleExact.exact_exactInvocation      avgt   30   714.041 ±  5.882  ns/op
VarHandleExact.generic_exactInvocation    avgt   30   641.570 ± 11.681  ns/op
VarHandleExact.generic_genericInvocation  avgt   30  1336.571 ± 11.873  ns/op

# -Xint
# Patched
VarHandleExact.exact_exactInvocation      avgt   30   678.495 ± 10.752  ns/op ; +5%
VarHandleExact.generic_exactInvocation    avgt   30   573.320 ±  5.100  ns/op ; +11%
VarHandleExact.generic_genericInvocation  avgt   30  1338.593 ± 14.275  ns/op 

# (server, default)
# Baseline
VarHandleExact.exact_exactInvocation      avgt   30   0.620 ± 0.079  ns/op
VarHandleExact.generic_exactInvocation    avgt   30   0.602 ± 0.063  ns/op
VarHandleExact.generic_genericInvocation  avgt   30  10.521 ± 0.065  ns/op

# (server, default)
# Patched
VarHandleExact.exact_exactInvocation      avgt   30   0.621 ± 0.070  ns/op
VarHandleExact.generic_exactInvocation    avgt   30   0.601 ± 0.061  ns/op
VarHandleExact.generic_genericInvocation  avgt   30  10.499 ± 0.070  ns/op


Additional testing:
 - [x] Linux x86_64 fastdebug `tier1`
 - [x] Linux x86_64 fastdebug `tier2`
 - [x] Linux x86_64 fastdebug `tier3`

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

Commit messages:
 - Fix

Changes: https://git.openjdk.java.net/jdk/pull/7333/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7333&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8281168
  Stats: 5 lines in 1 file changed: 3 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/7333.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/7333/head:pull/7333

PR: https://git.openjdk.java.net/jdk/pull/7333


More information about the core-libs-dev mailing list