[llvm-commits] CVS: llvm-java/lib/Compiler/VMField.h VMField.cpp VMClass.cpp
Alkis Evlogimenos
alkis at cs.uiuc.edu
Wed Mar 30 19:15:19 PST 2005
Changes in directory llvm-java/lib/Compiler:
VMField.h updated: 1.3 -> 1.4
VMField.cpp updated: 1.4 -> 1.5
VMClass.cpp updated: 1.25 -> 1.26
---
Log message:
Remove unneeded parameters from VMField constructors.
---
Diffs of the changes: (+20 -25)
VMClass.cpp | 16 +++++++---------
VMField.cpp | 15 +++++++++++----
VMField.h | 14 ++------------
3 files changed, 20 insertions(+), 25 deletions(-)
Index: llvm-java/lib/Compiler/VMField.h
diff -u llvm-java/lib/Compiler/VMField.h:1.3 llvm-java/lib/Compiler/VMField.h:1.4
--- llvm-java/lib/Compiler/VMField.h:1.3 Tue Mar 29 11:11:39 2005
+++ llvm-java/lib/Compiler/VMField.h Wed Mar 30 21:15:08 2005
@@ -40,20 +40,10 @@
// Interface for VMClass.
// Create static field reference.
- VMField(const VMClass* parent, const VMClass* clazz, const Field* field);
+ VMField(const VMClass* parent, const Field* field);
// Create member field reference.
- VMField(const VMClass* parent,
- const VMClass* clazz,
- const Field* field,
- int index)
- : parent_(parent),
- class_(clazz),
- field_(field) {
- assert(!isStatic() && "This should be a member field!");
- data_.index = index;
- }
-
+ VMField(const VMClass* parent, const Field* field, int index);
public:
const std::string& getName() const { return field_->getName()->str(); }
Index: llvm-java/lib/Compiler/VMField.cpp
diff -u llvm-java/lib/Compiler/VMField.cpp:1.4 llvm-java/lib/Compiler/VMField.cpp:1.5
--- llvm-java/lib/Compiler/VMField.cpp:1.4 Tue Mar 29 11:37:08 2005
+++ llvm-java/lib/Compiler/VMField.cpp Wed Mar 30 21:15:08 2005
@@ -20,11 +20,9 @@
using namespace llvm;
using namespace llvm::Java;
-VMField::VMField(const VMClass* parent,
- const VMClass* clazz,
- const Field* field)
+VMField::VMField(const VMClass* parent, const Field* field)
: parent_(parent),
- class_(clazz),
+ class_(parent->getClass(field->getDescriptorIndex())),
field_(field)
{
assert(isStatic() && "This should be a static field!");
@@ -49,3 +47,12 @@
parent_->getName() + '/' + getName(),
parent_->getResolver()->getModule());
}
+
+VMField::VMField(const VMClass* parent, const Field* field, int index)
+ : parent_(parent),
+ class_(parent->getClass(field->getDescriptorIndex())),
+ field_(field)
+{
+ assert(!isStatic() && "This should be a member field!");
+ data_.index = index;
+}
Index: llvm-java/lib/Compiler/VMClass.cpp
diff -u llvm-java/lib/Compiler/VMClass.cpp:1.25 llvm-java/lib/Compiler/VMClass.cpp:1.26
--- llvm-java/lib/Compiler/VMClass.cpp:1.25 Tue Mar 29 11:37:08 2005
+++ llvm-java/lib/Compiler/VMClass.cpp Wed Mar 30 21:15:08 2005
@@ -119,19 +119,17 @@
const Fields& fields = classFile_->getFields();
for (unsigned i = 0, e = fields.size(); i != e; ++i) {
Field* field = fields[i];
- const VMClass* fc = getClass(field->getDescriptorIndex());
+ const std::string& name = field->getName()->str();
if (field->isStatic()) {
- fieldMap_.insert(std::make_pair(field->getName()->str(),
- VMField(this, fc, field)));
+ fieldMap_.insert(std::make_pair(name, VMField(this, field)));
}
else {
unsigned index = memberFields_.size() + 1;
- FieldMap::iterator i =
- fieldMap_.insert(std::make_pair(
- field->getName()->str(),
- VMField(this, fc, field, index))).first;
- memberFields_.push_back(&i->second);
- layout.push_back(fc->getType());
+ FieldMap::iterator i = fieldMap_.insert(
+ std::make_pair(name, VMField(this, field, index))).first;
+ const VMField* vmf = &i->second;
+ memberFields_.push_back(vmf);
+ layout.push_back(vmf->getClass()->getType());
}
}
}
More information about the llvm-commits
mailing list