<div dir="ltr">Thanks Jan!<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, May 13, 2024 at 9:39 AM Jan Lahoda <<a href="mailto:jan.lahoda@oracle.com">jan.lahoda@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>

  
  <div>
    <p>Hi Archie,</p>
    <p><br>
    </p>
    <p>I think this is just a bug. My fix proposal:<br>
      <a href="https://github.com/openjdk/jdk/pull/19217" target="_blank">https://github.com/openjdk/jdk/pull/19217</a></p>
    <p><br>
    </p>
    <p>Thanks,<br>
    </p>
    <p>     Jan</p>
    <p><br>
    </p>
    <div>On 11. 05. 24 22:15, Archie Cobbs
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div>Looking at this a little further, I think I remember we
          already dealt with this, and the JVM restriction referred to
          below is no longer a problem.</div>
        <div><br>
        </div>
        <div>In JDK 22, the JVMS was changed to say:<br>
        </div>
        <div><br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The
          rule for <span><i>invokespecial</i></span> of an <code><init></code>
          method is the sole motivation for passing back a distinct
          exception stack frame. The concern is that when initializing
          an object, the <span><i>invokespecial</i></span> invocation
          could fail, leaving the object in a partially initialized,
          permanently unusable state. To prevent repeated initialization
          attempts after an object fails to initialize the first time, <span style="background-color:rgb(255,242,204)">an exception
            handler must consider any references to the object stored in
            local variables to have type <code>top</code></span> rather
          than <code>uninitializedThis</code> or <code>uninitialized(Offset)</code>.
        </blockquote>
        <br>
        <div>So then maybe this is just a regular bug, i.e., we need to
          make an adjustment to how stack maps are generated for code in
          early initialization contexts. Any confirmation on that
          appreciated & sorry for the false alarm.<br>
        </div>
        <div><br>
        </div>
        <div>-Archie<br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Sat, May 11, 2024 at
          11:01 AM Archie Cobbs <<a href="mailto:archie.cobbs@gmail.com" target="_blank">archie.cobbs@gmail.com</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div dir="ltr">
            <div>There is an issue with flexible constructors and
              certain synthetically-generated try/catch code, for
              example, when using switch patterns (where a try/catch for
              MatchException is sprinkled in).<br>
            </div>
            <div><br>
            </div>
            <div>Please see <a href="https://bugs.openjdk.org/browse/JDK-8332106" target="_blank">https://bugs.openjdk.org/browse/JDK-8332106</a>
              for an example.<br>
            </div>
            <div><br>
            </div>
            <div>As I understand it, this is due to the same verifier
              'uninitializedThis' restriction that prevents bytecode
              rewriters from building a synthetic try/catch around
              super() calls, even if the catch clause always rethrows.</div>
            <div><br>
            </div>
            <div>I may have this muddled, but I believe this restriction
              disallows an 'uninitializedThis' in a catch clause stack
              map even if the 'uninitializedThis' is never actually
              touched. In which case a seemingly obvious fix for this is
              to relax the restriction, but that's a JVMS change.</div>
            <div><br>
            </div>
            <div>Are there other options?<br>
            </div>
            <div><br>
            </div>
            <div>Thanks,</div>
            <div>-Archie<br>
            </div>
            <div><br>
              <span class="gmail_signature_prefix">-- </span><br>
              <div dir="ltr" class="gmail_signature">Archie L. Cobbs<br>
              </div>
            </div>
          </div>
        </blockquote>
      </div>
      <br clear="all">
      <br>
      <span class="gmail_signature_prefix">-- </span><br>
      <div dir="ltr" class="gmail_signature">Archie L. Cobbs<br>
      </div>
    </blockquote>
  </div>

</blockquote></div><br clear="all"><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Archie L. Cobbs<br></div>