Added index type of dex byte instructions.
Rationale:
The information was already in the instruction_list but not
exposed as enum through a getter. This CL adds that ability.
This information is needed by the upcoming Art-based dexdump.
NOTE:
Added "Index" to the enum constants naming convention.
NOTE:
Fixed few incorrect quickened entries in instruction_list.
Bug: 17442393
Change-Id: Ica18ae43135f78f29e9832f5a101d497e54724cf
diff --git a/runtime/dex_instruction.h b/runtime/dex_instruction.h
index b043aba..0ddbf7c 100644
--- a/runtime/dex_instruction.h
+++ b/runtime/dex_instruction.h
@@ -116,6 +116,17 @@
k51l, // op vAA, #+BBBBBBBBBBBBBBBB
};
+ enum IndexType {
+ kIndexUnknown = 0,
+ kIndexNone, // has no index
+ kIndexTypeRef, // type reference index
+ kIndexStringRef, // string reference index
+ kIndexMethodRef, // method reference index
+ kIndexFieldRef, // field reference index
+ kIndexFieldOffset, // field offset (for static linked fields)
+ kIndexVtableOffset // vtable offset (for static linked methods)
+ };
+
enum Flags {
kBranch = 0x0000001, // conditional or unconditional branch
kContinue = 0x0000002, // flow can continue to next statement
@@ -446,6 +457,11 @@
return kInstructionFormats[opcode];
}
+ // Returns the index type of the given opcode.
+ static IndexType IndexTypeOf(Code opcode) {
+ return kInstructionIndexTypes[opcode];
+ }
+
// Returns the flags for the given opcode.
static int FlagsOf(Code opcode) {
return kInstructionFlags[opcode];
@@ -583,6 +599,7 @@
static const char* const kInstructionNames[];
static Format const kInstructionFormats[];
+ static IndexType const kInstructionIndexTypes[];
static int const kInstructionFlags[];
static int const kInstructionVerifyFlags[];
static int const kInstructionSizeInCodeUnits[];