<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:10.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">> </span><span style="font-size:11.0pt">CCMP is error prone, being difficult to read and write.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Using CCMP does make one's head explode at first.  All the more reason to put some infrastructure around using it, and to provide some good examples of how to use it, and where not to use it.  I think searching
 key-value arrays is fairly common activity, not limited to the loops in itable stubs.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">                                                ... peter</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:.5in">
<b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">hotspot-dev <hotspot-dev-retn@openjdk.org> on behalf of Andrew Haley <aph-open@littlepinkcloud.com><br>
<b>Date: </b>Sunday, April 30, 2023 at 03:06<br>
<b>To: </b>hotspot-dev@openjdk.org <hotspot-dev@openjdk.org><br>
<b>Subject: </b>Re: JDK-8307137: aarch64 MacroAssembler::lookup_interface_method could use conditional compare instead of branch<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:.5in">
<span style="font-size:11.0pt">On 4/29/23 01:18, Peter Kessler OS wrote:<br>
> 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.<br>
<br>
I doubt that it'd be a win, but maybe. On out-of-order AArch64 boxes I know,<br>
branch prediction tends to be very effective, so it won't make much difference.<br>
<br>
Also, CCMP is error prone, being difficult to read and write. Unless<br>
there's a significant advantage I wouldn't do it. Benchmarking might be hard<br>
to do, though.<br>
<br>
-- <br>
Andrew Haley  (he/him)<br>
Java Platform Lead Engineer<br>
Red Hat UK Ltd. <<a href="https://www.redhat.com">https://www.redhat.com</a>><br>
<a href="https://keybase.io/andrewhaley">https://keybase.io/andrewhaley</a><br>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671<o:p></o:p></span></p>
</div>
</div>
</body>
</html>