JDK-8307137: aarch64 MacroAssembler::lookup_interface_method could use conditional compare instead of branch
Boris Ulasevich
boris.ulasevich at bell-sw.com
Sat Apr 29 07:48:55 UTC 2023
Hi Peter,
Please have a look at JDK-8305959. I'm going to rewrite the itable stub
codes to use a single pass over itable! I have an aarch64 implementation
which shows improvement on Ampere Altra.
Boris
On 4/29/2023 6:18 AM, Peter Kessler OS wrote:
>
> I notice that src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
> MacroAssembler::lookup_interface_method loops over the itable list
> with code that uses two branches: one to check for a null indicating
> the end of the list, and one to see if the appropriate entry has been
> found. aarch64 has a "ccmp" instruction that can be used to evaluate
> two conditions with only one branch. On an out-of-order
> implementation with more integer execution units than branch units,
> the trading of a branch for a ccmp can be beneficial. The downside is
> that one has to check, after the loop has exited, which of the
> conditions cause the loop to exit, but if the loop executes more than
> once or twice, that is still a win.
>
> There are other opportunities to use cmp;ccmp;br instead of
> cmp;br;cmp;br. I happened to see the one in
> MacroAssembler::lookup_interface_method because it was in what passes
> for hand-written assembler in HotSpot. For generic searches for a key
> in a key-value array the improvement can be ~10% on a Ampere Altra,
> depending on how far down the key-value array one has to look.
>
> I am only proposing to fix the loop in
> MacroAssembler::lookup_interface_method, but I would be interested in
> talking to people about where else the ccmp style could be applied.
>
> ... peter
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-dev/attachments/20230429/224521ad/attachment.htm>
More information about the hotspot-dev
mailing list