Sunday, May 1, 2011

Emscripten 1.1!

Emscripten is an LLVM to JavaScript compiler, allowing you to run code written in C or C++ on the web. I released version 1.1 today, with the following updates:
  • A much improved Bullet demo - check it out! This version is much faster. The main differences are use of memory compression (see below), LLVM optimizations, and CubicVR.js for rendering.
  • QUANTUM_SIZE == 1, a.k.a memory compression. This is an advanced, and somewhat risky, optimization technique. I see speedups of around 25%, but take note, this must be used carefully. See the docs.
  • Dead function elimination tool: A Python script that scrubs an .ll file to remove unneeded functions. This is useful to reduce the size of the generated code and speed up compilation. Note though that if you want to compile a library, then this tool will remove functions that you probably want left in - it removes everything that cannot be reached by main(). The test runner now uses this by default.
  • Various performance improvements and bug fixes.

6 comments:

  1. You rock kripken!!
    This project could hold the key to write-once-run-everywhere for Rpython opengl based games.

    ReplyDelete
  2. I second that, way to go Kripken. llvm/C++ will really be the way to write code that can cover systems programming (create an OS , or a browser)and thanks to emscripten , can even run as a web application, bringing a true standards based and vendor neutral language like C++ to the forefront.

    ReplyDelete
  3. Ive been trying to compile and run the testcases using llvm-gcc. They all fail with messages like
    : test_array2 (__main__.clang_0_0) ... ERROR
    Is this a configuration issue that I can identify ?

    ReplyDelete
  4. @krismort,

    Yeah, look at

    https://github.com/kripken/emscripten/wiki/Getting-started

    In the section about running the automatic tests, it says where the config file is, and how to run a single test to see where the problem is.

    ReplyDelete
  5. @azakai

    Hi Ive tryed out running the helloworld test with verbose output as you suggested. It turned out that the testrunner.py script was trying to use clang in line 211. COMPILER was set to ( \XX\XX\...\bin\clang++ )

    When I did a hack in before that line setting the compiler to COMPILER = LLVM_GCC then it worked :)

    Only problem now.. where in the script is the COMPILER var originally set to clang.. Ive tryed printing and setting the variable diffirent spots to LLVM_GCC but I failed to find the specific spot where its set to CLANG within testrunner.py.

    ReplyDelete
  6. Look at the function make_test in tests/runner.py. It creates a test, and sets the COMPILER global variable, using

    COMPILER = '%s'

    and %s is given later, it is the value of 'compiler'. We call make_test in a loop right under make_test, that goes over LLVM_GCC and CLANG. If you delete

    ('clang', CLANG, 1), ('clang', CLANG, 4),

    then it will only use LLVM_GCC.

    ReplyDelete