[llvm-commits] CVS: llvm-java/lib/Compiler/VMClass.cpp
Alkis Evlogimenos
alkis at cs.uiuc.edu
Thu Mar 31 21:00:17 PST 2005
Changes in directory llvm-java/lib/Compiler:
VMClass.cpp updated: 1.33 -> 1.34
---
Log message:
Compute interface index for classes as well (it represents the max
interface index of the interfaces it implements).
---
Diffs of the changes: (+15 -6)
VMClass.cpp | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
Index: llvm-java/lib/Compiler/VMClass.cpp
diff -u llvm-java/lib/Compiler/VMClass.cpp:1.33 llvm-java/lib/Compiler/VMClass.cpp:1.34
--- llvm-java/lib/Compiler/VMClass.cpp:1.33 Thu Mar 31 12:12:19 2005
+++ llvm-java/lib/Compiler/VMClass.cpp Thu Mar 31 23:00:06 2005
@@ -201,12 +201,10 @@
// In a classfile an interface is as if it inherits
// java/lang/Object, but java/lang/Class/getSuperClass() should
- // return null on any interface class. Thus we do the same here.
- if (classFile_->isInterface())
- interfaceIndex_ = resolver_->getNextInterfaceIndex();
- else {
- // Build the super classes array. The first class is the
- // direct super class of this class.
+ // return null on any interface class. So we only add
+ // superclasses to if this is not an interface.
+ if (!classFile_->isInterface()) {
+ // The first class is the direct super class of this class.
superClasses_.reserve(superClass->getNumSuperClasses() + 1);
superClasses_.push_back(superClass);
for (unsigned i = 0, e = superClass->getNumSuperClasses(); i != e; ++i)
@@ -229,6 +227,17 @@
interfaces_.end());
}
+ // The interface index for an interface is a unique number generated
+ // from the resolver.
+ if (isInterface())
+ interfaceIndex_ = resolver_->getNextInterfaceIndex();
+ // For a class it is the max index of all the interfaces it implements.
+ else {
+ for (unsigned i = 0, e = getNumInterfaces(); i != e; ++i)
+ interfaceIndex_ =
+ std::max(interfaceIndex_, getInterface(i)->getInterfaceIndex());
+ }
+
computeLayout();
computeClassRecord();
More information about the llvm-commits
mailing list