[vector] RFR 8221816: IndexOutOfBoundsException for fromArray/intoArray with unset mask lanes - was: RE: IndexOutOfBoundsException with unset mask lanes
Joshua Zhu (Arm Technology China)
Joshua.Zhu at arm.com
Fri May 10 06:41:21 UTC 2019
Hi Vladimir,
> It looks promising to introduce a variant of
> VectorIntrinsics.checkIndex() which is used to guard a fast path and is
> annotated with a JIT-compiler hint (akin to
> java.lang.invoke.MethodHandleImpl.profileBoolean() [1], but without
> profiling logic) to override bytecode profiling info, so JIT always puts an
> uncommon trap on the false branch.
Thanks for your comments.
As you suggested, I introduced VectorIntrinsics.expectTrue() in change [2].
It's used as below:
if (expectTrue(bool condition)) {
// fast path
} else {
// slow path: uncommon trap
}
I also wrote a jmh case [3] to check the performance.
See below table for jmh test results. (In Throughput Mode, Unit: ops/ms)
Base without expectTrue (patch [1]) UncommonTrap (patch [2])
1000 fastPath 318.228 ± 22.588 457.967 ± 12.622 457.328 ± 11.932
10000 fastPath 21.991 ± 2.496 23.360 ± 0.070 24.744 ± 0.213
100000 fastPath 1.613 ± 0.007 1.581 ± 0.031 1.631 ± 0.003
1000 fastPath + 1 slowPath N/A 57.298 ± 11.033 55.845 ± 0.716
10000 fastPath + 1 slowPath N/A 4.537 ± 0.536 15.164 ± 0.098
100000 fastPath + 1 slowPath N/A 0.577 ± 0.048 1.564 ± 0.005
[1] http://cr.openjdk.java.net/~jzhu/vectorapi/8221816.OOB/webrev.01/
[2] http://cr.openjdk.java.net/~jzhu/vectorapi/8221816.OOB/uncommontrap.webrev.00/
[3] http://cr.openjdk.java.net/~jzhu/vectorapi/8221816.OOB/IntVectorJmhTest.java
Please help review and feel free to share your comments.
Thanks.
Best Regards,
Joshua
More information about the panama-dev
mailing list