[OpenSmalltalk/opensmalltalk-vm] WASM Compile Target? (#387)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

[OpenSmalltalk/opensmalltalk-vm] WASM Compile Target? (#387)

Ben Coman-4
 

Hello all! As some of you might be aware, there has been a lot of progress in the web-world in developing WebAssembly. Many environments and languages can now compile to the wasm binary format. Projects are doing things like putting full Python interpreters and environments in the browser, etc. There is even a nascent movement to come up with a consistent system interface standard for WebAssembly, allowing developers to run wasm code on any platform -- not just the web.

My question is this: what would it take to get the opensmalltalk-vm to compile to WebAssembly and has anyone involved with it considered the option so far?

There would be a great many advantages to running a Smalltalk in the browser this way.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"WASM Compile Target? (#387)"}],"action":{"name":"View Issue","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/387"}}}</script> <script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/387", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/387", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] WASM Compile Target? (#387)

Ben Coman-4
 

$10,000,000 usa


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@johnmci in #387: $10,000,000 usa"}],"action":{"name":"View Issue","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/387#issuecomment-477770914"}}}</script> <script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/387#issuecomment-477770914", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/387#issuecomment-477770914", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] WASM Compile Target? (#387)

timrowledge
 


> On 2019-03-28, at 2:06 PM, johnmci <[hidden email]> wrote:
>
> $10,000,000 usa

At least.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
World Ends at Ten! Pictures at 11 on Fox News!


Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] WASM Compile Target? (#387)

Ben Coman-4
In reply to this post by Ben Coman-4
 

Yes, I've been following WASM since it attained full browser coverage in 2017. I've built the OpenSmalltalk stack interpreter with emscripten, no major gotchas. Of course we want a WASM Cog. We're waiting for WASM to do garbage collection, and provide an API for running your own generated native code. I expect both of these to arrive in the next two years.

In the meantime, I'm getting very good results running Squeak in web browser and on Node with SqueakJS. The simple bytecode-to-JS dynamic translator that Bert wrote for it is a big win. You get a decent translation of bytecodes to native code via the underlying JS engine (V8 et al).


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@ccrraaiigg in #387: Yes, I've been following WASM since it attained full browser coverage in 2017. I've built the OpenSmalltalk stack interpreter with emscripten, no major gotchas. Of course we want a WASM Cog. We're waiting for WASM to do garbage collection, and provide an API for running your own generated native code. I expect both of these to arrive in the next two years.\r\n\r\nIn the meantime, I'm getting very good results running Squeak in web browser and on Node with SqueakJS. The simple bytecode-to-JS dynamic translator that Bert wrote for it is a big win. You get a decent translation of bytecodes to native code via the underlying JS engine (V8 et al)."}],"action":{"name":"View Issue","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/387#issuecomment-477817211"}}}</script> <script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/387#issuecomment-477817211", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/387#issuecomment-477817211", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] WASM Compile Target? (#387)

Ben Coman
In reply to this post by timrowledge
 


On Fri, 29 Mar 2019 at 05:17, tim Rowledge <[hidden email]> wrote:
 


> On 2019-03-28, at 2:06 PM, johnmci <[hidden email]> wrote:
>
> $10,000,000 usa

At least.

Really?  So ten years for 5 x $200k programmers?
I'd hope we could do better than that ;)

On Fri, 29 Mar 2019 at 08:16, Craig Latta <[hidden email]> wrote:

In the meantime, I'm getting very good results running Squeak in web browser and on Node with SqueakJS. The simple bytecode-to-JS dynamic translator that Bert wrote for it is a big win. You get a decent translation of bytecodes to native code via the underlying JS engine (V8 et al).

btw, Is that then a Slang to SqueakJS writer? Or is the bytecode-to-JS happening as some other level?
 
cheers -ben
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] WASM Compile Target? (#387)

Ben Coman-4
In reply to this post by Ben Coman-4
 

It takes a Smalltalk CompiledMethod object, and transcribes the instructions (bytecodes) into a JavaScript method, and makes sure to run that instead the next time the CompiledMethod would normally run. Then V8 optimizes the hell out of that transcribed JS method. It's pretty neat, and makes a huge difference for lots of things, including the UI.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@ccrraaiigg in #387: It takes a Smalltalk CompiledMethod object, and transcribes the instructions (bytecodes) into a JavaScript method, and makes sure to run that instead the next time the CompiledMethod would normally run. Then V8 optimizes the hell out of that transcribed JS method. It's pretty neat, and makes a huge difference for lots of things, including the UI."}],"action":{"name":"View Issue","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/387#issuecomment-478077441"}}}</script> <script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/387#issuecomment-478077441", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/387#issuecomment-478077441", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] WASM Compile Target? (#387)

Craig Latta
In reply to this post by Ben Coman
 

Hi Ben--

> > In the meantime, I'm getting very good results running Squeak in web
> > browser and on Node with SqueakJS. The simple bytecode-to-JS dynamic
> > translator that Bert wrote for it is a big win. You get a decent
> > translation of bytecodes to native code via the underlying JS engine
> > (V8 et al).
>
> btw, Is that then a Slang to SqueakJS writer? Or is the bytecode-to-JS
> happening as some other level?

     It takes a Smalltalk CompiledMethod object, and transcribes the
instructions (bytecodes) into a JavaScript method, and makes sure to run
that instead, whenever the CompiledMethod would normally run. Then V8
optimizes the hell out of the native code for that transcribed JS
method. It's pretty neat, and makes a huge difference for lots of
things, including the UI.


-C

--
Craig Latta
Black Page Digital
Amsterdam :: San Francisco
[hidden email]
+31   6 2757 7177
+ 1 415  287 3547

Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] WASM Compile Target? (#387)

Ben Coman
 


On Sat, 30 Mar 2019 at 15:30, Craig Latta <[hidden email]> wrote:
 

Hi Ben--

> > In the meantime, I'm getting very good results running Squeak in web
> > browser and on Node with SqueakJS. The simple bytecode-to-JS dynamic
> > translator that Bert wrote for it is a big win. You get a decent
> > translation of bytecodes to native code via the underlying JS engine
> > (V8 et al).
>
> btw, Is that then a Slang to SqueakJS writer? Or is the bytecode-to-JS
> happening as some other level?

     It takes a Smalltalk CompiledMethod object, and transcribes the
instructions (bytecodes) into a JavaScript method, and makes sure to run
that instead, whenever the CompiledMethod would normally run. Then V8
optimizes the hell out of the native code for that transcribed JS
method. It's pretty neat, and makes a huge difference for lots of
things, including the UI.

When is the source code for that transcriber? 

cheers -ben
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] WASM Compile Target? (#387)

Craig Latta
 

> > [The SqueakJS VM] takes a Smalltalk CompiledMethod object, and
> > transcribes the instructions (bytecodes) into a JavaScript method,
> > and makes sure to run that instead, whenever the CompiledMethod
> > would normally run. Then V8 optimizes the hell out of the native
> > code for that transcribed JS method. It's pretty neat, and makes a
> > huge difference for lots of things, including the UI.
>
> Where is the source code for that transcriber?

     https://github.com/bertfreudenberg/SqueakJS/blob/master/jit.js

     Used by:

     https://github.com/bertfreudenberg/SqueakJS/blob/master/vm.js


-C

--
Craig Latta
Black Page Digital
Amsterdam :: San Francisco
[hidden email]
+31   6 2757 7177
+ 1 415  287 3547

Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] WASM Compile Target? (#387)

Clément Béra
In reply to this post by Ben Coman-4
 
Do you want good performance?
Do you want to use the ManagedObject layer provided by WASM or OpenSmalltalk-VM own GC? The latter would require to keep a shadow stack since the WASM stack cannot be walked easily for GC.
Do you want to JIT to WASM or just an interpreter?

My main concern is that implementing high level languages on top of WASM is just starting to be possible in a nice way, and I think we should wait for other people to struggle and to re-negotiate some APIs with the WASM people before trying. Each WASM API change have to be validated by multiple people from different companies after being prototyped, so it can take time.

Depending on what you want it may not be 10M$, but if you want a solid high-performance low-memory-footprint runtime and you don't want to wait multiple years for other people to struggle implementing other languages first, that would be a fair initial investment.

On Thu, Mar 28, 2019 at 9:36 PM Eric Gade <[hidden email]> wrote:
 

Hello all! As some of you might be aware, there has been a lot of progress in the web-world in developing WebAssembly. Many environments and languages can now compile to the wasm binary format. Projects are doing things like putting full Python interpreters and environments in the browser, etc. There is even a nascent movement to come up with a consistent system interface standard for WebAssembly, allowing developers to run wasm code on any platform -- not just the web.

My question is this: what would it take to get the opensmalltalk-vm to compile to WebAssembly and has anyone involved with it considered the option so far?

There would be a great many advantages to running a Smalltalk in the browser this way.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.



--
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] WASM Compile Target? (#387)

Ben Coman
In reply to this post by Craig Latta
 


On Sat, 30 Mar 2019 at 16:57, Craig Latta <[hidden email]> wrote:
 

> > [The SqueakJS VM] takes a Smalltalk CompiledMethod object, and
> > transcribes the instructions (bytecodes) into a JavaScript method,
> > and makes sure to run that instead, whenever the CompiledMethod
> > would normally run. Then V8 optimizes the hell out of the native
> > code for that transcribed JS method. It's pretty neat, and makes a
> > huge difference for lots of things, including the UI.
>
> Where is the source code for that transcriber?

     https://github.com/bertfreudenberg/SqueakJS/blob/master/jit.js

     Used by:

     https://github.com/bertfreudenberg/SqueakJS/blob/master/vm.js

Thx. Really interesting perusing that.  
Now was vm.js completely hand crafted?  
Or generated somehow from VMMaker Slang code? 

cheers -ben