WebAssembly (was Re: [ANN] Lowtalk, a new Smalltalk dialect that could eventually replace Slang)

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

WebAssembly (was Re: [ANN] Lowtalk, a new Smalltalk dialect that could eventually replace Slang)

Ben Coman
 
On Mon, Sep 18, 2017 at 8:58 PM, Ronie Salgado <[hidden email]> wrote:
>>
>> (although maybe a WebAssembly target might be a better research topic.)
>
> It seems that everybody is interested on WebAssembly, nd having Smalltalk on the Web.

Well its certainly a catchy name that promises at lot to the naive (me included)

> I checked the WebAssembly spec and I see that it is not possible to
> support Smalltalk completely in an efficient way.
> (a) There is no way for accessing the stack to implement thisContext.
> (b) There is also no way for doing setjmp/longjmp directly on webassembly
>      to implement non-local returns and Smalltalk exceptions.
> By doing a goggle search, it seems that the behavior of setjmp/longjmp  is simulated
> by wrapping a method in javascript code, and using javascript exception handling for doing the longjmp.
>
> Best regards,
> Ronie

Thx for the heads up on those issues.  I found a reference [1]
describing such lack of setjmp/longjmp in the WebAssembly MVP...
and another [2] that WebAssembly will later implement "zero-cost
exception handling"
which apparently  "can be used to implement setjmp/longjmp, and can
enable all of the defined behavior of setjmp/longjmp, namely unwinding
the stack without calling C++ destructors. It does not, however, allow
the undefined behavior case of jumping forward to a stack that was
already unwound which is sometimes used to implement coroutines.
Coroutine support is being considered separately."

Is there any obvious conflict in that statement with how we use setjump/longjmp?
Or do we run foul the assumption at [3] that "throwing is rare" ? i.e.
is longjmp a hotpath for us?

@Craig, How is thisContext dealt with in SqueakJS ?

cheers -ben

P.S. I was just having a look at https://caffeine.js.org
and I presume to run code I click the circular arrow (fifth icon down
outside left margin)
but every time I get a Halt.

[1]   https://stackoverflow.com/questions/44263019/how-would-setjmp-longjmp-be-implemented-in-webassembly
[2] https://github.com/WebAssembly/design/issues/1078
[3] https://github.com/WebAssembly/exception-handling/issues/19



>
>
> 2017-09-17 23:53 GMT+02:00 Edgar De Cleene <[hidden email]>:
>>
>>
>> We are  studying WebAssembly and have in the hands a Cuis fork with all necessary for have Smalltalk both sides of Web 2.0.
>> This .image for server side and Amber and Morphic.js on the client side.
>> So I glad to share experiments and feedback of my students and me on Smalltalk, WebAssembly and ways on made Web 2.0 nice and fast.
>>
>> Edgar
>> @morplenauta
>>
>>
>>
>> On 17 Sep 2017, at 11:44, Ben Coman <[hidden email]> wrote:
>>
>> (although maybe a WebAssembly target might be a better research topic.)
>>
>>
>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: WebAssembly (was Re: [ANN] Lowtalk, a new Smalltalk dialect that could eventually replace Slang)

Bert Freudenberg
 

On Tue 19. Sep 2017 at 05:43, Ben Coman <[hidden email]> wrote:

How is thisContext dealt with in SqueakJS ?

SqueakJS has full support for thisContext, non-local returns, resumable exceptions, etc. AFAIK it's the only web-based Smalltalk that is full-featured this way, including LargeInts, allInstances, finalization and so on. That's why it can run an unmodified Squeak image (even Cog/Spur images, but not Sista yet).

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

Re: WebAssembly (was "Lowtalk, a new Smalltalk dialect that could eventually replace Slang")

Craig Latta
In reply to this post by Ben Coman
 

Hi Ben--

> I was just having a look at https://caffeine.js.org and I presume to
> run code I click the circular arrow (fifth icon down outside left
> margin) but every time I get a Halt.

     Hm, no, that button is a placeholder for "rotate window". :)  I
guess I should take out the buttons that don't work yet (so far only the
top two "close" and "move" buttons do).

     To run code, you should be able to just interact with the Squeak UI
normally inside the window.


     thanks,

-C

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