There is a proper 'web assembly' instruction set. It's Google
's Portable Native Client [1]. The problem with this solution is that Google is the only one supporting it. But there other players in the web. Creating such a standard making all of the vendors happy might be impossible.
ASM.js might not be the perfect solution, but it has the huge advantage of being compatible with all major browsers. Practicality beating purity is a common pattern in Web's history.
The real-world differences between asm.js and PNaCl are really not that big (basically only whether threads are true POSIX threads, or WebWorkers). Here's a (shameless plug) demo page which has the same demos as emscripten and PNaCl compiled from the same C++ code (warning: most of the PNaCl demos need the latest Chrome Canary): http://floooh.github.io/oryol/
The sandboxing provided by NaCl is nice, but I'm not sure binary portability is really a worthwhile goal -- I think we really want cross-compilation, native binaries and the OS providing most of the sandbox.
That way we get maximum performance on the hardware we're targeting (not the "lowest common denominator" of common bytecodes), an ability to run self-modifying code if we want to send a JIT down the wire...
A bit off-topic, but I would really like to see (P)NaCl apps directly supported on Android outside the browser, no need to mess with the NDK or Java. One can dream, right? :)
Comments
There is a proper 'web assembly' instruction set. It's Google 's Portable Native Client [1]. The problem with this solution is that Google is the only one supporting it. But there other players in the web. Creating such a standard making all of the vendors happy might be impossible.
ASM.js might not be the perfect solution, but it has the huge advantage of being compatible with all major browsers. Practicality beating purity is a common pattern in Web's history.
[1] http://www.chromium.org/nativeclient/pnacl/introduction-to-p...
The real-world differences between asm.js and PNaCl are really not that big (basically only whether threads are true POSIX threads, or WebWorkers). Here's a (shameless plug) demo page which has the same demos as emscripten and PNaCl compiled from the same C++ code (warning: most of the PNaCl demos need the latest Chrome Canary): http://floooh.github.io/oryol/
The sandboxing provided by NaCl is nice, but I'm not sure binary portability is really a worthwhile goal -- I think we really want cross-compilation, native binaries and the OS providing most of the sandbox.
That way we get maximum performance on the hardware we're targeting (not the "lowest common denominator" of common bytecodes), an ability to run self-modifying code if we want to send a JIT down the wire...
A bit off-topic, but I would really like to see (P)NaCl apps directly supported on Android outside the browser, no need to mess with the NDK or Java. One can dream, right? :)