LLI: move instruction cache tweaks.
authorJim Grosbach <grosbach@apple.com>
Tue, 28 Aug 2012 23:22:30 +0000 (23:22 +0000)
committerJim Grosbach <grosbach@apple.com>
Tue, 28 Aug 2012 23:22:30 +0000 (23:22 +0000)
Invalidate the instruction cache right before we start actually executing code, otherwise
we can miss some that came later. This is still not quite right for a truly lazilly
compiled environment, but it's closer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162803 91177308-0d34-0410-b5e6-96231b3b80d8

tools/lli/lli.cpp

index b6c9299c65b58314df7827fb30ff0254abd11ff1..3a3f4c7cddf20d2e5d142d7ac52da22c8724d3a4 100644 (file)
@@ -466,10 +466,6 @@ int main(int argc, char **argv, char * const *envp) {
     exit(1);
   }
 
-  // Clear instruction cache before code will be executed.
-  if (JMM)
-    JMM->invalidateInstructionCache();
-
   // The following functions have no effect if their respective profiling
   // support wasn't enabled in the build configuration.
   EE->RegisterJITEventListener(
@@ -524,6 +520,10 @@ int main(int argc, char **argv, char * const *envp) {
     }
   }
 
+  // Clear instruction cache before code will be executed.
+  if (JMM)
+    JMM->invalidateInstructionCache();
+
   // Run main.
   int Result = EE->runFunctionAsMain(EntryFn, InputArgv, envp);