[llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp

Alkis Evlogimenos alkis at cs.uiuc.edu
Tue Sep 21 15:49:21 PDT 2004



Changes in directory llvm-java/lib/Compiler:

Compiler.cpp updated: 1.108 -> 1.109
---
Log message:

In the case of an interface, build the typeinfo right: the pointer to
the implemented interfaces array should be set to ((void*)-1).


---
Diffs of the changes:  (+10 -0)

Index: llvm-java/lib/Compiler/Compiler.cpp
diff -u llvm-java/lib/Compiler/Compiler.cpp:1.108 llvm-java/lib/Compiler/Compiler.cpp:1.109
--- llvm-java/lib/Compiler/Compiler.cpp:1.108	Tue Sep 21 17:23:00 2004
+++ llvm-java/lib/Compiler/Compiler.cpp	Tue Sep 21 17:49:11 2004
@@ -520,6 +520,16 @@
 
     std::pair<int, llvm::Constant*>
     buildInterfacesVTables(ClassFile* cf, const VTableInfo& vi) {
+      // if this is an interface then we are not implementing any
+      // interfaces so the lastInterface field is our index and the
+      // pointer to the array of interface vtables is an all-ones
+      // value
+      if (cf->isInterface())
+        return std::make_pair(
+          getClassInfo(cf).interfaceIdx,
+          ConstantExpr::getCast(
+            ConstantIntegral::getAllOnesValue(Type::LongTy),
+            PointerType::get(PointerType::get(VTableInfo::VTableTy))));
 
       std::vector<llvm::Constant*> vtables;
       const Classes& interfaces = cf->getInterfaces();






More information about the llvm-commits mailing list