<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p>Ah - got it.</p>
    <p>The fundamental issue, which is not visible in the source code,
      is that in some cases a single try/catch can be split into two (or
      more) exception table entries.</p>
    <p>Since we need a different exception range for each entry in the
      table, we can, in principle, end up with a combinatorial explosion
      of entry/exit, depending on how many nested try/catch there are,
      and on the paths taken by the code inside said try/catch.</p>
    <p>Your proposed solution works because, as you now treat an
      exception range more "as data", you can declare it once and for
      all (e.g. one range per exception table entry) and then, in each
      block, make sure you enter/exit the relevant blocks. So, if you
      have 3 possible ranges, you can enter range 1 and 3 - whereas in
      the old model you would have needed to create a dedicated sequence
      of blocks where the first block entered range 1 and pointed to the
      second block which entered 3 (and then reverse when exiting).</p>
    <p>Maurizio<br>
    </p>
    <div class="moz-cite-prefix">On 09/10/2024 15:59, Adam Sotona wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:DS0PR10MB684763B86C33FADA96CD14A48C7F2@DS0PR10MB6847.namprd10.prod.outlook.com">
      
      <meta name="Generator" content="Microsoft Word 15 (filtered medium)">
      <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:Aptos;
        panose-1:2 11 0 4 2 2 2 2 2 4;}@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:12.0pt;
        font-family:"Aptos",sans-serif;}span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Aptos",sans-serif;
        color:windowtext;}.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}div.WordSection1
        {page:WordSection1;}</style>
      <div class="WordSection1">
        <p class="MsoNormal"><span style="font-size:11.0pt">I would
            rather describe actual situation on examples:<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-size:11.0pt">1. The
            simplest example seamlessly matching current model:<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">try { // enter
            the top region<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">    try { //
            enter the nested region<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">    }  // leave
            the nested region<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">    catch { //
            handler implicitly a part of the top region
            <o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">        // here
            is the nested handler code<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">    }<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">} // leave the
            top region<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">catch { //
            handler outside of any regions<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">// here is the
            top handler code<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">}<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-size:11.0pt">2. Example
            with split (the same as above, just with added gap in the
            middle)<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">try { // enter
            the top region part 1<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">    try { //
            enter the nested region part 1<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">    } catch {
            // handler implicitly a part of the top region part 1<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">            
             // we need to leave the top region part 1<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">             
            // and we cannot jump to the handler in the other top region
            part<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">             
            // so we jump to a synthetic isolated nested region
            exception handler<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">   }<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">} // split -
            leave the top region part 1<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">catch { //
            handler outside of any regions<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">    // jump to
            common top region handler<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">}<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">... gap in the
            regions (may be a single instruction excluded from the
            exception regions)<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">try { // enter
            the top region part 2<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">    try { //
            enter the nested region part 2<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">    }  // leave
            the nested region part 2<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">    catch { //
            handler implicitly a part of the top region part 2<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">            //
            we need to leave the top region part 2<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">            //
            and jump to a synthetic isolated nested region exception
            handler<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">    }<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">} // leave the
            top region part 2<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">catch { //
            handler outside of any regions<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">    // jump to
            common top region handler<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">}<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">// synthetic
            nested region handler<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">try { // enter
            the top region part 3
            <o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">    // here is
            the nested handler code
            <o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas"> } // leave the
            top region part 3<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">catch { //
            common top region handler outside of any regions<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">// here is the
            common top handler code<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">}<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-size:11.0pt">3. And now
            add third level, jumps between the region fragments and
            jumps out of the regions (for example break or continue)...
            ;)<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></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="color:black">From:
                    </span></b><span style="color:black">Maurizio
                    Cimadamore <a class="moz-txt-link-rfc2396E" href="mailto:maurizio.cimadamore@oracle.com"><maurizio.cimadamore@oracle.com></a><br>
                    <b>Date: </b>Wednesday, 9 October 2024 at 15:55<br>
                    <b>To: </b>Adam Sotona
                    <a class="moz-txt-link-rfc2396E" href="mailto:adam.sotona@oracle.com"><adam.sotona@oracle.com></a>,
                    <a class="moz-txt-link-abbreviated" href="mailto:babylon-dev@openjdk.org">babylon-dev@openjdk.org</a>
                    <a class="moz-txt-link-rfc2396E" href="mailto:babylon-dev@openjdk.org"><babylon-dev@openjdk.org></a><br>
                    <b>Subject: </b>Re: ExceptionRegion modeling issues
                    and proposed improvements<o:p></o:p></span></p>
              </div>
              <p><o:p> </o:p></p>
              <div>
                <p class="MsoNormal">On 09/10/2024 14:16, Adam Sotona
                  wrote:<o:p></o:p></p>
              </div>
              <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
                <p>If we wanted to exit the region from block 27, then
                  we'd also need to split, as we might need to exit
                  either %1 or %5 from there, no?<o:p></o:p></p>
                <p><span style="font-size:11.0pt">block 27 is the
                    exception handler of the </span>
                  outer try region(s), so no need to exit it (them)<o:p></o:p></p>
              </blockquote>
              <p>Maybe this is the bit I'm missing: don't we need to
                exit exception regions explicitly, even inside catch
                handlers?<o:p></o:p></p>
              <p>Maurizio<o:p></o:p></p>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
  </body>
</html>