<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Manuel,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">   cool beans!</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 27, 2022 at 3:54 AM Manuel Leuenberger <<a href="mailto:maenuleu@gmail.com">maenuleu@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"> <div style="word-wrap:break-word;line-break:after-white-space"><div>Hi,</div><div><br></div><div>Ever since WebAssembly became a thing, I was wondering if this could become a target for VMs. People are already compiling FFMPEG and other complex tools. So I thought I would try as well.</div><div><br></div><div>So here I am to report to whom it may concern: OSVM compiles to WebAssembly, starts up (nearly), then looping infinitely</div><div>Meaning: The VM mmaps the image file, loads plugins (SecurityPlugin made EXTERNAL), starts interpreter loop, but then loops the same bytecode sequence forever</div><div><br></div>Code lives at <a href="https://github.com/maenu/opensmalltalk-vm/tree/Cog/building/minheadless.cmake/x86/pharo.stack.spur.wasm" target="_blank">https://github.com/maenu/opensmalltalk-vm/tree/Cog/building/minheadless.cmake/x86/pharo.stack.spur.wasm</a> if you want to try it out.<div><br><div>Below is the current Readme, including a short list of issues. Maybe some of you could give me a hint?</div><div><br></div><div>Cheers,</div><div>Manuel<br><div><br></div><div><h1 dir="auto" style="box-sizing:border-box;margin:0px 0px 16px;line-height:1.25;padding-bottom:0.3em;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-variant-ligatures:normal;background-color:rgb(255,255,255)">pharo.stack.spur.wasm</h1><p dir="auto" style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;font-variant-ligatures:normal;background-color:rgb(255,255,255)">Compiles OSVM Stack interpreter to WebAssembly using the Emscripten compiler. Emscripten can be used as a drop-in replacement for gcc/clang and cmake. Based on MinHeadless Linux 32bit sources, as Emscripten provides Linux-like environment (pthreads, nanosleep, dlopen, file system). Check the latest few commits of maenu to see changed files.</p><h2 dir="auto" style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-variant-ligatures:normal;background-color:rgb(255,255,255)"><a id="gmail-m_7225846950270489042user-content-current-issues" aria-hidden="true" href="https://github.com/maenu/opensmalltalk-vm/tree/Cog/building/minheadless.cmake/x86/pharo.stack.spur.wasm#current-issues" style="box-sizing:border-box;text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u></u><u></u><u></u><u></u></a>Current issues</h2><ul dir="auto" style="box-sizing:border-box;padding-left:2em;margin-top:0px;margin-bottom:16px;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;font-variant-ligatures:normal;background-color:rgb(255,255,255)"><li style="box-sizing:border-box"><p dir="auto" style="box-sizing:border-box;margin-top:16px;margin-bottom:16px">Most adjustments are just putting EMSCRIPTEN in a macro or script. Should be fine, but should be tested to not interfere with other builds.</p></li><li style="box-sizing:border-box;margin-top:0.25em"><p dir="auto" style="box-sizing:border-box;margin-top:16px;margin-bottom:16px">Compiles and runs, but seems to be stuck in initial GC and Heartbeat. Those could be related to incorrect get/set64() implementation.</p></li><li style="box-sizing:border-box;margin-top:0.25em"><p dir="auto" style="box-sizing:border-box;margin-top:16px;margin-bottom:16px">Removed mmap address hint, as it caused errors.</p></li><li style="box-sizing:border-box;margin-top:0.25em"><p dir="auto" style="box-sizing:border-box;margin-top:16px;margin-bottom:16px">Using argv <code style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;padding:0.2em 0.4em;margin:0px;border-radius:6px">eval '1 + 3'</code> to do a simple eval does not terminate.</p></li><li style="box-sizing:border-box;margin-top:0.25em"><p dir="auto" style="box-sizing:border-box;margin-top:16px;margin-bottom:16px">Interpreter repeats these bytecodes forever (what is this?):</p></li></ul></div></div></div></div></blockquote><div><br></div><div class="gmail_default" style="font-size:small">Taking these from e.g. src/spur64.stack/interp.c they are</div><div class="gmail_default" style="font-size:small"> </div><div class="gmail_default" style="font-size:small">       CASE(112)<br>        CASE(332) /*76*/<br>            /* pushReceiverBytecode */<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><div><div><div class="gmail-notranslate" style="box-sizing:border-box;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;font-variant-ligatures:normal;background-color:rgb(255,255,255);overflow:auto"><pre class="gmail-notranslate" style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;margin-top:0px;margin-bottom:16px;padding:16px;overflow:auto;line-height:1.45;border-radius:6px"><code style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;padding:0px;margin:0px;border-radius:6px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit">332</code></pre></div></div></div></div></div></blockquote>        CASE(208)<br>        CASE(209)<br>        CASE(210)<br>        CASE(211)<br>        CASE(212)<br>        CASE(213)<br>        CASE(214)<br>        CASE(215)<br>        CASE(216)<br>        CASE(217)<br>        CASE(218)<br>        CASE(219)<br>        CASE(220)<br>        CASE(221)<br>        CASE(222)<br>        CASE(223)<br>        CASE(384) /*128*/<span class="gmail_default" style="font-size:small"> i.e. send literal selector 0 with 0 args</span><br>        CASE(385) /*129*/<br>        CASE(386) /*130*/<br>        CASE(387) /*131*/<br>        CASE(388) /*132*/<br>        CASE(389) /*133*/<br>        CASE(390) /*134*/<br>        CASE(391) /*135*/<br>        CASE(392) /*136*/<br>        CASE(393) /*137*/<br>        CASE(394) /*138*/<br>        CASE(395) /*139*/<br>        CASE(396) /*140*/<br>        CASE(397) /*141*/<br>        CASE(398) /*142*/<br>        CASE(399) /*143*/<br>            /* sendLiteralSelector0ArgsBytecode */<br><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><div><div><div class="gmail-notranslate" style="box-sizing:border-box;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;font-variant-ligatures:normal;background-color:rgb(255,255,255);overflow:auto"><pre class="gmail-notranslate" style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;margin-top:0px;margin-bottom:16px;padding:16px;overflow:auto;line-height:1.45;border-radius:6px"><code style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;padding:0px;margin:0px;border-radius:6px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit">384</code></pre></div></div></div></div></div></blockquote><div> </div><div><div class="gmail_default" style="font-size:small">hence send literal selector 1 with 0 args</div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><div><div><div class="gmail-notranslate" style="box-sizing:border-box;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;font-variant-ligatures:normal;background-color:rgb(255,255,255);overflow:auto"><pre class="gmail-notranslate" style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;margin-top:0px;margin-bottom:16px;padding:16px;overflow:auto;line-height:1.45;border-radius:6px"><code style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;padding:0px;margin:0px;border-radius:6px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit">385</code></pre></div></div></div></div></div></blockquote><div><br></div><div>       <span class="gmail-Apple-converted-space"> </span>CASE(124)</div>        CASE(348) /*92*/<br>            /* returnTopFromMethod */<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><div><div><div class="gmail-notranslate" style="box-sizing:border-box;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;font-variant-ligatures:normal;background-color:rgb(255,255,255);overflow:auto"><pre class="gmail-notranslate" style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;margin-top:0px;margin-bottom:16px;padding:16px;overflow:auto;line-height:1.45;border-radius:6px"><code style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;padding:0px;margin:0px;border-radius:6px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit">348</code></pre></div></div></div></div></div></blockquote><div> </div><div>        CASE(501) /*245*/<br>            /* longStoreTemporaryVariableBytecode */<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><div><div><div class="gmail-notranslate" style="box-sizing:border-box;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;font-variant-ligatures:normal;background-color:rgb(255,255,255);overflow:auto"><pre class="gmail-notranslate" style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;margin-top:0px;margin-bottom:16px;padding:16px;overflow:auto;line-height:1.45;border-radius:6px"><code style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;padding:0px;margin:0px;border-radius:6px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit">501</code></pre></div></div></div></div></div></blockquote><div>       <span class="gmail-Apple-converted-space"> </span>CASE(136)</div>        CASE(339) /*83*/<br>            /* duplicateTopBytecode */<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><div><div><div class="gmail-notranslate" style="box-sizing:border-box;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;font-variant-ligatures:normal;background-color:rgb(255,255,255);overflow:auto"><pre class="gmail-notranslate" style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;margin-top:0px;margin-bottom:16px;padding:16px;overflow:auto;line-height:1.45;border-radius:6px"><code style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;padding:0px;margin:0px;border-radius:6px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit">339</code></pre></div></div></div></div></div></blockquote><div>        CASE(16)</div>        CASE(320) /*64*/<br>            /* pushTemporaryVariableBytecode */<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><div><div><div class="gmail-notranslate" style="box-sizing:border-box;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;font-variant-ligatures:normal;background-color:rgb(255,255,255);overflow:auto"><pre class="gmail-notranslate" style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;margin-top:0px;margin-bottom:16px;padding:16px;overflow:auto;line-height:1.45;border-radius:6px"><code style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;padding:0px;margin:0px;border-radius:6px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit">320</code></pre></div></div></div></div></div></blockquote><div> </div><div>        CASE(224)<br>        CASE(225)<br>        CASE(226)<br>        CASE(227)<br>        CASE(228)<br>        CASE(229)<br>        CASE(230)<br>        CASE(231)<br>        CASE(232)<br>        CASE(233)<br>        CASE(234)<br>        CASE(235)<br>        CASE(236)<br>        CASE(237)<br>        CASE(238)<br>        CASE(239)<br>        CASE(400) /*144*/<br>        CASE(401) /*145*/<span class="gmail_default" style="font-size:small"> i.e. send literal selector 1 with 1 arg</span><br>        CASE(402) /*146*/<br>        CASE(403) /*147*/<br>        CASE(404) /*148*/<br>        CASE(405) /*149*/<br>        CASE(406) /*150*/<br>        CASE(407) /*151*/<br>        CASE(408) /*152*/<br>        CASE(409) /*153*/<br>        CASE(410) /*154*/<br>        CASE(411) /*155*/<br>        CASE(412) /*156*/<br>        CASE(413) /*157*/<br>        CASE(414) /*158*/<br>        CASE(415) /*159*/<br>            /* sendLiteralSelector1ArgBytecode */<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><div><div><div class="gmail-notranslate" style="box-sizing:border-box;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;font-variant-ligatures:normal;background-color:rgb(255,255,255);overflow:auto"><pre class="gmail-notranslate" style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;margin-top:0px;margin-bottom:16px;padding:16px;overflow:auto;line-height:1.45;border-radius:6px"><code style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;padding:0px;margin:0px;border-radius:6px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit">401</code></pre></div></div></div></div></div></blockquote><div>       <span class="gmail-Apple-converted-space"> </span>CASE(64)</div>        CASE(272) /*16*/<br>            /* pushLiteralVariableBytecode */<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><div><div><div class="gmail-notranslate" style="box-sizing:border-box;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;font-variant-ligatures:normal;background-color:rgb(255,255,255);overflow:auto"><pre class="gmail-notranslate" style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;margin-top:0px;margin-bottom:16px;padding:16px;overflow:auto;line-height:1.45;border-radius:6px"><code style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;padding:0px;margin:0px;border-radius:6px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit">272</code></pre></div></div></div></div></div></blockquote><div>         CASE(204)</div>        CASE(380) /*124*/<br>            /* bytecodePrimNew */<span class="gmail_default" style="font-size:small"> i.e. a send of #new from the special selector bytecode</span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><div><div><div class="gmail-notranslate" style="box-sizing:border-box;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;font-variant-ligatures:normal;background-color:rgb(255,255,255);overflow:auto"><pre class="gmail-notranslate" style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;margin-top:0px;margin-bottom:16px;padding:16px;overflow:auto;line-height:1.45;border-radius:6px"><code style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;padding:0px;margin:0px;border-radius:6px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit">380</code></pre></div></div></div></div></div></blockquote><div><br></div><div class="gmail_default" style="font-size:small">If I had to guess what's going wrong I'd guess that the return bytecode 348 isn't correctly implemented.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><div><div><div class="gmail-notranslate" style="box-sizing:border-box;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;font-variant-ligatures:normal;background-color:rgb(255,255,255);overflow:auto"><pre class="gmail-notranslate" style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;margin-top:0px;margin-bottom:16px;padding:16px;overflow:auto;line-height:1.45;border-radius:6px"><code style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;padding:0px;margin:0px;border-radius:6px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit">
</code></pre></div><h2 dir="auto" style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-variant-ligatures:normal;background-color:rgb(255,255,255)"><a id="gmail-m_7225846950270489042user-content-build--run" aria-hidden="true" href="https://github.com/maenu/opensmalltalk-vm/tree/Cog/building/minheadless.cmake/x86/pharo.stack.spur.wasm#build--run" style="box-sizing:border-box;text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u></u><u></u><u></u><u></u></a>Build & Run</h2><h3 dir="auto" style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;font-size:1.25em;line-height:1.25;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-variant-ligatures:normal;background-color:rgb(255,255,255)"><a id="gmail-m_7225846950270489042user-content-1-install-emscripten" aria-hidden="true" href="https://github.com/maenu/opensmalltalk-vm/tree/Cog/building/minheadless.cmake/x86/pharo.stack.spur.wasm#1-install-emscripten" style="box-sizing:border-box;text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u></u><u></u><u></u><u></u></a>1. Install Emscripten</h3><p dir="auto" style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;font-variant-ligatures:normal;background-color:rgb(255,255,255)">I installed <a href="https://emscripten.org/docs/getting_started/downloads.html" rel="nofollow" style="box-sizing:border-box;text-decoration:none" target="_blank">Emscripten SDK</a> to get an all-in-one package.</p><h3 dir="auto" style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;font-size:1.25em;line-height:1.25;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-variant-ligatures:normal;background-color:rgb(255,255,255)"><a id="gmail-m_7225846950270489042user-content-2-grab-an-image" aria-hidden="true" href="https://github.com/maenu/opensmalltalk-vm/tree/Cog/building/minheadless.cmake/x86/pharo.stack.spur.wasm#2-grab-an-image" style="box-sizing:border-box;text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u></u><u></u><u></u><u></u></a>2. Grab an image</h3><p dir="auto" style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;font-variant-ligatures:normal;background-color:rgb(255,255,255)">Grab a 32bit Smalltalk image and but it in the <code style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;padding:0.2em 0.4em;margin:0px;border-radius:6px">image</code> folder. I used Pharo 9.</p><div class="gmail-notranslate" style="box-sizing:border-box;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;font-variant-ligatures:normal;background-color:rgb(255,255,255);overflow:auto"><pre class="gmail-notranslate" style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;margin-top:0px;margin-bottom:16px;padding:16px;overflow:auto;line-height:1.45;border-radius:6px"><code style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;padding:0px;margin:0px;border-radius:6px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit">cd building/minheadless.cmake/x86/pharo.stack.spur.wasm
mkdir image
cd image
curl <a href="https://get.pharo.org/32/90" target="_blank">https://get.pharo.org/32/90</a> | bash
</code></pre></div><h3 dir="auto" style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;font-size:1.25em;line-height:1.25;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-variant-ligatures:normal;background-color:rgb(255,255,255)"><a id="gmail-m_7225846950270489042user-content-3-build-vm" aria-hidden="true" href="https://github.com/maenu/opensmalltalk-vm/tree/Cog/building/minheadless.cmake/x86/pharo.stack.spur.wasm#3-build-vm" style="box-sizing:border-box;text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u></u><u></u><u></u><u></u></a>3. Build VM</h3><p dir="auto" style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;font-variant-ligatures:normal;background-color:rgb(255,255,255)"><code style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;padding:0.2em 0.4em;margin:0px;border-radius:6px">./mvm_configure_variant debug Debug && make -C debug install</code></p><h3 dir="auto" style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;font-size:1.25em;line-height:1.25;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-variant-ligatures:normal;background-color:rgb(255,255,255)"><a id="gmail-m_7225846950270489042user-content-4-run-a-web-server" aria-hidden="true" href="https://github.com/maenu/opensmalltalk-vm/tree/Cog/building/minheadless.cmake/x86/pharo.stack.spur.wasm#4-run-a-web-server" style="box-sizing:border-box;text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u></u><u></u><u></u><u></u></a>4. Run a web server</h3><p dir="auto" style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;font-variant-ligatures:normal;background-color:rgb(255,255,255)"><code style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:13.6px;padding:0.2em 0.4em;margin:0px;border-radius:6px">emrun --port 9090 --serve_root ../../../../ --no_browser .</code></p><h3 dir="auto" style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;font-size:1.25em;line-height:1.25;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-variant-ligatures:normal;background-color:rgb(255,255,255)"><a id="gmail-m_7225846950270489042user-content-5-launch-vm" aria-hidden="true" href="https://github.com/maenu/opensmalltalk-vm/tree/Cog/building/minheadless.cmake/x86/pharo.stack.spur.wasm#5-launch-vm" style="box-sizing:border-box;text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u></u><u></u><u></u><u></u></a>5. Launch VM</h3><p dir="auto" style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;font-variant-ligatures:normal;background-color:rgb(255,255,255)"><a href="http://localhost:9090/building/minheadless.cmake/x86/pharo.stack.spur.wasm/debug/dist/squeak.html" rel="nofollow" style="box-sizing:border-box;text-decoration:none" target="_blank">http://localhost:9090/building/minheadless.cmake/x86/pharo.stack.spur.wasm/debug/dist/squeak.html</a></p><h3 dir="auto" style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;font-size:1.25em;line-height:1.25;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-variant-ligatures:normal;background-color:rgb(255,255,255)"><a id="gmail-m_7225846950270489042user-content-6-inspect-running-vm" aria-hidden="true" href="https://github.com/maenu/opensmalltalk-vm/tree/Cog/building/minheadless.cmake/x86/pharo.stack.spur.wasm#6-inspect-running-vm" style="box-sizing:border-box;text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u></u><u></u><u></u><u></u></a>6. Inspect running VM</h3><p dir="auto" style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;font-variant-ligatures:normal;background-color:rgb(255,255,255)">The VM is compiled with DWARF debug information, which is understood by the Chrome debugger. So we can step through the C sources of the WebAssembly, pretty nifty.</p><h2 dir="auto" style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-variant-ligatures:normal;background-color:rgb(255,255,255)"><a id="gmail-m_7225846950270489042user-content-resources" aria-hidden="true" href="https://github.com/maenu/opensmalltalk-vm/tree/Cog/building/minheadless.cmake/x86/pharo.stack.spur.wasm#resources" style="box-sizing:border-box;text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u></u><u></u><u></u><u></u></a>Resources</h2><ul dir="auto" style="box-sizing:border-box;padding-left:2em;margin-top:0px;color:rgb(36,41,47);font-family:-apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;font-variant-ligatures:normal;background-color:rgb(255,255,255);margin-bottom:0px"><li style="box-sizing:border-box"><a href="https://webassembly.org/getting-started/developers-guide/" rel="nofollow" style="box-sizing:border-box;text-decoration:none" target="_blank">Inspect WebAssembly (at the bottom)</a></li><li style="box-sizing:border-box;margin-top:0.25em"><a href="https://emscripten.org/docs/porting/index.html" rel="nofollow" style="box-sizing:border-box;text-decoration:none" target="_blank">Emscripten doc (Porting)</a></li><li style="box-sizing:border-box;margin-top:0.25em"><a href="https://emsettings.surma.technology/" rel="nofollow" style="box-sizing:border-box;text-decoration:none" target="_blank">Emscripten settings</a></li></ul><div><br></div></div></div></div></div></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div>