WebAssembly a good fit for the future of GWT?

858 views
Skip to first unread message

salk31

unread,
Sep 22, 2017, 5:54:45 AM9/22/17
to GWT Users
Before I get too excited am I missing some major problem? Apart from all the work, GC...

Java should be a good source language for WebAssembly as it was designed for complication/VM?

I've never understand why JavaScript is seen to be hard to JIT etc (presumably dynamic nature) but that implies it will be harder to compile to WebAssembly? Have to check some feature or modification is not used that would modify a class at runtime?

Cheers

Sam

Thomas Broyer

unread,
Sep 22, 2017, 7:48:04 AM9/22/17
to GWT Users
GWT is moving in the opposite direction: more interop with JS, less of a black box. If you want to compile Java to webasm, there are other projects (I believe), but this is not GWT.

Kirill Prazdnikov

unread,
Sep 26, 2017, 11:10:57 AM9/26/17
to GWT Users
TeaVM is capable of Java to WebASM translation.

However you must understand that WebASM can not access to

* DOM
* Network
* WebGL
* WebAudio
* GC
* Any JavaScript Object

It can only do [+, -, *, /, read, write] of [int8, int16, int32, int64, float32, float64] and make calls to JavaScript methods with simple nuberic signature like Math.sqrt. Also it can make calls.


salk31

unread,
Sep 26, 2017, 11:44:27 AM9/26/17
to GWT Users
In the scale of thing the Java -> WebAssembly is probably relatively easy bit? Even after very tough problems like GC and host/JavaScript binding there would be no Widget set etc? I'm also a massive fan of Editor/RequestFactory etc that have magic in the complication process that I don't think anyone is offering to support.

I think Thomas is right. GWT 3.0 is going in the direction of playing nicely with all the other JavaScript toys nicely.

However, I'm in the other main camp that wants to program in Java using a component based widget set where the browser is just another deployment target. I could be wrong about the "other main camp", could just be me ;)

Regards

Sam

Kirill Prazdnikov

unread,
Sep 26, 2017, 12:04:45 PM9/26/17
to GWT Users
Hi

вторник, 26 сентября 2017 г., 18:44:27 UTC+3 пользователь salk31 написал:
In the scale of thing the Java -> WebAssembly is probably relatively easy bit?

No, Java is HARD to execute. For example it is not possible to "unwind" or to walk the stack in WebASM, so java execution must maintain the second stack in order to unwind exception handlers. It is really hard to execute java in WebASM. Ask Alexey, the author of TeaVM. 

WebAsm is for "C", "C++" developers who want to write a JS function in "C".

The phlosofy of GWT is to write JS program using java syntax, which is very efficient in navigation and refactoring (where Js is not). 
This is a way to write JavaScript. And the direction of GWT 3 is good (JsInterop, e,t,c). 

salk31

unread,
Sep 26, 2017, 12:22:07 PM9/26/17
to GWT Users
By "relatively easy" I still meant hard ;) Just easier than the other required parts.

I don't recognise your description of webasm. In the short term you have to use JS to load the webasm but after that you don't need JS again? GWT is even listed in their use cases http://webassembly.org/docs/use-cases/

In the future I'm not sure why my source Java would go via a JavaScript phase.
Reply all
Reply to author
Forward
0 new messages