Found some recent WebAssembly articles that may impact issues previously raised as impediments to Smalltalk-on-WebAssembly. Do these indicate anything useful for the possibility of running Squeak/Pharo on WebAssembly... Calls between JavaScript and WebAssembly are finally fast WebAssembly architecture for Go From WebAssembly Illustrated... * Slide 16 - If Slang could directly output WebAssembly bytecode, I presume the Interpreter lookup table could be modeled as a "call_indirect #n" of functions compiled to a WebAssembly "Table" * Slide 39-40 - I wonder if the Host environment being able to mutate the Table means by default a newly downloaded Smalltalk program would be running as an Interpreter, but you could a browser plugin for the JIT that updated Table for JIT'd methods. * Slides 48-51 - Alternatively, I wonder if a "form" of JITing could be dynamically creating a WebAssembly bytecode module that is then immediately loaded and the function called, and a new module loaded for each new JIT output. "Platform-independent JIT" is mentioned at https://webassembly.org/docs/future-features/ WebAssembly GC proposal including a tagging scheme for unboxed small scalars Garbage Collection (proposal) cheers -ben |
Hi Ben, On Fri, Mar 15, 2019 at 2:13 AM Ben Coman <[hidden email]> wrote:
Good to read. What can you find that discusses the range of stack frame formats? To map the StackInterpreter to WebAssembly conveniently we would need there ability to store the current method/closure in each frame.
_,,,^..^,,,_ best, Eliot |
In reply to this post by Ben Coman
Wouldn't it be easier to just use emscripten to compile the current C code directly to wasm? 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. Levente |
Hi Levente, > On Mar 18, 2019, at 1:50 PM, Levente Uzonyi <[hidden email]> wrote: > > Wouldn't it be easier to just use emscripten to compile the current C code directly to wasm? > 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. 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. > > Levente |
In reply to this post by Eliot Miranda-2
On Sun, 17 Mar 2019 at 02:49, Eliot Miranda <[hidden email]> wrote:
Can you point me to the code where this happens? And is there a good general description of this that I could refer to if I was discussing this with someone outside our community? cheers -ben |
In reply to this post by Ben Coman
On Fri, 15 Mar 2019 at 17:12, Ben Coman <[hidden email]> wrote:
Another article that makes me curious about the implications for opensmalltalk-vm. I suppose the same as we have Windows/Linux/OSX platforms we might have a WASI platform? Standardizing WASI: A system interface to run WebAssembly outside the web cheers -ben |
In reply to this post by Ben Coman
On Tue, 19 Mar 2019 at 16:47, Ben Coman <[hidden email]> wrote:
From WebAssembly Illustrated... * Slide 23 - Call stack I haven't spent any time trying to understand the code in this link, but does it give some hints...? Something formal... At a stretch for hints, V8 handling of walking WebAssembly frames... cheers -ben
P.S. I vaguely remember a concern about non-local-returns described as "A blockClosure has a direct pointer to its outerContext, the context that created the blockClosure. With this variable, the blockClosure can ... perform non local return. ... A blockClosure can return either to its sender (see our example with false as argument) or to its homeContext sender. This non local returns requires the virtual machine to walk up the stack until it finds the stack frame to return to. This can be done only using the outerContext field." I wonder if such walking-the-stack could be helped by using WebAssembly traps described as "Traps are bubbled up through nested instruction sequences" |
In reply to this post by Eliot Miranda-2
On Mon, Mar 18, 2019 at 7:58 PM Eliot Miranda <[hidden email]> wrote: > On Mar 18, 2019, at 1:50 PM, Levente Uzonyi <[hidden email]> wrote: 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. |
Free forum by Nabble | Edit this page |