RFR: 8337251: C1: Improve Class.isInstance intrinsic [v4]
Vladimir Ivanov
vlivanov at openjdk.org
Fri Feb 7 16:57:27 UTC 2025
On Mon, 27 Jan 2025 16:13:35 GMT, Andrew Haley <aph at openjdk.org> wrote:
>> 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 ...
>
> Andrew Haley has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 28 commits:
>
> - Next
> - Next
> - Merge branch 'master' into JDK-8337251
> - More
> - Next
> - Windows fix, maybe.
> - Update
> - Update
> - Test fix/
> - Test fix/
> - ... and 18 more: https://git.openjdk.org/jdk/compare/764d70b7...13a2d93e
Testing results (hs-tier1 - hs-tier4) look good.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/22491#issuecomment-2643475099
More information about the hotspot-dev
mailing list