[llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp
Alkis Evlogimenos
alkis at cs.uiuc.edu
Mon Nov 15 12:24:15 PST 2004
Changes in directory llvm-java/lib/Compiler:
Compiler.cpp updated: 1.143 -> 1.144
---
Log message:
Lazily initialize class info, vtable info and object array vtable info
maps. Also disable class initialization functions as these pull way
too many methods.
---
Diffs of the changes: (+14 -8)
Index: llvm-java/lib/Compiler/Compiler.cpp
diff -u llvm-java/lib/Compiler/Compiler.cpp:1.143 llvm-java/lib/Compiler/Compiler.cpp:1.144
--- llvm-java/lib/Compiler/Compiler.cpp:1.143 Mon Nov 8 02:04:27 2004
+++ llvm-java/lib/Compiler/Compiler.cpp Mon Nov 15 14:24:03 2004
@@ -218,7 +218,7 @@
/// Initializes the class info map; in other words it adds the
/// class info of java.lang.Object.
- void initializeClassInfoMap() {
+ bool initializeClassInfoMap() {
DEBUG(std::cerr << "Building ClassInfo for: java/lang/Object\n");
ClassFile* cf = ClassFile::get("java/lang/Object");
ClassInfo& ci = c2ciMap_[cf];
@@ -255,11 +255,12 @@
assert(ci.type && "ClassInfo not initialized properly!");
emitStaticInitializers(cf);
DEBUG(std::cerr << "Built ClassInfo for: java/lang/Object\n");
+ return true;
}
/// Initializes the VTableInfo map; in other words it adds the
/// VTableInfo for java.lang.Object.
- void initializeVTableInfoMap() {
+ bool initializeVTableInfoMap() {
DEBUG(std::cerr << "Building VTableInfo for: java/lang/Object\n");
ClassFile* cf = ClassFile::get("java/lang/Object");
VTableInfo& vi = c2viMap_[cf];
@@ -349,10 +350,13 @@
"java/lang/Object<vtable>",
&module_);
DEBUG(std::cerr << "Built VTableInfo for: java/lang/Object\n");
+ return true;
}
/// Returns the ClassInfo object associated with this classfile.
const ClassInfo& getClassInfo(ClassFile* cf) {
+ static bool initialized = initializeClassInfoMap();
+
Class2ClassInfoMap::iterator it = c2ciMap_.lower_bound(cf);
if (it != c2ciMap_.end() && it->first == cf)
return it->second;
@@ -637,6 +641,8 @@
/// Returns the VTableInfo associated with this classfile.
const VTableInfo& getVTableInfo(ClassFile* cf) {
+ static bool initialized = initializeVTableInfoMap();
+
Class2VTableInfoMap::iterator it = c2viMap_.lower_bound(cf);
if (it != c2viMap_.end() && it->first == cf)
return it->second;
@@ -854,7 +860,7 @@
/// Initializes the VTableInfo map for object arrays; in other
/// words it adds the VTableInfo for java.lang.Object[].
- void initializeObjectArrayVTableInfoMap() {
+ bool initializeObjectArrayVTableInfoMap() {
DEBUG(std::cerr << "Building VTableInfo for: java/lang/Object[]\n");
ClassFile* cf = ClassFile::get("java/lang/Object");
VTableInfo& vi = ac2viMap_[cf];
@@ -927,6 +933,8 @@
}
const VTableInfo& getObjectArrayVTableInfo(ClassFile* cf) {
+ static bool initialized = initializeObjectArrayVTableInfoMap();
+
Class2VTableInfoMap::iterator it = ac2viMap_.lower_bound(cf);
if (it != ac2viMap_.end() && it->first == cf)
return it->second;
@@ -1210,6 +1218,8 @@
}
}
+// FIXME: This pulls in too many methods for now so we disable it.
+#if 0
// Call its class initialization method if it exists.
if (const Method* method = classfile->getMethod("<clinit>()V")) {
std::string name = classfile->getThisClass()->getName()->str();
@@ -1229,6 +1239,7 @@
LLVM_JAVA_STATIC_INIT " should have a terminator!");
new CallInst(init, "", hook->front().getTerminator());
}
+#endif
}
}
@@ -1295,11 +1306,6 @@
BasicBlock* staticInitBB = new BasicBlock("entry", staticInit);
new ReturnInst(NULL, staticInitBB);
- // Initialize type maps and vtable globals.
- initializeClassInfoMap();
- initializeVTableInfoMap();
- initializeObjectArrayVTableInfoMap();
-
// Create the method requested.
Function* function = getFunction(getMethod(classMethodDesc));
toCompileFunctions_.insert(function);
More information about the llvm-commits
mailing list