<div dir="auto">Nice!  Thank you!</div><div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Wed, Dec 18, 2024 at 5:57 AM Martin Balao <<a href="mailto:mbalao@redhat.com">mbalao@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 12/18/24 05:25, Xuelei Fan wrote:> Hm, that would be nice if JIT <br>
could optimize it.  Did you have a chance<br>
> to verify it?<br>
> <br>
<br>
Yes. For example, to verify we can do the following:<br>
<br>
  1) Debug Signature::getInstance throughout the path that calls <br>
Signature::getInstanceRSA and ProvidersFilter::isAllowed to make sure <br>
that we are hitting the filter code (i.e. the fast-path for a disabled <br>
filter).<br>
<br>
  2) Dump C2's Signature::getInstance.<br>
<br>
  3) Recompile the JDK removing the call to ProvidersFilter::isAllowed.<br>
<br>
  4) Debug again to make sure that the call was removed (i.e. the <br>
classfile recompiled)<br>
<br>
  5) Dump C2's Signature::getInstance.<br>
<br>
  6) Compare the two Signature::getInstance dumps.<br>
<br>
After following the previous steps, we can see how the difference <br>
between the methods are just addresses. Find attached to this email <br>
Main.java to reproducer yourself (run with <br>
'-XX:CompileCommand=compileonly,java.security.Signature::getInstance <br>
-XX:CompileCommand=print,java.security.Signature::getInstance <br>
-XX:-BackgroundCompilation -XX:-TieredCompilation'), and my two <br>
ProvidersFilter::isAllowed dumps.</blockquote></div></div>