4 ms·
> It would be really good if gwt,doppio,teavm all agreed on a single api facade for targeting the browser API. Unfortunately, that is impossible due to differi
by jvilk 10y ago
> It would be really good if gwt,doppio,teavm all agreed on a single api facade for targeting the browser API.
Unfortunately, that is impossible due to differing requirements; I've actually talked with the teavm and bck2brwsr folks [0]. Doppio requires asynchronous function calls to support preemptive multithreading. TeaVM, GWT, and bck2brwsr all map Java methods directly to synchronous JavaScript methods, preventing them from supporting multithreading.
This is actually one of the larger differences we describe in the academic paper that sets Doppio apart from those projects and Emscripten [1].
[0] Start of the conversation: https://groups.google.com/d/msg/plasma-umass-gsoc/uuZk09CGIM4/EsTx_Lq3TcYJ https://groups.google.com/d/msg/plasma-umass-gsoc/uuZk09CGIM...
[1] PLDI 2014 paper (Sorry, I know I'm linking this a lot in the comments thread, but I promise it's a fun read!): https://plasma-umass.github.io/doppio-demo/paper.pdf https://plasma-umass.github.io/doppio-demo/paper.pdf
- grizzles 10y agoIt could be an async api facade. It would just happen to be mostly synchronous in those other cases.
- jvilk 10y agoAbsolutely true. I believe I proposed that in our correspondence, but it was a dealbreaker for bck2brwsr and TeaV M, which is understandable.
- vesinisa 10y agoWhat are your thoughts on WebAssembly? Do you see Doppio suppporting it as a target in the future?
- jvilk 10y agoOne of Doppio's explicit goals was to leverage existing resources in the browser to bring conventional programming languages to the web on top of JavaScript. Using WebAssembly would prevent Doppio from using the browser's garbage collector; we would have to write our own. It would also prevent Doppio from mapping JVM objects onto JavaScript objects. The WebAssembly standard is constantly evolving, and now contains some ambiguous statements regarding the ability to take advantage of the browser's GC [0]. Considering WebAssembly's current focus on C/C++ code, I do not believe this will come to fruition anytime soon. If it does, I do not see how it would noticeably improve Doppio's current performance, which is bottlenecked primarily by its interpreter. A contributor is working on a JIT right now to make execution faster [1]. Hope that clarifies! [0] https://github.com/WebAssembly/design/blob/master/GC.md https://github.com/WebAssembly/design/blob/master/GC.md [1] https://github.com/plasma-umass/doppio/pull/443 https://github.com/plasma-umass/doppio/pull/443
- karussell 10y agoTo my knowledge TeaVM supports multi threading. See the async demo: http://teavm.org/ http://teavm.org/ 'Async demo that shows how TeaVM can translate multithreaded applications with synchronization primitives.' Also see this effort trying to unify the APIs: http://dukescript.com/ http://dukescript.com/
- jvilk 10y agoInteresting! A cursory glance at the source code looks like they are doing some form of stack splitting at synchronization points, denoted by method annotations. Note that they reimplement the class library and eschew compatibility with traditional Java programs, so I'm not completely sure how general purpose their threads are. I tried finding some writeup about them, but I suspect the code is the documentation. :) I haven't checked in with this project since we last talked a few years ago, so it's nice to see notable progress! Thanks for the pointer.