summaryrefslogtreecommitdiffstats
path: root/dalvik
diff options
context:
space:
mode:
authorDan Bornstein <danfuzz@android.com>2010-11-29 16:45:15 -0800
committerDan Bornstein <danfuzz@android.com>2010-11-29 17:39:07 -0800
commit8630242560eefb56c0481931533eb7e12d3edfee (patch)
treed719bf9286a9f223c9c200a1ed60456ca45070df /dalvik
parentdf5fca24dbb5457d844d7e2d0f3f6b0f39892267 (diff)
downloadlibcore-8630242560eefb56c0481931533eb7e12d3edfee.zip
libcore-8630242560eefb56c0481931533eb7e12d3edfee.tar.gz
libcore-8630242560eefb56c0481931533eb7e12d3edfee.tar.bz2
Generate most libcore opcode-related stuff.
This brings libcore's Dalvik opcode definitions into the opcode-gen fold, but there is still a bit more to clean up after this. Change-Id: I199d6484f2d23f24a86ffe668739be99685a43e8
Diffstat (limited to 'dalvik')
-rw-r--r--dalvik/src/main/java/dalvik/bytecode/OpcodeInfo.java24
-rw-r--r--dalvik/src/main/java/dalvik/bytecode/Opcodes.java144
2 files changed, 114 insertions, 54 deletions
diff --git a/dalvik/src/main/java/dalvik/bytecode/OpcodeInfo.java b/dalvik/src/main/java/dalvik/bytecode/OpcodeInfo.java
index 035f741..5fd6397 100644
--- a/dalvik/src/main/java/dalvik/bytecode/OpcodeInfo.java
+++ b/dalvik/src/main/java/dalvik/bytecode/OpcodeInfo.java
@@ -27,18 +27,20 @@ public final class OpcodeInfo {
* but it is subject to change over time, so it is not appropriate
* to represent as a compile-time constant value.</p>
*/
- public static final int MAXIMUM_VALUE = getMaximumValue();
+ public static final int MAXIMUM_VALUE;
- /**
- * Gets the maximum possible value of a Dalvik opcode.
- *
- * @see #MAXIMUM_VALUE
- *
- * @return the maximum possible value of a Dalvik opcode
- */
- private static int getMaximumValue() {
- // TODO: Make this constant be generated by opcode-gen.
- return 255;
+ static {
+ /*
+ * See note on the definition of MAXIMUM_VALUE, above, for
+ * why it's not assigned directly on the declaration line.
+ *
+ * IMPORTANT NOTE: This assignment is generated automatically
+ * by the opcode-gen tool. Any edits will get wiped out the
+ * next time the tool is run.
+ */
+ // BEGIN(libcore-maximum-value); GENERATED AUTOMATICALLY BY opcode-gen
+ MAXIMUM_VALUE = 255;
+ // END(libcore-maximum-value)
}
/**
diff --git a/dalvik/src/main/java/dalvik/bytecode/Opcodes.java b/dalvik/src/main/java/dalvik/bytecode/Opcodes.java
index cb99ef5..ffbfad6 100644
--- a/dalvik/src/main/java/dalvik/bytecode/Opcodes.java
+++ b/dalvik/src/main/java/dalvik/bytecode/Opcodes.java
@@ -17,14 +17,17 @@
package dalvik.bytecode;
/**
- * This is a list of Dalvik opcodes.
- *
- * (This was converted from //device/dalvik/libdex/OpCode.h)
+ * A list of all normal (not implementation-specific) Dalvik opcodes.
*/
public interface Opcodes {
- // TODO: Make the following definitions be generated by opcode-gen.
- int OP_NOP = 0x00;
+ /*
+ * IMPORTANT NOTE: The contents of this file are mostly generated
+ * automatically by the opcode-gen tool. Any edits to the generated
+ * sections will get wiped out the next time the tool is run.
+ */
+ // BEGIN(libcore-opcodes); GENERATED AUTOMATICALLY BY opcode-gen
+ int OP_NOP = 0x00;
int OP_MOVE = 0x01;
int OP_MOVE_FROM16 = 0x02;
int OP_MOVE_16 = 0x03;
@@ -34,17 +37,14 @@ public interface Opcodes {
int OP_MOVE_OBJECT = 0x07;
int OP_MOVE_OBJECT_FROM16 = 0x08;
int OP_MOVE_OBJECT_16 = 0x09;
-
int OP_MOVE_RESULT = 0x0a;
int OP_MOVE_RESULT_WIDE = 0x0b;
int OP_MOVE_RESULT_OBJECT = 0x0c;
int OP_MOVE_EXCEPTION = 0x0d;
-
int OP_RETURN_VOID = 0x0e;
int OP_RETURN = 0x0f;
int OP_RETURN_WIDE = 0x10;
int OP_RETURN_OBJECT = 0x11;
-
int OP_CONST_4 = 0x12;
int OP_CONST_16 = 0x13;
int OP_CONST = 0x14;
@@ -56,35 +56,27 @@ public interface Opcodes {
int OP_CONST_STRING = 0x1a;
int OP_CONST_STRING_JUMBO = 0x1b;
int OP_CONST_CLASS = 0x1c;
-
int OP_MONITOR_ENTER = 0x1d;
int OP_MONITOR_EXIT = 0x1e;
-
int OP_CHECK_CAST = 0x1f;
int OP_INSTANCE_OF = 0x20;
-
int OP_ARRAY_LENGTH = 0x21;
-
int OP_NEW_INSTANCE = 0x22;
int OP_NEW_ARRAY = 0x23;
-
int OP_FILLED_NEW_ARRAY = 0x24;
int OP_FILLED_NEW_ARRAY_RANGE = 0x25;
int OP_FILL_ARRAY_DATA = 0x26;
-
int OP_THROW = 0x27;
int OP_GOTO = 0x28;
int OP_GOTO_16 = 0x29;
int OP_GOTO_32 = 0x2a;
int OP_PACKED_SWITCH = 0x2b;
int OP_SPARSE_SWITCH = 0x2c;
-
int OP_CMPL_FLOAT = 0x2d;
int OP_CMPG_FLOAT = 0x2e;
int OP_CMPL_DOUBLE = 0x2f;
int OP_CMPG_DOUBLE = 0x30;
int OP_CMP_LONG = 0x31;
-
int OP_IF_EQ = 0x32;
int OP_IF_NE = 0x33;
int OP_IF_LT = 0x34;
@@ -97,9 +89,6 @@ public interface Opcodes {
int OP_IF_GEZ = 0x3b;
int OP_IF_GTZ = 0x3c;
int OP_IF_LEZ = 0x3d;
-
- /* 3e-43 unused */
-
int OP_AGET = 0x44;
int OP_AGET_WIDE = 0x45;
int OP_AGET_OBJECT = 0x46;
@@ -114,7 +103,6 @@ public interface Opcodes {
int OP_APUT_BYTE = 0x4f;
int OP_APUT_CHAR = 0x50;
int OP_APUT_SHORT = 0x51;
-
int OP_IGET = 0x52;
int OP_IGET_WIDE = 0x53;
int OP_IGET_OBJECT = 0x54;
@@ -129,7 +117,6 @@ public interface Opcodes {
int OP_IPUT_BYTE = 0x5d;
int OP_IPUT_CHAR = 0x5e;
int OP_IPUT_SHORT = 0x5f;
-
int OP_SGET = 0x60;
int OP_SGET_WIDE = 0x61;
int OP_SGET_OBJECT = 0x62;
@@ -144,23 +131,16 @@ public interface Opcodes {
int OP_SPUT_BYTE = 0x6b;
int OP_SPUT_CHAR = 0x6c;
int OP_SPUT_SHORT = 0x6d;
-
int OP_INVOKE_VIRTUAL = 0x6e;
int OP_INVOKE_SUPER = 0x6f;
int OP_INVOKE_DIRECT = 0x70;
int OP_INVOKE_STATIC = 0x71;
int OP_INVOKE_INTERFACE = 0x72;
-
- /* 73 unused */
-
int OP_INVOKE_VIRTUAL_RANGE = 0x74;
int OP_INVOKE_SUPER_RANGE = 0x75;
int OP_INVOKE_DIRECT_RANGE = 0x76;
int OP_INVOKE_STATIC_RANGE = 0x77;
int OP_INVOKE_INTERFACE_RANGE = 0x78;
-
- /* 79-7a unused */
-
int OP_NEG_INT = 0x7b;
int OP_NOT_INT = 0x7c;
int OP_NEG_LONG = 0x7d;
@@ -182,7 +162,6 @@ public interface Opcodes {
int OP_INT_TO_BYTE = 0x8d;
int OP_INT_TO_CHAR = 0x8e;
int OP_INT_TO_SHORT = 0x8f;
-
int OP_ADD_INT = 0x90;
int OP_SUB_INT = 0x91;
int OP_MUL_INT = 0x92;
@@ -194,7 +173,6 @@ public interface Opcodes {
int OP_SHL_INT = 0x98;
int OP_SHR_INT = 0x99;
int OP_USHR_INT = 0x9a;
-
int OP_ADD_LONG = 0x9b;
int OP_SUB_LONG = 0x9c;
int OP_MUL_LONG = 0x9d;
@@ -206,7 +184,6 @@ public interface Opcodes {
int OP_SHL_LONG = 0xa3;
int OP_SHR_LONG = 0xa4;
int OP_USHR_LONG = 0xa5;
-
int OP_ADD_FLOAT = 0xa6;
int OP_SUB_FLOAT = 0xa7;
int OP_MUL_FLOAT = 0xa8;
@@ -217,7 +194,6 @@ public interface Opcodes {
int OP_MUL_DOUBLE = 0xad;
int OP_DIV_DOUBLE = 0xae;
int OP_REM_DOUBLE = 0xaf;
-
int OP_ADD_INT_2ADDR = 0xb0;
int OP_SUB_INT_2ADDR = 0xb1;
int OP_MUL_INT_2ADDR = 0xb2;
@@ -229,7 +205,6 @@ public interface Opcodes {
int OP_SHL_INT_2ADDR = 0xb8;
int OP_SHR_INT_2ADDR = 0xb9;
int OP_USHR_INT_2ADDR = 0xba;
-
int OP_ADD_LONG_2ADDR = 0xbb;
int OP_SUB_LONG_2ADDR = 0xbc;
int OP_MUL_LONG_2ADDR = 0xbd;
@@ -241,7 +216,6 @@ public interface Opcodes {
int OP_SHL_LONG_2ADDR = 0xc3;
int OP_SHR_LONG_2ADDR = 0xc4;
int OP_USHR_LONG_2ADDR = 0xc5;
-
int OP_ADD_FLOAT_2ADDR = 0xc6;
int OP_SUB_FLOAT_2ADDR = 0xc7;
int OP_MUL_FLOAT_2ADDR = 0xc8;
@@ -252,16 +226,14 @@ public interface Opcodes {
int OP_MUL_DOUBLE_2ADDR = 0xcd;
int OP_DIV_DOUBLE_2ADDR = 0xce;
int OP_REM_DOUBLE_2ADDR = 0xcf;
-
int OP_ADD_INT_LIT16 = 0xd0;
- int OP_RSUB_INT = 0xd1; /* no _LIT16 suffix for this */
+ int OP_RSUB_INT = 0xd1;
int OP_MUL_INT_LIT16 = 0xd2;
int OP_DIV_INT_LIT16 = 0xd3;
int OP_REM_INT_LIT16 = 0xd4;
int OP_AND_INT_LIT16 = 0xd5;
int OP_OR_INT_LIT16 = 0xd6;
int OP_XOR_INT_LIT16 = 0xd7;
-
int OP_ADD_INT_LIT8 = 0xd8;
int OP_RSUB_INT_LIT8 = 0xd9;
int OP_MUL_INT_LIT8 = 0xda;
@@ -273,8 +245,7 @@ public interface Opcodes {
int OP_SHL_INT_LIT8 = 0xe0;
int OP_SHR_INT_LIT8 = 0xe1;
int OP_USHR_INT_LIT8 = 0xe2;
-
- /* e3-e7 unused */
+ // END(libcore-opcodes)
/*
* The rest of these are either generated by dexopt for optimized
@@ -285,31 +256,118 @@ public interface Opcodes {
* release, since these declarations are really of private implementation
* details that are subject to change.
*/
+
+ /**
+ * Implementation detail.
+ * @deprecated Implementation detail.
+ */
@Deprecated int OP_IGET_WIDE_VOLATILE = 0xe8;
+
+ /**
+ * Implementation detail.
+ * @deprecated Implementation detail.
+ */
@Deprecated int OP_IPUT_WIDE_VOLATILE = 0xe9;
+
+ /**
+ * Implementation detail.
+ * @deprecated Implementation detail.
+ */
@Deprecated int OP_SGET_WIDE_VOLATILE = 0xea;
+
+ /**
+ * Implementation detail.
+ * @deprecated Implementation detail.
+ */
@Deprecated int OP_SPUT_WIDE_VOLATILE = 0xeb;
+ /**
+ * Implementation detail.
+ * @deprecated Implementation detail.
+ */
@Deprecated int OP_BREAKPOINT = 0xec;
+
+ /**
+ * Implementation detail.
+ * @deprecated Implementation detail.
+ */
@Deprecated int OP_THROW_VERIFICATION_ERROR = 0xed;
+ /**
+ * Implementation detail.
+ * @deprecated Implementation detail.
+ */
@Deprecated int OP_EXECUTE_INLINE = 0xee;
+
+ /**
+ * Implementation detail.
+ * @deprecated Implementation detail.
+ */
@Deprecated int OP_EXECUTE_INLINE_RANGE = 0xef;
+ /**
+ * Implementation detail.
+ * @deprecated Implementation detail.
+ */
@Deprecated int OP_INVOKE_DIRECT_EMPTY = 0xf0;
- /* f1 unused (OP_INVOKE_DIRECT_EMPTY_RANGE?) */
+
+ /**
+ * Implementation detail.
+ * @deprecated Implementation detail.
+ */
@Deprecated int OP_IGET_QUICK = 0xf2;
+
+ /**
+ * Implementation detail.
+ * @deprecated Implementation detail.
+ */
@Deprecated int OP_IGET_WIDE_QUICK = 0xf3;
+
+ /**
+ * Implementation detail.
+ * @deprecated Implementation detail.
+ */
@Deprecated int OP_IGET_OBJECT_QUICK = 0xf4;
+
+ /**
+ * Implementation detail.
+ * @deprecated Implementation detail.
+ */
@Deprecated int OP_IPUT_QUICK = 0xf5;
+
+ /**
+ * Implementation detail.
+ * @deprecated Implementation detail.
+ */
@Deprecated int OP_IPUT_WIDE_QUICK = 0xf6;
+
+ /**
+ * Implementation detail.
+ * @deprecated Implementation detail.
+ */
@Deprecated int OP_IPUT_OBJECT_QUICK = 0xf7;
+ /**
+ * Implementation detail.
+ * @deprecated Implementation detail.
+ */
@Deprecated int OP_INVOKE_VIRTUAL_QUICK = 0xf8;
+
+ /**
+ * Implementation detail.
+ * @deprecated Implementation detail.
+ */
@Deprecated int OP_INVOKE_VIRTUAL_QUICK_RANGE = 0xf9;
+
+ /**
+ * Implementation detail.
+ * @deprecated Implementation detail.
+ */
@Deprecated int OP_INVOKE_SUPER_QUICK = 0xfa;
+
+ /**
+ * Implementation detail.
+ * @deprecated Implementation detail.
+ */
@Deprecated int OP_INVOKE_SUPER_QUICK_RANGE = 0xfb;
- /* fc unused (OP_INVOKE_DIRECT_QUICK?) */
- /* fd unused (OP_INVOKE_DIRECT_QUICK_RANGE?) */
- /* fe unused (OP_INVOKE_INTERFACE_QUICK?) */
}