WebAssembly

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

WebAssembly

Ben Coman
 
I've just bumped into WebAssembly and am curious what opportunities
(or not) it might offer us.
* https://medium.com/javascript-scene/what-is-webassembly-the-dawn-of-a-new-era-61256ec5a8f6#.60dghpaek

One approach could be to just compile our currently generated C code
to WevAssembly via LLVM. Ronie's recent effort to produce a
non-display minimal VM should help proof of concept here.
* http://webassembly.org/docs/c-and-c++/
* https://hacks.mozilla.org/2015/12/compiling-to-webassembly-its-happening/
* http://cultureofdevelopment.com/blog/build-your-first-thing-with-web-assembly/

An obvious downside would be having a VM running on a VM.  But
WebAssembly doesn't do garbage collection so at least it wouldn't
double up on that.  Possibly there would be some double-up/conflict on
JIT-ing, but there seems like there will be a facility for adding JIT
and optimisation libraries, so possibly past investment in Cog is not
lost.  Also perhaps(??) while WebAssembly is in its formative stage
right now some primitives can be added to facilitate how Cog operates.
* http://webassembly.org/docs/future-features/#platform-independent-just-in-time-jit-compilation
* http://webassembly.org/docs/jit-library/

Another approach may be to start with SqueakJS, and work out how the
Cog JIT could be plugged into WebAssembly as a library that SqueakJS
(and others?) could use.  If its architecturally possible this might
broaden the exposure of Cog(??). What would WebAssembly require to
facilitate using Cog?

Of course all plates are full, but now seems the ideal time time to
get involved.
WebAssembly browser preview seeking community feedback concluding Q1 2017.
https://www.infoq.com/news/2016/11/webassembly-browser-preview
http://webassembly.org/roadmap/
https://github.com/WebAssembly/design

Chrome nightly builds available to test it
http://thenextweb.com/dd/2016/03/15/webassembly-lands-chrome-canary-offering-glimpse-future-web/

It would be amazing to run Cog in a web browser, and thus facilitate
all our favourite Smalltalk dialects.

Side thought: Craig's work to incrementally download a running image
could be useful to reducing web page startup time.

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

Re: WebAssembly

Eliot Miranda-2
 
Hi Ben,

    Craig Latta had already used the SqueakJS glue to allow Cog to run in a browser.  See Snowglobe (I wish it were called SnowGlobe).  This allows full performance and as good a browser integration as obtained with SqueakJS.

_,,,^..^,,,_ (phone)

> On Dec 7, 2016, at 8:05 PM, Ben Coman <[hidden email]> wrote:
>
>
> I've just bumped into WebAssembly and am curious what opportunities
> (or not) it might offer us.
> * https://medium.com/javascript-scene/what-is-webassembly-the-dawn-of-a-new-era-61256ec5a8f6#.60dghpaek
>
> One approach could be to just compile our currently generated C code
> to WevAssembly via LLVM. Ronie's recent effort to produce a
> non-display minimal VM should help proof of concept here.
> * http://webassembly.org/docs/c-and-c++/
> * https://hacks.mozilla.org/2015/12/compiling-to-webassembly-its-happening/
> * http://cultureofdevelopment.com/blog/build-your-first-thing-with-web-assembly/
>
> An obvious downside would be having a VM running on a VM.  But
> WebAssembly doesn't do garbage collection so at least it wouldn't
> double up on that.  Possibly there would be some double-up/conflict on
> JIT-ing, but there seems like there will be a facility for adding JIT
> and optimisation libraries, so possibly past investment in Cog is not
> lost.  Also perhaps(??) while WebAssembly is in its formative stage
> right now some primitives can be added to facilitate how Cog operates.
> * http://webassembly.org/docs/future-features/#platform-independent-just-in-time-jit-compilation
> * http://webassembly.org/docs/jit-library/
>
> Another approach may be to start with SqueakJS, and work out how the
> Cog JIT could be plugged into WebAssembly as a library that SqueakJS
> (and others?) could use.  If its architecturally possible this might
> broaden the exposure of Cog(??). What would WebAssembly require to
> facilitate using Cog?
>
> Of course all plates are full, but now seems the ideal time time to
> get involved.
> WebAssembly browser preview seeking community feedback concluding Q1 2017.
> https://www.infoq.com/news/2016/11/webassembly-browser-preview
> http://webassembly.org/roadmap/
> https://github.com/WebAssembly/design
>
> Chrome nightly builds available to test it
> http://thenextweb.com/dd/2016/03/15/webassembly-lands-chrome-canary-offering-glimpse-future-web/
>
> It would be amazing to run Cog in a web browser, and thus facilitate
> all our favourite Smalltalk dialects.
>
> Side thought: Craig's work to incrementally download a running image
> could be useful to reducing web page startup time.
>
> cheers -ben
Reply | Threaded
Open this post in threaded view
|

