[llvm-commits] [llvm] r56557 - in /llvm/trunk: include/llvm/ExecutionEngine/ExecutionEngine.h lib/ExecutionEngine/ExecutionEngine.cpp lib/ExecutionEngine/JIT/JIT.cpp

Evan Cheng evan.cheng at apple.com
Wed Sep 24 09:25:56 PDT 2008


Author: evancheng
Date: Wed Sep 24 11:25:55 2008
New Revision: 56557

URL: http://llvm.org/viewvc/llvm-project?rev=56557&view=rev
Log:
Add DisableGVCompilation which forces the JIT to assert when it tries to allocate space for a GlobalVariable.

Modified:
    llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h
    llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
    llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp

Modified: llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h?rev=56557&r1=56556&r2=56557&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h Wed Sep 24 11:25:55 2008
@@ -65,6 +65,7 @@
   const TargetData *TD;
   ExecutionEngineState state;
   bool LazyCompilationDisabled;
+  bool GVCompilationDisabled;
   bool SymbolSearchingDisabled;
 
 protected:
@@ -254,6 +255,16 @@
   bool isLazyCompilationDisabled() const {
     return LazyCompilationDisabled;
   }
+
+  /// DisableGVCompilation - If called, the JIT will abort if it's asked to allocate
+  /// space and populate a GlobalVariable.
+  void DisableGVCompilation(bool Disabled = true) {
+    GVCompilationDisabled = Disabled;
+  }
+  bool isGVCompilationDisabled() const {
+    return GVCompilationDisabled;
+  }
+
   /// DisableSymbolSearching - If called, the JIT will not try to lookup unknown
   /// symbols with dlsym.  A client can still use InstallLazyFunctionCreator to
   /// resolve symbols in a custom way.

Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=56557&r1=56556&r2=56557&view=diff

==============================================================================
--- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Wed Sep 24 11:25:55 2008
@@ -40,6 +40,7 @@
 
 ExecutionEngine::ExecutionEngine(ModuleProvider *P) : LazyFunctionCreator(0) {
   LazyCompilationDisabled = false;
+  GVCompilationDisabled   = false;
   SymbolSearchingDisabled = false;
   Modules.push_back(P);
   assert(P && "ModuleProvider is null?");

Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp?rev=56557&r1=56556&r2=56557&view=diff

==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Wed Sep 24 11:25:55 2008
@@ -552,6 +552,10 @@
     addGlobalMapping(GV, Ptr);
     }
   } else {
+    if (isGVCompilationDisabled()) {
+      cerr << "Compilation of GlobalVariable is disabled!\n";
+      abort();
+    }
     // If the global hasn't been emitted to memory yet, allocate space and
     // emit it into memory.  It goes in the same array as the generated
     // code, jump tables, etc.





More information about the llvm-commits mailing list