RFR: 8337251: C1: Improve Class.isInstance intrinsic
Andrew Haley
aph at openjdk.org
Mon Dec 2 17:20:48 UTC 2024
This replaces a runtime call to `Runtime1::is_instance_of()` by a platform-dependent C1 intrinsic.
This improves overall performance significantly. and it minimizes icache footprint.
The original commit contains this comment:
// TODO could try to substitute this node with an equivalent InstanceOf
// if clazz is known to be a constant Class. This will pick up newly found
// constants after HIR construction. I'll leave this to a future change.
However, there's little performance to be gained by restricting this optimization to constant Class instances, and after this this patch, C1 `Class.isInstance()` compares favorably with the current platform-dependent `instanceof` intrinsic.
It's not strictly necessary for other platforms to implement this optimization.
Performance:
Xeon-E5 2430, before and after::
Benchmark Score Error Score Error Units
SecondarySupersLookup.testNegative00 11.783 ± 0.491 10.459 ± 0.183 ns/op
SecondarySupersLookup.testNegative01 11.757 ± 0.127 10.475 ± 0.661 ns/op
SecondarySupersLookup.testNegative02 11.771 ± 0.700 10.479 ± 0.357 ns/op
SecondarySupersLookup.testNegative55 23.997 ± 1.816 16.854 ± 1.034 ns/op
SecondarySupersLookup.testNegative60 29.598 ± 1.326 26.828 ± 0.637 ns/op
SecondarySupersLookup.testNegative63 74.528 ± 3.157 69.431 ± 0.357 ns/op
SecondarySupersLookup.testNegative64 75.936 ± 1.805 70.124 ± 0.397 ns/op
SecondarySupersLookup.testPositive01 15.257 ± 1.179 9.722 ± 0.326 ns/op
SecondarySupersLookup.testPositive02 15.164 ± 1.383 9.737 ± 0.708 ns/op
SecondarySupersLookup.testPositive03 15.166 ± 0.934 9.726 ± 0.184 ns/op
SecondarySupersLookup.testPositive40 20.384 ± 0.530 12.805 ± 0.778 ns/op
SecondarySupersLookup.testPositive50 15.118 ± 0.140 9.735 ± 0.555 ns/op
SecondarySupersLookup.testPositive60 20.415 ± 3.083 11.603 ± 0.106 ns/op
SecondarySupersLookup.testPositive63 65.478 ± 8.484 58.507 ± 2.837 ns/op
SecondarySupersLookup.testPositive64 75.880 ± 1.047 68.667 ± 1.347 ns/op
AArch64 (Apple M1)
Benchmark Score Error Score Error Units
SecondarySupersLookup.testNegative00 4.139 ± 0.005 2.815 ± 0.014 ns/op
SecondarySupersLookup.testNegative01 4.071 ± 0.153 2.826 ± 0.291 ns/op
SecondarySupersLookup.testNegative02 4.089 ± 0.752 2.817 ± 0.028 ns/op
SecondarySupersLookup.testNegative55 7.191 ± 0.041 4.704 ± 0.036 ns/op
SecondarySupersLookup.testNegative60 10.712 ± 0.107 7.686 ± 0.763 ns/op
SecondarySupersLookup.testNegative63 28.270 ± 1.294 23.756 ± 0.026 ns/op
SecondarySupersLookup.testNegative64 28.618 ± 0.334 24.084 ± 0.238 ns/op
SecondarySupersLookup.testPositive01 4.379 ± 0.042 2.989 ± 0.600 ns/op
SecondarySupersLookup.testPositive02 4.462 ± 0.028 3.036 ± 0.261 ns/op
SecondarySupersLookup.testPositive03 4.749 ± 0.934 2.989 ± 0.586 ns/op
SecondarySupersLookup.testPositive40 5.352 ± 0.997 3.482 ± 0.696 ns/op
SecondarySupersLookup.testPositive50 4.435 ± 0.832 2.989 ± 0.571 ns/op
SecondarySupersLookup.testPositive60 5.349 ± 1.050 3.482 ± 0.680 ns/op
SecondarySupersLookup.testPositive63 23.879 ± 0.200 19.743 ± 1.668 ns/op
SecondarySupersLookup.testPositive64 28.340 ± 0.190 24.106 ± 0.454 ns/op
-------------
Commit messages:
- Remove obsolete comment
- Cleanup
- Cleanup
- Merge branch 'JDK-8337251' of https://github.com/theRealAph/jdk into JDK-8337251
- AArch64
- Temp
- More
- More
- More
- Merge branch 'clean' into JDK-8337251
- ... and 6 more: https://git.openjdk.org/jdk/compare/d589bafe...ae6e2355
Changes: https://git.openjdk.org/jdk/pull/22491/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22491&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8337251
Stats: 102 lines in 5 files changed: 94 ins; 7 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/22491.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/22491/head:pull/22491
PR: https://git.openjdk.org/jdk/pull/22491
More information about the hotspot-dev
mailing list