4 ms·
I am confused, there are JIT compilers for C: http://code.google.com/p/asmjit/ http://code.google.com/p/asmjit/ http://homepage1.nifty.com/herumi/soft/xbyak_e
by eliasmacpherson 13y ago
I am confused,
there are JIT compilers for C:
http://code.google.com/p/asmjit/ http://code.google.com/p/asmjit/
http://homepage1.nifty.com/herumi/soft/xbyak_e.html http://homepage1.nifty.com/herumi/soft/xbyak_e.html
How is asm.js different to those?
- Pacabel 13y agoHe's trying to conjure up a difference that just isn't there in practice. Compilation is compilation, regardless of the number of times it's performed, and regardless of whether or not the result is stored for future use.
- pacala 13y agoEmbedding jit assemblers into C binaries is different than jit-ing the C language itself.
- eliasmacpherson 13y agoSo is asm.js not run from a binary, that compiles the js JIT? C JIT compilers compile C code JIT, I still don't see the difference. The two projects I linked to were incorrect, they are for interpreting asm JIT. What I meant to point to were: http://root.cern.ch/drupal/content/cling http://root.cern.ch/drupal/content/cling https://metacpan.org/pod/C::TinyCompiler https://metacpan.org/pod/C::TinyCompiler
- pacala 13y agoThanks for the pointers. Looks like asm.js and C are on par as portable assembly targets. The one difference is that asm.js is ready to use by half a billion users, the other is that no sane human should code asm.js directly, whereas some people swear by C as a language for humans. Allow me to clarify the initial statement: > For 99.9% of the end users, asm.js it's even closer to "portable native code" than C, as C is usually delivered to end users as a precompiled binary via a separate compilation step, therefore no longer portable.
- eliasmacpherson 13y agoThe reason people call C portable assembly is because it's about as low as you can go without coding in assembly, and still have it compile to various platforms. You are really comparing asm.js and C as portable assembly emitters rather than targets. That said, people very occasionally use C as a target like they use asm.js, e.g. the original C++ compilers, the mars rover. asm.js is as low as you can seemingly go and have it run in a modern version of Chrome and Firefox, but those requirements prevent it from being a portable assembler in the sense that C is. In addition, it's sensible to write your program in another language first before asm.js, as I understand it. There's a whole swathe of machines (rather than users) out there that cannot run a modern version of those browsers, i.e. asm.js is not portable to them. When the code being written in and transposed from is asm.js and the destination is some other language - then asm.js will be portable assembler in the sense that C is.