Re: WebAssembly

Clément Béra
In reply to this post by Ben Coman
 
Hi,

On Thu, Dec 8, 2016 at 5:05 AM, Ben Coman <[hidden email]> wrote:

I've just bumped into WebAssembly and am curious what opportunities
(or not) it might offer us.
* https://medium.com/javascript-scene/what-is-webassembly-the-dawn-of-a-new-era-61256ec5a8f6#.60dghpaek 
One approach could be to just compile our currently generated C code
to WevAssembly via LLVM. Ronie's recent effort to produce a
non-display minimal VM should help proof of concept here.
* http://webassembly.org/docs/c-and-c++/
* https://hacks.mozilla.org/2015/12/compiling-to-webassembly-its-happening/
* http://cultureofdevelopment.com/blog/build-your-first-thing-with-web-assembly/



It should be possible to port the StackVM to WebAssembly through LLVM, but many plugins have to be rewritten. Some people worked on making an easy to bind interface for files, display and other plugin features already, but it needs to be done. FFI plugin needs to be reimplemented too.

WebAssembly is an abstract assembly, so running the VM on it kind of makes sense. It's not really running on top of a VM, it's running on top of an abstract assembler to avoid assembly back-end dependencies.
 
An obvious downside would be having a VM running on a VM.  But
WebAssembly doesn't do garbage collection so at least it wouldn't
double up on that.  Possibly there would be some double-up/conflict on
JIT-ing, but there seems like there will be a facility for adding JIT
and optimisation libraries, so possibly past investment in Cog is not
lost.  Also perhaps(??) while WebAssembly is in its formative stage
right now some primitives can be added to facilitate how Cog operates.
* http://webassembly.org/docs/future-features/#platform-independent-just-in-time-jit-compilation
* http://webassembly.org/docs/jit-library/


It's possible. You need the JIT to have a back-end to web assembly, which is some work.

However, stack introspection is not possible currently (though it may be added in the future). This means that the VM needs to maintain a shadow stack for the GC to scan it with the current implementation. It requires changes in the VM that are non trivial. It would be better to wait for stack introspection to be available.
 
Another approach may be to start with SqueakJS, and work out how the
Cog JIT could be plugged into WebAssembly as a library that SqueakJS
(and others?) could use.  If its architecturally possible this might
broaden the exposure of Cog(??). What would WebAssembly require to
facilitate using Cog?

I believe it's easier to use directly the Cog compiled to web assembly. The most difficult part is to make the JIT compliant anyway.
 

Of course all plates are full, but now seems the ideal time time to
get involved.
WebAssembly browser preview seeking community feedback concluding Q1 2017.
https://www.infoq.com/news/2016/11/webassembly-browser-preview
http://webassembly.org/roadmap/
https://github.com/WebAssembly/design

Chrome nightly builds available to test it
http://thenextweb.com/dd/2016/03/15/webassembly-lands-chrome-canary-offering-glimpse-future-web/

It would be amazing to run Cog in a web browser, and thus facilitate
all our favourite Smalltalk dialects. 

Side thought: Craig's work to incrementally download a running image
could be useful to reducing web page startup time.

There's already multiple things like Amber, PharoJS, SqueakJS, Craig's work.

Another thing we could do: now that the JIT supports 4 sets of unsafe operations, like Ronie's lowcode or the sista instructions, we could support a DSL similar to webAssembly in Squeak/Pharo that compiles to machine code though Cog's JIT...
 

cheers -ben

Reply | Threaded
Open this post in threaded view
|

