<div dir="ltr"><div dir="ltr">On Mon, Mar 18, 2019 at 7:58 PM Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> On Mar 18, 2019, at 1:50 PM, Levente Uzonyi <<a href="mailto:leves@caesar.elte.hu" target="_blank">leves@caesar.elte.hu</a>> wrote:<br>
> Wouldn't it be easier to just use emscripten to compile the current C code directly to wasm?<br>
> I mean, it would probably be a smaller undertaking to create the necessary bindings/plugins for emscripten than to generate wasm code directly from VMMaker and rewrite the platform code.<br>
<br>
Sure, but running a stack machine virtually above another stack machine is going to be far less efficient than mapping the Cog Smalltalk stack to the WebAssembly stack.  So it’s an issue of performance and ambition.  I tend to choose the ambitious route, within affordability constraints.<br></blockquote><div><br></div><div>The WebAssembly stack is too restrictive to directly host the Smalltalk stack. By design, it's not possible to get an address into the stack. For C code, Emscripten places locals that have their address taken into a shadow stack that lives in WebAssembly memory. A direct translation from Slang to WebAssembly would have to do the same.<br></div><div><br></div></div></div>