<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<html><head><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;}
@font-face
{font-family:Aptos;}
/* 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;}
@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">The ‘before’ was compiled with javac version 24-ea+22-269, but I compiled with javac version 17.0.11 and got the exact same binary. The stack map frames are there:</span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt"> StackMapTable:</span></p><p class="MsoNormal"><span style="font-size:11.0pt"> StackMap((SAME_LOCALS_1_STACK, offset delta=19, stack items={(type=Object, class=DataStructures.Overflow)}), (SAME, offset delta=0))</span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt">The first (@19) is the target of the exception handler, the second (@20) is the target of the branch @16.</span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt">It all looks good to me.</span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt">Mark</span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><div><div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span style="font-size:11.0pt">From:</span></b><span style="font-size:11.0pt"> Adam Sotona <<a href="mailto:adam.sotona@oracle.com">adam.sotona@oracle.com</a>> <br><b>Sent:</b> Wednesday, January 29, 2025 1:07 AM<br><b>To:</b> Mark Roberts <<a href="mailto:markro@cs.washington.edu">markro@cs.washington.edu</a>>; <a href="mailto:classfile-api-dev@openjdk.org">classfile-api-dev@openjdk.org</a><br><b>Cc:</b> Chen Liang <<a href="mailto:chen.l.liang@oracle.com">chen.l.liang@oracle.com</a>><br><b>Subject:</b> Re: StackMap problem</span></p></div></div><p class="MsoNormal"> </p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:Aptos">Hi Mark,</span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:Aptos">Both attached class listings are missing stack map frames at branch targets, and they seem to be invalid.</span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:Aptos">I would like to ask what compiler generates the first class and how your tool adds the instrumentation code.</span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:Aptos">My first impression is that I don’t see any trace of Class-File API stack map generator involment. Transformation of a method with missing or invalid stack map would generate new stack maps, unless explicitly disabled.</span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:Aptos"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:Aptos">Thanks,</span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:Aptos">Adam</span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:Aptos"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:Aptos"> </span></p><div id="mail-editor-reference-message-container"><div><div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;font-family:Aptos;color:black">From: </span></b><span style="font-size:12.0pt;font-family:Aptos;color:black">classfile-api-dev <<a href="mailto:classfile-api-dev-retn@openjdk.org">classfile-api-dev-retn@openjdk.org</a>> on behalf of Mark Roberts <<a href="mailto:markro@cs.washington.edu">markro@cs.washington.edu</a>><br><b>Date: </b>Tuesday, 28 January 2025 at 21:45<br><b>To: </b><a href="mailto:classfile-api-dev@openjdk.org">classfile-api-dev@openjdk.org</a> <<a href="mailto:classfile-api-dev@openjdk.org">classfile-api-dev@openjdk.org</a>><br><b>Cc: </b>Chen Liang <<a href="mailto:chen.l.liang@oracle.com">chen.l.liang@oracle.com</a>><br><b>Subject: </b>StackMap problem</span></p></div><div><p class="MsoNormal"><span style="font-size:11.0pt">The existence of compiler generated, unnamed local temps (no LocalVariable code element) seems to cause a problem with stack maps.</span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt">The ‘source’ attachment shows the problem method. The ‘before’ attachment shows the generated code before instrumentation. Note that the compiler generates an unnamed temp at slot 0 to store the exception code. The stackmap for the branch target says same locals, which is correct.</span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt">The ‘after’ attachment shows the code generated after our tool has added instrumentation code – note the addition of a new local variable at slot 1. The stackmap for the branch target still says same locals, which is no longer correct. This causes the iload_1 @41 to fail.</span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt">I tried to see if this issue has already been reported, but I was unable to figure out how to search </span><a href="https://bugs.java.com/bugdatabase/"><span style="font-size:11.0pt">https://bugs.java.com/bugdatabase/</span></a><span style="font-size:11.0pt"> by keyword.</span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt">Mark</span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt"> </span></p></div></div></div></div></div></body></html>