Re: WebAssembly

Ben Coman
In reply to this post by Eliot Miranda-2
 
Hard to find info on Snowglobe.  Only 4 million results to compete with.
Sorry to harp on my pet gripe again.  The following alternatives are
much more distinctive...
"Snowglowbe" with only 364 results,
or "Snowglobal" with 854 result,
or "Snowglowbal" with only!! 1 result!!!!
Maybe my parachute career should be brand consulting?

So finally a four term search "cog snowglobe craig latta" found...
* http://forum.world.st/App-streaming-with-Snowglobe-td4920867.html
* https://thiscontext.com/2016/10/31/app-streaming-with-snowglobe/

I tried the demo. http://blackpagedigital.com/snowglobe/
Pretty impressive.  The world menu is a bit sluggish for a few seconds
to pop up each time, but menu item highlighting is instantaneous, as
is editing in the system Browser. However mouse point is off by about
15mm at 7o'clock position.  Platform is 32-bit Linux Chrome Version
48.0.2564.116.
(I guess any further discussion on this would be better on squeak-dev)

cheers -ben

P.S. reading about "live serialization" the term "serialivation" pops in mind.

On Thu, Dec 8, 2016 at 2:08 PM, Eliot Miranda <[hidden email]> wrote:

>
> Hi Ben,
>
>     Craig Latta had already used the SqueakJS glue to allow Cog to run in a browser.  See Snowglobe (I wish it were called SnowGlobe).  This allows full performance and as good a browser integration as obtained with SqueakJS.
>
> _,,,^..^,,,_ (phone)
>
>> On Dec 7, 2016, at 8:05 PM, Ben Coman <[hidden email]> wrote:
>>
>>
>> I've just bumped into WebAssembly and am curious what opportunities
>> (or not) it might offer us.
>> * https://medium.com/javascript-scene/what-is-webassembly-the-dawn-of-a-new-era-61256ec5a8f6#.60dghpaek
>>
>> One approach could be to just compile our currently generated C code
>> to WevAssembly via LLVM. Ronie's recent effort to produce a
>> non-display minimal VM should help proof of concept here.
>> * http://webassembly.org/docs/c-and-c++/
>> * https://hacks.mozilla.org/2015/12/compiling-to-webassembly-its-happening/
>> * http://cultureofdevelopment.com/blog/build-your-first-thing-with-web-assembly/
>>
>> An obvious downside would be having a VM running on a VM.  But
>> WebAssembly doesn't do garbage collection so at least it wouldn't
>> double up on that.  Possibly there would be some double-up/conflict on
>> JIT-ing, but there seems like there will be a facility for adding JIT
>> and optimisation libraries, so possibly past investment in Cog is not
>> lost.  Also perhaps(??) while WebAssembly is in its formative stage
>> right now some primitives can be added to facilitate how Cog operates.
>> * http://webassembly.org/docs/future-features/#platform-independent-just-in-time-jit-compilation
>> * http://webassembly.org/docs/jit-library/
>>
>> Another approach may be to start with SqueakJS, and work out how the
>> Cog JIT could be plugged into WebAssembly as a library that SqueakJS
>> (and others?) could use.  If its architecturally possible this might
>> broaden the exposure of Cog(??). What would WebAssembly require to
>> facilitate using Cog?
>>
>> Of course all plates are full, but now seems the ideal time time to
>> get involved.
>> WebAssembly browser preview seeking community feedback concluding Q1 2017.
>> https://www.infoq.com/news/2016/11/webassembly-browser-preview
>> http://webassembly.org/roadmap/
>> https://github.com/WebAssembly/design
>>
>> Chrome nightly builds available to test it
>> http://thenextweb.com/dd/2016/03/15/webassembly-lands-chrome-canary-offering-glimpse-future-web/
>>
>> It would be amazing to run Cog in a web browser, and thus facilitate
>> all our favourite Smalltalk dialects.
>>
>> Side thought: Craig's work to incrementally download a running image
>> could be useful to reducing web page startup time.
>>
>> cheers -ben
Reply | Threaded
Open this post in threaded view
|

Re: WebAssembly

philippeback
 
