[llvm-commits] CVS: llvm-java/include/llvm/Java/ClassFile.h
Alkis Evlogimenos
alkis at cs.uiuc.edu
Sat Feb 12 12:39:42 PST 2005
Changes in directory llvm-java/include/llvm/Java:
ClassFile.h updated: 1.30 -> 1.31
---
Log message:
Now that we have parent pointers, shrink the Field and Method classes
a bit by storing indices to the constant pool instead of pointers to
the constants themselves. While we are at it introduce a
non-instanciable class Member that both Field and Method inherit from.
---
Diffs of the changes: (+26 -32)
ClassFile.h | 58 ++++++++++++++++++++++++++--------------------------------
1 files changed, 26 insertions(+), 32 deletions(-)
Index: llvm-java/include/llvm/Java/ClassFile.h
diff -u llvm-java/include/llvm/Java/ClassFile.h:1.30 llvm-java/include/llvm/Java/ClassFile.h:1.31
--- llvm-java/include/llvm/Java/ClassFile.h:1.30 Sat Feb 12 14:17:57 2005
+++ llvm-java/include/llvm/Java/ClassFile.h Sat Feb 12 14:38:50 2005
@@ -283,14 +283,34 @@
std::ostream& dump(std::ostream& os) const;
};
- class Field {
- private:
+ class Member {
+ protected:
const ClassFile* parent_;
uint16_t accessFlags_;
- ConstantUtf8* name_;
- ConstantUtf8* descriptor_;
+ uint16_t nameIdx_;
+ uint16_t descriptorIdx_;
Attributes attributes_;
+ Member(const ClassFile* parent, std::istream& is);
+ ~Member();
+
+public:
+ bool isPublic() const { return accessFlags_ & ACC_PUBLIC; }
+ bool isPrivate() const { return accessFlags_ & ACC_PRIVATE; }
+ bool isProtected() const { return accessFlags_ & ACC_PROTECTED; }
+ bool isStatic() const { return accessFlags_ & ACC_STATIC; }
+ bool isFinal() const { return accessFlags_ & ACC_FINAL; }
+
+ const ClassFile* getParent() const { return parent_; }
+ ConstantUtf8* getName() const { return parent_->getConstantUtf8(nameIdx_); }
+ ConstantUtf8* getDescriptor() const {
+ return parent_->getConstantUtf8(descriptorIdx_);
+ }
+ const Attributes& getAttributes() const { return attributes_; }
+ };
+
+ class Field : public Member {
+ private:
Field(const ClassFile* parent, std::istream& is);
public:
@@ -300,18 +320,9 @@
~Field();
- bool isPublic() const { return accessFlags_ & ACC_PUBLIC; }
- bool isPrivate() const { return accessFlags_ & ACC_PRIVATE; }
- bool isProtected() const { return accessFlags_ & ACC_PROTECTED; }
- bool isStatic() const { return accessFlags_ & ACC_STATIC; }
- bool isFinal() const { return accessFlags_ & ACC_FINAL; }
bool isVolatile() const { return accessFlags_ & ACC_VOLATILE; }
bool isTransient() const { return accessFlags_ & ACC_TRANSIENT; }
- const ClassFile* getParent() const { return parent_; }
- ConstantUtf8* getName() const { return name_; }
- ConstantUtf8* getDescriptor() const { return descriptor_; }
- const Attributes& getAttributes() const { return attributes_; }
ConstantValueAttribute* getConstantValueAttribute() const;
std::ostream& dump(std::ostream& os) const;
@@ -321,13 +332,7 @@
return f.dump(os);
}
- class Method {
- const ClassFile* parent_;
- uint16_t accessFlags_;
- ConstantUtf8* name_;
- ConstantUtf8* descriptor_;
- Attributes attributes_;
-
+ class Method : public Member {
Method(const ClassFile* parent, std::istream& is);
public:
@@ -337,20 +342,11 @@
~Method();
- bool isPublic() const { return accessFlags_ & ACC_PUBLIC; }
- bool isPrivate() const { return accessFlags_ & ACC_PRIVATE; }
- bool isProtected() const { return accessFlags_ & ACC_PROTECTED; }
- bool isStatic() const { return accessFlags_ & ACC_STATIC; }
- bool isFinal() const { return accessFlags_ & ACC_FINAL; }
bool isSynchronized() const { return accessFlags_ & ACC_SYNCHRONIZED; }
bool isNative() const { return accessFlags_ & ACC_NATIVE; }
bool isAbstract() const { return accessFlags_ & ACC_ABSTRACT; }
bool isStrict() const { return accessFlags_ & ACC_STRICT; }
- const ClassFile* getParent() const { return parent_; }
- ConstantUtf8* getName() const { return name_; }
- ConstantUtf8* getDescriptor() const { return descriptor_; }
- const Attributes& getAttributes() const { return attributes_; }
CodeAttribute* getCodeAttribute() const;
ExceptionsAttribute* getExceptionsAttribute() const;
@@ -433,9 +429,7 @@
Attributes attributes_;
public:
- CodeAttribute(ConstantUtf8* name,
- const ClassFile* cf,
- std::istream& is);
+ CodeAttribute(ConstantUtf8* name, const ClassFile* cf, std::istream& is);
~CodeAttribute();
uint16_t getMaxStack() const { return maxStack_; }
uint16_t getMaxLocals() const { return maxLocals_; }
More information about the llvm-commits
mailing list