mozilla/rust — pull request #3292 by z0w0 (2012-08-28 04:10:55+00:00)
Title: Experimental JIT compiler

This is my 3rd attempt to get this working over around 4 months. It's working pretty well compared to last attempts.

I've found that it runs perfectly (slow parsing/compiling times, fast executing times) with most tests running fine. Most benchmarks actually run faster than statically compiled executables! Of course, it's not perfect yet and there are some issues:

* No crates are explicitly linked in yet - this is easy to do code-wise, the issue is `llvm::sys::DynamicLibrary::LoadLibraryPermanently` is crashing when I try and load crates. The code to do this (pretty simple) is commented out and ready to be fixed (I imagine the fix is something simple)
* `std` and `core` are the only crates available because of above - they're only available because the JIT compiler uses `dlsym` to resolve symbols from the main program and any loaded crates - hence it loads the `std` and `core` crates used by `rustc`. This is not a good idea, as users may want to use specific versions of the core libraries, so it has to be fixed with above
* Running some code/tests or using `--test` results in `terminate called after throwing an instance of 'rust_task*'` - I do not know enough to understand what's causing that
* Minor/easy thing: You can't pass along arguments to the jitted program yet

These issues can easily be fixed in patches (I'll investigate the first two issues) but I'm not sure about the last one. #rust were pretty keen to see this pulled upstream and I think it's ready for that.