<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Eliot,<div class=""><br class=""></div><div class="">Thanks for the explanation. I started looking into the return bytecode 348, but I could not find something suspicious. So I started logging more and then I saw a dim light:</div><div class=""><br class=""></div><div class=""><div class=""></div><blockquote type="cite" class=""><div class="">Error in loading dynamic library /SecurityPlugin: Error: need to see wasm magic number</div><div class="">Error in loading dynamic library /SecurityPlugin.so: Error: need to see wasm magic number</div><div class="">Error in loading dynamic library /libSecurityPlugin.so: Error: need to see wasm magic number</div><div class="">Error in loading dynamic library SecurityPlugin: Error: need to see wasm magic number</div><div class="">Error in loading dynamic library SecurityPlugin.so: Error: need to see wasm magic number</div></blockquote><br class="">It finds libSecurityPlugin.so. But it only works as an external plugin, won't find it as an internal plugin. Weird, but it continues.</div><div class=""><br class=""><blockquote type="cite" class=""><div class="">sqImageFileClose ftruncate: Invalid argument</div></blockquote><div class=""><br class=""></div><div class="">Opening the image file seems to work, and this is only a warning. Probably some Emscripten-specific ftruncate is needed.</div><br class=""><blockquote type="cite" class=""><div class="">stateMachinePolicy != UNDEFINED 364</div></blockquote><div class=""><br class=""></div><div class="">Assertion failed in heartbeat clock. I assume this is fine, as it happens only in the beginning</div><br class=""><blockquote type="cite" class=""><div class="">Smalltalk stack dump:</div><div class="">  0xaa2fec WorkingSession class(Behavior)>new 0x172b9f0: a(n) WorkingSession</div><div class="">  0xaa300c SessionManager>newSession 0x177d300: a(n) SessionManager</div><div class="">  0xaa302c SessionManager>installNewSession 0x177d300: a(n) SessionManager</div><div class="">  0xaa3050 SessionManager>launchSnapshot:andQuit: 0x177d300: a(n) SessionManager</div><div class=""> 0x43276f8 s [] in SessionManager>snapshot:andQuit:</div><div class=""> 0x43278a0 s [] in FullBlockClosure(BlockClosure)>newProcess</div></blockquote><div class=""><br class=""></div><div class="">This looks good!</div><br class=""><blockquote type="cite" class=""><div class="">currentBytecode = 464</div><div class="">currentBytecode = 320</div><div class="">currentBytecode = 332</div><div class="">currentBytecode = 401</div><div class="">currentBytecode = 272</div><div class="">currentBytecode = 380</div><div class="">currentBytecode = 332</div><div class="">currentBytecode = 384</div><div class="">(localPrimIndex > 0xFF) && (localPrimIndex < 520) 5814</div><div class="">localPrimIndex = 253</div></blockquote><div class=""><br class=""></div><div class="">Assertion failed in interpreter. Oddly close to 0xFF...</div><br class=""><blockquote type="cite" class=""><div class="">currentBytecode = 385</div><div class="">localPrimIndex = 256</div><div class="">currentBytecode = 348</div><div class="">Smalltalk stack dump:</div><div class="">  0xaa2fc4 MessageNotUnderstood class(Behavior)>new 0x1728360: a(n) MessageNotUnderstood</div><div class="">  0xaa2fe8 SmallInteger(Object)>doesNotUnderstand: manager: 0xfffffff1=-8</div></blockquote><div class=""><br class=""></div><div class="">Bottom of stack missing, assume it is SessionManager>>#newSession</div><div class=""><br class=""></div><div class=""><div class="">newSession</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>| aWorkingSession |</div><div class=""><span class="Apple-tab-span" style="white-space:pre">       </span>aWorkingSession := WorkingSession new.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">    </span>aWorkingSession manager: self.</div><div class=""><span class="Apple-tab-span" style="white-space:pre">    </span>^ aWorkingSession</div></div><div class=""><br class=""></div><div class="">#new seemed to have worked, but not #manager:.</div><div class="">Not sure how to interpret the 0xfffffff1=-8, and is SmallInteger always the receiver type in the interpreter stack?</div><br class=""><blockquote type="cite" class=""><div class="">currentBytecode = 332</div><div class="">currentBytecode = 384</div><div class="">(localPrimIndex > 0xFF) && (localPrimIndex < 520) 5814</div><div class="">localPrimIndex = 253</div></blockquote><div class=""><br class=""></div><div class="">253 again. But where is it coming from?<br class=""></div><br class=""><blockquote type="cite" class=""><div class="">currentBytecode = 385</div><div class="">localPrimIndex = 256</div><div class="">currentBytecode = 348</div><div class="">Smalltalk stack dump:</div><div class="">  0xaa2f98 MessageNotUnderstood class(Behavior)>new 0x1728360: a(n) MessageNotUnderstood</div><div class="">  0xaa2fbc SmallInteger(Object)>doesNotUnderstand: message: 0xfffffff1=-8</div><div class="">  0xaa2fe8 SmallInteger(Object)>doesNotUnderstand: manager: 0xfffffff1=-8</div><div class="">  0xaa300c SessionManager>newSession 0x177d300: a(n) SessionManager</div><div class="">  0xaa302c SessionManager>installNewSession 0x177d300: a(n) SessionManager</div><div class="">  0xaa3050 SessionManager>launchSnapshot:andQuit: 0x177d300: a(n) SessionManager</div><div class=""> 0x43276f8 s [] in SessionManager>snapshot:andQuit:</div><div class=""> 0x43278a0 s [] in FullBlockClosure(BlockClosure)>newProcess</div></blockquote><br class="">Once it reaches #doesNotUnderstand:, we are in an infinite loop.</div><div class=""><br class=""><blockquote type="cite" class=""><div class="">currentBytecode = 501</div><div class="">currentBytecode = 339</div><div class="">currentBytecode = 320</div><div class="">currentBytecode = 401</div><div class="">currentBytecode = 272</div><div class="">currentBytecode = 380</div><div class="">currentBytecode = 332</div><div class="">currentBytecode = 384</div><div class="">(localPrimIndex > 0xFF) && (localPrimIndex < 520) 5814</div><div class="">localPrimIndex = 253</div><div class="">currentBytecode = 385</div><div class="">localPrimIndex = 256</div><div class="">currentBytecode = 348</div><div class="">Smalltalk stack dump:</div><div class="">  0xaa2f6c MessageNotUnderstood class(Behavior)>new 0x1728360: a(n) MessageNotUnderstood</div><div class="">  0xaa2f90 SmallInteger(Object)>doesNotUnderstand: message: 0xfffffff1=-8</div><div class="">  0xaa2fbc SmallInteger(Object)>doesNotUnderstand: message: 0xfffffff1=-8</div><div class="">  0xaa2fe8 SmallInteger(Object)>doesNotUnderstand: manager: 0xfffffff1=-8</div><div class="">  0xaa300c SessionManager>newSession 0x177d300: a(n) SessionManager</div><div class="">  0xaa302c SessionManager>installNewSession 0x177d300: a(n) SessionManager</div><div class="">  0xaa3050 SessionManager>launchSnapshot:andQuit: 0x177d300: a(n) SessionManager</div><div class=""> 0x43276f8 s [] in SessionManager>snapshot:andQuit:</div><div class=""> 0x43278a0 s [] in FullBlockClosure(BlockClosure)>newProcess</div></blockquote><div class=""><br class=""></div><div class="">My suspicion is a 32bit/64bit type issue. I also saw a few segfaults in the past, but not recently, and not reproducible.</div><div class="">Anybody has a clue on what I should look at next?</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Manuel</div><div><br class=""><blockquote type="cite" class=""><div class="">On 27 Jun 2022, at 23:31, Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com" class="">eliot.miranda@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta charset="UTF-8" class=""><div dir="ltr" style="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;" class=""><div dir="ltr" class=""><div class="gmail_default" style="font-size: small;">Hi Manuel,</div><div class="gmail_default" style="font-size: small;"><br class=""></div><div class="gmail_default" style="font-size: small;">   cool beans!</div></div><br class=""><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" class="">maenuleu@gmail.com</a>> wrote:<br class=""></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;" class=""><div class="">Hi,</div><div class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">So here I am to report to whom it may concern: OSVM compiles to WebAssembly, starts up (nearly), then looping infinitely</div><div class="">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 class=""><br class=""></div>Code lives at <a href="https://github.com/maenu/opensmalltalk-vm/tree/Cog/building/minheadless.cmake/x86/pharo.stack.spur.wasm" target="_blank" class="">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 class=""><br class=""><div class="">Below is the current Readme, including a short list of issues. Maybe some of you could give me a hint?</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Manuel<br class=""><div class=""><br class=""></div><div class=""><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);" class="">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);" class="">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);" class=""><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" target="_blank" style="box-sizing: border-box; text-decoration: none; float: left; padding-right: 4px; line-height: 1;" class=""><u class=""></u><u class=""></u><u class=""></u><u class=""></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);" class=""><li style="box-sizing: border-box;" class=""><p dir="auto" style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">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;" class=""><p dir="auto" style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">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;" class=""><p dir="auto" style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">Removed mmap address hint, as it caused errors.</p></li><li style="box-sizing: border-box; margin-top: 0.25em;" class=""><p dir="auto" style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">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;" class="">eval '1 + 3'</code> to do a simple eval does not terminate.</p></li><li style="box-sizing: border-box; margin-top: 0.25em;" class=""><p dir="auto" style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;" class="">Interpreter repeats these bytecodes forever (what is this?):</p></li></ul></div></div></div></div></blockquote><div class=""><br class=""></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 class="">        CASE(332) /*76*/<br class="">            /* pushReceiverBytecode */<br class=""></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;" class=""><div class=""><div class=""><div class=""><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;" class="">332</code></pre></div></div></div></div></div></blockquote>        CASE(208)<br class="">        CASE(209)<br class="">        CASE(210)<br class="">        CASE(211)<br class="">        CASE(212)<br class="">        CASE(213)<br class="">        CASE(214)<br class="">        CASE(215)<br class="">        CASE(216)<br class="">        CASE(217)<br class="">        CASE(218)<br class="">        CASE(219)<br class="">        CASE(220)<br class="">        CASE(221)<br class="">        CASE(222)<br class="">        CASE(223)<br class="">        CASE(384) /*128*/<span class="gmail_default" style="font-size: small;"><span class="Apple-converted-space"> </span>i.e. send literal selector 0 with 0 args</span><br class="">        CASE(385) /*129*/<br class="">        CASE(386) /*130*/<br class="">        CASE(387) /*131*/<br class="">        CASE(388) /*132*/<br class="">        CASE(389) /*133*/<br class="">        CASE(390) /*134*/<br class="">        CASE(391) /*135*/<br class="">        CASE(392) /*136*/<br class="">        CASE(393) /*137*/<br class="">        CASE(394) /*138*/<br class="">        CASE(395) /*139*/<br class="">        CASE(396) /*140*/<br class="">        CASE(397) /*141*/<br class="">        CASE(398) /*142*/<br class="">        CASE(399) /*143*/<br class="">            /* sendLiteralSelector0ArgsBytecode */<br class=""><div class=""> </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;" class=""><div class=""><div class=""><div class=""><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;" class="">384</code></pre></div></div></div></div></div></blockquote><div class=""> </div><div class=""><div class="gmail_default" style="font-size: small;">hence send literal selector 1 with 0 args</div><br class=""></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;" class=""><div class=""><div class=""><div class=""><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;" class="">385</code></pre></div></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">       <span class="gmail-Apple-converted-space"> </span>CASE(124)</div>        CASE(348) /*92*/<br class="">            /* returnTopFromMethod */<br class=""><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;" class=""><div class=""><div class=""><div class=""><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;" class="">348</code></pre></div></div></div></div></div></blockquote><div class=""> </div><div class="">        CASE(501) /*245*/<br class="">            /* longStoreTemporaryVariableBytecode */<br class=""></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;" class=""><div class=""><div class=""><div class=""><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;" class="">501</code></pre></div></div></div></div></div></blockquote><div class="">       <span class="gmail-Apple-converted-space"> </span>CASE(136)</div>        CASE(339) /*83*/<br class="">            /* duplicateTopBytecode */<br class=""><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;" class=""><div class=""><div class=""><div class=""><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;" class="">339</code></pre></div></div></div></div></div></blockquote><div class="">        CASE(16)</div>        CASE(320) /*64*/<br class="">            /* pushTemporaryVariableBytecode */<br class=""><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;" class=""><div class=""><div class=""><div class=""><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;" class="">320</code></pre></div></div></div></div></div></blockquote><div class=""> </div><div class="">        CASE(224)<br class="">        CASE(225)<br class="">        CASE(226)<br class="">        CASE(227)<br class="">        CASE(228)<br class="">        CASE(229)<br class="">        CASE(230)<br class="">        CASE(231)<br class="">        CASE(232)<br class="">        CASE(233)<br class="">        CASE(234)<br class="">        CASE(235)<br class="">        CASE(236)<br class="">        CASE(237)<br class="">        CASE(238)<br class="">        CASE(239)<br class="">        CASE(400) /*144*/<br class="">        CASE(401) /*145*/<span class="gmail_default" style="font-size: small;"><span class="Apple-converted-space"> </span>i.e. send literal selector 1 with 1 arg</span><br class="">        CASE(402) /*146*/<br class="">        CASE(403) /*147*/<br class="">        CASE(404) /*148*/<br class="">        CASE(405) /*149*/<br class="">        CASE(406) /*150*/<br class="">        CASE(407) /*151*/<br class="">        CASE(408) /*152*/<br class="">        CASE(409) /*153*/<br class="">        CASE(410) /*154*/<br class="">        CASE(411) /*155*/<br class="">        CASE(412) /*156*/<br class="">        CASE(413) /*157*/<br class="">        CASE(414) /*158*/<br class="">        CASE(415) /*159*/<br class="">            /* sendLiteralSelector1ArgBytecode */<br class=""></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;" class=""><div class=""><div class=""><div class=""><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;" class="">401</code></pre></div></div></div></div></div></blockquote><div class="">       <span class="gmail-Apple-converted-space"> </span>CASE(64)</div>        CASE(272) /*16*/<br class="">            /* pushLiteralVariableBytecode */<br class=""><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;" class=""><div class=""><div class=""><div class=""><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;" class="">272</code></pre></div></div></div></div></div></blockquote><div class="">         CASE(204)</div>        CASE(380) /*124*/<br class="">            /* bytecodePrimNew */<span class="gmail_default" style="font-size: small;"><span class="Apple-converted-space"> </span>i.e. a send of #new from the special selector bytecode</span><br class=""><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;" class=""><div class=""><div class=""><div class=""><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;" class="">380</code></pre></div></div></div></div></div></blockquote><div class=""><br class=""></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 class=""> </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;" class=""><div class=""><div class=""><div class=""><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;" class="">
</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);" class=""><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" target="_blank" style="box-sizing: border-box; text-decoration: none; float: left; padding-right: 4px; line-height: 1;" class=""><u class=""></u><u class=""></u><u class=""></u><u class=""></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);" class=""><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" target="_blank" style="box-sizing: border-box; text-decoration: none; float: left; padding-right: 4px; line-height: 1;" class=""><u class=""></u><u class=""></u><u class=""></u><u class=""></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);" class="">I installed <a href="https://emscripten.org/docs/getting_started/downloads.html" rel="nofollow" target="_blank" style="box-sizing: border-box; text-decoration: none;" class="">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);" class=""><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" target="_blank" style="box-sizing: border-box; text-decoration: none; float: left; padding-right: 4px; line-height: 1;" class=""><u class=""></u><u class=""></u><u class=""></u><u class=""></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);" class="">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;" class="">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;" class="">cd building/minheadless.cmake/x86/pharo.stack.spur.wasm
mkdir image
cd image
curl <a href="https://get.pharo.org/32/90" target="_blank" class="">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);" class=""><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" target="_blank" style="box-sizing: border-box; text-decoration: none; float: left; padding-right: 4px; line-height: 1;" class=""><u class=""></u><u class=""></u><u class=""></u><u class=""></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);" class=""><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;" class="">./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);" class=""><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" target="_blank" style="box-sizing: border-box; text-decoration: none; float: left; padding-right: 4px; line-height: 1;" class=""><u class=""></u><u class=""></u><u class=""></u><u class=""></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);" class=""><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;" class="">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);" class=""><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" target="_blank" style="box-sizing: border-box; text-decoration: none; float: left; padding-right: 4px; line-height: 1;" class=""><u class=""></u><u class=""></u><u class=""></u><u class=""></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);" class=""><a href="http://localhost:9090/building/minheadless.cmake/x86/pharo.stack.spur.wasm/debug/dist/squeak.html" rel="nofollow" target="_blank" style="box-sizing: border-box; text-decoration: none;" class="">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);" class=""><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" target="_blank" style="box-sizing: border-box; text-decoration: none; float: left; padding-right: 4px; line-height: 1;" class=""><u class=""></u><u class=""></u><u class=""></u><u class=""></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);" class="">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);" class=""><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" target="_blank" style="box-sizing: border-box; text-decoration: none; float: left; padding-right: 4px; line-height: 1;" class=""><u class=""></u><u class=""></u><u class=""></u><u class=""></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;" class=""><li style="box-sizing: border-box;" class=""><a href="https://webassembly.org/getting-started/developers-guide/" rel="nofollow" target="_blank" style="box-sizing: border-box; text-decoration: none;" class="">Inspect WebAssembly (at the bottom)</a></li><li style="box-sizing: border-box; margin-top: 0.25em;" class=""><a href="https://emscripten.org/docs/porting/index.html" rel="nofollow" target="_blank" style="box-sizing: border-box; text-decoration: none;" class="">Emscripten doc (Porting)</a></li><li style="box-sizing: border-box; margin-top: 0.25em;" class=""><a href="https://emsettings.surma.technology/" rel="nofollow" target="_blank" style="box-sizing: border-box; text-decoration: none;" class="">Emscripten settings</a></li></ul><div class=""><br class=""></div></div></div></div></div></blockquote></div><br clear="all" class=""><div class=""><br class=""></div>--<span class="Apple-converted-space"> </span><br class=""><div dir="ltr" class="gmail_signature"><div dir="ltr" class=""><div class=""><span style="font-size: small; border-collapse: separate;" class=""><div class="">_,,,^..^,,,_<br class=""></div><div class="">best, Eliot</div></span></div></div></div></div></div></blockquote></div><br class=""></div></body></html>