[vmkit-commits] [vmkit] r73694 - in /vmkit/trunk/lib/JnJVM: Compiler/JavaAOTCompiler.cpp Compiler/JavaJIT.cpp VMCore/JavaArray.h VMCore/JavaClass.cpp VMCore/JavaClass.h VMCore/JavaConstantPool.cpp VMCore/JavaInitialise.cpp VMCore/JavaObject.h VMCore/JavaRuntimeJIT.cpp VMCore/JavaTypes.h VMCore/JavaUpcalls.h VMCore/Jnjvm.cpp VMCore/JnjvmClassLoader.cpp VMCore/Zip.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Thu Jun 18 06:18:42 PDT 2009


Author: geoffray
Date: Thu Jun 18 08:18:29 2009
New Revision: 73694

URL: http://llvm.org/viewvc/llvm-project?rev=73694&view=rev
Log:
Add a string when allocating in a bump pointer for debugging purposes.


Modified:
    vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp
    vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp
    vmkit/trunk/lib/JnJVM/VMCore/JavaArray.h
    vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
    vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h
    vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp
    vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp
    vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h
    vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp
    vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h
    vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.h
    vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp
    vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp
    vmkit/trunk/lib/JnJVM/VMCore/Zip.cpp

Modified: vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp?rev=73694&r1=73693&r2=73694&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp Thu Jun 18 08:18:29 2009
@@ -1671,7 +1671,7 @@
 void JavaAOTCompiler::compileFile(JnjvmClassLoader* JCL, const char* n) {
   name = n;
   mvm::BumpPtrAllocator A;
-  Jnjvm* vm = new(A) Jnjvm(A, (JnjvmBootstrapLoader*)JCL);
+  Jnjvm* vm = new(A, "Bootstrap loader") Jnjvm(A, (JnjvmBootstrapLoader*)JCL);
   JavaThread* th = new JavaThread(0, 0, vm);
   vm->setMainThread(th);
   th->start((void (*)(mvm::Thread*))mainCompilerStart);

Modified: vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp?rev=73694&r1=73693&r2=73694&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp Thu Jun 18 08:18:29 2009
@@ -890,7 +890,8 @@
   
   exploreOpcodes(&compilingClass->bytes->elements[start], codeLen);
   compilingMethod->enveloppes = 
-    new (compilingClass->classLoader->allocator) Enveloppe[nbEnveloppes];
+    new (compilingClass->classLoader->allocator, "Enveloppes")
+    Enveloppe[nbEnveloppes];
   compilingMethod->nbEnveloppes = nbEnveloppes;
   nbEnveloppes = 0;
  
@@ -1918,7 +1919,7 @@
 #ifndef ISOLATE_SHARING
   // ok now the cache
   Enveloppe& enveloppe = buggyVirtual ?
-    *(new (compilingClass->classLoader->allocator) Enveloppe()) :
+    *(new (compilingClass->classLoader->allocator, "Enveloppe") Enveloppe()) :
     compilingMethod->enveloppes[nbEnveloppes++];
   if (!inlining)
     enveloppe.initialise(compilingClass, name, signature->keyName);

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaArray.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaArray.h?rev=73694&r1=73693&r2=73694&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaArray.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaArray.h Thu Jun 18 08:18:29 2009
@@ -97,7 +97,7 @@
   /// its objects in permanent memory, not with the garbage collector.
   void* operator new(size_t sz, mvm::BumpPtrAllocator& allocator,
                      sint32 size) {
-    return allocator.Allocate(sizeof(ssize_t) + size * sizeof(uint16));
+    return allocator.Allocate(sizeof(ssize_t) + size * sizeof(uint16), "UTF8");
   }
   
   UTF8(sint32 n) {

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp?rev=73694&r1=73693&r2=73694&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp Thu Jun 18 08:18:29 2009
@@ -288,7 +288,7 @@
   VirtualTable* VT = virtualVT;
   uint32 size = sizeof(JavaObject) + sizeof(ssize_t) + (n << logSize);
   
-  JavaArray* res = (JavaArray*)allocator.Allocate(size);
+  JavaArray* res = (JavaArray*)allocator.Allocate(size, "Array");
   ((void**)res)[0] = VT;
   res->size = n;
   return res;
@@ -602,7 +602,8 @@
 #ifdef USE_GC_BOEHM
   void* val = GC_MALLOC(getStaticSize());
 #else
-  void* val = classLoader->allocator.Allocate(getStaticSize());
+  void* val = classLoader->allocator.Allocate(getStaticSize(),
+                                              "Static instance");
 #endif
   setStaticInstance(val);
   return val;
@@ -642,7 +643,7 @@
   uint16 nbI = reader.readU2();
 
   interfaces = (Class**)
-    classLoader->allocator.Allocate(nbI * sizeof(Class*));
+    classLoader->allocator.Allocate(nbI * sizeof(Class*), "Interfaces");
   
   // Do not set nbInterfaces yet, we may be interrupted by the GC
   // in anon-cooperative environment.
@@ -707,7 +708,7 @@
 Attribut* Class::readAttributs(Reader& reader, uint16& size) {
   uint16 nba = reader.readU2();
  
-  Attribut* attributs = new(classLoader->allocator) Attribut[nba];
+  Attribut* attributs = new(classLoader->allocator, "Attributs") Attribut[nba];
 
   for (int i = 0; i < nba; i++) {
     const UTF8* attName = ctpInfo->UTF8At(reader.readU2());
@@ -725,7 +726,7 @@
 
 void Class::readFields(Reader& reader) {
   uint16 nbFields = reader.readU2();
-  virtualFields = new (classLoader->allocator) JavaField[nbFields];
+  virtualFields = new (classLoader->allocator, "Fields") JavaField[nbFields];
   staticFields = virtualFields + nbFields;
   for (int i = 0; i < nbFields; i++) {
     uint16 access = reader.readU2();
@@ -781,7 +782,7 @@
 
 void Class::readMethods(Reader& reader) {
   uint16 nbMethods = reader.readU2();
-  virtualMethods = new(classLoader->allocator) JavaMethod[nbMethods];
+  virtualMethods = new(classLoader->allocator, "Methods") JavaMethod[nbMethods];
   staticMethods = virtualMethods + nbMethods;
   for (int i = 0; i < nbMethods; i++) {
     uint16 access = reader.readU2();
@@ -901,7 +902,8 @@
         } else if (clOuter == this) {
           if (!innerClasses) {
             innerClasses = (Class**)
-              classLoader->allocator.Allocate(nbi * sizeof(Class*));
+              classLoader->allocator.Allocate(nbi * sizeof(Class*),
+                                              "Inner classes");
           }
           clInner->setInnerAccess(accessFlags);
           if (!innerName) isAnonymous = true;
@@ -1288,7 +1290,8 @@
 
     mvm::BumpPtrAllocator& allocator = C->classLoader->allocator;
     secondaryTypes = (JavaVirtualTable**)
-      allocator.Allocate(sizeof(JavaVirtualTable*) * nbSecondaryTypes);  
+      allocator.Allocate(sizeof(JavaVirtualTable*) * nbSecondaryTypes,
+                         "Secondary types");  
     
     if (outOfDepth) {
       secondaryTypes[0] = this;
@@ -1423,7 +1426,8 @@
           nbSecondaryTypes = base->nbInterfaces + superVT->nbSecondaryTypes +
                                 addSuper;
           secondaryTypes = (JavaVirtualTable**)
-            allocator.Allocate(sizeof(JavaVirtualTable*) * nbSecondaryTypes);
+            allocator.Allocate(sizeof(JavaVirtualTable*) * nbSecondaryTypes,
+                               "Secondary types");
          
           // Put the super in the list of secondary types.
           if (addSuper) secondaryTypes[0] = superVT;
@@ -1468,7 +1472,8 @@
         nbSecondaryTypes = superVT->nbSecondaryTypes + 2 + outOfDepth;
 
         secondaryTypes = (JavaVirtualTable**)
-          allocator.Allocate(sizeof(JavaVirtualTable*) * nbSecondaryTypes);
+          allocator.Allocate(sizeof(JavaVirtualTable*) * nbSecondaryTypes,
+                             "Secondary types");
         
         // First, copy the list of secondary types from super array.
         memcpy(secondaryTypes + outOfDepth, superVT->secondaryTypes,
@@ -1520,7 +1525,8 @@
       
       mvm::BumpPtrAllocator& allocator = JCL->allocator;
       secondaryTypes = (JavaVirtualTable**)
-        allocator.Allocate(sizeof(JavaVirtualTable*) * nbSecondaryTypes);
+        allocator.Allocate(sizeof(JavaVirtualTable*) * nbSecondaryTypes,
+                           "Secondary types");
 
       // The interfaces have already been resolved.
       secondaryTypes[0] = cl->interfaces[0]->virtualVT;

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h?rev=73694&r1=73693&r2=73694&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h Thu Jun 18 08:18:29 2009
@@ -398,7 +398,7 @@
     }
 
     static FatLock* allocate(UserCommonClass* cl) {
-      return new(cl->classLoader->allocator) FatLock();
+      return new(cl->classLoader->allocator, "Class fat lock") FatLock();
     }
 
     void acquire() {
@@ -684,7 +684,7 @@
   template<typename Ty> 
   Ty *getInfo() {
     if (!JInfo) {
-      JInfo = new(classLoader->allocator) Ty(this);
+      JInfo = new(classLoader->allocator, "Class JIT info") Ty(this);
     }   
 
     assert((void*)dynamic_cast<Ty*>(JInfo) == (void*)JInfo &&
@@ -1161,7 +1161,7 @@
   template<typename Ty> 
   Ty *getInfo() {
     if (!JInfo) {
-      JInfo = new(classDef->classLoader->allocator) Ty(this);
+      JInfo = new(classDef->classLoader->allocator, "Method JIT info") Ty(this);
     }   
 
     assert((void*)dynamic_cast<Ty*>(JInfo) == (void*)JInfo &&
@@ -1284,7 +1284,7 @@
   template<typename Ty> 
   Ty *getInfo() {
     if (!JInfo) {
-      JInfo = new(classDef->classLoader->allocator) Ty(this);
+      JInfo = new(classDef->classLoader->allocator, "Field JIT info") Ty(this);
     }   
 
     assert((void*)dynamic_cast<Ty*>(JInfo) == (void*)JInfo &&

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp?rev=73694&r1=73693&r2=73694&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp Thu Jun 18 08:18:29 2009
@@ -157,7 +157,7 @@
 JavaConstantPool::operator new(size_t sz, mvm::BumpPtrAllocator& allocator,
                                uint32 ctpSize) {
   uint32 size = sz + ctpSize * (sizeof(void*) + sizeof(sint32) + sizeof(uint8));
-  return allocator.Allocate(size);
+  return allocator.Allocate(size, "Constant pool");
 }
 
 JavaConstantPool::JavaConstantPool(Class* cl, Reader& reader, uint32 size) {

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp?rev=73694&r1=73693&r2=73694&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaInitialise.cpp Thu Jun 18 08:18:29 2009
@@ -34,7 +34,7 @@
   mvm::BumpPtrAllocator* C = new mvm::BumpPtrAllocator();
   JnjvmBootstraLoader* bootstrapLoader = 
     new(*C) JnjvmBootstrapLoader(*C, JCL->getCompiler());
-  Jnjvm* vm = new(*A) Jnjvm(*A, bootstrapLoader);
+  Jnjvm* vm = new(*A, "VM") Jnjvm(*A, bootstrapLoader);
   return vm;
 }
 #else
@@ -42,12 +42,12 @@
 JnjvmClassLoader*
 mvm::VirtualMachine::initialiseJVM(JavaCompiler* Comp, bool dlLoad) {
   mvm::BumpPtrAllocator* A = new mvm::BumpPtrAllocator();
-  return new(*A) JnjvmBootstrapLoader(*A, Comp, dlLoad);
+  return new(*A, "Bootstrap loader") JnjvmBootstrapLoader(*A, Comp, dlLoad);
 }
 
 mvm::VirtualMachine* mvm::VirtualMachine::createJVM(JnjvmClassLoader* C) {
   mvm::BumpPtrAllocator* A = new mvm::BumpPtrAllocator();
-  Jnjvm* vm = new(*A) Jnjvm(*A, (JnjvmBootstrapLoader*)C);
+  Jnjvm* vm = new(*A, "VM") Jnjvm(*A, (JnjvmBootstrapLoader*)C);
   return vm;
 }
 

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h?rev=73694&r1=73693&r2=73694&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h Thu Jun 18 08:18:29 2009
@@ -160,7 +160,7 @@
   ///
   void* operator new(size_t sz, mvm::BumpPtrAllocator& allocator,
                      uint32 nbMethods) {
-    return allocator.Allocate(sizeof(uintptr_t) * (nbMethods));
+    return allocator.Allocate(sizeof(uintptr_t) * (nbMethods), "Virtual table");
   }
 
   /// JavaVirtualTable - Create JavaVirtualTable objects for classes, array

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp?rev=73694&r1=73693&r2=73694&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp Thu Jun 18 08:18:29 2009
@@ -82,7 +82,7 @@
     } else {
       mvm::BumpPtrAllocator& alloc = 
         enveloppe->classDef->classLoader->allocator;
-      rcache = new(alloc) CacheNode(enveloppe);
+      rcache = new(alloc, "CacheNode") CacheNode(enveloppe);
     }
     
     rcache->methPtr = dmeth->compiledPtr();

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h?rev=73694&r1=73693&r2=73694&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h Thu Jun 18 08:18:29 2009
@@ -276,7 +276,8 @@
   ///
   void* operator new(size_t sz, mvm::BumpPtrAllocator& allocator,
                      sint32 size) {
-    return allocator.Allocate(sizeof(Signdef) + size * sizeof(Typedef));
+    return allocator.Allocate(sizeof(Signdef) + size * sizeof(Typedef),
+                              "Signdef");
   }
 
   
@@ -338,7 +339,7 @@
   template<typename Ty> 
   Ty *getInfo() {
     if (!JInfo) {
-      JInfo = new(initialLoader->allocator) Ty(this);
+      JInfo = new(initialLoader->allocator, "Sign info") Ty(this);
     }   
 
     assert((void*)dynamic_cast<Ty*>(JInfo) == (void*)JInfo &&

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.h?rev=73694&r1=73693&r2=73694&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.h Thu Jun 18 08:18:29 2009
@@ -18,7 +18,7 @@
   vm->loadName(vm->asciizConstructUTF8(name), true, false)                        
 
 #define UPCALL_PRIMITIVE_CLASS(loader, name, nb)                               \
-  new(loader->allocator)                                                       \
+  new(loader->allocator, "Primitive class")                                    \
           UserClassPrimitive(loader, loader->asciizConstructUTF8(name), nb)    \
 
 #define UPCALL_FIELD(vm, cl, name, type, acc)                                  \

Modified: vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp?rev=73694&r1=73693&r2=73694&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp Thu Jun 18 08:18:29 2009
@@ -706,7 +706,7 @@
     else end += index;
 
     sint32 length = end - index - 1;
-    char* name = (char*)vm->allocator.Allocate(length + 1);
+    char* name = (char*)vm->allocator.Allocate(length + 1, "class name");
     memcpy(name, &(ptr[index]), length);
     name[length] = 0;
     return name;
@@ -719,7 +719,7 @@
                                           int i) {
   jarFile = argv[i];
   uint32 size = 2 + strlen(vm->classpath) + strlen(jarFile);
-  char* temp = (char*)vm->allocator.Allocate(size);
+  char* temp = (char*)vm->allocator.Allocate(size, "jar file");
 
   sprintf(temp, "%s:%s", vm->classpath, jarFile);
   vm->setClasspath(temp);
@@ -968,7 +968,7 @@
     uint32 size = upcalls->newString->virtualTableSize * sizeof(uintptr_t);
     
     JavaString::internStringVT = 
-      (JavaVirtualTable*)bootstrapLoader->allocator.Allocate(size);
+      (JavaVirtualTable*)bootstrapLoader->allocator.Allocate(size, "String VT");
 
     memcpy(JavaString::internStringVT, stringVT, size);
     

Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp?rev=73694&r1=73693&r2=73694&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp Thu Jun 18 08:18:29 2009
@@ -61,10 +61,10 @@
   
 	TheCompiler = Comp;
   
-  hashUTF8 = new(allocator) UTF8Map(allocator, 0);
-  classes = new(allocator) ClassMap();
-  javaTypes = new(allocator) TypeMap(); 
-  javaSignatures = new(allocator) SignMap(); 
+  hashUTF8 = new(allocator, "UTF8Map") UTF8Map(allocator, 0);
+  classes = new(allocator, "ClassMap") ClassMap();
+  javaTypes = new(allocator, "TypeMap") TypeMap(); 
+  javaSignatures = new(allocator, "SignMap") SignMap(); 
   
   bootClasspathEnv = getenv("JNJVM_BOOTCLASSPATH");
   if (!bootClasspathEnv) {
@@ -77,7 +77,7 @@
   }
   
   
-  upcalls = new(allocator) Classpath();
+  upcalls = new(allocator, "Classpath") Classpath();
   bootstrapLoader = this;
    
   // Try to find if we have a pre-compiled rt.jar
@@ -129,7 +129,8 @@
    
   if (!upcalls->OfChar) {
     // Allocate interfaces.
-    InterfacesArray = (Class**)allocator.Allocate(2 * sizeof(UserClass*));
+    InterfacesArray = (Class**)allocator.Allocate(2 * sizeof(UserClass*),
+                                                  "Interface array");
     ClassArray::InterfacesArray = InterfacesArray;
 
     // Create the primitive classes.
@@ -256,11 +257,11 @@
   bootstrapLoader = JCL.bootstrapLoader;
   TheCompiler = bootstrapLoader->getCompiler()->Create("Applicative loader");
   
-  hashUTF8 = new(allocator) UTF8Map(allocator,
-                                    bootstrapLoader->upcalls->ArrayOfChar);
-  classes = new(allocator) ClassMap();
-  javaTypes = new(allocator) TypeMap();
-  javaSignatures = new(allocator) SignMap();
+  hashUTF8 = new(allocator, "UTF8Map")
+    UTF8Map(allocator, bootstrapLoader->upcalls->ArrayOfChar);
+  classes = new(allocator, "ClassMap") ClassMap();
+  javaTypes = new(allocator, "TypeMap") TypeMap();
+  javaSignatures = new(allocator, "SignMap") SignMap();
 
   javaLoader = loader;
   isolate = I;
@@ -628,7 +629,7 @@
   UserClass* res = 0;
   if (I == End) {
     const UTF8* internalName = readerConstructUTF8(name->elements, name->size);
-    res = new(allocator) UserClass(this, internalName, bytes);
+    res = new(allocator, "Class") UserClass(this, internalName, bytes);
     classes->map.insert(std::make_pair(internalName, res));
   } else {
     res = ((UserClass*)(I->second));
@@ -648,7 +649,8 @@
   UserClassArray* res = 0;
   if (I == End) {
     const UTF8* internalName = readerConstructUTF8(name->elements, name->size);
-    res = new(allocator) UserClassArray(this, internalName, baseClass);
+    res = new(allocator, "Array class") UserClassArray(this, internalName,
+                                                       baseClass);
     classes->map.insert(std::make_pair(internalName, res));
   } else {
     res = ((UserClassArray*)(I->second));
@@ -662,10 +664,10 @@
   Typedef* res = 0;
   switch (cur) {
     case I_TAB :
-      res = new(allocator) ArrayTypedef(name);
+      res = new(allocator, "ArrayTypedef") ArrayTypedef(name);
       break;
     case I_REF :
-      res = new(allocator) ObjectTypedef(name, hashUTF8);
+      res = new(allocator, "ObjectTypedef") ObjectTypedef(name, hashUTF8);
       break;
     default :
       UserClassPrimitive* cl = 
@@ -673,7 +675,8 @@
       assert(cl && "No primitive");
       bool unsign = (cl == bootstrapLoader->upcalls->OfChar || 
                      cl == bootstrapLoader->upcalls->OfBool);
-      res = new(allocator) PrimitiveTypedef(name, cl, unsign, cur);
+      res = new(allocator, "PrimitiveTypedef") PrimitiveTypedef(name, cl,
+                                                                unsign, cur);
   }
   return res;
 }
@@ -811,7 +814,8 @@
       (VMClassLoader*)(upcalls->vmdataClassLoader->getObjectField(loader));
     if (!vmdata) {
       mvm::BumpPtrAllocator* A = new mvm::BumpPtrAllocator();    
-      JCL = new(*A) JnjvmClassLoader(*A, *vm->bootstrapLoader, loader, vm);
+      JCL = new(*A, "Class loader") JnjvmClassLoader(*A, *vm->bootstrapLoader,
+                                                     loader, vm);
       vmdata = VMClassLoader::allocate(JCL);
       (upcalls->vmdataClassLoader->setObjectField(loader, (JavaObject*)vmdata));
     }
@@ -905,7 +909,7 @@
           stat(rp, &st);
           if ((st.st_mode & S_IFMT) == S_IFDIR) {
             unsigned int len = strlen(rp);
-            char* temp = (char*)allocator.Allocate(len + 2);
+            char* temp = (char*)allocator.Allocate(len + 2, "Boot classpath");
             memcpy(temp, rp, len);
             temp[len] = Jnjvm::dirSeparator[0];
             temp[len + 1] = 0;
@@ -914,7 +918,8 @@
             ArrayUInt8* bytes =
               Reader::openFile(this, rp);
             if (bytes) {
-              ZipArchive *archive = new(allocator) ZipArchive(bytes, allocator);
+              ZipArchive *archive = new(allocator, "ZipArchive")
+                ZipArchive(bytes, allocator);
               if (archive) {
                 bootArchives.push_back(archive);
               }

Modified: vmkit/trunk/lib/JnJVM/VMCore/Zip.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Zip.cpp?rev=73694&r1=73693&r2=73694&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/Zip.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/Zip.cpp Thu Jun 18 08:18:29 2009
@@ -124,7 +124,7 @@
 
   while (true) {
     if (memcmp(&(reader.bytes->elements[temp]), HDR_CENTRAL, 4)) return;
-    ZipFile* ptr = new(allocator) ZipFile();
+    ZipFile* ptr = new(allocator, "ZipFile") ZipFile();
     reader.cursor = temp + 4 + C_COMPRESSION_METHOD;
     ptr->compressionMethod = readEndianDep2(reader);
     
@@ -145,7 +145,8 @@
         (reader.max - temp) < ptr->filenameLength)
       return;
 
-    ptr->filename = (char*)allocator.Allocate(ptr->filenameLength + 1);
+    ptr->filename = (char*)allocator.Allocate(ptr->filenameLength + 1,
+                                              "Zip file name");
     memcpy(ptr->filename, &(reader.bytes->elements[temp]), ptr->filenameLength);
     ptr->filename[ptr->filenameLength] = 0;
 





More information about the vmkit-commits mailing list