<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <font size="4"><font face="monospace">If a boolean is not
        sufficient, we can combine with the option refactor strategy I
        outlined yesterday:<br>
      </font></font><br>
    <font size="4"><font face="monospace"><font size="4"><font face="monospace">    enum StackMapGenerationOption { ALWAYS,
            NEVER, FAIL_ON_JSR_RET, OMIT_ON_JSR_RET }<br>
                record GenerateStackMaps(StackMapGenerationOption
            option) implements Option { }<br>
            <br>
            <br>
          </font></font></font></font>
    <div class="moz-cite-prefix">On 4/20/2023 3:41 AM, Adam Sotona
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:CY4PR1001MB21500B3E373CBF10C437784B8C639@CY4PR1001MB2150.namprd10.prod.outlook.com">
      <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 style="font-size:13.5pt;font-family:"Courier New"" lang="EN-US">StackMapGenerator<o:p></o:p></span></p>
      <p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-US">The last condition unfortunately does not allow
          to agnostically process classes of unknown versions (the use
          case of jlink
        </span><span lang="EN-US">StripJavaDebugAttributesPlugin)</span><span lang="EN-US">. 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></p>
    </blockquote>
    <br>
  </body>
</html>