[vmkit-commits] [vmkit] r71660 - in /vmkit/trunk/lib/JnJVM: Compiler/JavaAOTCompiler.cpp VMCore/JnjvmClassLoader.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Wed May 13 07:37:55 PDT 2009


Author: geoffray
Date: Wed May 13 09:37:43 2009
New Revision: 71660

URL: http://llvm.org/viewvc/llvm-project?rev=71660&view=rev
Log:
Hash the UTF8s in vmjcAddClass, not in the Init method, otherwise
the Init method is too big for LLVM.


Modified:
    vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp
    vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp Wed May 13 09:37:43 2009
@@ -1404,7 +1404,9 @@
       CallInst::Create(AddString, Args, Args + 2, "", currentBlock);
     }
   }
-  
+ 
+#if 0
+  // Disable initialization of UTF8s, it makes the Init method too big.
   // If we have defined some UTF8s.
   if (utf8s.begin() != utf8s.end()) {
     llvmArgs.clear();
@@ -1423,7 +1425,8 @@
       CallInst::Create(AddUTF8, Args, Args + 2, "", currentBlock);
     }
   }
-  
+#endif
+
   for (native_class_iterator i = nativeClasses.begin(), 
        e = nativeClasses.end(); i != e; ++i) {
     if (isCompiling(i->first)) {

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp Wed May 13 09:37:43 2009
@@ -1072,6 +1072,8 @@
                                         CommonClass* cl) {
   cl->classLoader = JCL;
   
+  JCL->hashUTF8->insert(cl->name);
+
   if (cl->isClass()) {
     Class* realCl = cl->asClass();
 		// To avoid data alignment in the llvm assembly emitter, we set the
@@ -1079,6 +1081,30 @@
     realCl->staticMethods = realCl->virtualMethods + realCl->nbVirtualMethods;
     realCl->staticFields = realCl->virtualFields + realCl->nbVirtualFields;
   	cl->virtualVT->setNativeTracer(cl->virtualVT->tracer, "");
+
+    for (uint32 i = 0; i< realCl->nbStaticMethods; ++i) {
+      JavaMethod& meth = realCl->staticMethods[i];
+      JCL->hashUTF8->insert(meth.name);
+      JCL->hashUTF8->insert(meth.type);
+    }
+    
+    for (uint32 i = 0; i< realCl->nbVirtualMethods; ++i) {
+      JavaMethod& meth = realCl->virtualMethods[i];
+      JCL->hashUTF8->insert(meth.name);
+      JCL->hashUTF8->insert(meth.type);
+    }
+    
+    for (uint32 i = 0; i< realCl->nbStaticFields; ++i) {
+      JavaField& field = realCl->staticFields[i];
+      JCL->hashUTF8->insert(field.name);
+      JCL->hashUTF8->insert(field.type);
+    }
+    
+    for (uint32 i = 0; i< realCl->nbVirtualFields; ++i) {
+      JavaField& field = realCl->virtualFields[i];
+      JCL->hashUTF8->insert(field.name);
+      JCL->hashUTF8->insert(field.type);
+    }
   }
 
 	if (!cl->isPrimitive())
@@ -1087,7 +1113,8 @@
 }
 
 extern "C" void vmjcGetClassArray(JnjvmClassLoader* JCL, ClassArray** ptr,
-                              const UTF8* name) {
+                                  const UTF8* name) {
+  JCL->hashUTF8->insert(name);
   *ptr = JCL->constructArray(name);
 }
 





More information about the vmkit-commits mailing list