[llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp
Alkis Evlogimenos
alkis at cs.uiuc.edu
Tue Jan 25 00:40:39 PST 2005
Changes in directory llvm-java/lib/Compiler:
Compiler.cpp updated: 1.193 -> 1.194
---
Log message:
Do not emit interface vtables more than once. This fixes
Collection1.java. Also add some more classes to compile so that
Collections.java and Collection2.java do not fail with missing
functions.
---
Diffs of the changes: (+16 -6)
Compiler.cpp | 22 ++++++++++++++++------
1 files changed, 16 insertions(+), 6 deletions(-)
Index: llvm-java/lib/Compiler/Compiler.cpp
diff -u llvm-java/lib/Compiler/Compiler.cpp:1.193 llvm-java/lib/Compiler/Compiler.cpp:1.194
--- llvm-java/lib/Compiler/Compiler.cpp:1.193 Mon Jan 24 07:47:17 2005
+++ llvm-java/lib/Compiler/Compiler.cpp Tue Jan 25 02:40:28 2005
@@ -587,6 +587,9 @@
/// Builds an interface VTable for the specified <class,interface>
/// pair.
llvm::Constant* buildInterfaceVTable(ClassFile* cf, ClassFile* interface) {
+ DEBUG(std::cerr << "Building interface vtable: "
+ << interface->getThisClass()->getName()->str() << " for: "
+ << cf->getThisClass()->getName()->str() << '\n');
const VTableInfo& classVI = getVTableInfo(cf);
const VTableInfo& interfaceVI = getVTableInfo(interface);
@@ -638,11 +641,14 @@
const ClassInfo& ifaceCi = getClassInfo(ifaceCf);
if (ifaceCi.interfaceIdx >= vtables.size())
vtables.resize(ifaceCi.interfaceIdx+1, nullVTable);
- vtables[ifaceCi.interfaceIdx] = buildInterfaceVTable(cf, ifaceCf);
- const Classes& interfaces = ifaceCf->getInterfaces();
- for (unsigned i = 0, e = interfaces.size(); i != e; ++i) {
- ClassFile* otherCf = ClassFile::get(interfaces[i]->getName()->str());
- insertVtablesForInterface(vtables, cf, otherCf);
+ // Add this interface's vtable if it was not added before.
+ if (vtables[ifaceCi.interfaceIdx] == nullVTable) {
+ vtables[ifaceCi.interfaceIdx] = buildInterfaceVTable(cf, ifaceCf);
+ const Classes& interfaces = ifaceCf->getInterfaces();
+ for (unsigned i = 0, e = interfaces.size(); i != e; ++i) {
+ ClassFile* otherCf = ClassFile::get(interfaces[i]->getName()->str());
+ insertVtablesForInterface(vtables, cf, otherCf);
+ }
}
}
@@ -1308,8 +1314,12 @@
classMethodDesc.find("java/util/NoSuchElementException") != 0 &&
classMethodDesc.find("java/util/AbstractCollection") != 0 &&
classMethodDesc.find("java/util/AbstractList") != 0 &&
+ classMethodDesc.find("java/util/AbstractSet") != 0 &&
+ classMethodDesc.find("java/util/AbstractMap") != 0 &&
classMethodDesc.find("java/util/AbstractSequentialList") != 0 &&
- classMethodDesc.find("java/util/LinkedList") != 0) {
+ classMethodDesc.find("java/util/LinkedList") != 0 &&
+ classMethodDesc.find("java/util/TreeMap") != 0 &&
+ classMethodDesc.find("java/util/TreeSet") != 0) {
DEBUG(std::cerr << "Skipping compilation of method: "
<< classMethodDesc << '\n');
return function;
More information about the llvm-commits
mailing list