2 ms·
Some notes: 1. Emscripten/asm.js supports the defined behavior case of setjmp/longjmp. What is not supported is jumping up an already unwound stack, which is u
by azakai 11y ago
Some notes:
1. Emscripten/asm.js supports the defined behavior case of setjmp/longjmp. What is not supported is jumping up an already unwound stack, which is undefined behavior. This is somewhat commonly-seen undefined behavior, though.
2. I don't think it's fair to say that function pointers are "hairy at best, broken at worst." Again, this is a case where we do not support undefined behavior. But perhaps most importantly, most real-world code is properly portable and just works. When not, we have tools that help figure things out.
3. It's not true that everything must be compiled into one massive JS file, Emscripten/asm.js also supports dynamic linking, [1]. However, the default is a single file, because then it can be more fully optimized.
4. There is already threads support, [2]. It works, and progress in the standards bodies is going well. The main issue is waiting for browsers aside from Firefox nightly to support it, but that's coming too.
A final note, I don't think the reason most asm.js use cases have been games is because the technology is only suitable for games. First, there are a bunch of non-game use cases already (for example, I've seen sites use asm.js for encryption, education, emulation, codecs, non-game WebGL sites, etc., including on major sites like Wikipedia [3]). But perhaps more importantly, games are already on the web, so they have a clear business model and use case. And, they are on the web mostly in the form of plugins, and plugins are going away, so they have to move to JavaScript.
[1] https://github.com/kripken/emscripten/wiki/Linking https://github.com/kripken/emscripten/wiki/Linking
[2] http://kripken.github.io/emscripten-site/docs/porting/pthreads.html http://kripken.github.io/emscripten-site/docs/porting/pthrea...
[3] https://brionv.com/log/2015/08/09/video-decoding-in-the-javascript-platform-ogv-js-how-u-work/ https://brionv.com/log/2015/08/09/video-decoding-in-the-java...