<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" 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=Windows-1252">
<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:"Calibri Light";
        panose-1:2 15 3 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:10.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
span.EmailStyle18
        {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:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:10188355;
        mso-list-template-ids:-1932730170;}
@list l1
        {mso-list-id:229776937;
        mso-list-template-ids:-1881232984;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style>
</head>
<body lang="en-CZ" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">FYI: I’ve created new RFE
</span><span style="font-size:11.0pt;mso-fareast-language:EN-US"><a href="https://bugs.openjdk.org/browse/JDK-8306650">JDK-8306650</a><span lang="EN-US">
</span></span><span style="font-size:11.0pt;font-family:"Calibri Light",sans-serif;mso-fareast-language:EN-US">Improve control of stack maps generation in Classfile API</span><span style="font-size:11.0pt;mso-fareast-language:EN-US">
<span lang="EN-US"><o:p></o:p></span></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">to separate it from the actual bug fix of
</span><span style="font-size:11.0pt;mso-fareast-language:EN-US"><a href="https://bugs.openjdk.org/browse/JDK-8305990">JDK-8305990</a></span><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">
</span><span style="font-size:11.0pt;font-family:"Calibri Light",sans-serif;mso-fareast-language:EN-US">Stripping debug info of ASM 9.5 fails</span><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">Thank you,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">Adam<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">Brian Goetz <brian.goetz@oracle.com><br>
<b>Date: </b>Thursday, 20 April 2023 16:00<br>
<b>To: </b>Adam Sotona <adam.sotona@oracle.com>, classfile-api-dev@openjdk.org <classfile-api-dev@openjdk.org><br>
<b>Subject: </b>Re: Classfile API support for JSR and RET instructions<o:p></o:p></span></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:13.5pt;font-family:"Courier New"">If a boolean is not sufficient, we can combine with the option refactor strategy I outlined yesterday:<br>
</span><span style="font-size:11.0pt"><br>
</span><span style="font-size:13.5pt;font-family:"Courier New"">    enum StackMapGenerationOption { ALWAYS, NEVER, FAIL_ON_JSR_RET, OMIT_ON_JSR_RET }<br>
    record GenerateStackMaps(StackMapGenerationOption option) implements Option { }<br>
<br>
</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">On 4/20/2023 3:41 AM, Adam Sotona wrote:<o:p></o:p></span></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal" style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt">
<span style="font-size:13.5pt;font-family:"Courier New"">Our strategy with stackmaps is to generate based on an option, whose default is to generate.  You are right that we should refine this so that we never generate stack maps for classfiles < 50 because
 the stackmap attribute wasn't defined until then.  But that leaves us with a quandary about what to do for 51; in your proposed changes below, there is no way a user could get a stack map table even if they wanted one and didn't use JSR/RET.  Instead, I think
 we should:<br>
<br>
 - Generate a stackmap if the option is set and classfile version >= 50<br>
 - If JSR/RET is generated in classfile > 51, throw from CodeBuilder<br>
 - If stackmap generation encounters JSR/RET in classfile 50, throw from </span><span lang="EN-US" style="font-size:13.5pt;font-family:"Courier New"">StackMapGenerator</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><span lang="EN-US" style="font-size:11.0pt">The last condition unfortunately does not allow to agnostically process classes of unknown versions (the use case of jlink StripJavaDebugAttributesPlugin).
 If a classfile version 50 with JSR/RET instructions appears, there is no way how to turn off the stackmap generation for transformation of already parsed classfile. We have only a global boolean option for stackmap generation and it must be set before we know
 the class version. We may alternatively swallow the exception for classfile version 50 or call generator based on detection of JSR/RET for classfile version 50.
</span><span style="font-size:11.0pt"><o:p></o:p></span></p>
</blockquote>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
</body>
</html>