Snowglobe is nice indeed. But still slow on this monster of a machine of mine.


UI page appears dead though.

Phil

On Thu, Dec 8, 2016 at 3:18 PM, Ben Coman <[hidden email]> wrote:

Hard to find info on Snowglobe.  Only 4 million results to compete with.
Sorry to harp on my pet gripe again.  The following alternatives are
much more distinctive...
"Snowglowbe" with only 364 results,
or "Snowglobal" with 854 result,
or "Snowglowbal" with only!! 1 result!!!!
Maybe my parachute career should be brand consulting?

So finally a four term search "cog snowglobe craig latta" found...
* http://forum.world.st/App-streaming-with-Snowglobe-td4920867.html
* https://thiscontext.com/2016/10/31/app-streaming-with-snowglobe/

I tried the demo. http://blackpagedigital.com/snowglobe/
Pretty impressive.  The world menu is a bit sluggish for a few seconds
to pop up each time, but menu item highlighting is instantaneous, as
is editing in the system Browser. However mouse point is off by about
15mm at 7o'clock position.  Platform is 32-bit Linux Chrome Version
<a href="tel:48.0.2564.116" value="+14802564116">48.0.2564.116.
(I guess any further discussion on this would be better on squeak-dev)

cheers -ben

P.S. reading about "live serialization" the term "serialivation" pops in mind.

On Thu, Dec 8, 2016 at 2:08 PM, Eliot Miranda <[hidden email]> wrote:
>
> Hi Ben,
>
>     Craig Latta had already used the SqueakJS glue to allow Cog to run in a browser.  See Snowglobe (I wish it were called SnowGlobe).  This allows full performance and as good a browser integration as obtained with SqueakJS.
>
> _,,,^..^,,,_ (phone)
>
>> On Dec 7, 2016, at 8:05 PM, Ben Coman <[hidden email]> wrote:
>>
>>
>> I've just bumped into WebAssembly and am curious what opportunities
>> (or not) it might offer us.
>> * https://medium.com/javascript-scene/what-is-webassembly-the-dawn-of-a-new-era-61256ec5a8f6#.60dghpaek
>>
>> One approach could be to just compile our currently generated C code
>> to WevAssembly via LLVM. Ronie's recent effort to produce a
>> non-display minimal VM should help proof of concept here.
>> * http://webassembly.org/docs/c-and-c++/
>> * https://hacks.mozilla.org/2015/12/compiling-to-webassembly-its-happening/
>> * http://cultureofdevelopment.com/blog/build-your-first-thing-with-web-assembly/
>>
>> An obvious downside would be having a VM running on a VM.  But
>> WebAssembly doesn't do garbage collection so at least it wouldn't
>> double up on that.  Possibly there would be some double-up/conflict on
>> JIT-ing, but there seems like there will be a facility for adding JIT
>> and optimisation libraries, so possibly past investment in Cog is not
>> lost.  Also perhaps(??) while WebAssembly is in its formative stage
>> right now some primitives can be added to facilitate how Cog operates.
>> * http://webassembly.org/docs/future-features/#platform-independent-just-in-time-jit-compilation
>> * http://webassembly.org/docs/jit-library/
>>
>> Another approach may be to start with SqueakJS, and work out how the
>> Cog JIT could be plugged into WebAssembly as a library that SqueakJS
>> (and others?) could use.  If its architecturally possible this might
>> broaden the exposure of Cog(??). What would WebAssembly require to
>> facilitate using Cog?
>>
>> Of course all plates are full, but now seems the ideal time time to
>> get involved.
>> WebAssembly browser preview seeking community feedback concluding Q1 2017.
>> https://www.infoq.com/news/2016/11/webassembly-browser-preview
>> http://webassembly.org/roadmap/
>> https://github.com/WebAssembly/design
>>
>> Chrome nightly builds available to test it
>> http://thenextweb.com/dd/2016/03/15/webassembly-lands-chrome-canary-offering-glimpse-future-web/
>>
>> It would be amazing to run Cog in a web browser, and thus facilitate
>> all our favourite Smalltalk dialects.
>>
>> Side thought: Craig's work to incrementally download a running image
>> could be useful to reducing web page startup time.
>>
>> cheers -ben