On Mon, Sep 18, 2017 at 8:58 PM, Ronie Salgado roniesalg@gmail.com 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-imp... [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 edgardec2005@gmail.com:
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 btc@openinworld.com wrote:
(although maybe a WebAssembly target might be a better research topic.)