diff options
| author | Zack Corr <zack@z0w0.me> | 2012-08-26 22:40:21 +1000 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-08-31 16:20:35 -0700 |
| commit | 7993f4820995c9b26d73e8a58bb8f3c0e2e79d47 (patch) | |
| tree | 449106cbe7bdd17cf03b3c93c0559957b114e099 /src/rustc/back | |
| parent | d7aa9918ef1673edcef261da41075203de5b15b3 (diff) | |
| download | rust-7993f4820995c9b26d73e8a58bb8f3c0e2e79d47.tar.gz rust-7993f4820995c9b26d73e8a58bb8f3c0e2e79d47.zip | |
jit: Add custom memory manager (still segfaulting)
Diffstat (limited to 'src/rustc/back')
| -rw-r--r-- | src/rustc/back/link.rs | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/rustc/back/link.rs b/src/rustc/back/link.rs index 04c38c11d62..06d90e982c1 100644 --- a/src/rustc/back/link.rs +++ b/src/rustc/back/link.rs @@ -160,14 +160,37 @@ mod write { llvm::LLVMAddCFGSimplificationPass(pm.llpm);*/ // JIT execution takes ownership of the module, - // so don't dispose and return. + // so don't dispose and return. Due to a weird bug + // with dynamic libraries, we need to separate jitting + // into two functions and load crates inbetween. + + if !llvm::LLVMRustPrepareJIT(pm.llpm, + llmod, + CodeGenOptLevel, + true) { + llvm_err(sess, ~"Could not JIT"); + } + + // We need to tell LLVM where to resolve all linked + // symbols from. The equivalent of -lstd, -lcore, etc. + /*let cstore = sess.cstore; + for cstore::get_used_crate_files(cstore).each |cratepath| { + debug!{"linking: %s", cratepath}; + + let _: () = str::as_c_str( + cratepath, + |buf_t| { + if !llvm::LLVMRustLoadLibrary(buf_t) { + llvm_err(sess, ~"Could not link"); + } + debug!{"linked: %s", cratepath}; + }); + }*/ - if !llvm::LLVMRustJIT(pm.llpm, - llmod, - CodeGenOptLevel, - true) { + if !llvm::LLVMRustExecuteJIT() { llvm_err(sess, ~"Could not JIT"); } + if sess.time_llvm_passes() { llvm::LLVMRustPrintPassTimings(); } return; } |
