summaryrefslogtreecommitdiffstats
path: root/dalvik
diff options
context:
space:
mode:
authorDan Bornstein <danfuzz@android.com>2010-11-19 18:11:21 -0800
committerDan Bornstein <danfuzz@android.com>2010-11-29 10:59:57 -0800
commit16829a7fc923d557b7c0cd951f0251b9d53a45aa (patch)
treec15fd9904aa0faf656cfb0928588e60841df31f6 /dalvik
parent102b3a86bde04a4cffcbecd5b6d175d7790b132a (diff)
downloadlibcore-16829a7fc923d557b7c0cd951f0251b9d53a45aa.zip
libcore-16829a7fc923d557b7c0cd951f0251b9d53a45aa.tar.gz
libcore-16829a7fc923d557b7c0cd951f0251b9d53a45aa.tar.bz2
A little opcode cleanup in dalvik.system.
OpcodeInfo is a sparse class right now, but I expect it will eventually start to look a bit like InstrInfo.[ch] in libdex. Change-Id: Ia446c95829515ee5f718ed80217d80a74738a09d
Diffstat (limited to 'dalvik')
-rw-r--r--dalvik/src/main/java/dalvik/bytecode/OpcodeInfo.java50
-rw-r--r--dalvik/src/main/java/dalvik/bytecode/Opcodes.java47
2 files changed, 75 insertions, 22 deletions
diff --git a/dalvik/src/main/java/dalvik/bytecode/OpcodeInfo.java b/dalvik/src/main/java/dalvik/bytecode/OpcodeInfo.java
new file mode 100644
index 0000000..035f741
--- /dev/null
+++ b/dalvik/src/main/java/dalvik/bytecode/OpcodeInfo.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dalvik.bytecode;
+
+/**
+ * Information about Dalvik opcodes.
+ */
+public final class OpcodeInfo {
+ /**
+ * The maximum possible value of a Dalvik opcode.
+ *
+ * <p><b>Note:</b>: This is constant in any given VM incarnation,
+ * 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();
+
+ /**
+ * 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;
+ }
+
+ /**
+ * This class is not instantiable.
+ */
+ private OpcodeInfo() {
+ // This space intentionally left blank.
+ }
+}
diff --git a/dalvik/src/main/java/dalvik/bytecode/Opcodes.java b/dalvik/src/main/java/dalvik/bytecode/Opcodes.java
index a6f053a..cb99ef5 100644
--- a/dalvik/src/main/java/dalvik/bytecode/Opcodes.java
+++ b/dalvik/src/main/java/dalvik/bytecode/Opcodes.java
@@ -22,6 +22,7 @@ package dalvik.bytecode;
* (This was converted from //device/dalvik/libdex/OpCode.h)
*/
public interface Opcodes {
+ // TODO: Make the following definitions be generated by opcode-gen.
int OP_NOP = 0x00;
int OP_MOVE = 0x01;
@@ -279,34 +280,36 @@ public interface Opcodes {
* The rest of these are either generated by dexopt for optimized
* code, or inserted by the VM at runtime. They are never generated
* by "dx".
+ *
+ * They are all deprecated and will be removed in a future
+ * release, since these declarations are really of private implementation
+ * details that are subject to change.
*/
- int OP_IGET_WIDE_VOLATILE = 0xe8;
- int OP_IPUT_WIDE_VOLATILE = 0xe9;
- int OP_SGET_WIDE_VOLATILE = 0xea;
- int OP_SPUT_WIDE_VOLATILE = 0xeb;
+ @Deprecated int OP_IGET_WIDE_VOLATILE = 0xe8;
+ @Deprecated int OP_IPUT_WIDE_VOLATILE = 0xe9;
+ @Deprecated int OP_SGET_WIDE_VOLATILE = 0xea;
+ @Deprecated int OP_SPUT_WIDE_VOLATILE = 0xeb;
- int OP_BREAKPOINT = 0xec;
- int OP_THROW_VERIFICATION_ERROR = 0xed;
+ @Deprecated int OP_BREAKPOINT = 0xec;
+ @Deprecated int OP_THROW_VERIFICATION_ERROR = 0xed;
- int OP_EXECUTE_INLINE = 0xee;
- int OP_EXECUTE_INLINE_RANGE = 0xef;
+ @Deprecated int OP_EXECUTE_INLINE = 0xee;
+ @Deprecated int OP_EXECUTE_INLINE_RANGE = 0xef;
- int OP_INVOKE_DIRECT_EMPTY = 0xf0;
+ @Deprecated int OP_INVOKE_DIRECT_EMPTY = 0xf0;
/* f1 unused (OP_INVOKE_DIRECT_EMPTY_RANGE?) */
- int OP_IGET_QUICK = 0xf2;
- int OP_IGET_WIDE_QUICK = 0xf3;
- int OP_IGET_OBJECT_QUICK = 0xf4;
- int OP_IPUT_QUICK = 0xf5;
- int OP_IPUT_WIDE_QUICK = 0xf6;
- int OP_IPUT_OBJECT_QUICK = 0xf7;
-
- int OP_INVOKE_VIRTUAL_QUICK = 0xf8;
- int OP_INVOKE_VIRTUAL_QUICK_RANGE = 0xf9;
- int OP_INVOKE_SUPER_QUICK = 0xfa;
- int OP_INVOKE_SUPER_QUICK_RANGE = 0xfb;
+ @Deprecated int OP_IGET_QUICK = 0xf2;
+ @Deprecated int OP_IGET_WIDE_QUICK = 0xf3;
+ @Deprecated int OP_IGET_OBJECT_QUICK = 0xf4;
+ @Deprecated int OP_IPUT_QUICK = 0xf5;
+ @Deprecated int OP_IPUT_WIDE_QUICK = 0xf6;
+ @Deprecated int OP_IPUT_OBJECT_QUICK = 0xf7;
+
+ @Deprecated int OP_INVOKE_VIRTUAL_QUICK = 0xf8;
+ @Deprecated int OP_INVOKE_VIRTUAL_QUICK_RANGE = 0xf9;
+ @Deprecated int OP_INVOKE_SUPER_QUICK = 0xfa;
+ @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?) */
- /* ff unused (OP_INVOKE_INTERFACE_QUICK_RANGE?) */
}
-