Initialize the PoisonMemory member before initializing
authorDan Gohman <gohman@apple.com>
Thu, 27 Aug 2009 01:25:57 +0000 (01:25 +0000)
committerDan Gohman <gohman@apple.com>
Thu, 27 Aug 2009 01:25:57 +0000 (01:25 +0000)
members that call methods that read the PoisonMemory member.
This fixes potential spurious (though probably otherwise
harmless) poising of unused memory, and fixes the
associated valgrind error.

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

lib/ExecutionEngine/JIT/JITMemoryManager.cpp

index e750768d25088a08a898871688530b326735262f..474843f06624725f740485b19559ab46ffdc167e 100644 (file)
@@ -556,16 +556,16 @@ void JITSlabAllocator::Deallocate(MemSlab *Slab) {
 }
 
 DefaultJITMemoryManager::DefaultJITMemoryManager()
-  : LastSlab(0, 0),
-    BumpSlabAllocator(*this),
-    StubAllocator(DefaultSlabSize, DefaultSizeThreshold, BumpSlabAllocator),
-    DataAllocator(DefaultSlabSize, DefaultSizeThreshold, BumpSlabAllocator) {
-
+  :
 #ifdef NDEBUG
-  PoisonMemory = false;
+    PoisonMemory(false),
 #else
-  PoisonMemory = true;
+    PoisonMemory(true),
 #endif
+    LastSlab(0, 0),
+    BumpSlabAllocator(*this),
+    StubAllocator(DefaultSlabSize, DefaultSizeThreshold, BumpSlabAllocator),
+    DataAllocator(DefaultSlabSize, DefaultSizeThreshold, BumpSlabAllocator) {
 
   // Allocate space for code.
   sys::MemoryBlock MemBlock = allocateNewSlab(DefaultCodeSlabSize);