Java to WebAssembly Compiler

1,533 views
Skip to first unread message

Joel Handwell

unread,
Jun 22, 2015, 3:03:49 PM6/22/15
to google-web-tool...@googlegroups.com
- Luke Wagner wrote a post on his blog to report that his team at Mozilla have started working with Chromium, Edge and WebKit engineers on creating a new standard, WebAssembly, that defines a portable, size- and load-time-efficient format and execution model specifically designed to serve as a compilation target for the Web. 

- Google's JF Bastien mentions GWT in the design document of WebAssembly as a better execution for languages and toolkits that are currently cross-compiled to the Web.

Given this context, how do you think about considing building Java to WebAssembly compiler? 

Colin Alworth

unread,
Jun 22, 2015, 3:16:40 PM6/22/15
to google-web-tool...@googlegroups.com
Without GC, I think its going to be a bit of a non-starter - the same issues that apply to compiling to asm.js apply here too. I've heard a few ideas floated around to just compile specific methods to asm.js, and those same ideas seem that they could work, but the really hard part is isolating these pieces of code, and at least for asm.js, you can actually take a significant performance hit from moving data into (or even just allocating) typed arrays. If you can tune the feature to how you'll need it (i.e. only ask the compiler to turn it on if you'll keep them around for a long time and have very hot code running through there) it seems worth it, but at that point JSNI or JsInterop might almost be easier to talk to raw JS (or WebAssembly) to guarantee that you get it right.

That said, GC is an eventual design goal in WebAssembly, so I think GWT or something like GWT could make it an eventual target.

/2cents

--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/f9c423c0-bda2-4018-b7e1-9f56f3a34d73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

John Stalcup

unread,
Jun 22, 2015, 6:19:29 PM6/22/15
to google-web-tool...@googlegroups.com
My thoughts are pretty much exactly what Colin said.

Without GC it's not a reasonable target for Java cross compilation because you'd have to embed your own GC implementation into the output.

That being said, they plan to add GC, which will make it more attractive. But WebAssembly would probably be even less readable than current GWT output. So it might be good for GWT apps that don't interoperate with any external JS and might be bad for those that do interoperate wtih external JS.

Alexander Orlov

unread,
Nov 7, 2015, 1:37:55 PM11/7/15
to GWT Contributors
Would not a bytecode to WebAssembly compiler make more sense instead? There are many great JVM languages and Java is a major one but still there are many other great languages that have bytecode as a compilation target. Would it not make more sense to a have a bytecode to WebAssembly compiler once GC is support by WebAssembly?
Reply all
Reply to author
Forward
0 new messages