[vmkit-commits] [vmkit] r86835 - in /vmkit/trunk: include/mvm/VirtualMachine.h lib/Mvm/Runtime/MethodInfo.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Wed Nov 11 04:42:39 PST 2009


Author: geoffray
Date: Wed Nov 11 06:42:38 2009
New Revision: 86835

URL: http://llvm.org/viewvc/llvm-project?rev=86835&view=rev
Log:
MacOS does not like static initialization of llvm::BumpPtrAllocator. Just create them dynamically.


Modified:
    vmkit/trunk/include/mvm/VirtualMachine.h
    vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp

Modified: vmkit/trunk/include/mvm/VirtualMachine.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/VirtualMachine.h?rev=86835&r1=86834&r2=86835&view=diff

==============================================================================
--- vmkit/trunk/include/mvm/VirtualMachine.h (original)
+++ vmkit/trunk/include/mvm/VirtualMachine.h Wed Nov 11 06:42:38 2009
@@ -97,8 +97,13 @@
 
 class SharedStartFunctionMap : public StartFunctionMap {
 public: 
-  static BumpPtrAllocator StaticAllocator;
-  SharedStartFunctionMap();
+  BumpPtrAllocator* StaticAllocator;
+  bool initialized;
+  SharedStartFunctionMap() {
+    initialized = false;
+  }
+
+  void initialize();
 };
 
 
@@ -200,6 +205,7 @@
     
     mainThread = 0;
     NumberOfThreads = 0;
+    if (!SharedStaticFunctions.initialized) SharedStaticFunctions.initialize();
   }
 public:
 

Modified: vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp?rev=86835&r1=86834&r2=86835&view=diff

==============================================================================
--- vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp (original)
+++ vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp Wed Nov 11 06:42:38 2009
@@ -98,9 +98,7 @@
 }
 
 
-BumpPtrAllocator SharedStartFunctionMap::StaticAllocator;
-
-SharedStartFunctionMap::SharedStartFunctionMap() {
+void SharedStartFunctionMap::initialize() {
   CamlFrame* currentFrame =
     (CamlFrame*)dlsym(SELF_HANDLE, "camlVmkitoptimized__frametable");
 
@@ -108,6 +106,7 @@
   void* previousPtr = 0;
   const char* previousName = 0;
   CamlFrame* previousFrame = currentFrame;
+  StaticAllocator = new BumpPtrAllocator();
 
   if (currentFrame) {
     while (true) {
@@ -116,7 +115,7 @@
       if (res) {
         if (previousPtr && info.dli_saddr != previousPtr) {
           StaticCamlMethodInfo* MI =
-            new(StaticAllocator, "StaticCamlMethodInfo")
+            new(*StaticAllocator, "StaticCamlMethodInfo")
             StaticCamlMethodInfo(previousFrame, previousPtr, previousName);
           addMethodInfo(MI, previousPtr);
         }





More information about the vmkit-commits mailing list