<!-- BaNnErBlUrFlE-BoDy-start -->
<!-- Preheader Text : BEGIN -->
<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;max-height:0px;opacity:0;overflow:hidden;">
Hi, I'm Guillermo Adrián Molina, author of Protos, a prototype-based language implemented on Truffle 25. 3. 4. 1. I originally intended to ask about how to represent dynamic guest control flow around Bytecode DSL continuations, but the implementation</div>
<!-- Preheader Text : END -->
<!-- Email Banner : BEGIN -->
<div style="display:none !important;display:none;visibility:hidden;mso-hide:all;font-size:1px;color:#ffffff;line-height:1px;max-height:0px;opacity:0;overflow:hidden;"></div>
<!-- Email Banner : END -->
<!-- BaNnErBlUrFlE-BoDy-end -->
<html><head><!-- BaNnErBlUrFlE-HeAdEr-start -->
<style>
#pfptBannernvw7eth { all: revert !important; display: block !important;
visibility: visible !important; opacity: 1 !important;
background-color: #c2d4d4 !important;
max-width: none !important; max-height: none !important }
.pfptPrimaryButtonnvw7eth:hover, .pfptPrimaryButtonnvw7eth:focus {
background-color: #a2b1b1 !important; }
.pfptPrimaryButtonnvw7eth:active {
background-color: #828e8e !important; }
html:root, html:root>body { all: revert !important; display: block !important;
visibility: visible !important; opacity: 1 !important; }
</style>
<!-- BaNnErBlUrFlE-HeAdEr-end -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p class="PDq2pG_selectionAnchorContainer" data-start="1381" data-end="1384">Hi,<span class="PDq2pG_selectionAnchor" aria-hidden="true"></span></p>
<p data-start="1389" data-end="1488">I'm Guillermo Adrián Molina, author of Protos, a prototype-based language implemented on Truffle 25.3.4.1.</p>
<p data-start="1493" data-end="1784">I originally intended to ask about how to represent dynamic guest control flow around Bytecode DSL continuations, but the implementation has progressed quite a bit since then, so I thought a more useful question would be about the final production cutover and any pitfalls we may be missing.</p>
<p data-start="1789" data-end="1882">Protos is migrating from an AST-based cooperative replay mechanism to a Bytecode DSL backend.</p>
<p data-start="1887" data-end="1918">The Bytecode path now supports:</p>
<ul data-start="1923" data-end="2375">
<li data-start="1923" data-end="1984">source-backed closure calls composed across Bytecode roots;</li>
<li data-start="1987" data-end="2099">Task/Future suspension and resumption through <code data-start="2035" data-end="2055">ContinuationResult</code>, without replaying completed guest effects;</li>
<li data-start="2102" data-end="2203">non-local return, guest Error propagation/handlers, suspendible <code data-start="2168" data-end="2176">ensure</code>, cancellation and <code data-start="2195" data-end="2202">while</code>;</li>
<li data-start="2206" data-end="2262">debugger scopes through <code data-start="2232" data-end="2245">TagTreeNode</code> / <code data-start="2248" data-end="2261">NodeLibrary</code>;</li>
<li data-start="2265" data-end="2373">StatementTag/CallTag source identity and logical <code data-start="2316" data-end="2334">BytecodeLocation</code> preservation across suspension/resume.</li>
</ul>
<p data-start="2378" data-end="2421">The control-flow model we ended up with is:</p>
<ul data-start="2426" data-end="3140">
<li data-start="2426" data-end="2471">normal guest values remain ordinary values;</li>
<li data-start="2474" data-end="2569">suspension is distinct from unwind and is represented by the Bytecode continuation mechanism;</li>
<li data-start="2572" data-end="2617">guest Error remains a guest-exception lane;</li>
<li data-start="2620" data-end="2697">non-local return and cancellation are rare internal control-flow transfers;</li>
<li data-start="2700" data-end="2891">a narrow <code data-start="2711" data-end="2742">interceptControlFlowException</code> bridge allows those internal transfers to cross Bytecode EH regions so that structured cleanup can run, while retaining the exact original transfer;</li>
<li data-start="2894" data-end="3016">pending transfers live in resumable Bytecode/frame state while cleanup executes, including when cleanup itself suspends;</li>
<li data-start="3019" data-end="3138">there is no replay tape, global continuation registry, semantic <code data-start="3085" data-end="3098">ThreadLocal</code>, or parked thread on the Bytecode path.</li>
</ul>
<p data-start="3143" data-end="3434">At this point the remaining work is mostly production cutover: complete a couple of hosting/native boundaries, switch normal <code data-start="3268" data-end="3293">TruffleLanguage.parse()</code> execution to the Bytecode backend, retire the old replay path, and then enable/measure the optimizing Truffle runtime in ordinary execution.</p>
<p data-start="3439" data-end="3489">I would be interested in feedback on three points:</p>
<ol data-start="3494" data-end="4309">
<li data-start="3494" data-end="3799">Does the separation above — Bytecode continuations for suspension, structured Bytecode EH/finally for unwind, and a narrow <code data-start="3620" data-end="3642">ControlFlowException</code> bridge for internal transfers — match the intended direction of the Bytecode DSL, or is there another pattern you would recommend for a production language?</li>
<li data-start="3804" data-end="4068">Are there known caveats when making a continuation-enabled Bytecode DSL root the normal production backend, particularly for runtime compilation / partial evaluation? For example, does enabling <code data-start="4001" data-end="4008">yield</code> have meaningful cost for roots that never actually suspend?</li>
<li data-start="4073" data-end="4307">Are there specific diagnostics or invariants you recommend checking during the final AST-to-Bytecode cutover to make sure resumed paths, structured control flow, source metadata and runtime compilation remain optimization-friendly?</li>
</ol>
<p data-start="4312" data-end="4408">The project is <code data-start="4327" data-end="4351">guillermomolina/protos</code> on GitHub if concrete implementation details are useful.</p>
<p data-start="4413" data-end="4420">Thanks,</p>
<p data-start="4425" data-end="4452">Guillermo Adrián Molina<br data-start="4441" data-end="4444" />Protos</p>
</body></html>