Emscripts

from Wikipedia, the free encyclopedia

Emscripten is an LLVM -to-Web compiler . Emscripten compiles LLVM assembly code to standard JavaScript or to WebAssembly . Depending on the programming language used, different approaches are followed in the translation. The source code is either translated directly from LLVM bytecode into JavaScript (e.g. C ++ or C), or the execution environment of the programming language is translated into JavaScript. The compiled execution environment is then used to execute code of the respective programming language (e.g. CPython ). Emscripten supports a number of programming languages, but the developers focus on translating C and C ++ .

An example for the use of Emscripts shows the porting of Unreal Engine 4 to JavaScript.

Translation process

The first stage of the compilation process is the LLVM frontend. The LLVM frontend used translates the source code of the language used into LLVM assembler code (LLVM Intermediate Representation). For example, Clang can be used to translate C ++ code . The generated LLVM assembler code is then translated into the target language by LLVM with the corresponding backend. Normally, the executable assembler machine code for a specific platform would be generated in the backend. The Emscript compiler takes on this role instead. The Emscript compiler translates the generated LLVM assembler code into a high-performance translatable subset of JavaScript ( asm.js ).

performance

In contrast to the execution of native applications, the execution speed of script-generated JavaScript code is significantly lower. The browser used also plays a major role; the performance varies greatly depending on the application. An optimistic guideline is approximately twice the execution time. In the case of performance-critical applications, the execution environment must therefore also be precisely specified.

License

Emscripten can be used as free software under two different licenses: MIT license and University of Illinois / NCSA Open Source License .

use

Since 23 December 2014, the used Internet Archive , a emscripten-converted DOSBox emulation for browser-based presentation of thousands of archived DOS - computer games , only for "education and research" .

Individual evidence

  1. Zakai, Alon. "Emscripten: an LLVM-to-JavaScript compiler." Proceedings of the ACM international conference companion on Object oriented programming systems languages ​​and applications companion. ACM, 2011.
  2. https://github.com/kripken/emscripten/wiki#programming-languages
  3. https://blog.mozilla.org/blog/2014/03/12/mozilla-and-epic-preview-unreal-engine-4-running-in-firefox/
  4. http://arewefastyet.com/#machine=11&view=breakdown&suite=asmjs-ubench
  5. https://kripken.github.io/mloc_emscripten_talk/gindex.html#/11
  6. Abby Ohlheiser: You can now play nearly 2,400 MS-DOS video games in your browser . Washington Post . January 5, 2015. Retrieved January 8, 2015.
  7. Each New Boot a Miracle by Jason Scott (December 23, 2014)
  8. collection: softwarelibrary_msdos in the Internet Archive (December 29, 2014)
  9. Internet Archive's Terms of Use, Privacy Policy, and Copyright Policy . archive.org. December 31, 2014. Retrieved January 8, 2015: " Access to the Archive's Collections is provided at no cost to you and is granted for scholarship and research purposes only. "

Web links