about summary refs log tree commit diff
path: root/src/rustc
diff options
context:
space:
mode:
authorZack Corr <zack@z0w0.me>2012-08-28 11:39:34 +1000
committerBrian Anderson <banderson@mozilla.com>2012-08-31 16:20:36 -0700
commit19ea3ab480ad273420837da25e428fae597ef9f7 (patch)
treeb62cdba4670f239e1a49d316adcde6b1b81f979a /src/rustc
parent795acb73950adf632d1e3fb48ea6104b4d61f3cd (diff)
downloadrust-19ea3ab480ad273420837da25e428fae597ef9f7.tar.gz
rust-19ea3ab480ad273420837da25e428fae597ef9f7.zip
jit: Add passes and cleanup code
Diffstat (limited to 'src/rustc')
-rw-r--r--src/rustc/back/link.rs26
-rw-r--r--src/rustc/lib/llvm.rs7
2 files changed, 10 insertions, 23 deletions
diff --git a/src/rustc/back/link.rs b/src/rustc/back/link.rs
index 06d90e982c1..4de4a27e182 100644
--- a/src/rustc/back/link.rs
+++ b/src/rustc/back/link.rs
@@ -152,27 +152,14 @@ mod write {
             if opts.jit {
                 // If we are using JIT, go ahead and create and
                 // execute the engine now.
-
-                /*llvm::LLVMAddBasicAliasAnalysisPass(pm.llpm);
-                llvm::LLVMAddInstructionCombiningPass(pm.llpm);
-                llvm::LLVMAddReassociatePass(pm.llpm);
-                llvm::LLVMAddGVNPass(pm.llpm);
-                llvm::LLVMAddCFGSimplificationPass(pm.llpm);*/
-
                 // JIT execution takes ownership of the module,
-                // 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");
-                }
+                // so don't dispose and return.
 
                 // We need to tell LLVM where to resolve all linked
                 // symbols from. The equivalent of -lstd, -lcore, etc.
+                // By default the JIT will resolve symbols from the std and
+                // core linked into rustc. We don't want that,
+                // incase the user wants to use an older std library.
                 /*let cstore = sess.cstore;
                 for cstore::get_used_crate_files(cstore).each |cratepath| {
                     debug!{"linking: %s", cratepath};
@@ -187,7 +174,10 @@ mod write {
                         });
                 }*/
 
-                if !llvm::LLVMRustExecuteJIT() {
+                if !llvm::LLVMRustJIT(pm.llpm,
+                                      llmod,
+                                      CodeGenOptLevel,
+                                      true) {
                     llvm_err(sess, ~"Could not JIT");
                 }
 
diff --git a/src/rustc/lib/llvm.rs b/src/rustc/lib/llvm.rs
index ec9c669501b..f325b3a3d03 100644
--- a/src/rustc/lib/llvm.rs
+++ b/src/rustc/lib/llvm.rs
@@ -989,15 +989,12 @@ extern mod llvm {
     /** Load a shared library to resolve symbols against. */
     fn LLVMRustLoadLibrary(Filename: *c_char) -> bool;
 
-    /** Create the JIT engine. */
-    fn LLVMRustPrepareJIT(PM: PassManagerRef,
+    /** Create and execute the JIT engine. */
+    fn LLVMRustJIT(PM: PassManagerRef,
                    M: ModuleRef,
                    OptLevel: c_int,
                    EnableSegmentedStacks: bool) -> bool;
 
-    /** Execute the JIT engine. */
-    fn LLVMRustExecuteJIT() -> bool;
-
     /** Parses the bitcode in the given memory buffer. */
     fn LLVMRustParseBitcode(MemBuf: MemoryBufferRef) -> ModuleRef;