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

Nicolas Geoffray nicolas.geoffray at lip6.fr
Mon Jul 25 12:49:42 PDT 2011


Author: geoffray
Date: Mon Jul 25 14:49:42 2011
New Revision: 135941

URL: http://llvm.org/viewvc/llvm-project?rev=135941&view=rev
Log:
Use the VM allocator to allocate caml frames. Also make sure the function cache is big enough so that we don't resize at startup.


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=135941&r1=135940&r2=135941&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/VirtualMachine.h (original)
+++ vmkit/trunk/include/mvm/VirtualMachine.h Mon Jul 25 14:49:42 2011
@@ -51,7 +51,7 @@
   /// removeMethodInfos - Remove all MethodInfo owned by the given owner.
   void removeMethodInfos(void* owner);
 
-  FunctionMap(CamlFrames** frames);
+  FunctionMap(BumpPtrAllocator& allocator, CamlFrames** frames);
 };
 
 /// VirtualMachine - This class is the root of virtual machine classes. It
@@ -60,7 +60,7 @@
 class VirtualMachine : public mvm::PermanentObject {
 protected:
   VirtualMachine(mvm::BumpPtrAllocator &Alloc, mvm::CamlFrames** frames) :
-		  allocator(Alloc), FunctionsCache(frames) {
+		  allocator(Alloc), FunctionsCache(Alloc, frames) {
     mainThread = NULL;
     numberOfThreads = 0;
     doExit = false;

Modified: vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp?rev=135941&r1=135940&r2=135941&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp (original)
+++ vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp Mon Jul 25 14:49:42 2011
@@ -87,9 +87,9 @@
 
 static BumpPtrAllocator* StaticAllocator = NULL;
 
-FunctionMap::FunctionMap(CamlFrames** allFrames) {
+FunctionMap::FunctionMap(BumpPtrAllocator& allocator, CamlFrames** allFrames) {
   if (allFrames == NULL) return;
-  StaticAllocator = new BumpPtrAllocator();
+  Functions.resize(40000); // Make sure the cache is big enough.
   int i = 0;
   CamlFrames* frames = NULL;
   while ((frames = allFrames[i++]) != NULL) {
@@ -97,7 +97,7 @@
     while (decoder.hasNext()) {
       CamlFrame* frame = decoder.next();
       CamlMethodInfo* MI =
-          new(*StaticAllocator, "CamlMethodInfo") CamlMethodInfo(frame);
+          new(allocator, "CamlMethodInfo") CamlMethodInfo(frame);
       addMethodInfoNoLock(MI, frame->ReturnAddress);
     }
   }





More information about the vmkit-commits mailing list