<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<br id="lineBreakAtBeginningOfMessage">
<div><br>
<blockquote type="cite">
<div>On Oct 10, 2024, at 11:36 PM, Adam Sotona <adam.sotona@oracle.com> wrote:</div>
<br class="Apple-interchange-newline">
<div>
<div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div>
<div id="mail-editor-reference-message-container">
<div>
<div>
<div style="border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(181, 196, 223) currentcolor currentcolor; border-image: none; padding: 3pt 0in 0in;">
<p class="MsoNormal" style="margin: 0in 0in 12pt; font-size: 12pt; font-family: Aptos, sans-serif;">
<b><span style="">From:<span class="Apple-converted-space"> </span></span></b><span style="">Paul Sandoz <<a href="mailto:paul.sandoz@oracle.com">paul.sandoz@oracle.com</a>><br>
<br>
</span><o:p></o:p></p>
</div>
<div>
<div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;">> All I was suggesting is to replace the operand whose operation refers to the catch block as a successor with that successor. (Of course it's not really a successor in the conventional
sense for either region enter or exit). Just less moving parts.<span class="Apple-converted-space"> </span><o:p></o:p></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;">Yes, let's start with this and see the effect on exits from the nested regions. It will definitely reduce the complexity.<o:p></o:p></span></div>
</div>
<div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><o:p> </o:p></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
Ok. I suspect with that approach we can support what we have today and the relaxed form you are proposing e.g. an region exit can either refer to an associated region enter by value or explicitly to the handlers by successor.</div>
<div><br>
</div>
<div><br>
<blockquote type="cite">
<div>
<div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<div id="mail-editor-reference-message-container">
<div>
<div>
<div>
<div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;">> The exit and re-enter to handle variable modifications is interesting. Although, those variable modifications should covered by the exception region and if we modify the program otherwise
are we not changing its behavior?<o:p></o:p></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;">The trick is that exception region is interrupted (with zero gap) right after the VarStore. Everything is still covered, just one more flow graph path
(passing through the modified var) leads to the handler. Ultimatelly the try blocks should be modeled as each individual op is in its own block with alternative successor leading to the exception handler (that is how verification tests the stack maps). Practically
only instructions modifying variables are important and even more practically only instructions modifying variables consumed in the exception handler matter.<o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;"></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>Very sneaky :-)</div>
<div><br>
</div>
<div>How would this work with control flow? I think you would need distinct handlers corresponding to each store.</div>
<div><br>
</div>
<div>FWIW C2 does not bother with anything fancy, it just treats it as a box that cannot be SSA’ed. This may indicate it may not be worth the complexity.</div>
<div><br>
</div>
Paul.</div>
<div><br>
<blockquote type="cite">
<div>
<div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<div id="mail-editor-reference-message-container">
<div>
<div>
<div>
<div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;">Ultimate flow graph of a try/catch:<o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;"></span><span style="font-size: 11pt; font-family: Consolas;">-(try start)- INS -- INS -- STORE 1 -- INS -- STORE 2 -- INS -(try end)- ...<o:p></o:p></span></div>
</div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-family: Consolas;"> \ \ \ \ \ \ \ <o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-family: Consolas;"> ------------------------------------------(handler)- LOAD 1 -- ...<br>
<br>
</span><span style="font-size: 11pt;"><o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;">Flow graph reflecting all variable modifications:<o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;"></span><span style="font-size: 11pt; font-family: Consolas;">-(try start)- INS -- INS -- STORE 1 -- INS -- STORE 2 -- INS -(try end)- ...<o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-family: Consolas;"> \ \ \ <o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-family: Consolas;"> ------------------------------------------(handler)- LOAD 1 -- ...<br>
<br>
<o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;">Flow graph reflecting modifications of variables consumed in the handler:<o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;"></span><span style="font-size: 11pt; font-family: Consolas;">-(try start)- INS -- INS -- STORE 1 -- INS -- STORE 2 -- INS -(try end)- ...<o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-family: Consolas;"> \ \ <o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-family: Consolas;"> ------------------------------------------(handler)- LOAD 1 -- ...<br>
<br>
</span><span style="font-size: 11pt;"><o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;">Flow graph we have now:<o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;"></span><span style="font-size: 11pt; font-family: Consolas;">-(try start)- INS -- INS -- STORE 1 -- INS -- STORE 2 -- INS -(try end)- ...<o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-family: Consolas;"> \ <o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-family: Consolas;"> ------------------------------------------(handler)- LOAD 1 -- ...<br>
<br>
<o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;">And this is the trick that might help:<o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;"></span><span style="font-size: 11pt; font-family: Consolas;">-(try start)- INS -- INS -- STORE 1 -(try end/re-start)- INS -- STORE 2 -- INS -(try end)-
...<o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-family: Consolas;"> \ \ <o:p></o:p></span></div>
<div style="margin: 0in; font-size: 12pt; font-family: Aptos, sans-serif;"><span style="font-family: Consolas;"> ------------------------------------------(handler)- LOAD 1 -- ...</span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</body>
</html>