Other highlights in this release:
- Very significant optimization of memory use in the compiler. This was necessary for the PDF demo to build, since it is far larger than previous demos.
- Full support for the recently released LLVM 2.9.
- The Emscripten documentation paper is finished. It explains how Emscripten works, so you might be interested in it if you care what Emscripten does under the hood (but if you just want to use Emscripten you don't need to read it).
The speed of the generated code can be quite good. By default Emscripten compiles with very conservative settings, so the code will be slow, but optimizing the code is not that hard to do. Optimized code tends to run around 10x slower than gcc -O3, which is obviously not great, but on the other hand fairly decent and more than good enough for many purposes. And of course, that ratio will improve along with advancements in JavaScript engines, LLVM, and the Closure Compiler.
So, Emscripten 1.0 is in my opinion pretty solid. There are no major outstanding bugs, and no major missing features. (But I do have plans for some major improvements, which are difficult, but should end up with code that runs at least twice as fast.) Now that Emscripten is at 1.0, I am hoping to see it used in more places. I'm starting to propose at Mozilla that we use it in various ways, and also I'd love to see things like GTK or Qt ported to the web - if anyone wants to collaborate on that, let me know.
Does emscripten use a giant "memory" array, or does it manage to compile individual C objects to individual JavaScript objects?
ReplyDeleteHow much of a C library do you have?
@Anon:
ReplyDelete1. It uses a giant memory array. I have plans to create JS objects for C structs, but that will be hard.
2. There is enough of a C library to run all the demos. So that is quite a lot, but probably lots of little stuff missing. It is possible though to compile an entire libc from C into JS and use that (only need to hook up the lower-level stuff where it calls the OS).
Sounds like it would be a good match for the existing GTK+ HTML backed work...
ReplyDeleteCongrats on the 1.0 release. I'm definetly looking forward to coding my next web based RIA in C++!! Was wondering if emscripten supports javascript event callbacks (for eg., coding for the Browser DOM in C++ through javascript callbacks into llvm functions).Any examples or pointers would be great!
ReplyDelete@sam
ReplyDeleteThere isn't any specific support for that, mainly since I'm not sure what kind of API would be right. But you can already do this sort of thing by writing
emscripten_run_script(" ... ");
in your C++ code. That will run the text in eval() in the browser. So you can manipulate the DOM there, for example
emscripten_run_script("window.alert('hello world!')");
would show an alert, etc. And you can generate the proper string in C++ to do whatever you want.
This project is the bomb!
ReplyDeleteNice work Kripken
HOLY F****IN CR*P!! This is the best project ever! thanks a million! This will certainly be useful for web-izing my existing apps.
ReplyDeleteI can't believe I didn't see your work before.
ReplyDeleteI'm currently working on a html5 port of Qt 4.8.0!
You can see some primitive demos on my website.
I'd really like to grind QtCore and QtGui out through enscript, but of course there's the canvas, mouse/keyboard handling and mouse cursors which I kind of have working, in Google Chrome anyway.
Check out http://developer.qt.nokia.com/forums/search_results/dd0547661be85505352530eb89570aac/
for my posts.
I'm hitting a brick wall getting enscript running on Debian amd64 (I set up debugging).
Here's the .js file for
python tests/runner.py clang_0_0.test_hello_world:
// ll ==> 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;
^