[llvm-commits] CVS: llvm-java/include/llvm/Java/Compiler.h ClassFile.h BytecodeParser.h Bytecode.h
Alkis Evlogimenos
alkis at cs.uiuc.edu
Wed Aug 4 03:02:14 PDT 2004
Changes in directory llvm-java/include/llvm/Java:
Compiler.h updated: 1.7 -> 1.8
ClassFile.h updated: 1.17 -> 1.18
BytecodeParser.h updated: 1.5 -> 1.6
Bytecode.h updated: 1.9 -> 1.10
---
Log message:
Convert indentation to 2 spaces.
---
Diffs of the changes: (+1426 -1426)
Index: llvm-java/include/llvm/Java/Compiler.h
diff -u llvm-java/include/llvm/Java/Compiler.h:1.7 llvm-java/include/llvm/Java/Compiler.h:1.8
--- llvm-java/include/llvm/Java/Compiler.h:1.7 Thu Jul 8 19:06:30 2004
+++ llvm-java/include/llvm/Java/Compiler.h Wed Aug 4 05:02:03 2004
@@ -18,25 +18,25 @@
namespace llvm { namespace Java {
- namespace {
- class CompilerImpl;
- }
-
- class Compiler {
- public:
- Compiler();
- ~Compiler();
-
- void compile(Module& m, const std::string& className);
-
- private:
- // do not implement
- Compiler(const Compiler&);
- const Compiler& operator=(const Compiler&);
-
- private:
- CompilerImpl* compilerImpl_;
- };
+ namespace {
+ class CompilerImpl;
+ }
+
+ class Compiler {
+ public:
+ Compiler();
+ ~Compiler();
+
+ void compile(Module& m, const std::string& className);
+
+ private:
+ // do not implement
+ Compiler(const Compiler&);
+ const Compiler& operator=(const Compiler&);
+
+ private:
+ CompilerImpl* compilerImpl_;
+ };
} } // namespace llvm::Java
Index: llvm-java/include/llvm/Java/ClassFile.h
diff -u llvm-java/include/llvm/Java/ClassFile.h:1.17 llvm-java/include/llvm/Java/ClassFile.h:1.18
--- llvm-java/include/llvm/Java/ClassFile.h:1.17 Sat Jul 24 15:33:23 2004
+++ llvm-java/include/llvm/Java/ClassFile.h Wed Aug 4 05:02:03 2004
@@ -24,460 +24,460 @@
namespace llvm { namespace Java {
- // Forward declarations
- class Attribute;
- class ConstantValueAttribute;
- class CodeAttribute;
- class ExceptionsAttribute;
- class Constant;
- class ConstantClass;
- class ConstantNameAndType;
- class ConstantUtf8;
- class ClassFile;
- class Field;
- class Method;
-
- enum AccessFlag {
- ACC_PUBLIC = 0x0001,
- ACC_PRIVATE = 0x0002,
- ACC_PROTECTED = 0x0004,
- ACC_STATIC = 0x0008,
- ACC_FINAL = 0x0010,
- ACC_SUPER = 0x0020,
- ACC_SYNCHRONIZED = 0x0020,
- ACC_VOLATILE = 0x0040,
- ACC_TRANSIENT = 0x0080,
- ACC_NATIVE = 0x0100,
- ACC_INTERFACE = 0x0200,
- ACC_ABSTRACT = 0x0400,
- ACC_STRICT = 0x0800,
- };
-
- typedef std::vector<Constant*> ConstantPool;
- typedef std::vector<ConstantClass*> Classes;
- typedef std::vector<Field*> Fields;
- typedef std::vector<Method*> Methods;
- typedef std::vector<Attribute*> Attributes;
-
- Attribute* getAttribute(const Attributes& attrs,
- const std::string& name);
-
- class ClassFile {
- static ClassFile* readClassFile(std::istream& is);
- static std::vector<std::string> getClassPath();
- static std::string getFileForClass(const std::string& classname);
-
- typedef std::map<std::string, Method*> Name2MethodMap;
-
- public:
- static ClassFile* getClassFile(const std::string& classname);
-
- ~ClassFile();
-
- uint16_t getMinorVersion() const { return minorV_; }
- uint16_t getMajorVersion() const { return majorV_; }
-
- const ConstantPool& getConstantPool() const { return cPool_; }
-
- bool isPublic() const { return accessFlags_ & ACC_PUBLIC; }
- bool isFinal() const { return accessFlags_ & ACC_FINAL; }
- bool isSuper() const { return accessFlags_ & ACC_SUPER; }
- bool isInterface() const { return accessFlags_ & ACC_INTERFACE; }
- bool isAbstract() const { return accessFlags_ & ACC_ABSTRACT; }
-
- ConstantClass* getThisClass() const { return thisClass_; }
- ConstantClass* getSuperClass() const { return superClass_; }
-
- const Classes& getInterfaces() const { return interfaces_; }
-
- const Fields& getFields() const { return fields_; }
-
- const Methods& getMethods() const { return methods_; }
-
- const Attributes& getAttributes() const { return attributes_; }
-
- Method* getMethod(const std::string& nameAndDescr) const;
-
- std::ostream& dump(std::ostream& os) const;
-
- private:
- uint16_t majorV_;
- uint16_t minorV_;
- ConstantPool cPool_;
- uint16_t accessFlags_;
- ConstantClass* thisClass_;
- ConstantClass* superClass_;
- Classes interfaces_;
- Fields fields_;
- Methods methods_;
- Attributes attributes_;
- Name2MethodMap n2mMap_;
-
- ClassFile(std::istream& is);
- };
-
- inline std::ostream& operator<<(std::ostream& os, const ClassFile& c) {
- return c.dump(os);
+ // Forward declarations
+ class Attribute;
+ class ConstantValueAttribute;
+ class CodeAttribute;
+ class ExceptionsAttribute;
+ class Constant;
+ class ConstantClass;
+ class ConstantNameAndType;
+ class ConstantUtf8;
+ class ClassFile;
+ class Field;
+ class Method;
+
+ enum AccessFlag {
+ ACC_PUBLIC = 0x0001,
+ ACC_PRIVATE = 0x0002,
+ ACC_PROTECTED = 0x0004,
+ ACC_STATIC = 0x0008,
+ ACC_FINAL = 0x0010,
+ ACC_SUPER = 0x0020,
+ ACC_SYNCHRONIZED = 0x0020,
+ ACC_VOLATILE = 0x0040,
+ ACC_TRANSIENT = 0x0080,
+ ACC_NATIVE = 0x0100,
+ ACC_INTERFACE = 0x0200,
+ ACC_ABSTRACT = 0x0400,
+ ACC_STRICT = 0x0800,
+ };
+
+ typedef std::vector<Constant*> ConstantPool;
+ typedef std::vector<ConstantClass*> Classes;
+ typedef std::vector<Field*> Fields;
+ typedef std::vector<Method*> Methods;
+ typedef std::vector<Attribute*> Attributes;
+
+ Attribute* getAttribute(const Attributes& attrs,
+ const std::string& name);
+
+ class ClassFile {
+ static ClassFile* readClassFile(std::istream& is);
+ static std::vector<std::string> getClassPath();
+ static std::string getFileForClass(const std::string& classname);
+
+ typedef std::map<std::string, Method*> Name2MethodMap;
+
+ public:
+ static ClassFile* getClassFile(const std::string& classname);
+
+ ~ClassFile();
+
+ uint16_t getMinorVersion() const { return minorV_; }
+ uint16_t getMajorVersion() const { return majorV_; }
+
+ const ConstantPool& getConstantPool() const { return cPool_; }
+
+ bool isPublic() const { return accessFlags_ & ACC_PUBLIC; }
+ bool isFinal() const { return accessFlags_ & ACC_FINAL; }
+ bool isSuper() const { return accessFlags_ & ACC_SUPER; }
+ bool isInterface() const { return accessFlags_ & ACC_INTERFACE; }
+ bool isAbstract() const { return accessFlags_ & ACC_ABSTRACT; }
+
+ ConstantClass* getThisClass() const { return thisClass_; }
+ ConstantClass* getSuperClass() const { return superClass_; }
+
+ const Classes& getInterfaces() const { return interfaces_; }
+
+ const Fields& getFields() const { return fields_; }
+
+ const Methods& getMethods() const { return methods_; }
+
+ const Attributes& getAttributes() const { return attributes_; }
+
+ Method* getMethod(const std::string& nameAndDescr) const;
+
+ std::ostream& dump(std::ostream& os) const;
+
+ private:
+ uint16_t majorV_;
+ uint16_t minorV_;
+ ConstantPool cPool_;
+ uint16_t accessFlags_;
+ ConstantClass* thisClass_;
+ ConstantClass* superClass_;
+ Classes interfaces_;
+ Fields fields_;
+ Methods methods_;
+ Attributes attributes_;
+ Name2MethodMap n2mMap_;
+
+ ClassFile(std::istream& is);
+ };
+
+ inline std::ostream& operator<<(std::ostream& os, const ClassFile& c) {
+ return c.dump(os);
+ }
+
+ class Constant {
+ protected:
+ const ConstantPool& cPool_;
+
+ Constant(const ConstantPool& cp)
+ : cPool_(cp) { }
+
+ public:
+ enum Tag {
+ CLASS = 7,
+ FIELD_REF = 9,
+ METHOD_REF = 10,
+ INTERFACE_METHOD_REF = 11,
+ STRING = 8,
+ INTEGER = 3,
+ FLOAT = 4,
+ LONG = 5,
+ DOUBLE = 6,
+ NAME_AND_TYPE = 12,
+ UTF8 = 1
+ };
+
+ static Constant* readConstant(const ConstantPool& cp,
+ std::istream& is);
+
+ virtual bool isSingleSlot() { return true; }
+ bool isDoubleSlot() { return !isSingleSlot(); }
+ virtual ~Constant();
+
+ virtual std::ostream& dump(std::ostream& os) const = 0;
+ };
+
+ inline std::ostream& operator<<(std::ostream& os, const Constant& c) {
+ return c.dump(os);
+ }
+
+ class ConstantClass : public Constant {
+ uint16_t nameIdx_;
+ public:
+ ConstantClass(const ConstantPool& cp, std::istream& is);
+ ConstantUtf8* getName() const {
+ return (ConstantUtf8*) cPool_[nameIdx_];
}
+ std::ostream& dump(std::ostream& os) const;
+ };
- class Constant {
- protected:
- const ConstantPool& cPool_;
-
- Constant(const ConstantPool& cp)
- : cPool_(cp) { }
-
- public:
- enum Tag {
- CLASS = 7,
- FIELD_REF = 9,
- METHOD_REF = 10,
- INTERFACE_METHOD_REF = 11,
- STRING = 8,
- INTEGER = 3,
- FLOAT = 4,
- LONG = 5,
- DOUBLE = 6,
- NAME_AND_TYPE = 12,
- UTF8 = 1
- };
-
- static Constant* readConstant(const ConstantPool& cp,
- std::istream& is);
-
- virtual bool isSingleSlot() { return true; }
- bool isDoubleSlot() { return !isSingleSlot(); }
- virtual ~Constant();
-
- virtual std::ostream& dump(std::ostream& os) const = 0;
- };
-
- inline std::ostream& operator<<(std::ostream& os, const Constant& c) {
- return c.dump(os);
+ class ConstantMemberRef : public Constant {
+ uint16_t classIdx_;
+ uint16_t nameAndTypeIdx_;
+ protected:
+ ConstantMemberRef(const ConstantPool& cp, std::istream& is);
+
+ public:
+ ConstantClass* getClass() const {
+ return (ConstantClass*) cPool_[classIdx_];
}
-
- class ConstantClass : public Constant {
- uint16_t nameIdx_;
- public:
- ConstantClass(const ConstantPool& cp, std::istream& is);
- ConstantUtf8* getName() const {
- return (ConstantUtf8*) cPool_[nameIdx_];
- }
- std::ostream& dump(std::ostream& os) const;
- };
-
- class ConstantMemberRef : public Constant {
- uint16_t classIdx_;
- uint16_t nameAndTypeIdx_;
- protected:
- ConstantMemberRef(const ConstantPool& cp, std::istream& is);
-
- public:
- ConstantClass* getClass() const {
- return (ConstantClass*) cPool_[classIdx_];
- }
- ConstantNameAndType* getNameAndType() const {
- return (ConstantNameAndType*) cPool_[nameAndTypeIdx_];
- }
- std::ostream& dump(std::ostream& os) const;
- };
-
- struct ConstantFieldRef : public ConstantMemberRef {
- ConstantFieldRef(const ConstantPool& cp, std::istream& is)
- : ConstantMemberRef(cp, is) { }
- };
-
- struct ConstantMethodRef : public ConstantMemberRef {
- ConstantMethodRef(const ConstantPool& cp, std::istream& is)
- : ConstantMemberRef(cp, is) { }
- };
-
- struct ConstantInterfaceMethodRef : public ConstantMemberRef {
- ConstantInterfaceMethodRef(const ConstantPool& cp, std::istream& is)
- : ConstantMemberRef(cp, is) { }
- };
-
- class ConstantString : public Constant {
- uint16_t stringIdx_;
- public:
- ConstantString(const ConstantPool& cp, std::istream& is);
- ConstantUtf8* getValue() const {
- return (ConstantUtf8*) cPool_[stringIdx_];
- }
- std::ostream& dump(std::ostream& os) const;
- };
-
- class ConstantInteger : public Constant {
- int32_t value_;
- public:
- ConstantInteger(const ConstantPool& cp, std::istream& is);
- int32_t getValue() const { return value_; }
- std::ostream& dump(std::ostream& os) const;
- };
-
- class ConstantFloat : public Constant {
- float value_;
- public:
- ConstantFloat(const ConstantPool& cp, std::istream& is);
- float getValue() const { return value_; }
- std::ostream& dump(std::ostream& os) const;
- };
-
- class ConstantLong : public Constant {
- int64_t value_;
- public:
- ConstantLong(const ConstantPool& cp, std::istream& is);
- virtual bool isSingleSlot() { return false; }
- int64_t getValue() const { return value_; }
- std::ostream& dump(std::ostream& os) const;
- };
-
- class ConstantDouble : public Constant {
- double value_;
- public:
- ConstantDouble(const ConstantPool& cp, std::istream& is);
- virtual bool isSingleSlot() { return false; }
- double getValue() const { return value_; }
- std::ostream& dump(std::ostream& os) const;
- };
-
- class ConstantNameAndType : public Constant {
- uint16_t nameIdx_;
- uint16_t descriptorIdx_;
- public:
- ConstantNameAndType(const ConstantPool& cp, std::istream& is);
- ConstantUtf8* getName() const {
- return (ConstantUtf8*) cPool_[nameIdx_];
- }
- ConstantUtf8* getDescriptor() const {
- return (ConstantUtf8*) cPool_[descriptorIdx_];
- }
- std::ostream& dump(std::ostream& os) const;
- };
-
- class ConstantUtf8 : public Constant {
- std::string utf8_;
- public:
- ConstantUtf8(const ConstantPool& cp, std::istream& is);
- const std::string& str() const { return utf8_; }
-
- std::ostream& dump(std::ostream& os) const;
- };
-
- class Field {
- private:
- uint16_t accessFlags_;
- ConstantUtf8* name_;
- ConstantUtf8* descriptor_;
- Attributes attributes_;
-
- Field(const ConstantPool& cp, std::istream& is);
-
- public:
- static Field* readField(const ConstantPool& cp, std::istream& is) {
- return new Field(cp, is);
- }
-
- ~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; }
-
- 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;
- };
-
- inline std::ostream& operator<<(std::ostream& os, const Field& f) {
- return f.dump(os);
+ ConstantNameAndType* getNameAndType() const {
+ return (ConstantNameAndType*) cPool_[nameAndTypeIdx_];
}
+ std::ostream& dump(std::ostream& os) const;
+ };
- class Method {
- uint16_t accessFlags_;
- ConstantUtf8* name_;
- ConstantUtf8* descriptor_;
- Attributes attributes_;
-
- Method(const ConstantPool& cp, std::istream& is);
-
- public:
- static Method* readMethod(const ConstantPool& cp, std::istream& is) {
- return new Method(cp, is);
- }
-
- ~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; }
-
- ConstantUtf8* getName() const { return name_; }
- ConstantUtf8* getDescriptor() const { return descriptor_; }
- const Attributes& getAttributes() const { return attributes_; }
- CodeAttribute* getCodeAttribute() const;
- ExceptionsAttribute* getExceptionsAttribute() const;
-
- std::ostream& dump(std::ostream& os) const;
- };
-
- inline std::ostream& operator<<(std::ostream& os, const Method& m) {
- return m.dump(os);
+ struct ConstantFieldRef : public ConstantMemberRef {
+ ConstantFieldRef(const ConstantPool& cp, std::istream& is)
+ : ConstantMemberRef(cp, is) { }
+ };
+
+ struct ConstantMethodRef : public ConstantMemberRef {
+ ConstantMethodRef(const ConstantPool& cp, std::istream& is)
+ : ConstantMemberRef(cp, is) { }
+ };
+
+ struct ConstantInterfaceMethodRef : public ConstantMemberRef {
+ ConstantInterfaceMethodRef(const ConstantPool& cp, std::istream& is)
+ : ConstantMemberRef(cp, is) { }
+ };
+
+ class ConstantString : public Constant {
+ uint16_t stringIdx_;
+ public:
+ ConstantString(const ConstantPool& cp, std::istream& is);
+ ConstantUtf8* getValue() const {
+ return (ConstantUtf8*) cPool_[stringIdx_];
}
+ std::ostream& dump(std::ostream& os) const;
+ };
- class Attribute {
- ConstantUtf8* name_;
-
- protected:
- Attribute(ConstantUtf8* name,
- const ConstantPool& cp,
- std::istream& is);
-
- public:
- static Attribute* readAttribute(const ConstantPool& cp,
- std::istream& is);
-
- virtual ~Attribute();
-
- ConstantUtf8* getName() const { return name_; }
-
- virtual std::ostream& dump(std::ostream& os) const;
-
- static const std::string CONSTANT_VALUE;
- static const std::string CODE;
- static const std::string EXCEPTIONS;
- static const std::string INNER_CLASSES;
- static const std::string SYNTHETIC;
- static const std::string SOURCE_FILE;
- static const std::string LINE_NUMBER_TABLE;
- static const std::string LOCAL_VARIABLE_TABLE;
- static const std::string DEPRECATED;
- };
-
- inline std::ostream& operator<<(std::ostream& os, const Attribute& a) {
- return a.dump(os);
+ class ConstantInteger : public Constant {
+ int32_t value_;
+ public:
+ ConstantInteger(const ConstantPool& cp, std::istream& is);
+ int32_t getValue() const { return value_; }
+ std::ostream& dump(std::ostream& os) const;
+ };
+
+ class ConstantFloat : public Constant {
+ float value_;
+ public:
+ ConstantFloat(const ConstantPool& cp, std::istream& is);
+ float getValue() const { return value_; }
+ std::ostream& dump(std::ostream& os) const;
+ };
+
+ class ConstantLong : public Constant {
+ int64_t value_;
+ public:
+ ConstantLong(const ConstantPool& cp, std::istream& is);
+ virtual bool isSingleSlot() { return false; }
+ int64_t getValue() const { return value_; }
+ std::ostream& dump(std::ostream& os) const;
+ };
+
+ class ConstantDouble : public Constant {
+ double value_;
+ public:
+ ConstantDouble(const ConstantPool& cp, std::istream& is);
+ virtual bool isSingleSlot() { return false; }
+ double getValue() const { return value_; }
+ std::ostream& dump(std::ostream& os) const;
+ };
+
+ class ConstantNameAndType : public Constant {
+ uint16_t nameIdx_;
+ uint16_t descriptorIdx_;
+ public:
+ ConstantNameAndType(const ConstantPool& cp, std::istream& is);
+ ConstantUtf8* getName() const {
+ return (ConstantUtf8*) cPool_[nameIdx_];
}
-
- class ConstantValueAttribute : public Attribute {
- Constant* value_;
- public:
- ConstantValueAttribute(ConstantUtf8* name,
- const ConstantPool& cp,
- std::istream& is);
-
- Constant* getValue() const { return value_; }
-
- std::ostream& dump(std::ostream& os) const;
- };
-
- class CodeAttribute : public Attribute {
- public:
- class Exception {
- uint16_t startPc_;
- uint16_t endPc_;
- uint16_t handlerPc_;
- ConstantClass* catchType_;
-
- public:
- Exception(const ConstantPool& cp, std::istream& is);
-
- uint16_t getStartPc() const { return startPc_; }
- uint16_t getEndPc() const { return endPc_; }
- uint16_t getHandlerPc() const { return handlerPc_; }
- ConstantClass* getCatchType() const { return catchType_; }
-
- std::ostream& dump(std::ostream& os) const;
- };
-
- typedef std::vector<Exception*> Exceptions;
-
- private:
- uint16_t maxStack_;
- uint16_t maxLocals_;
- uint32_t codeSize_;
- uint8_t* code_;
- Exceptions exceptions_;
- Attributes attributes_;
-
- public:
- CodeAttribute(ConstantUtf8* name,
- const ConstantPool& cp,
- std::istream& is);
- ~CodeAttribute();
- uint16_t getMaxStack() const { return maxStack_; }
- uint16_t getMaxLocals() const { return maxLocals_; }
- const uint8_t* getCode() const { return code_; }
- uint32_t getCodeSize() const { return codeSize_; }
- const Exceptions& getExceptions() const { return exceptions_; }
- const Attributes& getAttributes() const { return attributes_; }
-
- std::ostream& dump(std::ostream& os) const;
- };
-
- inline std::ostream& operator<<(std::ostream& os,
- const CodeAttribute::Exception& e) {
- return e.dump(os);
+ ConstantUtf8* getDescriptor() const {
+ return (ConstantUtf8*) cPool_[descriptorIdx_];
}
+ std::ostream& dump(std::ostream& os) const;
+ };
- class ExceptionsAttribute : public Attribute {
- private:
- ConstantUtf8* name_;
- Classes exceptions_;
-
- public:
- ExceptionsAttribute(ConstantUtf8* name,
- const ConstantPool& cp,
- std::istream& is);
-
- const Classes& getExceptions() const { return exceptions_; }
+ class ConstantUtf8 : public Constant {
+ std::string utf8_;
+ public:
+ ConstantUtf8(const ConstantPool& cp, std::istream& is);
+ const std::string& str() const { return utf8_; }
+
+ std::ostream& dump(std::ostream& os) const;
+ };
+
+ class Field {
+ private:
+ uint16_t accessFlags_;
+ ConstantUtf8* name_;
+ ConstantUtf8* descriptor_;
+ Attributes attributes_;
+
+ Field(const ConstantPool& cp, std::istream& is);
+
+ public:
+ static Field* readField(const ConstantPool& cp, std::istream& is) {
+ return new Field(cp, is);
+ }
- std::ostream& dump(std::ostream& os) const;
- };
+ ~Field();
- class ClassFileParseError : public std::exception {
- std::string msg_;
- public:
- explicit ClassFileParseError(const std::string& msg) : msg_(msg) { }
- virtual ~ClassFileParseError() throw();
- virtual const char* what() const throw() { return msg_.c_str(); }
- };
+ 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; }
+
+ 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;
+ };
+
+ inline std::ostream& operator<<(std::ostream& os, const Field& f) {
+ return f.dump(os);
+ }
+
+ class Method {
+ uint16_t accessFlags_;
+ ConstantUtf8* name_;
+ ConstantUtf8* descriptor_;
+ Attributes attributes_;
+
+ Method(const ConstantPool& cp, std::istream& is);
+
+ public:
+ static Method* readMethod(const ConstantPool& cp, std::istream& is) {
+ return new Method(cp, is);
+ }
- class ClassFileSemanticError : public std::exception {
- std::string msg_;
- public:
- explicit ClassFileSemanticError(const std::string& msg) : msg_(msg) { }
- virtual ~ClassFileSemanticError() throw();
- virtual const char* what() const throw() { return msg_.c_str(); }
- };
+ ~Method();
- class ClassNotFoundException : public std::exception {
- std::string msg_;
- public:
- explicit ClassNotFoundException(const std::string& msg) : msg_(msg) { }
- virtual ~ClassNotFoundException() throw();
- virtual const char* what() const throw() { return msg_.c_str(); }
- };
+ 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; }
+
+ ConstantUtf8* getName() const { return name_; }
+ ConstantUtf8* getDescriptor() const { return descriptor_; }
+ const Attributes& getAttributes() const { return attributes_; }
+ CodeAttribute* getCodeAttribute() const;
+ ExceptionsAttribute* getExceptionsAttribute() const;
+
+ std::ostream& dump(std::ostream& os) const;
+ };
+
+ inline std::ostream& operator<<(std::ostream& os, const Method& m) {
+ return m.dump(os);
+ }
+
+ class Attribute {
+ ConstantUtf8* name_;
+
+ protected:
+ Attribute(ConstantUtf8* name,
+ const ConstantPool& cp,
+ std::istream& is);
+
+ public:
+ static Attribute* readAttribute(const ConstantPool& cp,
+ std::istream& is);
+
+ virtual ~Attribute();
+
+ ConstantUtf8* getName() const { return name_; }
+
+ virtual std::ostream& dump(std::ostream& os) const;
+
+ static const std::string CONSTANT_VALUE;
+ static const std::string CODE;
+ static const std::string EXCEPTIONS;
+ static const std::string INNER_CLASSES;
+ static const std::string SYNTHETIC;
+ static const std::string SOURCE_FILE;
+ static const std::string LINE_NUMBER_TABLE;
+ static const std::string LOCAL_VARIABLE_TABLE;
+ static const std::string DEPRECATED;
+ };
+
+ inline std::ostream& operator<<(std::ostream& os, const Attribute& a) {
+ return a.dump(os);
+ }
+
+ class ConstantValueAttribute : public Attribute {
+ Constant* value_;
+ public:
+ ConstantValueAttribute(ConstantUtf8* name,
+ const ConstantPool& cp,
+ std::istream& is);
+
+ Constant* getValue() const { return value_; }
+
+ std::ostream& dump(std::ostream& os) const;
+ };
+
+ class CodeAttribute : public Attribute {
+ public:
+ class Exception {
+ uint16_t startPc_;
+ uint16_t endPc_;
+ uint16_t handlerPc_;
+ ConstantClass* catchType_;
+
+ public:
+ Exception(const ConstantPool& cp, std::istream& is);
+
+ uint16_t getStartPc() const { return startPc_; }
+ uint16_t getEndPc() const { return endPc_; }
+ uint16_t getHandlerPc() const { return handlerPc_; }
+ ConstantClass* getCatchType() const { return catchType_; }
+
+ std::ostream& dump(std::ostream& os) const;
+ };
+
+ typedef std::vector<Exception*> Exceptions;
+
+ private:
+ uint16_t maxStack_;
+ uint16_t maxLocals_;
+ uint32_t codeSize_;
+ uint8_t* code_;
+ Exceptions exceptions_;
+ Attributes attributes_;
- class InvocationTargetException : public std::exception {
- std::string msg_;
- public:
- explicit InvocationTargetException(const std::string& msg) : msg_(msg) { }
- virtual ~InvocationTargetException() throw();
- virtual const char* what() const throw() { return msg_.c_str(); }
- };
+ public:
+ CodeAttribute(ConstantUtf8* name,
+ const ConstantPool& cp,
+ std::istream& is);
+ ~CodeAttribute();
+ uint16_t getMaxStack() const { return maxStack_; }
+ uint16_t getMaxLocals() const { return maxLocals_; }
+ const uint8_t* getCode() const { return code_; }
+ uint32_t getCodeSize() const { return codeSize_; }
+ const Exceptions& getExceptions() const { return exceptions_; }
+ const Attributes& getAttributes() const { return attributes_; }
+
+ std::ostream& dump(std::ostream& os) const;
+ };
+
+ inline std::ostream& operator<<(std::ostream& os,
+ const CodeAttribute::Exception& e) {
+ return e.dump(os);
+ }
+
+ class ExceptionsAttribute : public Attribute {
+ private:
+ ConstantUtf8* name_;
+ Classes exceptions_;
+
+ public:
+ ExceptionsAttribute(ConstantUtf8* name,
+ const ConstantPool& cp,
+ std::istream& is);
+
+ const Classes& getExceptions() const { return exceptions_; }
+
+ std::ostream& dump(std::ostream& os) const;
+ };
+
+ class ClassFileParseError : public std::exception {
+ std::string msg_;
+ public:
+ explicit ClassFileParseError(const std::string& msg) : msg_(msg) { }
+ virtual ~ClassFileParseError() throw();
+ virtual const char* what() const throw() { return msg_.c_str(); }
+ };
+
+ class ClassFileSemanticError : public std::exception {
+ std::string msg_;
+ public:
+ explicit ClassFileSemanticError(const std::string& msg) : msg_(msg) { }
+ virtual ~ClassFileSemanticError() throw();
+ virtual const char* what() const throw() { return msg_.c_str(); }
+ };
+
+ class ClassNotFoundException : public std::exception {
+ std::string msg_;
+ public:
+ explicit ClassNotFoundException(const std::string& msg) : msg_(msg) { }
+ virtual ~ClassNotFoundException() throw();
+ virtual const char* what() const throw() { return msg_.c_str(); }
+ };
+
+ class InvocationTargetException : public std::exception {
+ std::string msg_;
+ public:
+ explicit InvocationTargetException(const std::string& msg) : msg_(msg) { }
+ virtual ~InvocationTargetException() throw();
+ virtual const char* what() const throw() { return msg_.c_str(); }
+ };
} } // namespace llvm::Java
Index: llvm-java/include/llvm/Java/BytecodeParser.h
diff -u llvm-java/include/llvm/Java/BytecodeParser.h:1.5 llvm-java/include/llvm/Java/BytecodeParser.h:1.6
--- llvm-java/include/llvm/Java/BytecodeParser.h:1.5 Thu May 27 15:51:38 2004
+++ llvm-java/include/llvm/Java/BytecodeParser.h Wed Aug 4 05:02:03 2004
@@ -19,745 +19,745 @@
namespace llvm { namespace Java {
- /// @brief This class provides a base class that eases bytecode
- /// parsing.
- ///
- /// By default all the do_* methods do nothing. A subclass can
- /// override at will to provide specific behaviour.
- template <typename SubClass>
- class BytecodeParser {
- protected:
- typedef std::vector<std::pair<int, unsigned> > SwitchCases;
+ /// @brief This class provides a base class that eases bytecode
+ /// parsing.
+ ///
+ /// By default all the do_* methods do nothing. A subclass can
+ /// override at will to provide specific behaviour.
+ template <typename SubClass>
+ class BytecodeParser {
+ protected:
+ typedef std::vector<std::pair<int, unsigned> > SwitchCases;
- enum JSetCC { EQ, NE, LT, GE, GT, LE };
+ enum JSetCC { EQ, NE, LT, GE, GT, LE };
- enum JType {
- REFERENCE = 0, // this is not defined in the java spec
- BOOLEAN = 4,
- CHAR = 5,
- FLOAT = 6,
- DOUBLE = 7,
- BYTE = 8,
- SHORT = 9,
- INT = 10,
- LONG = 11,
- };
+ enum JType {
+ REFERENCE = 0, // this is not defined in the java spec
+ BOOLEAN = 4,
+ CHAR = 5,
+ FLOAT = 6,
+ DOUBLE = 7,
+ BYTE = 8,
+ SHORT = 9,
+ INT = 10,
+ LONG = 11,
+ };
- private:
- SwitchCases switchCases_;
+ private:
+ SwitchCases switchCases_;
- protected:
+ protected:
#define THIS ((SubClass*)this)
- /// @brief parse code pointed to by \c code of size \c size
- ///
- /// This function parses the code pointed to by \c code and
- /// calls the subclass's do_<bytecode> method
- /// appropriately. When this function returns all code up to
- /// \c size is parsed.
- void parse(const uint8_t* code, unsigned size) {
- using namespace Opcode;
+ /// @brief parse code pointed to by \c code of size \c size
+ ///
+ /// This function parses the code pointed to by \c code and
+ /// calls the subclass's do_<bytecode> method
+ /// appropriately. When this function returns all code up to
+ /// \c size is parsed.
+ void parse(const uint8_t* code, unsigned size) {
+ using namespace Opcode;
- for (unsigned i = 0; i < size; ++i) {
- unsigned curBC = i;
- bool wide = code[i] == WIDE;
- i += wide;
- switch (code[i]) {
- case ACONST_NULL:
- THIS->do_aconst_null(curBC);
- break;
- case ICONST_M1:
- case ICONST_0:
- case ICONST_1:
- case ICONST_2:
- case ICONST_3:
- case ICONST_4:
- case ICONST_5:
- THIS->do_iconst(curBC, code[i]-ICONST_0);
- break;
- case LCONST_0:
- case LCONST_1:
- THIS->do_lconst(curBC, code[i]-LCONST_0);
- break;
- case FCONST_0:
- case FCONST_1:
- case FCONST_2:
- THIS->do_fconst(curBC, code[i]-FCONST_0);
- break;
- case DCONST_0:
- case DCONST_1:
- THIS->do_dconst(curBC, code[i]-DCONST_0);
- break;
- case BIPUSH:
- THIS->do_iconst(curBC, readSByte(code, i));
- break;
- case SIPUSH:
- THIS->do_iconst(curBC, readSShort(code, i));
- break;
- case LDC:
- THIS->do_ldc(curBC, readUByte(code, i));
- break;
- case LDC_W:
- THIS->do_ldc(curBC, readUShort(code, i));
- break;
- case LDC2_W:
- THIS->do_ldc(curBC, readUShort(code, i));
- break;
- case ILOAD:
- THIS->do_load(
- curBC, INT,
- wide ? readUShort(code, i) : readUByte(code, i));
- break;
- case LLOAD:
- THIS->do_load(
- curBC, LONG,
- wide ? readUShort(code, i) : readUByte(code, i));
- break;
- case FLOAD:
- THIS->do_load(
- curBC, FLOAT,
- wide ? readUShort(code, i) : readUByte(code, i));
- break;
- case DLOAD:
- THIS->do_load(
- curBC, DOUBLE,
- wide ? readUShort(code, i) : readUByte(code, i));
- break;
- case ALOAD:
- THIS->do_load(
- curBC, REFERENCE,
- wide ? readUShort(code, i) : readUByte(code, i));
- break;
- case ILOAD_0:
- case ILOAD_1:
- case ILOAD_2:
- case ILOAD_3:
- THIS->do_load(curBC, INT, code[i]-ILOAD_0);
- break;
- case LLOAD_0:
- case LLOAD_1:
- case LLOAD_2:
- case LLOAD_3:
- THIS->do_load(curBC, LONG, code[i]-LLOAD_0);
- break;
- case FLOAD_0:
- case FLOAD_1:
- case FLOAD_2:
- case FLOAD_3:
- THIS->do_load(curBC, FLOAT, code[i]-FLOAD_0);
- break;
- case DLOAD_0:
- case DLOAD_1:
- case DLOAD_2:
- case DLOAD_3:
- THIS->do_load(curBC, DOUBLE, code[i]-DLOAD_0);
- break;
- case ALOAD_0:
- case ALOAD_1:
- case ALOAD_2:
- case ALOAD_3:
- THIS->do_load(curBC, REFERENCE, code[i]-ALOAD_0);
- break;
- case IALOAD:
- THIS->do_aload(curBC, INT);
- break;
- case LALOAD:
- THIS->do_aload(curBC, LONG);
- break;
- case FALOAD:
- THIS->do_aload(curBC, FLOAT);
- break;
- case DALOAD:
- THIS->do_aload(curBC, DOUBLE);
- break;
- case AALOAD:
- THIS->do_aload(curBC, REFERENCE);
- break;
- case BALOAD:
- THIS->do_aload(curBC, BYTE);
- break;
- case CALOAD:
- THIS->do_aload(curBC, CHAR);
- break;
- case SALOAD:
- THIS->do_aload(curBC, SHORT);
- break;
- case ISTORE:
- THIS->do_store(
- curBC, INT,
- wide ? readUShort(code, i) : readUByte(code, i));
- break;
- case LSTORE:
- THIS->do_store(
- curBC, LONG,
- wide ? readUShort(code, i) : readUByte(code, i));
- break;
- case FSTORE:
- THIS->do_store(
- curBC, FLOAT,
- wide ? readUShort(code, i) : readUByte(code, i));
- break;
- case DSTORE:
- THIS->do_store(
- curBC, DOUBLE,
- wide ? readUShort(code, i) : readUByte(code, i));
- break;
- case ASTORE:
- THIS->do_store(
- curBC, REFERENCE,
- wide ? readUShort(code, i) : readUByte(code, i));
- break;
- case ISTORE_0:
- case ISTORE_1:
- case ISTORE_2:
- case ISTORE_3:
- THIS->do_store(curBC, INT, code[i]-ISTORE_0);
- break;
- case LSTORE_0:
- case LSTORE_1:
- case LSTORE_2:
- case LSTORE_3:
- THIS->do_store(curBC, LONG, code[i]-LSTORE_0);
- break;
- case FSTORE_0:
- case FSTORE_1:
- case FSTORE_2:
- case FSTORE_3:
- THIS->do_store(curBC, FLOAT, code[i]-FSTORE_0);
- break;
- case DSTORE_0:
- case DSTORE_1:
- case DSTORE_2:
- case DSTORE_3:
- THIS->do_store(curBC, DOUBLE, code[i]-DSTORE_0);
- break;
- case ASTORE_0:
- case ASTORE_1:
- case ASTORE_2:
- case ASTORE_3:
- THIS->do_store(curBC, REFERENCE, code[i]-ASTORE_0);
- break;
- case IASTORE:
- THIS->do_astore(curBC, INT);
- break;
- case LASTORE:
- THIS->do_astore(curBC, LONG);
- break;
- case FASTORE:
- THIS->do_astore(curBC, FLOAT);
- break;
- case DASTORE:
- THIS->do_astore(curBC, DOUBLE);
- break;
- case AASTORE:
- THIS->do_astore(curBC, REFERENCE);
- break;
- case BASTORE:
- THIS->do_astore(curBC, BYTE);
- break;
- case CASTORE:
- THIS->do_astore(curBC, CHAR);
- break;
- case SASTORE:
- THIS->do_astore(curBC, SHORT);
- break;
- case POP:
- THIS->do_pop(curBC);
- break;
- case POP2:
- THIS->do_pop2(curBC);
- break;
- case DUP:
- THIS->do_dup(curBC);
- break;
- case DUP_X1:
- THIS->do_dup_x1(curBC);
- break;
- case DUP_X2:
- THIS->do_dup_x2(curBC);
- break;
- case DUP2:
- THIS->do_dup2(curBC);
- break;
- case DUP2_X1:
- THIS->do_dup2_x1(curBC);
- break;
- case DUP2_X2:
- THIS->do_dup2_x2(curBC);
- break;
- case SWAP:
- THIS->do_swap(curBC);
- break;
- case IADD:
- case LADD:
- case FADD:
- case DADD:
- THIS->do_add(curBC);
- break;
- case ISUB:
- case LSUB:
- case FSUB:
- case DSUB:
- THIS->do_sub(curBC);
- break;
- case IMUL:
- case LMUL:
- case FMUL:
- case DMUL:
- THIS->do_mul(curBC);
- break;
- case IDIV:
- case LDIV:
- case FDIV:
- case DDIV:
- THIS->do_div(curBC);
- break;
- case IREM:
- case LREM:
- case FREM:
- case DREM:
- THIS->do_rem(curBC);
- break;
- case INEG:
- case LNEG:
- case FNEG:
- case DNEG:
- THIS->do_neg(curBC);
- break;
- case ISHL:
- case LSHL:
- THIS->do_shl(curBC);
- break;
- case ISHR:
- case LSHR:
- THIS->do_shr(curBC);
- break;
- case IUSHR:
- case LUSHR:
- THIS->do_ushr(curBC);
- break;
- case IAND:
- case LAND:
- THIS->do_and(curBC);
- break;
- case IOR:
- case LOR:
- THIS->do_or(curBC);
- break;
- case IXOR:
- case LXOR:
- THIS->do_xor(curBC);
- break;
- case IINC:
- THIS->do_iinc(
- curBC, readUByte(code, i), readSByte(code, i));
- break;
- case I2L:
- THIS->do_convert(curBC, LONG);
- break;
- case I2F:
- THIS->do_convert(curBC, FLOAT);
- break;
- case I2D:
- THIS->do_convert(curBC, DOUBLE);
- break;
- case L2I:
- THIS->do_convert(curBC, INT);
- break;
- case L2F:
- THIS->do_convert(curBC, FLOAT);
- break;
- case L2D:
- THIS->do_convert(curBC, DOUBLE);
- break;
- case F2I:
- THIS->do_convert(curBC, INT);
- break;
- case F2L:
- THIS->do_convert(curBC, LONG);
- break;
- case F2D:
- THIS->do_convert(curBC, DOUBLE);
- break;
- case D2I:
- THIS->do_convert(curBC, INT);
- break;
- case D2L:
- THIS->do_convert(curBC, LONG);
- break;
- case D2F:
- THIS->do_convert(curBC, FLOAT);
- break;
- case I2B:
- THIS->do_convert(curBC, BYTE);
- break;
- case I2C:
- THIS->do_convert(curBC, CHAR);
- break;
- case I2S:
- THIS->do_convert(curBC, SHORT);
- break;
- case LCMP:
- THIS->do_lcmp(curBC);
- break;
- case FCMPL:
- THIS->do_cmpl(curBC);
- break;
- case FCMPG:
- THIS->do_cmpg(curBC);
- break;
- case DCMPL:
- THIS->do_cmpl(curBC);
- break;
- case DCMPG:
- THIS->do_cmpg(curBC);
- break;
- case IFEQ: {
- unsigned t = curBC + readSShort(code, i);
- THIS->do_if(curBC, EQ, INT, t, i + 1);
- break;
- }
- case IFNE: {
- unsigned t = curBC + readSShort(code, i);
- THIS->do_if(curBC, NE, INT, t, i + 1);
- break;
- }
- case IFLT: {
- unsigned t = curBC + readSShort(code, i);
- THIS->do_if(curBC, LT, INT, t, i + 1);
- break;
- }
- case IFGE: {
- unsigned t = curBC + readSShort(code, i);
- THIS->do_if(curBC, GE, INT, t, i + 1);
- break;
- }
- case IFGT: {
- unsigned t = curBC + readSShort(code, i);
- THIS->do_if(curBC, GT, INT, t, i + 1);
- break;
- }
- case IFLE: {
- unsigned t = curBC + readSShort(code, i);
- THIS->do_if(curBC, LE, INT, t, i + 1);
- break;
- }
- case IF_ICMPEQ: {
- unsigned t = curBC + readSShort(code, i);
- THIS->do_ifcmp(curBC, EQ, t, i + 1);
- break;
- }
- case IF_ICMPNE: {
- unsigned t = curBC + readSShort(code, i);
- THIS->do_ifcmp(curBC, NE, t, i + 1);
- break;
- }
- case IF_ICMPLT: {
- unsigned t = curBC + readSShort(code, i);
- THIS->do_ifcmp(curBC, LT, t, i + 1);
- break;
- }
- case IF_ICMPGE: {
- unsigned t = curBC + readSShort(code, i);
- THIS->do_ifcmp(curBC, GE, t, i + 1);
- break;
- }
- case IF_ICMPGT: {
- unsigned t = curBC + readSShort(code, i);
- THIS->do_ifcmp(curBC, GT, t, i + 1);
- break;
- }
- case IF_ICMPLE: {
- unsigned t = curBC + readSShort(code, i);
- THIS->do_ifcmp(curBC, LE, t, i + 1);
- break;
- }
- case IF_IACMPEQ: {
- unsigned t = curBC + readSShort(code, i);
- THIS->do_ifcmp(curBC, EQ, t, i + 1);
- break;
- }
- case IF_IACMPNE: {
- unsigned t = curBC + readSShort(code, i);
- THIS->do_ifcmp(curBC, NE, t, i + 1);
- break;
- }
- case GOTO:
- THIS->do_goto(curBC, curBC + readSShort(code, i));
- break;
- case JSR:
- THIS->do_jsr(curBC, curBC + readSShort(code, i));
- break;
- case RET:
- THIS->do_ret(curBC, readUByte(code, i));
- break;
- case TABLESWITCH: {
- switchCases_.clear();
- skipPadBytes(i);
- int def = readSInt(code, i);
- int low = readSInt(code, i);
- int high = readSInt(code, i);
- switchCases_.reserve(high - low + 1);
- while (low <= high)
- switchCases_.push_back(
- std::make_pair(low++, curBC + readSInt(code, i)));
- THIS->do_switch(curBC, curBC + def, switchCases_);
- break;
- }
- case LOOKUPSWITCH: {
- switchCases_.clear();
- skipPadBytes(i);
- int def = readSInt(code, i);
- int pairCount = readSInt(code, i);
- switchCases_.reserve(pairCount);
- while (pairCount--) {
- int value = readSInt(code, i);
- switchCases_.push_back(
- std::make_pair(value, curBC + readSInt(code, i)));
- }
- THIS->do_switch(curBC, curBC + def, switchCases_);
- break;
- }
- case IRETURN:
- case LRETURN:
- case FRETURN:
- case DRETURN:
- case ARETURN:
- THIS->do_return(curBC);
- break;
- case RETURN:
- THIS->do_return_void(curBC);
- break;
- case GETSTATIC:
- THIS->do_getstatic(curBC, readUShort(code, i));
- break;
- case PUTSTATIC:
- THIS->do_putstatic(curBC, readUShort(code, i));
- break;
- case GETFIELD:
- THIS->do_getfield(curBC, readUShort(code, i));
- break;
- case PUTFIELD:
- THIS->do_putfield(curBC, readUShort(code, i));
- break;
- case INVOKEVIRTUAL:
- THIS->do_invokevirtual(curBC, readUShort(code, i));
- break;
- case INVOKESPECIAL:
- THIS->do_invokespecial(curBC, readUShort(code, i));
- break;
- case INVOKESTATIC:
- THIS->do_invokestatic(curBC, readUShort(code, i));
- break;
- case INVOKEINTERFACE: {
- THIS->do_invokeinterface(curBC, readUShort(code, i));
- unsigned count = readUByte(code, i);
- unsigned zero = readUByte(code, i);
- break;
- }
- case XXXUNUSEDXXX:
- // FIXME: must throw something
- break;
- case NEW:
- THIS->do_new(curBC, readUShort(code, i));
- break;
- case NEWARRAY:
- THIS->do_newarray(curBC,
- static_cast<JType>(readUByte(code, i)));
- break;
- case ANEWARRAY:
- THIS->do_anewarray(curBC, readUShort(code, i));
- break;
- case ARRAYLENGTH:
- THIS->do_arraylength(curBC);
- break;
- case ATHROW:
- THIS->do_athrow(curBC);
- break;
- case CHECKCAST:
- THIS->do_checkcast(curBC, readUShort(code, i));
- break;
- case INSTANCEOF:
- THIS->do_instanceof(curBC, readUShort(code, i));
- break;
- case MONITORENTER:
- THIS->do_monitorenter(curBC);
- break;
- case MONITOREXIT:
- THIS->do_monitorexit(curBC);
- break;
- case WIDE:
- // FIXME: must throw something
- break;
- case MULTIANEWARRAY:
- THIS->do_multianewarray(
- curBC, readUShort(code, i), readUByte(code, i));
- break;
- case IFNULL: {
- unsigned t = curBC + readUShort(code, i);
- THIS->do_if(curBC, EQ, REFERENCE, t, i + 1);
- break;
- }
- case IFNONNULL: {
- unsigned t = curBC + readUShort(code, i);
- THIS->do_if(curBC, NE, REFERENCE, t, i + 1);
- break;
- }
- case GOTO_W:
- THIS->do_goto(curBC, curBC + readSInt(code, i));
- break;
- case JSR_W:
- THIS->do_jsr(curBC, curBC + readSInt(code, i));
- break;
- case BREAKPOINT:
- case IMPDEP1:
- case IMPDEP2:
- case NOP:
- break;
- }
- }
+ for (unsigned i = 0; i < size; ++i) {
+ unsigned curBC = i;
+ bool wide = code[i] == WIDE;
+ i += wide;
+ switch (code[i]) {
+ case ACONST_NULL:
+ THIS->do_aconst_null(curBC);
+ break;
+ case ICONST_M1:
+ case ICONST_0:
+ case ICONST_1:
+ case ICONST_2:
+ case ICONST_3:
+ case ICONST_4:
+ case ICONST_5:
+ THIS->do_iconst(curBC, code[i]-ICONST_0);
+ break;
+ case LCONST_0:
+ case LCONST_1:
+ THIS->do_lconst(curBC, code[i]-LCONST_0);
+ break;
+ case FCONST_0:
+ case FCONST_1:
+ case FCONST_2:
+ THIS->do_fconst(curBC, code[i]-FCONST_0);
+ break;
+ case DCONST_0:
+ case DCONST_1:
+ THIS->do_dconst(curBC, code[i]-DCONST_0);
+ break;
+ case BIPUSH:
+ THIS->do_iconst(curBC, readSByte(code, i));
+ break;
+ case SIPUSH:
+ THIS->do_iconst(curBC, readSShort(code, i));
+ break;
+ case LDC:
+ THIS->do_ldc(curBC, readUByte(code, i));
+ break;
+ case LDC_W:
+ THIS->do_ldc(curBC, readUShort(code, i));
+ break;
+ case LDC2_W:
+ THIS->do_ldc(curBC, readUShort(code, i));
+ break;
+ case ILOAD:
+ THIS->do_load(
+ curBC, INT,
+ wide ? readUShort(code, i) : readUByte(code, i));
+ break;
+ case LLOAD:
+ THIS->do_load(
+ curBC, LONG,
+ wide ? readUShort(code, i) : readUByte(code, i));
+ break;
+ case FLOAD:
+ THIS->do_load(
+ curBC, FLOAT,
+ wide ? readUShort(code, i) : readUByte(code, i));
+ break;
+ case DLOAD:
+ THIS->do_load(
+ curBC, DOUBLE,
+ wide ? readUShort(code, i) : readUByte(code, i));
+ break;
+ case ALOAD:
+ THIS->do_load(
+ curBC, REFERENCE,
+ wide ? readUShort(code, i) : readUByte(code, i));
+ break;
+ case ILOAD_0:
+ case ILOAD_1:
+ case ILOAD_2:
+ case ILOAD_3:
+ THIS->do_load(curBC, INT, code[i]-ILOAD_0);
+ break;
+ case LLOAD_0:
+ case LLOAD_1:
+ case LLOAD_2:
+ case LLOAD_3:
+ THIS->do_load(curBC, LONG, code[i]-LLOAD_0);
+ break;
+ case FLOAD_0:
+ case FLOAD_1:
+ case FLOAD_2:
+ case FLOAD_3:
+ THIS->do_load(curBC, FLOAT, code[i]-FLOAD_0);
+ break;
+ case DLOAD_0:
+ case DLOAD_1:
+ case DLOAD_2:
+ case DLOAD_3:
+ THIS->do_load(curBC, DOUBLE, code[i]-DLOAD_0);
+ break;
+ case ALOAD_0:
+ case ALOAD_1:
+ case ALOAD_2:
+ case ALOAD_3:
+ THIS->do_load(curBC, REFERENCE, code[i]-ALOAD_0);
+ break;
+ case IALOAD:
+ THIS->do_aload(curBC, INT);
+ break;
+ case LALOAD:
+ THIS->do_aload(curBC, LONG);
+ break;
+ case FALOAD:
+ THIS->do_aload(curBC, FLOAT);
+ break;
+ case DALOAD:
+ THIS->do_aload(curBC, DOUBLE);
+ break;
+ case AALOAD:
+ THIS->do_aload(curBC, REFERENCE);
+ break;
+ case BALOAD:
+ THIS->do_aload(curBC, BYTE);
+ break;
+ case CALOAD:
+ THIS->do_aload(curBC, CHAR);
+ break;
+ case SALOAD:
+ THIS->do_aload(curBC, SHORT);
+ break;
+ case ISTORE:
+ THIS->do_store(
+ curBC, INT,
+ wide ? readUShort(code, i) : readUByte(code, i));
+ break;
+ case LSTORE:
+ THIS->do_store(
+ curBC, LONG,
+ wide ? readUShort(code, i) : readUByte(code, i));
+ break;
+ case FSTORE:
+ THIS->do_store(
+ curBC, FLOAT,
+ wide ? readUShort(code, i) : readUByte(code, i));
+ break;
+ case DSTORE:
+ THIS->do_store(
+ curBC, DOUBLE,
+ wide ? readUShort(code, i) : readUByte(code, i));
+ break;
+ case ASTORE:
+ THIS->do_store(
+ curBC, REFERENCE,
+ wide ? readUShort(code, i) : readUByte(code, i));
+ break;
+ case ISTORE_0:
+ case ISTORE_1:
+ case ISTORE_2:
+ case ISTORE_3:
+ THIS->do_store(curBC, INT, code[i]-ISTORE_0);
+ break;
+ case LSTORE_0:
+ case LSTORE_1:
+ case LSTORE_2:
+ case LSTORE_3:
+ THIS->do_store(curBC, LONG, code[i]-LSTORE_0);
+ break;
+ case FSTORE_0:
+ case FSTORE_1:
+ case FSTORE_2:
+ case FSTORE_3:
+ THIS->do_store(curBC, FLOAT, code[i]-FSTORE_0);
+ break;
+ case DSTORE_0:
+ case DSTORE_1:
+ case DSTORE_2:
+ case DSTORE_3:
+ THIS->do_store(curBC, DOUBLE, code[i]-DSTORE_0);
+ break;
+ case ASTORE_0:
+ case ASTORE_1:
+ case ASTORE_2:
+ case ASTORE_3:
+ THIS->do_store(curBC, REFERENCE, code[i]-ASTORE_0);
+ break;
+ case IASTORE:
+ THIS->do_astore(curBC, INT);
+ break;
+ case LASTORE:
+ THIS->do_astore(curBC, LONG);
+ break;
+ case FASTORE:
+ THIS->do_astore(curBC, FLOAT);
+ break;
+ case DASTORE:
+ THIS->do_astore(curBC, DOUBLE);
+ break;
+ case AASTORE:
+ THIS->do_astore(curBC, REFERENCE);
+ break;
+ case BASTORE:
+ THIS->do_astore(curBC, BYTE);
+ break;
+ case CASTORE:
+ THIS->do_astore(curBC, CHAR);
+ break;
+ case SASTORE:
+ THIS->do_astore(curBC, SHORT);
+ break;
+ case POP:
+ THIS->do_pop(curBC);
+ break;
+ case POP2:
+ THIS->do_pop2(curBC);
+ break;
+ case DUP:
+ THIS->do_dup(curBC);
+ break;
+ case DUP_X1:
+ THIS->do_dup_x1(curBC);
+ break;
+ case DUP_X2:
+ THIS->do_dup_x2(curBC);
+ break;
+ case DUP2:
+ THIS->do_dup2(curBC);
+ break;
+ case DUP2_X1:
+ THIS->do_dup2_x1(curBC);
+ break;
+ case DUP2_X2:
+ THIS->do_dup2_x2(curBC);
+ break;
+ case SWAP:
+ THIS->do_swap(curBC);
+ break;
+ case IADD:
+ case LADD:
+ case FADD:
+ case DADD:
+ THIS->do_add(curBC);
+ break;
+ case ISUB:
+ case LSUB:
+ case FSUB:
+ case DSUB:
+ THIS->do_sub(curBC);
+ break;
+ case IMUL:
+ case LMUL:
+ case FMUL:
+ case DMUL:
+ THIS->do_mul(curBC);
+ break;
+ case IDIV:
+ case LDIV:
+ case FDIV:
+ case DDIV:
+ THIS->do_div(curBC);
+ break;
+ case IREM:
+ case LREM:
+ case FREM:
+ case DREM:
+ THIS->do_rem(curBC);
+ break;
+ case INEG:
+ case LNEG:
+ case FNEG:
+ case DNEG:
+ THIS->do_neg(curBC);
+ break;
+ case ISHL:
+ case LSHL:
+ THIS->do_shl(curBC);
+ break;
+ case ISHR:
+ case LSHR:
+ THIS->do_shr(curBC);
+ break;
+ case IUSHR:
+ case LUSHR:
+ THIS->do_ushr(curBC);
+ break;
+ case IAND:
+ case LAND:
+ THIS->do_and(curBC);
+ break;
+ case IOR:
+ case LOR:
+ THIS->do_or(curBC);
+ break;
+ case IXOR:
+ case LXOR:
+ THIS->do_xor(curBC);
+ break;
+ case IINC:
+ THIS->do_iinc(
+ curBC, readUByte(code, i), readSByte(code, i));
+ break;
+ case I2L:
+ THIS->do_convert(curBC, LONG);
+ break;
+ case I2F:
+ THIS->do_convert(curBC, FLOAT);
+ break;
+ case I2D:
+ THIS->do_convert(curBC, DOUBLE);
+ break;
+ case L2I:
+ THIS->do_convert(curBC, INT);
+ break;
+ case L2F:
+ THIS->do_convert(curBC, FLOAT);
+ break;
+ case L2D:
+ THIS->do_convert(curBC, DOUBLE);
+ break;
+ case F2I:
+ THIS->do_convert(curBC, INT);
+ break;
+ case F2L:
+ THIS->do_convert(curBC, LONG);
+ break;
+ case F2D:
+ THIS->do_convert(curBC, DOUBLE);
+ break;
+ case D2I:
+ THIS->do_convert(curBC, INT);
+ break;
+ case D2L:
+ THIS->do_convert(curBC, LONG);
+ break;
+ case D2F:
+ THIS->do_convert(curBC, FLOAT);
+ break;
+ case I2B:
+ THIS->do_convert(curBC, BYTE);
+ break;
+ case I2C:
+ THIS->do_convert(curBC, CHAR);
+ break;
+ case I2S:
+ THIS->do_convert(curBC, SHORT);
+ break;
+ case LCMP:
+ THIS->do_lcmp(curBC);
+ break;
+ case FCMPL:
+ THIS->do_cmpl(curBC);
+ break;
+ case FCMPG:
+ THIS->do_cmpg(curBC);
+ break;
+ case DCMPL:
+ THIS->do_cmpl(curBC);
+ break;
+ case DCMPG:
+ THIS->do_cmpg(curBC);
+ break;
+ case IFEQ: {
+ unsigned t = curBC + readSShort(code, i);
+ THIS->do_if(curBC, EQ, INT, t, i + 1);
+ break;
+ }
+ case IFNE: {
+ unsigned t = curBC + readSShort(code, i);
+ THIS->do_if(curBC, NE, INT, t, i + 1);
+ break;
+ }
+ case IFLT: {
+ unsigned t = curBC + readSShort(code, i);
+ THIS->do_if(curBC, LT, INT, t, i + 1);
+ break;
+ }
+ case IFGE: {
+ unsigned t = curBC + readSShort(code, i);
+ THIS->do_if(curBC, GE, INT, t, i + 1);
+ break;
+ }
+ case IFGT: {
+ unsigned t = curBC + readSShort(code, i);
+ THIS->do_if(curBC, GT, INT, t, i + 1);
+ break;
+ }
+ case IFLE: {
+ unsigned t = curBC + readSShort(code, i);
+ THIS->do_if(curBC, LE, INT, t, i + 1);
+ break;
+ }
+ case IF_ICMPEQ: {
+ unsigned t = curBC + readSShort(code, i);
+ THIS->do_ifcmp(curBC, EQ, t, i + 1);
+ break;
+ }
+ case IF_ICMPNE: {
+ unsigned t = curBC + readSShort(code, i);
+ THIS->do_ifcmp(curBC, NE, t, i + 1);
+ break;
+ }
+ case IF_ICMPLT: {
+ unsigned t = curBC + readSShort(code, i);
+ THIS->do_ifcmp(curBC, LT, t, i + 1);
+ break;
+ }
+ case IF_ICMPGE: {
+ unsigned t = curBC + readSShort(code, i);
+ THIS->do_ifcmp(curBC, GE, t, i + 1);
+ break;
}
+ case IF_ICMPGT: {
+ unsigned t = curBC + readSShort(code, i);
+ THIS->do_ifcmp(curBC, GT, t, i + 1);
+ break;
+ }
+ case IF_ICMPLE: {
+ unsigned t = curBC + readSShort(code, i);
+ THIS->do_ifcmp(curBC, LE, t, i + 1);
+ break;
+ }
+ case IF_IACMPEQ: {
+ unsigned t = curBC + readSShort(code, i);
+ THIS->do_ifcmp(curBC, EQ, t, i + 1);
+ break;
+ }
+ case IF_IACMPNE: {
+ unsigned t = curBC + readSShort(code, i);
+ THIS->do_ifcmp(curBC, NE, t, i + 1);
+ break;
+ }
+ case GOTO:
+ THIS->do_goto(curBC, curBC + readSShort(code, i));
+ break;
+ case JSR:
+ THIS->do_jsr(curBC, curBC + readSShort(code, i));
+ break;
+ case RET:
+ THIS->do_ret(curBC, readUByte(code, i));
+ break;
+ case TABLESWITCH: {
+ switchCases_.clear();
+ skipPadBytes(i);
+ int def = readSInt(code, i);
+ int low = readSInt(code, i);
+ int high = readSInt(code, i);
+ switchCases_.reserve(high - low + 1);
+ while (low <= high)
+ switchCases_.push_back(
+ std::make_pair(low++, curBC + readSInt(code, i)));
+ THIS->do_switch(curBC, curBC + def, switchCases_);
+ break;
+ }
+ case LOOKUPSWITCH: {
+ switchCases_.clear();
+ skipPadBytes(i);
+ int def = readSInt(code, i);
+ int pairCount = readSInt(code, i);
+ switchCases_.reserve(pairCount);
+ while (pairCount--) {
+ int value = readSInt(code, i);
+ switchCases_.push_back(
+ std::make_pair(value, curBC + readSInt(code, i)));
+ }
+ THIS->do_switch(curBC, curBC + def, switchCases_);
+ break;
+ }
+ case IRETURN:
+ case LRETURN:
+ case FRETURN:
+ case DRETURN:
+ case ARETURN:
+ THIS->do_return(curBC);
+ break;
+ case RETURN:
+ THIS->do_return_void(curBC);
+ break;
+ case GETSTATIC:
+ THIS->do_getstatic(curBC, readUShort(code, i));
+ break;
+ case PUTSTATIC:
+ THIS->do_putstatic(curBC, readUShort(code, i));
+ break;
+ case GETFIELD:
+ THIS->do_getfield(curBC, readUShort(code, i));
+ break;
+ case PUTFIELD:
+ THIS->do_putfield(curBC, readUShort(code, i));
+ break;
+ case INVOKEVIRTUAL:
+ THIS->do_invokevirtual(curBC, readUShort(code, i));
+ break;
+ case INVOKESPECIAL:
+ THIS->do_invokespecial(curBC, readUShort(code, i));
+ break;
+ case INVOKESTATIC:
+ THIS->do_invokestatic(curBC, readUShort(code, i));
+ break;
+ case INVOKEINTERFACE: {
+ THIS->do_invokeinterface(curBC, readUShort(code, i));
+ unsigned count = readUByte(code, i);
+ unsigned zero = readUByte(code, i);
+ break;
+ }
+ case XXXUNUSEDXXX:
+ // FIXME: must throw something
+ break;
+ case NEW:
+ THIS->do_new(curBC, readUShort(code, i));
+ break;
+ case NEWARRAY:
+ THIS->do_newarray(curBC,
+ static_cast<JType>(readUByte(code, i)));
+ break;
+ case ANEWARRAY:
+ THIS->do_anewarray(curBC, readUShort(code, i));
+ break;
+ case ARRAYLENGTH:
+ THIS->do_arraylength(curBC);
+ break;
+ case ATHROW:
+ THIS->do_athrow(curBC);
+ break;
+ case CHECKCAST:
+ THIS->do_checkcast(curBC, readUShort(code, i));
+ break;
+ case INSTANCEOF:
+ THIS->do_instanceof(curBC, readUShort(code, i));
+ break;
+ case MONITORENTER:
+ THIS->do_monitorenter(curBC);
+ break;
+ case MONITOREXIT:
+ THIS->do_monitorexit(curBC);
+ break;
+ case WIDE:
+ // FIXME: must throw something
+ break;
+ case MULTIANEWARRAY:
+ THIS->do_multianewarray(
+ curBC, readUShort(code, i), readUByte(code, i));
+ break;
+ case IFNULL: {
+ unsigned t = curBC + readUShort(code, i);
+ THIS->do_if(curBC, EQ, REFERENCE, t, i + 1);
+ break;
+ }
+ case IFNONNULL: {
+ unsigned t = curBC + readUShort(code, i);
+ THIS->do_if(curBC, NE, REFERENCE, t, i + 1);
+ break;
+ }
+ case GOTO_W:
+ THIS->do_goto(curBC, curBC + readSInt(code, i));
+ break;
+ case JSR_W:
+ THIS->do_jsr(curBC, curBC + readSInt(code, i));
+ break;
+ case BREAKPOINT:
+ case IMPDEP1:
+ case IMPDEP2:
+ case NOP:
+ break;
+ }
+ }
+ }
#undef THIS
- /// @brief called on ACONST_NULL
- void do_aconst_null(unsigned bcI) { }
- /// @brief called on ICONST_<n>, SIPUSH and BIPUSH
- void do_iconst(unsigned bcI, int value) { }
- /// @brief called on LCONST_<n>
- void do_lconst(unsigned bcI, long long value) { }
- /// @brief called on FCONST_<n>
- void do_fconst(unsigned bcI, float value) { }
- /// @brief called on DCONST_<n>
- void do_dconst(unsigned bcI, double value) { }
- /// @brief called on LDC, LDC_W and LDC2_W
- void do_ldc(unsigned bcI, unsigned index) { }
- /// @brief called on ILOAD, LLOAD, FLOAD, DLOAD, ALOAD,
- /// ILOAD_<n>, LLOAD_<n>, FLOAD_<n>, DLOAD_<n>, and ALOAD_<n>
- void do_load(unsigned bcI, JType type, unsigned index) { }
- /// @brief called on IALOAD, LALOAD, FALOAD, DALOAD, AALOAD,
- /// BALOAD, CALOAD, and SALOAD
- void do_aload(unsigned bcI, JType type) { }
- /// @brief called on ISTORE, LSTORE, FSTORE, DSTORE, ASTORE,
- /// ISTORE_<n>, LSTORE_<n>, FSTORE_<n>, DSTORE_<n>, and
- /// ASTORE_<n>
- void do_store(unsigned bcI, JType type, unsigned index) { }
- /// @brief called on IASTORE, LASTORE, FASTORE, DASTORE, AASTORE,
- /// BASTORE, CASTORE, and SASTORE
- void do_astore(unsigned bcI, JType type) { }
- /// @brief called on POP
- void do_pop(unsigned bcI) { }
- /// @brief called on POP2
- void do_pop2(unsigned bcI) { }
- /// @brief called on DUP
- void do_dup(unsigned bcI) { }
- /// @brief called on DUP_X1
- void do_dup_x1(unsigned bcI) { }
- /// @brief called on DUP_X2
- void do_dup_x2(unsigned bcI) { }
- /// @brief called on DUP2
- void do_dup2(unsigned bcI) { }
- /// @brief called on DUP2_X1
- void do_dup2_x1(unsigned bcI) { }
- /// @brief called on DUP2_X2
- void do_dup2_x2(unsigned bcI) { }
- /// @brief called on SWAP
- void do_swap(unsigned bcI) { }
- /// @brief called on IADD, LADD, FADD, and DADD
- void do_add(unsigned bcI) { }
- /// @brief called on ISUB, LSUB, FSUB, and DSUB
- void do_sub(unsigned bcI) { }
- /// @brief called on IMUL, LMUL, FMUL, and DMUL
- void do_mul(unsigned bcI) { }
- /// @brief called on IDIV, LDIV, FDIV, and DDIV
- void do_div(unsigned bcI) { }
- /// @brief called on IREM, LREM, FREM, and DREM
- void do_rem(unsigned bcI) { }
- /// @brief called on INEG, LNEG, FNEG, and DNEG
- void do_neg(unsigned bcI) { }
- /// @brief called on ISHL and LSHL
- void do_shl(unsigned bcI) { }
- /// @brief called on ISHR and LSHR
- void do_shr(unsigned bcI) { }
- /// @brief called on IUSHR and LUSHR
- void do_ushr(unsigned bcI) { }
- /// @brief called on IAND and LAND
- void do_and(unsigned bcI) { }
- /// @brief called on IOR or LOR
- void do_or(unsigned bcI) { }
- /// @brief called on IXOR and LXOR
- void do_xor(unsigned bcI) { }
- /// @brief called on IINC
- void do_iinc(unsigned bcI, unsigned index, int amount) { }
- /// @brief called on I2L, I2F, I2D, L2I, L2F, L2D, F2I, F2L,
- /// F2D, D2I, D2L, D2F, I2B, I2C, and I2S
- void do_convert(unsigned bcI, JType to) { }
- /// @brief called on LCMP
- void do_lcmp(unsigned bcI) { }
- /// @brief called on FCMPL and DCMPL
- void do_cmpl(unsigned bcI) { }
- /// @brief called on FCMPG and DCMPG
- void do_cmpg(unsigned bcI) { }
- /// @brief called on IF<op>, IFNULL, and IFNONNULL
- void do_if(unsigned bcI, JSetCC cc, JType type,
- unsigned t, unsigned f) { }
- /// @brief called on IFCMP<op> and IFACMP<op>
- void do_ifcmp(unsigned bcI, JSetCC cc,
- unsigned t, unsigned f) { }
- /// @brief called on GOTO and GOTO_W
- void do_goto(unsigned bcI, unsigned target) { }
- /// @brief called on JSR and JSR_W
- void do_jsr(unsigned bcI, unsigned target) { }
- /// @brief called on RET
- void do_ret(unsigned bcI, unsigned index) { }
- /// @brief called on TABLESWITCH and LOOKUPSWITCH
- void do_switch(unsigned bcI,
- unsigned defTarget,
- const SwitchCases& sw) { }
- /// @brief called on IRETURN, LRETURN, FRETURN, DRETURN and
- /// ARETURN
- void do_return(unsigned bcI) { }
- /// @brief called on RETURN
- void do_return_void(unsigned bcI) { }
- /// @brief called on GETSTATIC
- void do_getstatic(unsigned bcI, unsigned index) { }
- /// @brief called on PUTSTATIC
- void do_putstatic(unsigned bcI, unsigned index) { }
- /// @brief called on GETFIELD
- void do_getfield(unsigned bcI, unsigned index) { }
- /// @brief called on PUTFIELD
- void do_putfield(unsigned bcI, unsigned index) { }
- /// @brief called on INVOKEVIRTUAL
- void do_invokevirtual(unsigned bcI, unsigned index) { }
- /// @brief called on INVOKESPECIAL
- void do_invokespecial(unsigned bcI, unsigned index) { }
- /// @brief called on INVOKESTATIC
- void do_invokestatic(unsigned bcI, unsigned index) { }
- /// @brief called on INVOKEINTERFACE
- void do_invokeinterface(unsigned bcI, unsigned index) { }
- /// @brief called on NEW
- void do_new(unsigned bcI, unsigned index) { }
- /// @brief called on NEWARRAY
- void do_newarray(unsigned bcI, JType type) { }
- /// @brief called on ANEWARRAY
- void do_anewarray(unsigned bcI, unsigned index) { }
- /// @brief called on ARRAYLENGTH
- void do_arraylength(unsigned bcI) { }
- /// @brief called on ATHROW
- void do_athrow(unsigned bcI) { }
- /// @brief called on CHECKCAST
- void do_checkcast(unsigned bcI, unsigned index) { }
- /// @brief called on INSTANCEOF
- void do_instanceof(unsigned bcI, unsigned index) { }
- /// @brief called on MONITORENTER
- void do_monitorenter(unsigned bcI) { }
- /// @brief called on MONITOREXIT
- void do_monitorexit(unsigned bcI) { }
- /// @brief called on MULTIANEWARRAY
- void do_multianewarray(unsigned bcI,
- unsigned index,
- unsigned dims) { }
- };
+ /// @brief called on ACONST_NULL
+ void do_aconst_null(unsigned bcI) { }
+ /// @brief called on ICONST_<n>, SIPUSH and BIPUSH
+ void do_iconst(unsigned bcI, int value) { }
+ /// @brief called on LCONST_<n>
+ void do_lconst(unsigned bcI, long long value) { }
+ /// @brief called on FCONST_<n>
+ void do_fconst(unsigned bcI, float value) { }
+ /// @brief called on DCONST_<n>
+ void do_dconst(unsigned bcI, double value) { }
+ /// @brief called on LDC, LDC_W and LDC2_W
+ void do_ldc(unsigned bcI, unsigned index) { }
+ /// @brief called on ILOAD, LLOAD, FLOAD, DLOAD, ALOAD,
+ /// ILOAD_<n>, LLOAD_<n>, FLOAD_<n>, DLOAD_<n>, and ALOAD_<n>
+ void do_load(unsigned bcI, JType type, unsigned index) { }
+ /// @brief called on IALOAD, LALOAD, FALOAD, DALOAD, AALOAD,
+ /// BALOAD, CALOAD, and SALOAD
+ void do_aload(unsigned bcI, JType type) { }
+ /// @brief called on ISTORE, LSTORE, FSTORE, DSTORE, ASTORE,
+ /// ISTORE_<n>, LSTORE_<n>, FSTORE_<n>, DSTORE_<n>, and
+ /// ASTORE_<n>
+ void do_store(unsigned bcI, JType type, unsigned index) { }
+ /// @brief called on IASTORE, LASTORE, FASTORE, DASTORE, AASTORE,
+ /// BASTORE, CASTORE, and SASTORE
+ void do_astore(unsigned bcI, JType type) { }
+ /// @brief called on POP
+ void do_pop(unsigned bcI) { }
+ /// @brief called on POP2
+ void do_pop2(unsigned bcI) { }
+ /// @brief called on DUP
+ void do_dup(unsigned bcI) { }
+ /// @brief called on DUP_X1
+ void do_dup_x1(unsigned bcI) { }
+ /// @brief called on DUP_X2
+ void do_dup_x2(unsigned bcI) { }
+ /// @brief called on DUP2
+ void do_dup2(unsigned bcI) { }
+ /// @brief called on DUP2_X1
+ void do_dup2_x1(unsigned bcI) { }
+ /// @brief called on DUP2_X2
+ void do_dup2_x2(unsigned bcI) { }
+ /// @brief called on SWAP
+ void do_swap(unsigned bcI) { }
+ /// @brief called on IADD, LADD, FADD, and DADD
+ void do_add(unsigned bcI) { }
+ /// @brief called on ISUB, LSUB, FSUB, and DSUB
+ void do_sub(unsigned bcI) { }
+ /// @brief called on IMUL, LMUL, FMUL, and DMUL
+ void do_mul(unsigned bcI) { }
+ /// @brief called on IDIV, LDIV, FDIV, and DDIV
+ void do_div(unsigned bcI) { }
+ /// @brief called on IREM, LREM, FREM, and DREM
+ void do_rem(unsigned bcI) { }
+ /// @brief called on INEG, LNEG, FNEG, and DNEG
+ void do_neg(unsigned bcI) { }
+ /// @brief called on ISHL and LSHL
+ void do_shl(unsigned bcI) { }
+ /// @brief called on ISHR and LSHR
+ void do_shr(unsigned bcI) { }
+ /// @brief called on IUSHR and LUSHR
+ void do_ushr(unsigned bcI) { }
+ /// @brief called on IAND and LAND
+ void do_and(unsigned bcI) { }
+ /// @brief called on IOR or LOR
+ void do_or(unsigned bcI) { }
+ /// @brief called on IXOR and LXOR
+ void do_xor(unsigned bcI) { }
+ /// @brief called on IINC
+ void do_iinc(unsigned bcI, unsigned index, int amount) { }
+ /// @brief called on I2L, I2F, I2D, L2I, L2F, L2D, F2I, F2L,
+ /// F2D, D2I, D2L, D2F, I2B, I2C, and I2S
+ void do_convert(unsigned bcI, JType to) { }
+ /// @brief called on LCMP
+ void do_lcmp(unsigned bcI) { }
+ /// @brief called on FCMPL and DCMPL
+ void do_cmpl(unsigned bcI) { }
+ /// @brief called on FCMPG and DCMPG
+ void do_cmpg(unsigned bcI) { }
+ /// @brief called on IF<op>, IFNULL, and IFNONNULL
+ void do_if(unsigned bcI, JSetCC cc, JType type,
+ unsigned t, unsigned f) { }
+ /// @brief called on IFCMP<op> and IFACMP<op>
+ void do_ifcmp(unsigned bcI, JSetCC cc,
+ unsigned t, unsigned f) { }
+ /// @brief called on GOTO and GOTO_W
+ void do_goto(unsigned bcI, unsigned target) { }
+ /// @brief called on JSR and JSR_W
+ void do_jsr(unsigned bcI, unsigned target) { }
+ /// @brief called on RET
+ void do_ret(unsigned bcI, unsigned index) { }
+ /// @brief called on TABLESWITCH and LOOKUPSWITCH
+ void do_switch(unsigned bcI,
+ unsigned defTarget,
+ const SwitchCases& sw) { }
+ /// @brief called on IRETURN, LRETURN, FRETURN, DRETURN and
+ /// ARETURN
+ void do_return(unsigned bcI) { }
+ /// @brief called on RETURN
+ void do_return_void(unsigned bcI) { }
+ /// @brief called on GETSTATIC
+ void do_getstatic(unsigned bcI, unsigned index) { }
+ /// @brief called on PUTSTATIC
+ void do_putstatic(unsigned bcI, unsigned index) { }
+ /// @brief called on GETFIELD
+ void do_getfield(unsigned bcI, unsigned index) { }
+ /// @brief called on PUTFIELD
+ void do_putfield(unsigned bcI, unsigned index) { }
+ /// @brief called on INVOKEVIRTUAL
+ void do_invokevirtual(unsigned bcI, unsigned index) { }
+ /// @brief called on INVOKESPECIAL
+ void do_invokespecial(unsigned bcI, unsigned index) { }
+ /// @brief called on INVOKESTATIC
+ void do_invokestatic(unsigned bcI, unsigned index) { }
+ /// @brief called on INVOKEINTERFACE
+ void do_invokeinterface(unsigned bcI, unsigned index) { }
+ /// @brief called on NEW
+ void do_new(unsigned bcI, unsigned index) { }
+ /// @brief called on NEWARRAY
+ void do_newarray(unsigned bcI, JType type) { }
+ /// @brief called on ANEWARRAY
+ void do_anewarray(unsigned bcI, unsigned index) { }
+ /// @brief called on ARRAYLENGTH
+ void do_arraylength(unsigned bcI) { }
+ /// @brief called on ATHROW
+ void do_athrow(unsigned bcI) { }
+ /// @brief called on CHECKCAST
+ void do_checkcast(unsigned bcI, unsigned index) { }
+ /// @brief called on INSTANCEOF
+ void do_instanceof(unsigned bcI, unsigned index) { }
+ /// @brief called on MONITORENTER
+ void do_monitorenter(unsigned bcI) { }
+ /// @brief called on MONITOREXIT
+ void do_monitorexit(unsigned bcI) { }
+ /// @brief called on MULTIANEWARRAY
+ void do_multianewarray(unsigned bcI,
+ unsigned index,
+ unsigned dims) { }
+ };
} } // namespace llvm::Java
Index: llvm-java/include/llvm/Java/Bytecode.h
diff -u llvm-java/include/llvm/Java/Bytecode.h:1.9 llvm-java/include/llvm/Java/Bytecode.h:1.10
--- llvm-java/include/llvm/Java/Bytecode.h:1.9 Tue May 25 20:28:49 2004
+++ llvm-java/include/llvm/Java/Bytecode.h Wed Aug 4 05:02:03 2004
@@ -21,247 +21,247 @@
namespace llvm { namespace Java {
- namespace Opcode {
+ namespace Opcode {
- enum {
- NOP = 0x00,
- ACONST_NULL = 0x01,
- ICONST_M1 = 0x02,
- ICONST_0 = 0x03,
- ICONST_1 = 0x04,
- ICONST_2 = 0x05,
- ICONST_3 = 0x06,
- ICONST_4 = 0x07,
- ICONST_5 = 0x08,
- LCONST_0 = 0x09,
- LCONST_1 = 0x0A,
- FCONST_0 = 0x0B,
- FCONST_1 = 0x0C,
- FCONST_2 = 0x0D,
- DCONST_0 = 0x0E,
- DCONST_1 = 0x0F,
- BIPUSH = 0x10,
- SIPUSH = 0x11,
- LDC = 0x12,
- LDC_W = 0x13,
- LDC2_W = 0x14,
- ILOAD = 0x15,
- LLOAD = 0x16,
- FLOAD = 0x17,
- DLOAD = 0x18,
- ALOAD = 0x19,
- ILOAD_0 = 0x1A,
- ILOAD_1 = 0x1B,
- ILOAD_2 = 0x1C,
- ILOAD_3 = 0x1D,
- LLOAD_0 = 0x1E,
- LLOAD_1 = 0x1F,
- LLOAD_2 = 0x20,
- LLOAD_3 = 0x21,
- FLOAD_0 = 0x22,
- FLOAD_1 = 0x23,
- FLOAD_2 = 0x24,
- FLOAD_3 = 0x25,
- DLOAD_0 = 0x26,
- DLOAD_1 = 0x27,
- DLOAD_2 = 0x28,
- DLOAD_3 = 0x29,
- ALOAD_0 = 0x2A,
- ALOAD_1 = 0x2B,
- ALOAD_2 = 0x2C,
- ALOAD_3 = 0x2D,
- IALOAD = 0x2E,
- LALOAD = 0x2F,
- FALOAD = 0x30,
- DALOAD = 0x31,
- AALOAD = 0x32,
- BALOAD = 0x33,
- CALOAD = 0x34,
- SALOAD = 0x35,
- ISTORE = 0x36,
- LSTORE = 0x37,
- FSTORE = 0x38,
- DSTORE = 0x39,
- ASTORE = 0x3A,
- ISTORE_0 = 0x3B,
- ISTORE_1 = 0x3C,
- ISTORE_2 = 0x3D,
- ISTORE_3 = 0x3E,
- LSTORE_0 = 0x3F,
- LSTORE_1 = 0x40,
- LSTORE_2 = 0x41,
- LSTORE_3 = 0x42,
- FSTORE_0 = 0x43,
- FSTORE_1 = 0x44,
- FSTORE_2 = 0x45,
- FSTORE_3 = 0x46,
- DSTORE_0 = 0x47,
- DSTORE_1 = 0x48,
- DSTORE_2 = 0x49,
- DSTORE_3 = 0x4A,
- ASTORE_0 = 0x4B,
- ASTORE_1 = 0x4C,
- ASTORE_2 = 0x4D,
- ASTORE_3 = 0x4E,
- IASTORE = 0x4F,
- LASTORE = 0x50,
- FASTORE = 0x51,
- DASTORE = 0x52,
- AASTORE = 0x53,
- BASTORE = 0x54,
- CASTORE = 0x55,
- SASTORE = 0x56,
- POP = 0x57,
- POP2 = 0x58,
- DUP = 0x59,
- DUP_X1 = 0x5A,
- DUP_X2 = 0x5B,
- DUP2 = 0x5C,
- DUP2_X1 = 0x5D,
- DUP2_X2 = 0x5E,
- SWAP = 0x5F,
- IADD = 0x60,
- LADD = 0x61,
- FADD = 0x62,
- DADD = 0x63,
- ISUB = 0x64,
- LSUB = 0x65,
- FSUB = 0x66,
- DSUB = 0x67,
- IMUL = 0x68,
- LMUL = 0x69,
- FMUL = 0x6A,
- DMUL = 0x6B,
- IDIV = 0x6C,
- LDIV = 0x6D,
- FDIV = 0x6E,
- DDIV = 0x6F,
- IREM = 0x70,
- LREM = 0x71,
- FREM = 0x72,
- DREM = 0x73,
- INEG = 0x74,
- LNEG = 0x75,
- FNEG = 0x76,
- DNEG = 0x77,
- ISHL = 0x78,
- LSHL = 0x79,
- ISHR = 0x7A,
- LSHR = 0x7B,
- IUSHR = 0x7C,
- LUSHR = 0x7D,
- IAND = 0x7E,
- LAND = 0x7F,
- IOR = 0x80,
- LOR = 0x81,
- IXOR = 0x82,
- LXOR = 0x83,
- IINC = 0x84,
- I2L = 0x85,
- I2F = 0x86,
- I2D = 0x87,
- L2I = 0x88,
- L2F = 0x89,
- L2D = 0x8A,
- F2I = 0x8B,
- F2L = 0x8C,
- F2D = 0x8D,
- D2I = 0x8E,
- D2L = 0x8F,
- D2F = 0x90,
- I2B = 0x91,
- I2C = 0x92,
- I2S = 0x93,
- LCMP = 0x94,
- FCMPL = 0x95,
- FCMPG = 0x96,
- DCMPL = 0x97,
- DCMPG = 0x98,
- IFEQ = 0x99,
- IFNE = 0x9A,
- IFLT = 0x9B,
- IFGE = 0x9C,
- IFGT = 0x9D,
- IFLE = 0x9E,
- IF_ICMPEQ = 0x9F,
- IF_ICMPNE = 0xA0,
- IF_ICMPLT = 0xA1,
- IF_ICMPGE = 0xA2,
- IF_ICMPGT = 0xA3,
- IF_ICMPLE = 0xA4,
- IF_IACMPEQ = 0xA5,
- IF_IACMPNE = 0xA6,
- GOTO = 0xA7,
- JSR = 0xA8,
- RET = 0xA9,
- TABLESWITCH = 0xAA,
- LOOKUPSWITCH = 0xAB,
- IRETURN = 0xAC,
- LRETURN = 0xAD,
- FRETURN = 0xAE,
- DRETURN = 0xAF,
- ARETURN = 0xB0,
- RETURN = 0xB1,
- GETSTATIC = 0xB2,
- PUTSTATIC = 0xB3,
- GETFIELD = 0xB4,
- PUTFIELD = 0xB5,
- INVOKEVIRTUAL = 0xB6,
- INVOKESPECIAL = 0xB7,
- INVOKESTATIC = 0xB8,
- INVOKEINTERFACE = 0xB9,
- XXXUNUSEDXXX = 0xBA,
- NEW = 0xBB,
- NEWARRAY = 0xBC,
- ANEWARRAY = 0xBD,
- ARRAYLENGTH = 0xBE,
- ATHROW = 0xBF,
- CHECKCAST = 0xC0,
- INSTANCEOF = 0xC1,
- MONITORENTER = 0xC2,
- MONITOREXIT = 0xC3,
- WIDE = 0xC4,
- MULTIANEWARRAY = 0xC5,
- IFNULL = 0xC6,
- IFNONNULL = 0xC7,
- GOTO_W = 0xC8,
- JSR_W = 0xC9,
- BREAKPOINT = 0xCA,
- IMPDEP1 = 0xFE,
- IMPDEP2 = 0xFF,
- };
-
- } // namespace Opcode
-
- inline int readSByte(const uint8_t* code, unsigned& i) {
- return ((int8_t*)code)[++i];
- }
-
- inline unsigned readUByte(const uint8_t* code, unsigned& i) {
- return code[++i];
- }
-
- inline int readSShort(const uint8_t* code, unsigned& i) {
- return (readSByte(code, i) << 8) | readUByte(code, i);
- }
-
- inline unsigned readUShort(const uint8_t* code, unsigned& i) {
- return (readUByte(code, i) << 8) | readUByte(code, i);
- }
-
- inline int readSInt(const uint8_t* code, unsigned& i) {
- return (readUShort(code, i) << 16) | readUShort(code, i);
- }
-
- inline unsigned readUInt(const uint8_t* code, unsigned& i) {
- return readSInt(code, i);
- }
-
- inline void skipPadBytes(unsigned& i) {
- unsigned lastTwoBits = i & 0x3;
- i += (4 - lastTwoBits) & 0x3;
- --i;
- }
+ enum {
+ NOP = 0x00,
+ ACONST_NULL = 0x01,
+ ICONST_M1 = 0x02,
+ ICONST_0 = 0x03,
+ ICONST_1 = 0x04,
+ ICONST_2 = 0x05,
+ ICONST_3 = 0x06,
+ ICONST_4 = 0x07,
+ ICONST_5 = 0x08,
+ LCONST_0 = 0x09,
+ LCONST_1 = 0x0A,
+ FCONST_0 = 0x0B,
+ FCONST_1 = 0x0C,
+ FCONST_2 = 0x0D,
+ DCONST_0 = 0x0E,
+ DCONST_1 = 0x0F,
+ BIPUSH = 0x10,
+ SIPUSH = 0x11,
+ LDC = 0x12,
+ LDC_W = 0x13,
+ LDC2_W = 0x14,
+ ILOAD = 0x15,
+ LLOAD = 0x16,
+ FLOAD = 0x17,
+ DLOAD = 0x18,
+ ALOAD = 0x19,
+ ILOAD_0 = 0x1A,
+ ILOAD_1 = 0x1B,
+ ILOAD_2 = 0x1C,
+ ILOAD_3 = 0x1D,
+ LLOAD_0 = 0x1E,
+ LLOAD_1 = 0x1F,
+ LLOAD_2 = 0x20,
+ LLOAD_3 = 0x21,
+ FLOAD_0 = 0x22,
+ FLOAD_1 = 0x23,
+ FLOAD_2 = 0x24,
+ FLOAD_3 = 0x25,
+ DLOAD_0 = 0x26,
+ DLOAD_1 = 0x27,
+ DLOAD_2 = 0x28,
+ DLOAD_3 = 0x29,
+ ALOAD_0 = 0x2A,
+ ALOAD_1 = 0x2B,
+ ALOAD_2 = 0x2C,
+ ALOAD_3 = 0x2D,
+ IALOAD = 0x2E,
+ LALOAD = 0x2F,
+ FALOAD = 0x30,
+ DALOAD = 0x31,
+ AALOAD = 0x32,
+ BALOAD = 0x33,
+ CALOAD = 0x34,
+ SALOAD = 0x35,
+ ISTORE = 0x36,
+ LSTORE = 0x37,
+ FSTORE = 0x38,
+ DSTORE = 0x39,
+ ASTORE = 0x3A,
+ ISTORE_0 = 0x3B,
+ ISTORE_1 = 0x3C,
+ ISTORE_2 = 0x3D,
+ ISTORE_3 = 0x3E,
+ LSTORE_0 = 0x3F,
+ LSTORE_1 = 0x40,
+ LSTORE_2 = 0x41,
+ LSTORE_3 = 0x42,
+ FSTORE_0 = 0x43,
+ FSTORE_1 = 0x44,
+ FSTORE_2 = 0x45,
+ FSTORE_3 = 0x46,
+ DSTORE_0 = 0x47,
+ DSTORE_1 = 0x48,
+ DSTORE_2 = 0x49,
+ DSTORE_3 = 0x4A,
+ ASTORE_0 = 0x4B,
+ ASTORE_1 = 0x4C,
+ ASTORE_2 = 0x4D,
+ ASTORE_3 = 0x4E,
+ IASTORE = 0x4F,
+ LASTORE = 0x50,
+ FASTORE = 0x51,
+ DASTORE = 0x52,
+ AASTORE = 0x53,
+ BASTORE = 0x54,
+ CASTORE = 0x55,
+ SASTORE = 0x56,
+ POP = 0x57,
+ POP2 = 0x58,
+ DUP = 0x59,
+ DUP_X1 = 0x5A,
+ DUP_X2 = 0x5B,
+ DUP2 = 0x5C,
+ DUP2_X1 = 0x5D,
+ DUP2_X2 = 0x5E,
+ SWAP = 0x5F,
+ IADD = 0x60,
+ LADD = 0x61,
+ FADD = 0x62,
+ DADD = 0x63,
+ ISUB = 0x64,
+ LSUB = 0x65,
+ FSUB = 0x66,
+ DSUB = 0x67,
+ IMUL = 0x68,
+ LMUL = 0x69,
+ FMUL = 0x6A,
+ DMUL = 0x6B,
+ IDIV = 0x6C,
+ LDIV = 0x6D,
+ FDIV = 0x6E,
+ DDIV = 0x6F,
+ IREM = 0x70,
+ LREM = 0x71,
+ FREM = 0x72,
+ DREM = 0x73,
+ INEG = 0x74,
+ LNEG = 0x75,
+ FNEG = 0x76,
+ DNEG = 0x77,
+ ISHL = 0x78,
+ LSHL = 0x79,
+ ISHR = 0x7A,
+ LSHR = 0x7B,
+ IUSHR = 0x7C,
+ LUSHR = 0x7D,
+ IAND = 0x7E,
+ LAND = 0x7F,
+ IOR = 0x80,
+ LOR = 0x81,
+ IXOR = 0x82,
+ LXOR = 0x83,
+ IINC = 0x84,
+ I2L = 0x85,
+ I2F = 0x86,
+ I2D = 0x87,
+ L2I = 0x88,
+ L2F = 0x89,
+ L2D = 0x8A,
+ F2I = 0x8B,
+ F2L = 0x8C,
+ F2D = 0x8D,
+ D2I = 0x8E,
+ D2L = 0x8F,
+ D2F = 0x90,
+ I2B = 0x91,
+ I2C = 0x92,
+ I2S = 0x93,
+ LCMP = 0x94,
+ FCMPL = 0x95,
+ FCMPG = 0x96,
+ DCMPL = 0x97,
+ DCMPG = 0x98,
+ IFEQ = 0x99,
+ IFNE = 0x9A,
+ IFLT = 0x9B,
+ IFGE = 0x9C,
+ IFGT = 0x9D,
+ IFLE = 0x9E,
+ IF_ICMPEQ = 0x9F,
+ IF_ICMPNE = 0xA0,
+ IF_ICMPLT = 0xA1,
+ IF_ICMPGE = 0xA2,
+ IF_ICMPGT = 0xA3,
+ IF_ICMPLE = 0xA4,
+ IF_IACMPEQ = 0xA5,
+ IF_IACMPNE = 0xA6,
+ GOTO = 0xA7,
+ JSR = 0xA8,
+ RET = 0xA9,
+ TABLESWITCH = 0xAA,
+ LOOKUPSWITCH = 0xAB,
+ IRETURN = 0xAC,
+ LRETURN = 0xAD,
+ FRETURN = 0xAE,
+ DRETURN = 0xAF,
+ ARETURN = 0xB0,
+ RETURN = 0xB1,
+ GETSTATIC = 0xB2,
+ PUTSTATIC = 0xB3,
+ GETFIELD = 0xB4,
+ PUTFIELD = 0xB5,
+ INVOKEVIRTUAL = 0xB6,
+ INVOKESPECIAL = 0xB7,
+ INVOKESTATIC = 0xB8,
+ INVOKEINTERFACE = 0xB9,
+ XXXUNUSEDXXX = 0xBA,
+ NEW = 0xBB,
+ NEWARRAY = 0xBC,
+ ANEWARRAY = 0xBD,
+ ARRAYLENGTH = 0xBE,
+ ATHROW = 0xBF,
+ CHECKCAST = 0xC0,
+ INSTANCEOF = 0xC1,
+ MONITORENTER = 0xC2,
+ MONITOREXIT = 0xC3,
+ WIDE = 0xC4,
+ MULTIANEWARRAY = 0xC5,
+ IFNULL = 0xC6,
+ IFNONNULL = 0xC7,
+ GOTO_W = 0xC8,
+ JSR_W = 0xC9,
+ BREAKPOINT = 0xCA,
+ IMPDEP1 = 0xFE,
+ IMPDEP2 = 0xFF,
+ };
+
+ } // namespace Opcode
+
+ inline int readSByte(const uint8_t* code, unsigned& i) {
+ return ((int8_t*)code)[++i];
+ }
+
+ inline unsigned readUByte(const uint8_t* code, unsigned& i) {
+ return code[++i];
+ }
+
+ inline int readSShort(const uint8_t* code, unsigned& i) {
+ return (readSByte(code, i) << 8) | readUByte(code, i);
+ }
+
+ inline unsigned readUShort(const uint8_t* code, unsigned& i) {
+ return (readUByte(code, i) << 8) | readUByte(code, i);
+ }
+
+ inline int readSInt(const uint8_t* code, unsigned& i) {
+ return (readUShort(code, i) << 16) | readUShort(code, i);
+ }
+
+ inline unsigned readUInt(const uint8_t* code, unsigned& i) {
+ return readSInt(code, i);
+ }
+
+ inline void skipPadBytes(unsigned& i) {
+ unsigned lastTwoBits = i & 0x3;
+ i += (4 - lastTwoBits) & 0x3;
+ --i;
+ }
} } // namespace llvm::Java
More information about the llvm-commits
mailing list