mozilla/rust — pull request #6570 by alexcrichton (2013-05-17 23:56:15+00:00)
Title: Use LLVM in a threadsafe fashion

Closes #6511.

To isolate LLVM among threads, the main need to to use different `LLVMContextRef` structures. This is easy enough to do by storing a task-local context while translation is happening.

There aren't that many points in the LLVM api which actually need a context, so this wasn't too bad of a change in that respect. All of the bindings to functions which implicitly take a global context have been removed to prevent them from being used again.

Furthermore, this fixes memory leaks in the JIT by properly destroying the `ExecutionEngine` created after the JIT code finishes running. With this in mind, plus the parallel usage of `rustc`, I re-enabled the `rusti` tests for everything except `x86` (see #6489).

One consequence of these commits is that LLVM needs to be re-built because the `disable-threads` and `disable-pthreads` options were previously passed to LLVM. By default these are no longer passed in.