[llvm-commits] CVS: llvm-java/lib/Compiler/VMClass.h VMClass.cpp Resolver.cpp Compiler.cpp
Alkis Evlogimenos
alkis at cs.uiuc.edu
Fri Apr 1 19:06:46 PST 2005
Changes in directory llvm-java/lib/Compiler:
VMClass.h updated: 1.28 -> 1.29
VMClass.cpp updated: 1.38 -> 1.39
Resolver.cpp updated: 1.14 -> 1.15
Compiler.cpp updated: 1.275 -> 1.276
---
Log message:
Add the name of the class in the typeinfo struct inside the class
record.
---
Diffs of the changes: (+19 -1)
Compiler.cpp | 2 +-
Resolver.cpp | 2 ++
VMClass.cpp | 15 +++++++++++++++
VMClass.h | 1 +
4 files changed, 19 insertions(+), 1 deletion(-)
Index: llvm-java/lib/Compiler/VMClass.h
diff -u llvm-java/lib/Compiler/VMClass.h:1.28 llvm-java/lib/Compiler/VMClass.h:1.29
--- llvm-java/lib/Compiler/VMClass.h:1.28 Fri Apr 1 16:59:20 2005
+++ llvm-java/lib/Compiler/VMClass.h Fri Apr 1 21:06:35 2005
@@ -55,6 +55,7 @@
void computeLayout();
void computeClassRecord();
+ llvm::Constant* buildClassName() const;
llvm::Constant* buildSuperClassRecords() const;
llvm::Constant* buildInterfaceClassRecord(const VMClass* interface) const;
llvm::Constant* buildInterfaceClassRecords() const;
Index: llvm-java/lib/Compiler/VMClass.cpp
diff -u llvm-java/lib/Compiler/VMClass.cpp:1.38 llvm-java/lib/Compiler/VMClass.cpp:1.39
--- llvm-java/lib/Compiler/VMClass.cpp:1.38 Fri Apr 1 16:59:20 2005
+++ llvm-java/lib/Compiler/VMClass.cpp Fri Apr 1 21:06:35 2005
@@ -273,11 +273,26 @@
resolver_->getModule()));
}
+llvm::Constant* VMClass::buildClassName() const
+{
+ llvm::Constant* name = ConstantArray::get(getName());
+
+ return ConstantExpr::getPtrPtrFromArrayPtr(
+ new GlobalVariable(
+ name->getType(),
+ true,
+ GlobalVariable::ExternalLinkage,
+ name,
+ getName() + "<classname>",
+ resolver_->getModule()));
+}
+
llvm::Constant* VMClass::buildClassTypeInfo() const
{
std::vector<llvm::Constant*> init;
init.reserve(5);
+ init.push_back(buildClassName());
init.push_back(ConstantSInt::get(Type::IntTy, getNumSuperClasses()));
init.push_back(buildSuperClassRecords());
init.push_back(ConstantSInt::get(Type::IntTy, getInterfaceIndex()));
Index: llvm-java/lib/Compiler/Resolver.cpp
diff -u llvm-java/lib/Compiler/Resolver.cpp:1.14 llvm-java/lib/Compiler/Resolver.cpp:1.15
--- llvm-java/lib/Compiler/Resolver.cpp:1.14 Fri Apr 1 20:47:33 2005
+++ llvm-java/lib/Compiler/Resolver.cpp Fri Apr 1 21:06:35 2005
@@ -39,6 +39,7 @@
// };
//
// struct type_info {
+ // char** name;
// int depth;
// struct class_record** superclasses;
// int interfaceIndex;
@@ -49,6 +50,7 @@
// Compute the type_info type.
std::vector<const Type*> elements;
+ elements.push_back(PointerType::get(PointerType::get(Type::SByteTy)));
elements.push_back(Type::IntTy);
elements.push_back(PointerType::get(PointerType::get(classRecordType_)));
elements.push_back(Type::IntTy);
Index: llvm-java/lib/Compiler/Compiler.cpp
diff -u llvm-java/lib/Compiler/Compiler.cpp:1.275 llvm-java/lib/Compiler/Compiler.cpp:1.276
--- llvm-java/lib/Compiler/Compiler.cpp:1.275 Fri Apr 1 16:43:44 2005
+++ llvm-java/lib/Compiler/Compiler.cpp Fri Apr 1 21:06:35 2005
@@ -1044,7 +1044,7 @@
TMP, currentBB_);
// get the interfaces array of class records
std::vector<Value*> indices(2, ConstantUInt::get(Type::UIntTy, 0));
- indices.push_back(ConstantUInt::get(Type::UIntTy, 3));
+ indices.push_back(ConstantUInt::get(Type::UIntTy, 4));
Value* interfaceClassRecords =
new GetElementPtrInst(classRecord, indices, TMP, currentBB_);
interfaceClassRecords =
More information about the llvm-commits
mailing list