Sunday, July 31, 2011

Emscripten 1.5!

Version 1.5 of Emscripten, the LLVM to JavaScript compiler, is out. Lots of new stuff:
  • A Text-to-Speech demo using eSpeak. Not much had to be done to get this to work, a few library functions were missing but that is pretty much it. I did need to bundle getopt and strtok C sources in the project though. Also, I had to use typed arrays type 2, since the eSpeak source code is not as platform independent as we would like (so this ended up being a good test of typed arrays 2 actually). For more details, source code etc., see the demo page.
  • max99x has written a nice Filesystem API. See that link for documentation. It makes the emulated filesystem much more flexible and useful. The text-to-speech demo uses it, as do all the automatic tests. Aside from the API itself, this update comes with a ton of library additions for IO related things.
  • max99x also wrote parsing code to detect field names in LLVM metadata. This lets you use the original C/C++ field names in your JavaScript, so integrating compiled code and JavaScript becomes much easier. I am thinking about extending this for use in the bindings generator.
  • Speaking of the bindings generator, it has seen a lot of work and things are finally starting to run with Bullet, at least a 'hello world' of creating a btVector3. There is still some work ahead before it is finished, not sure how much.


6 comments:

  1. Hi there.
    I posted a reponse to enscripten 1.0 by mistake - please ignore it.

    I'm developing something called QtJs in sourceforge.

    I've also posted to Qt DevNet:

    http://developer.qt.nokia.com/forums/search_results/dd0547661be85505352530eb89570aac/

    I'm hitting a brick wall with enscript trunk, commit 5b3b4c5.

    I built v8 from svn v8.googlecode.com
    I turned on some debugging features - hope they help.

    The following test fails badly:
    python tests/runner.py clang_0_0.test_hello_world

    Here's the output< meta: {"11":"0","12":"7","13":"8","14":"8"}
    // meta ==> sline: {"0":"5","2":"458798","7":"6","8":"7"}
    // meta ==> pmeta: {"0":"1","2":"3","7":"1","8":"2"}
    // meta ==> fname: {}
    // starting to recurse metadata for: 0
    // recursing metadata, at: 0
    // recursing metadata, at: 1
    Assertion failed: Confused as to parent metadata for llvm #11, metadata !undefined
    Stack: Error
    at assertTrue (utility.js:60:23)
    at Object.processMetadata (modules.js:113:9)
    at intertyper (intertyper.js:24:24)
    at /v3c/dev/Graphics/html5/kripken-emscripten-5b3b4c5/src/compiler.js:79:16
    utility.js:61: Assertion failed: Confused as to parent metadata for llvm #11, metadata !undefined
    throw msg;
    ^
    EOF

    ReplyDelete
  2. Hi Philius,

    Can you please file an issue about that on github?

    https://github.com/kripken/emscripten/issues?sort=created&direction=desc&state=open

    It's much easier to communicate there. Thanks!

    - azakai

    ReplyDelete
  3. Sorry - I'm new to GitHub, Syntensity, emscripten, llvm...

    Here it is.

    https://github.com/kripken/emscripten/issues/72

    ReplyDelete
  4. I see you're using dlmalloc.

    I've got a project in SourceForge called treedb.

    Among it's many uses, it's capable of implementing IMalloc - a memory allocator.

    IMalloc is a COM interface that includes didalloc() for debugging.

    Oh, and it's capable of storing the heap in a disk file.

    It's not as space efficient as dlmalloc and probably a lot slower, but it would be an interesting exercise to see how difficult it would be to try another allocator in emscripten.

    ReplyDelete
  5. @Philius:

    That does sound interesting. I'd be curious to see how it works.

    ReplyDelete
  6. I just uploaded my v3c and treedb SourceForge projects.
    Treedb includes a malloc implementation, to be used by LD_PRELOAD so you can try it with existing apps.

    It needs libfuse-dev installed which the build system detects at configure time as libtreedb-malloc currently don't work without it, but for emscripten's purposes you could dispense with a file backing and work it off a fixed size array.

    ReplyDelete