You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by mb...@apache.org on 2005/05/22 19:55:54 UTC
svn commit: r171351 [7/16] - in /incubator/jdo/trunk/enhancer20: ./ src/
src/conf/ src/java/ src/java/org/ src/java/org/apache/
src/java/org/apache/jdo/ src/java/org/apache/jdo/enhancer/
src/java/org/apache/jdo/impl/ src/java/org/apache/jdo/impl/enhancer/
src/java/org/apache/jdo/impl/enhancer/classfile/
src/java/org/apache/jdo/impl/enhancer/core/
src/java/org/apache/jdo/impl/enhancer/generator/
src/java/org/apache/jdo/impl/enhancer/meta/
src/java/org/apache/jdo/impl/enhancer/meta/model/
src/java/org/apache/jdo/impl/enhancer/meta/prop/
src/java/org/apache/jdo/impl/enhancer/meta/util/
src/java/org/apache/jdo/impl/enhancer/util/ test/ test/sempdept/
test/sempdept/src/ test/sempdept/src/empdept/
Added: incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/VMConstants.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/VMConstants.java?rev=171351&view=auto
==============================================================================
--- incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/VMConstants.java (added)
+++ incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/VMConstants.java Sun May 22 10:55:51 2005
@@ -0,0 +1,282 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * 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 org.apache.jdo.impl.enhancer.classfile;
+
+/**
+ * VMConstants is a collection of the constants defined in the
+ * virtual machine spec.
+ * Also included are several assorted constants of our own which
+ * seem logical to define here.
+ */
+public interface VMConstants {
+ /* Access types */
+ static final int ACCPublic = 0x0001;
+ static final int ACCPrivate = 0x0002;
+ static final int ACCProtected = 0x0004;
+ static final int ACCStatic = 0x0008;
+ static final int ACCFinal = 0x0010;
+ static final int ACCSuper = 0x0020; /* For Class file */
+ static final int ACCSynchronized = 0x0020; /* For methods */
+ static final int ACCVolatile = 0x0040;
+ static final int ACCTransient = 0x0080;
+ static final int ACCNative = 0x0100;
+ static final int ACCInterface = 0x0200;
+ static final int ACCAbstract = 0x0400;
+
+
+ /* Primitive Types */
+ /* These correspond to the values used by newarray */
+ static final int T_BOOLEAN = 4;
+ static final int T_CHAR = 5;
+ static final int T_FLOAT = 6;
+ static final int T_DOUBLE = 7;
+ static final int T_BYTE = 8;
+ static final int T_SHORT = 9;
+ static final int T_INT = 10;
+ static final int T_LONG = 11;
+
+ /* Class types - Not really part of the VM spec */
+ static final int TC_OBJECT = 12;
+ static final int TC_INTERFACE = 13;
+ static final int TC_STRING = 14;
+
+ /* Special pseudo types - Not really part of the VM spec */
+ static final int T_UNKNOWN = 15;
+ static final int T_WORD = 16;
+ static final int T_TWOWORD = 17;
+
+ /* Constant pool types */
+ static final int CONSTANTUtf8 = 1;
+ static final int CONSTANTUnicode = 2; /* Def.in Beta doc - not in 1.0.2 */
+ static final int CONSTANTInteger = 3;
+ static final int CONSTANTFloat = 4;
+ static final int CONSTANTLong = 5;
+ static final int CONSTANTDouble = 6;
+ static final int CONSTANTClass = 7;
+ static final int CONSTANTString = 8;
+ static final int CONSTANTFieldRef = 9;
+ static final int CONSTANTMethodRef = 10;
+ static final int CONSTANTInterfaceMethodRef = 11;
+ static final int CONSTANTNameAndType = 12;
+
+
+
+ /* Java VM opcodes */
+ final static int opc_nop = 0;
+ final static int opc_aconst_null = 1;
+ final static int opc_iconst_m1 = 2;
+ final static int opc_iconst_0 = 3;
+ final static int opc_iconst_1 = 4;
+ final static int opc_iconst_2 = 5;
+ final static int opc_iconst_3 = 6;
+ final static int opc_iconst_4 = 7;
+ final static int opc_iconst_5 = 8;
+ final static int opc_lconst_0 = 9;
+ final static int opc_lconst_1 = 10;
+ final static int opc_fconst_0 = 11;
+ final static int opc_fconst_1 = 12;
+ final static int opc_fconst_2 = 13;
+ final static int opc_dconst_0 = 14;
+ final static int opc_dconst_1 = 15;
+ final static int opc_bipush = 16;
+ final static int opc_sipush = 17;
+ final static int opc_ldc = 18;
+ final static int opc_ldc_w = 19;
+ final static int opc_ldc2_w = 20;
+ final static int opc_iload = 21;
+ final static int opc_lload = 22;
+ final static int opc_fload = 23;
+ final static int opc_dload = 24;
+ final static int opc_aload = 25;
+ final static int opc_iload_0 = 26;
+ final static int opc_iload_1 = 27;
+ final static int opc_iload_2 = 28;
+ final static int opc_iload_3 = 29;
+ final static int opc_lload_0 = 30;
+ final static int opc_lload_1 = 31;
+ final static int opc_lload_2 = 32;
+ final static int opc_lload_3 = 33;
+ final static int opc_fload_0 = 34;
+ final static int opc_fload_1 = 35;
+ final static int opc_fload_2 = 36;
+ final static int opc_fload_3 = 37;
+ final static int opc_dload_0 = 38;
+ final static int opc_dload_1 = 39;
+ final static int opc_dload_2 = 40;
+ final static int opc_dload_3 = 41;
+ final static int opc_aload_0 = 42;
+ final static int opc_aload_1 = 43;
+ final static int opc_aload_2 = 44;
+ final static int opc_aload_3 = 45;
+ final static int opc_iaload = 46;
+ final static int opc_laload = 47;
+ final static int opc_faload = 48;
+ final static int opc_daload = 49;
+ final static int opc_aaload = 50;
+ final static int opc_baload = 51;
+ final static int opc_caload = 52;
+ final static int opc_saload = 53;
+ final static int opc_istore = 54;
+ final static int opc_lstore = 55;
+ final static int opc_fstore = 56;
+ final static int opc_dstore = 57;
+ final static int opc_astore = 58;
+ final static int opc_istore_0 = 59;
+ final static int opc_istore_1 = 60;
+ final static int opc_istore_2 = 61;
+ final static int opc_istore_3 = 62;
+ final static int opc_lstore_0 = 63;
+ final static int opc_lstore_1 = 64;
+ final static int opc_lstore_2 = 65;
+ final static int opc_lstore_3 = 66;
+ final static int opc_fstore_0 = 67;
+ final static int opc_fstore_1 = 68;
+ final static int opc_fstore_2 = 69;
+ final static int opc_fstore_3 = 70;
+ final static int opc_dstore_0 = 71;
+ final static int opc_dstore_1 = 72;
+ final static int opc_dstore_2 = 73;
+ final static int opc_dstore_3 = 74;
+ final static int opc_astore_0 = 75;
+ final static int opc_astore_1 = 76;
+ final static int opc_astore_2 = 77;
+ final static int opc_astore_3 = 78;
+ final static int opc_iastore = 79;
+ final static int opc_lastore = 80;
+ final static int opc_fastore = 81;
+ final static int opc_dastore = 82;
+ final static int opc_aastore = 83;
+ final static int opc_bastore = 84;
+ final static int opc_castore = 85;
+ final static int opc_sastore = 86;
+ final static int opc_pop = 87;
+ final static int opc_pop2 = 88;
+ final static int opc_dup = 89;
+ final static int opc_dup_x1 = 90;
+ final static int opc_dup_x2 = 91;
+ final static int opc_dup2 = 92;
+ final static int opc_dup2_x1 = 93;
+ final static int opc_dup2_x2 = 94;
+ final static int opc_swap = 95;
+ final static int opc_iadd = 96;
+ final static int opc_ladd = 97;
+ final static int opc_fadd = 98;
+ final static int opc_dadd = 99;
+ final static int opc_isub = 100;
+ final static int opc_lsub = 101;
+ final static int opc_fsub = 102;
+ final static int opc_dsub = 103;
+ final static int opc_imul = 104;
+ final static int opc_lmul = 105;
+ final static int opc_fmul = 106;
+ final static int opc_dmul = 107;
+ final static int opc_idiv = 108;
+ final static int opc_ldiv = 109;
+ final static int opc_fdiv = 110;
+ final static int opc_ddiv = 111;
+ final static int opc_irem = 112;
+ final static int opc_lrem = 113;
+ final static int opc_frem = 114;
+ final static int opc_drem = 115;
+ final static int opc_ineg = 116;
+ final static int opc_lneg = 117;
+ final static int opc_fneg = 118;
+ final static int opc_dneg = 119;
+ final static int opc_ishl = 120;
+ final static int opc_lshl = 121;
+ final static int opc_ishr = 122;
+ final static int opc_lshr = 123;
+ final static int opc_iushr = 124;
+ final static int opc_lushr = 125;
+ final static int opc_iand = 126;
+ final static int opc_land = 127;
+ final static int opc_ior = 128;
+ final static int opc_lor = 129;
+ final static int opc_ixor = 130;
+ final static int opc_lxor = 131;
+ final static int opc_iinc = 132;
+ final static int opc_i2l = 133;
+ final static int opc_i2f = 134;
+ final static int opc_i2d = 135;
+ final static int opc_l2i = 136;
+ final static int opc_l2f = 137;
+ final static int opc_l2d = 138;
+ final static int opc_f2i = 139;
+ final static int opc_f2l = 140;
+ final static int opc_f2d = 141;
+ final static int opc_d2i = 142;
+ final static int opc_d2l = 143;
+ final static int opc_d2f = 144;
+ final static int opc_i2b = 145;
+ final static int opc_i2c = 146;
+ final static int opc_i2s = 147;
+ final static int opc_lcmp = 148;
+ final static int opc_fcmpl = 149;
+ final static int opc_fcmpg = 150;
+ final static int opc_dcmpl = 151;
+ final static int opc_dcmpg = 152;
+ final static int opc_ifeq = 153;
+ final static int opc_ifne = 154;
+ final static int opc_iflt = 155;
+ final static int opc_ifge = 156;
+ final static int opc_ifgt = 157;
+ final static int opc_ifle = 158;
+ final static int opc_if_icmpeq = 159;
+ final static int opc_if_icmpne = 160;
+ final static int opc_if_icmplt = 161;
+ final static int opc_if_icmpge = 162;
+ final static int opc_if_icmpgt = 163;
+ final static int opc_if_icmple = 164;
+ final static int opc_if_acmpeq = 165;
+ final static int opc_if_acmpne = 166;
+ final static int opc_goto = 167;
+ final static int opc_jsr = 168;
+ final static int opc_ret = 169;
+ final static int opc_tableswitch = 170;
+ final static int opc_lookupswitch = 171;
+ final static int opc_ireturn = 172;
+ final static int opc_lreturn = 173;
+ final static int opc_freturn = 174;
+ final static int opc_dreturn = 175;
+ final static int opc_areturn = 176;
+ final static int opc_return = 177;
+ final static int opc_getstatic = 178;
+ final static int opc_putstatic = 179;
+ final static int opc_getfield = 180;
+ final static int opc_putfield = 181;
+ final static int opc_invokevirtual = 182;
+ final static int opc_invokespecial = 183;
+ final static int opc_invokestatic = 184;
+ final static int opc_invokeinterface = 185;
+ final static int opc_xxxunusedxxx = 186;
+ final static int opc_new = 187;
+ final static int opc_newarray = 188;
+ final static int opc_anewarray = 189;
+ final static int opc_arraylength = 190;
+ final static int opc_athrow = 191;
+ final static int opc_checkcast = 192;
+ final static int opc_instanceof = 193;
+ final static int opc_monitorenter = 194;
+ final static int opc_monitorexit = 195;
+ final static int opc_wide = 196;
+ final static int opc_multianewarray = 197;
+ final static int opc_ifnull = 198;
+ final static int opc_ifnonnull = 199;
+ final static int opc_goto_w = 200;
+ final static int opc_jsr_w = 201;
+}
Added: incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/VMOp.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/VMOp.java?rev=171351&view=auto
==============================================================================
--- incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/VMOp.java (added)
+++ incubator/jdo/trunk/enhancer20/src/java/org/apache/jdo/impl/enhancer/classfile/VMOp.java Sun May 22 10:55:51 2005
@@ -0,0 +1,546 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * 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 org.apache.jdo.impl.enhancer.classfile;
+
+/**
+ * Description of the VM opcodes
+ */
+public class VMOp implements VMConstants {
+ /* The opcode value */
+ private int opcodeValue;
+
+ /* The name of the opcode */
+ private String opcodeName;
+
+ /* The number of stack argument words */
+ private int stackArgs;
+
+ /* The number of stack result words */
+ private int stackResults;
+
+ /* The "type" signature of the stack argument words */
+ private String stackArgTypes;
+
+ /* The "type" signature of the stack result words */
+ private String stackResultTypes;
+
+ /* public accessors */
+
+ /**
+ * Return the opcode value
+ */
+ final public int opcode() {
+ return opcodeValue;
+ }
+
+ /**
+ * Return the opcode name
+ */
+ final public String name() {
+ return opcodeName;
+ }
+
+ /**
+ * Return the number of words of stack arguments expected by this operation.
+ * If the number is not a fixed value, return -1;
+ */
+ final public int nStackArgs() {
+ return stackArgs;
+ }
+
+ /**
+ * Return the number of words of stack results produced by this operation.
+ * If the number is not a fixed value, return -1;
+ */
+ final public int nStackResults() {
+ return stackResults;
+ }
+
+ /**
+ * Return the type descriptor for the stack arguments to the operation.
+ */
+ final public String argTypes() {
+ return stackArgTypes;
+ }
+
+ /**
+ * Return the type descriptor for the stack results of the operation.
+ */
+ final public String resultTypes() {
+ return stackResultTypes;
+ }
+
+ /**
+ * constructor for a VMOp
+ */
+
+ public VMOp(int theOpcode, String theOpcodeName, int nArgs, int nResults,
+ String argDescr, String resultDescr) {
+ opcodeValue = theOpcode;
+ opcodeName = theOpcodeName;
+ stackArgs = nArgs;
+ stackResults = nResults;
+ stackArgTypes = argDescr;
+ stackResultTypes = resultDescr;
+ }
+
+ /* package local methods */
+
+ static VMOp[] ops = {
+ /* | no change*/
+ new VMOp(opc_nop, "nop", 0, 0, "", ""),
+ /* | ... -> ..., null */
+ new VMOp(opc_aconst_null, "aconst_null", 0, 1, "", "A"),
+ /* | ... -> ..., -1 */
+ new VMOp(opc_iconst_m1, "iconst_m1", 0, 1, "", "I"),
+ /* | ... -> ..., 0 */
+ new VMOp(opc_iconst_0, "iconst_0", 0, 1, "", "I"),
+ /* | ... -> ..., 1 */
+ new VMOp(opc_iconst_1, "iconst_1", 0, 1, "", "I"),
+ /* | ... -> ..., 2 */
+ new VMOp(opc_iconst_2, "iconst_2", 0, 1, "", "I"),
+ /* | ... -> ..., 3 */
+ new VMOp(opc_iconst_3, "iconst_3", 0, 1, "", "I"),
+ /* | ... -> ..., 4 */
+ new VMOp(opc_iconst_4, "iconst_4", 0, 1, "", "I"),
+ /* | ... -> ..., 5 */
+ new VMOp(opc_iconst_5, "iconst_5", 0, 1, "", "I"),
+ /* | ... -> ..., 0<high/low>, 0<high/low> */
+ new VMOp(opc_lconst_0, "lconst_0", 0, 2, "", "J"),
+ /* | ... -> ..., 1<high/low>, 1<high/low> */
+ new VMOp(opc_lconst_1, "lconst_1", 0, 2, "", "J"),
+ /* | ... -> ..., 0.0f */
+ new VMOp(opc_fconst_0, "fconst_0", 0, 1, "", "F"),
+ /* | ... -> ..., 1.0f */
+ new VMOp(opc_fconst_1, "fconst_1", 0, 1, "", "F"),
+ /* | ... -> ..., 2.0f */
+ new VMOp(opc_fconst_2, "fconst_2", 0, 1, "", "F"),
+ /* | ... -> ..., 0.0<high/low>, 0.0<high/low> */
+ new VMOp(opc_dconst_0, "dconst_0", 0, 2, "", "D"),
+ /* | ... -> ..., 1.0<high/low>, 1.0<high/low> */
+ new VMOp(opc_dconst_1, "dconst_1", 0, 2, "", "D"),
+ /* byte1 | ... => ..., value */
+ new VMOp(opc_bipush, "bipush", 0, 1, "", "I"),
+ /* byte1 byte2 | ... => ..., value */
+ new VMOp(opc_sipush, "sipush", 0, 1, "", "I"),
+ /* indexbyte1 | ... => ..., item */
+ new VMOp(opc_ldc, "ldc", 0, 1, "", "W"),
+ /* indexbyte1 indexbyte2 | ... => ..., item */
+ new VMOp(opc_ldc_w, "ldc_w", 0, 1, "", "W"),
+ /* indexbyte1 indexbyte2 | ... => ..., item1, item2 */
+ new VMOp(opc_ldc2_w, "ldc2_w", 0, 2, "", "X"),
+ /* vindex | ... => ..., value<vindex> */
+ new VMOp(opc_iload, "iload", 0, 1, "", "I"),
+ /* vindex | ... => ..., value<vindex><h/l>, value<vindex><h/l> */
+ new VMOp(opc_lload, "lload", 0, 2, "", "J"),
+ /* vindex | ... => ..., value<vindex> */
+ new VMOp(opc_fload, "fload", 0, 1, "", "F"),
+ /* vindex | ... => ..., value<vindex><h/l>, value<vindex><h/l> */
+ new VMOp(opc_dload, "dload", 0, 2, "", "D"),
+ /* vindex | ... => ..., value<vindex> */
+ new VMOp(opc_aload, "aload", 0, 1, "", "A"),
+ /* | ... => ..., value<0> */
+ new VMOp(opc_iload_0, "iload_0", 0, 1, "", "I"),
+ /* | ... => ..., value<1> */
+ new VMOp(opc_iload_1, "iload_1", 0, 1, "", "I"),
+ /* | ... => ..., value<2> */
+ new VMOp(opc_iload_2, "iload_2", 0, 1, "", "I"),
+ /* | ... => ..., value<3> */
+ new VMOp(opc_iload_3, "iload_3", 0, 1, "", "I"),
+ /* | ... => ..., value<0><h/l>, value<0><h/l> */
+ new VMOp(opc_lload_0, "lload_0", 0, 2, "", "J"),
+ /* | ... => ..., value<1><h/l>, value<1><h/l> */
+ new VMOp(opc_lload_1, "lload_1", 0, 2, "", "J"),
+ /* | ... => ..., value<2><h/l>, value<2><h/l> */
+ new VMOp(opc_lload_2, "lload_2", 0, 2, "", "J"),
+ /* | ... => ..., value<3><h/l>, value<3><h/l> */
+ new VMOp(opc_lload_3, "lload_3", 0, 2, "", "J"),
+ /* | ... => ..., value<0> */
+ new VMOp(opc_fload_0, "fload_0", 0, 1, "", "F"),
+ /* | ... => ..., value<1> */
+ new VMOp(opc_fload_1, "fload_1", 0, 1, "", "F"),
+ /* | ... => ..., value<2> */
+ new VMOp(opc_fload_2, "fload_2", 0, 1, "", "F"),
+ /* | ... => ..., value<3> */
+ new VMOp(opc_fload_3, "fload_3", 0, 1, "", "F"),
+ /* | ... => ..., value<0><h/l>, value<0><h/l> */
+ new VMOp(opc_dload_0, "dload_0", 0, 2, "", "D"),
+ /* | ... => ..., value<1><h/l>, value<1><h/l> */
+ new VMOp(opc_dload_1, "dload_1", 0, 2, "", "D"),
+ /* | ... => ..., value<2><h/l>, value<2><h/l> */
+ new VMOp(opc_dload_2, "dload_2", 0, 2, "", "D"),
+ /* | ... => ..., value<3><h/l>, value<3><h/l> */
+ new VMOp(opc_dload_3, "dload_3", 0, 2, "", "D"),
+ /* | ... => ..., value<0> */
+ new VMOp(opc_aload_0, "aload_0", 0, 1, "", "A"),
+ /* | ... => ..., value<1> */
+ new VMOp(opc_aload_1, "aload_1", 0, 1, "", "A"),
+ /* | ... => ..., value<2> */
+ new VMOp(opc_aload_2, "aload_2", 0, 1, "", "A"),
+ /* | ... => ..., value<3> */
+ new VMOp(opc_aload_3, "aload_3", 0, 1, "", "A"),
+ /* | ..., arrayref, index => ..., value */
+ new VMOp(opc_iaload, "iaload", 2, 1, "AI", "I"),
+ /* | ..., arrayref, index => ..., value<h/l>, value<h/l> */
+ new VMOp(opc_laload, "laload", 2, 2, "AI", "J"),
+ /* | ..., arrayref, index => ..., value */
+ new VMOp(opc_faload, "faload", 2, 1, "AI", "F"),
+ /* | ..., arrayref, index => ..., value<h/l>, value<h/l> */
+ new VMOp(opc_daload, "daload", 2, 2, "AI", "D"),
+ /* | ..., arrayref, index => ..., value */
+ new VMOp(opc_aaload, "aaload", 2, 1, "AI", "A"),
+ /* | ..., arrayref, index => ..., value */
+ new VMOp(opc_baload, "baload", 2, 1, "AI", "I"),
+ /* | ..., arrayref, index => ..., value */
+ new VMOp(opc_caload, "caload", 2, 1, "AI", "I"),
+ /* | ..., arrayref, index => ..., value */
+ new VMOp(opc_saload, "saload", 2, 1, "AI", "I"),
+ /* vindex | ..., value => ... */
+ new VMOp(opc_istore, "istore", 1, 0, "I", ""),
+ /* vindex | ..., value<h/l>, value<h/l> => ... */
+ new VMOp(opc_lstore, "lstore", 2, 0, "J", ""),
+ /* vindex | ..., value => ... */
+ new VMOp(opc_fstore, "fstore", 1, 0, "F", ""),
+ /* vindex | ..., value<h/l>, value<h/l> => ... */
+ new VMOp(opc_dstore, "dstore", 2, 0, "D", ""),
+ /* vindex | ..., value => ... */
+ new VMOp(opc_astore, "astore", 1, 0, "A", ""),
+ /* | ..., value => ... */
+ new VMOp(opc_istore_0, "istore_0", 1, 0, "I", ""),
+ /* | ..., value => ... */
+ new VMOp(opc_istore_1, "istore_1", 1, 0, "I", ""),
+ /* | ..., value => ... */
+ new VMOp(opc_istore_2, "istore_2", 1, 0, "I", ""),
+ /* | ..., value => ... */
+ new VMOp(opc_istore_3, "istore_3", 1, 0, "I", ""),
+ /* | ..., value<h/l>, value<h/l> => ... */
+ new VMOp(opc_lstore_0, "lstore_0", 2, 0, "J", ""),
+ /* | ..., value<h/l>, value<h/l> => ... */
+ new VMOp(opc_lstore_1, "lstore_1", 2, 0, "J", ""),
+ /* | ..., value<h/l>, value<h/l> => ... */
+ new VMOp(opc_lstore_2, "lstore_2", 2, 0, "J", ""),
+ /* | ..., value<h/l>, value<h/l> => ... */
+ new VMOp(opc_lstore_3, "lstore_3", 2, 0, "J", ""),
+ /* | ..., value => ... */
+ new VMOp(opc_fstore_0, "fstore_0", 1, 0, "F", ""),
+ /* | ..., value => ... */
+ new VMOp(opc_fstore_1, "fstore_1", 1, 0, "F", ""),
+ /* | ..., value => ... */
+ new VMOp(opc_fstore_2, "fstore_2", 1, 0, "F", ""),
+ /* | ..., value => ... */
+ new VMOp(opc_fstore_3, "fstore_3", 1, 0, "F", ""),
+ /* | ..., value<h/l>, value<h/l> => ... */
+ new VMOp(opc_dstore_0, "dstore_0", 2, 0, "D", ""),
+ /* | ..., value<h/l>, value<h/l> => ... */
+ new VMOp(opc_dstore_1, "dstore_1", 2, 0, "D", ""),
+ /* | ..., value<h/l>, value<h/l> => ... */
+ new VMOp(opc_dstore_2, "dstore_2", 2, 0, "D", ""),
+ /* | ..., value<h/l>, value<h/l> => ... */
+ new VMOp(opc_dstore_3, "dstore_3", 2, 0, "D", ""),
+ /* | ..., value => ... */
+ new VMOp(opc_astore_0, "astore_0", 1, 0, "A", ""),
+ /* | ..., value => ... */
+ new VMOp(opc_astore_1, "astore_1", 1, 0, "A", ""),
+ /* | ..., value => ... */
+ new VMOp(opc_astore_2, "astore_2", 1, 0, "A", ""),
+ /* | ..., value => ... */
+ new VMOp(opc_astore_3, "astore_3", 1, 0, "A", ""),
+ /* | ..., arrayref, index, value => ... */
+ new VMOp(opc_iastore, "iastore", 3, 0, "AII", ""),
+ /* | ..., arrayref, index, value<h/l>, value<h/l> => ... */
+ new VMOp(opc_lastore, "lastore", 4, 0, "AIJ", ""),
+ /* | ..., arrayref, index, value => ... */
+ new VMOp(opc_fastore, "fastore", 3, 0, "AIF", ""),
+ /* | ..., arrayref, index, value<h/l>, value<h/l> => ... */
+ new VMOp(opc_dastore, "dastore", 4, 0, "AID", ""),
+ /* | ..., arrayref, index, value => ... */
+ new VMOp(opc_aastore, "aastore", 3, 0, "AIA", ""),
+ /* | ..., arrayref, index, value => ... */
+ new VMOp(opc_bastore, "bastore", 3, 0, "AII", ""),
+ /* | ..., arrayref, index, value => ... */
+ new VMOp(opc_castore, "castore", 3, 0, "AII", ""),
+ /* | ..., arrayref, index, value => ... */
+ new VMOp(opc_sastore, "sastore", 3, 0, "AII", ""),
+ /* | ..., any => ... */
+ new VMOp(opc_pop, "pop", 1, 0, "W", ""),
+ /* | ..., any1, any2 => ... */
+ new VMOp(opc_pop2, "pop2", 2, 0, "WW", ""),
+ /* | ..., any => ..., any, any */
+ new VMOp(opc_dup, "dup", 1, 2, "W", "WW"),
+ /* | ..., any1, any2 => ..., any2, any1, any2 */
+ new VMOp(opc_dup_x1, "dup_x1", 2, 3, "WW", "WWW"),
+ /* | ..., any1, any2, any3 => ..., any3, any1, any2, any3 */
+ new VMOp(opc_dup_x2, "dup_x2", 3, 4, "WWW", "WWWW"),
+ /* | ..., any1, any2 => ..., any1, any2, any1, any2 */
+ new VMOp(opc_dup2, "dup2", 2, 4, "WW", "WWWW"),
+ /* | ..., any1, any2, any3 => ..., any2, any3, any1, any2, any3 */
+ new VMOp(opc_dup2_x1, "dup2_x1", 3, 5, "WWW", "WWWWW"),
+ /* | ..., any1, any2, any3, any4 => ..., any3, any4, any1, any2, any3, any4 */
+ new VMOp(opc_dup2_x2, "dup2_x2", 4, 6, "WWWW", "WWWWWW"),
+ /* | ..., any1, any2 => ..., any2, any1 */
+ new VMOp(opc_swap, "swap", 2, 2, "WW", "WW"),
+ /* | ..., value1, value2 => ..., result */
+ new VMOp(opc_iadd, "iadd", 2, 1, "II", "I"),
+ /* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
+ new VMOp(opc_ladd, "ladd", 4, 2, "JJ", "J"),
+ /* | ..., value1, value2 => ..., result */
+ new VMOp(opc_fadd, "fadd", 2, 1, "FF", "F"),
+ /* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
+ new VMOp(opc_dadd, "dadd", 4, 2, "DD", "D"),
+ /* | ..., value1, value2 => ..., result */
+ new VMOp(opc_isub, "isub", 2, 1, "II", "I"),
+ /* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
+ new VMOp(opc_lsub, "lsub", 4, 2, "JJ", "J"),
+ /* | ..., value1, value2 => ..., result */
+ new VMOp(opc_fsub, "fsub", 2, 1, "FF", "F"),
+ /* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
+ new VMOp(opc_dsub, "dsub", 4, 2, "DD", "D"),
+ /* | ..., value1, value2 => ..., result */
+ new VMOp(opc_imul, "imul", 2, 1, "II", "I"),
+ /* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
+ new VMOp(opc_lmul, "lmul", 4, 2, "JJ", "J"),
+ /* | ..., value1, value2 => ..., result */
+ new VMOp(opc_fmul, "fmul", 2, 1, "FF", "F"),
+ /* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
+ new VMOp(opc_dmul, "dmul", 4, 2, "DD", "D"),
+ /* | ..., value1, value2 => ..., result */
+ new VMOp(opc_idiv, "idiv", 2, 1, "II", "I"),
+ /* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
+ new VMOp(opc_ldiv, "ldiv", 4, 2, "JJ", "J"),
+ /* | ..., value1, value2 => ..., result */
+ new VMOp(opc_fdiv, "fdiv", 2, 1, "FF", "F"),
+ /* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
+ new VMOp(opc_ddiv, "ddiv", 4, 2, "DD", "D"),
+ /* | ..., value1, value2 => ..., result */
+ new VMOp(opc_irem, "irem", 2, 1, "II", "I"),
+ /* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
+ new VMOp(opc_lrem, "lrem", 4, 2, "JJ", "J"),
+ /* | ..., value1, value2 => ..., result */
+ new VMOp(opc_frem, "frem", 2, 1, "FF", "F"),
+ /* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
+ new VMOp(opc_drem, "drem", 4, 2, "DD", "D"),
+ /* | ..., value => ..., result */
+ new VMOp(opc_ineg, "ineg", 1, 1, "I", "I"),
+ /* | ..., value<h/l>, value<h/l> => ..., result<h/l>, result<h/l> */
+ new VMOp(opc_lneg, "lneg", 2, 2, "J", "J"),
+ /* | ..., value => ..., result */
+ new VMOp(opc_fneg, "fneg", 1, 1, "F", "F"),
+ /* | ..., value<h/l>, value<h/l> => ..., result<h/l>, result<h/l> */
+ new VMOp(opc_dneg, "dneg", 2, 2, "D", "D"),
+ /* | ..., value1, value2 => ..., result */
+ new VMOp(opc_ishl, "ishl", 2, 1, "II", "I"),
+ /* | ..., value1<h/l>, value1<h/l>, value2 => ..., result */
+ new VMOp(opc_lshl, "lshl", 3, 2, "JI", "J"),
+ /* | ..., value1, value2 => ..., result */
+ new VMOp(opc_ishr, "ishr", 2, 1, "II", "I"),
+ /* | ..., value1<h/l>, value1<h/l>, value2 => ..., result<h/l>, result<h/l> */
+ new VMOp(opc_lshr, "lshr", 3, 2, "JI", "J"),
+ /* | ..., value1, value2 => ..., result */
+ new VMOp(opc_iushr, "iushr", 2, 1, "II", "I"),
+ /* | ..., value1<h/l>, value1<h/l>, value2 => ..., result<h/l>, result<h/l> */
+ new VMOp(opc_lushr, "lushr", 3, 2, "JI", "J"),
+ /* | ..., value1, value2 => ..., result */
+ new VMOp(opc_iand, "iand", 2, 1, "II", "I"),
+ /* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
+ new VMOp(opc_land, "land", 4, 2, "JJ", "J"),
+ /* | ..., value1, value2 => ..., result */
+ new VMOp(opc_ior, "ior", 2, 1, "II", "I"),
+ /* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
+ new VMOp(opc_lor, "lor", 4, 2, "JJ", "J"),
+ /* | ..., value1, value2 => ..., result */
+ new VMOp(opc_ixor, "ixor", 2, 1, "II", "I"),
+ /* | ..., value1<h/l>, value1<h/l>, value2<h/l>, value2<h/l> => ..., result<h/l>, result<h/l> */
+ new VMOp(opc_lxor, "lxor", 4, 2, "JJ", "J"),
+ /* vindex, const | no change */
+ new VMOp(opc_iinc, "iinc", 0, 0, "", ""),
+ /* | ..., value => ..., value<h/l>, value<h/l> */
+ new VMOp(opc_i2l, "i2l", 1, 2, "I", "J"),
+ /* | ..., value => ..., value */
+ new VMOp(opc_i2f, "i2f", 1, 1, "I", "F"),
+ /* | ..., value => ..., value<h/l>, value<h/l> */
+ new VMOp(opc_i2d, "i2d", 1, 2, "I", "D"),
+ /* | ..., value<h/l>, value<h/l> => ..., value */
+ new VMOp(opc_l2i, "l2i", 2, 1, "J", "I"),
+ /* | ..., value<h/l>, value<h/l> => ..., value */
+ new VMOp(opc_l2f, "l2f", 2, 1, "J", "F"),
+ /* | ..., value<h/l>, value<h/l> => ..., value<h/l>, value<h/l> */
+ new VMOp(opc_l2d, "l2d", 2, 2, "J", "D"),
+ /* | ..., value => ..., value */
+ new VMOp(opc_f2i, "f2i", 1, 1, "F", "I"),
+ /* | ..., value => ..., value<h/l>, value<h/l> */
+ new VMOp(opc_f2l, "f2l", 1, 2, "F", "J"),
+ /* | ..., value => ..., value<h/l>, value<h/l> */
+ new VMOp(opc_f2d, "f2d", 1, 2, "F", "D"),
+ /* | ..., value<h/l>, value<h/l> => ..., value */
+ new VMOp(opc_d2i, "d2i", 2, 1, "D", "I"),
+ /* | ..., value<h/l>, value<h/l> => ..., value<h/l>, value<h/l> */
+ new VMOp(opc_d2l, "d2l", 2, 2, "D", "J"),
+ /* | ..., value<h/l>, value<h/l> => ..., value */
+ new VMOp(opc_d2f, "d2f", 2, 1, "D", "F"),
+ /* | ..., value => ..., result */
+ new VMOp(opc_i2b, "i2b", 1, 1, "I", "I"),
+ /* | ..., value => ..., result */
+ new VMOp(opc_i2c, "i2c", 1, 1, "I", "I"),
+ /* | ..., value => ..., result */
+ new VMOp(opc_i2s, "i2s", 1, 1, "I", "I"),
+ /* | ..., v1<h/l>, v1<h/l>, v2<h/l>, v2<h/l> => ..., result */
+ new VMOp(opc_lcmp, "lcmp", 4, 1, "JJ", "I"),
+ /* | ..., v1<h/l>, v1<h/l>, v2<h/l>, v2<h/l> => ..., result */
+ new VMOp(opc_fcmpl, "fcmpl", 2, 1, "FF", "I"),
+ /* | ..., v1, v2 => ..., result */
+ new VMOp(opc_fcmpg, "fcmpg", 2, 1, "FF", "I"),
+ /* | ..., v1<h/l>, v1<h/l>, v2<h/l>, v2<h/l> => ..., result */
+ new VMOp(opc_dcmpl, "dcmpl", 4, 1, "DD", "I"),
+ /* | ..., v1<h/l>, v1<h/l>, v2<h/l>, v2<h/l> => ..., result */
+ new VMOp(opc_dcmpg, "dcmpg", 4, 1, "DD", "I"),
+ /* brbyte1, brbyte2 | ..., value => ... */
+ new VMOp(opc_ifeq, "ifeq", 1, 0, "I", ""),
+ /* brbyte1, brbyte2 | ..., value => ... */
+ new VMOp(opc_ifne, "ifne", 1, 0, "I", ""),
+ /* brbyte1, brbyte2 | ..., value => ... */
+ new VMOp(opc_iflt, "iflt", 1, 0, "I", ""),
+ /* brbyte1, brbyte2 | ..., value => ... */
+ new VMOp(opc_ifge, "ifge", 1, 0, "I", ""),
+ /* brbyte1, brbyte2 | ..., value => ... */
+ new VMOp(opc_ifgt, "ifgt", 1, 0, "I", ""),
+ /* brbyte1, brbyte2 | ..., value => ... */
+ new VMOp(opc_ifle, "ifle", 1, 0, "I", ""),
+ /* brbyte1, brbyte2 | ..., value1, value2 => ... */
+ new VMOp(opc_if_icmpeq, "if_icmpeq", 2, 0, "II", ""),
+ /* brbyte1, brbyte2 | ..., value1, value2 => ... */
+ new VMOp(opc_if_icmpne, "if_icmpne", 2, 0, "II", ""),
+ /* brbyte1, brbyte2 | ..., value1, value2 => ... */
+ new VMOp(opc_if_icmplt, "if_icmplt", 2, 0, "II", ""),
+ /* brbyte1, brbyte2 | ..., value1, value2 => ... */
+ new VMOp(opc_if_icmpge, "if_icmpge", 2, 0, "II", ""),
+ /* brbyte1, brbyte2 | ..., value1, value2 => ... */
+ new VMOp(opc_if_icmpgt, "if_icmpgt", 2, 0, "II", ""),
+ /* brbyte1, brbyte2 | ..., value1, value2 => ... */
+ new VMOp(opc_if_icmple, "if_icmple", 2, 0, "II", ""),
+ /* brbyte1, brbyte2 | ..., value1, value2 => ... */
+ new VMOp(opc_if_acmpeq, "if_acmpeq", 2, 0, "AA", ""),
+ /* brbyte1, brbyte2 | ..., value1, value2 => ... */
+ new VMOp(opc_if_acmpne, "if_acmpne", 2, 0, "AA", ""),
+ /* brbyte1, brbyte2 | no change */
+ new VMOp(opc_goto, "goto", 0, 0, "", ""),
+ /* brbyte1, brbyte2 | ... => ..., return_addr */
+ new VMOp(opc_jsr, "jsr", 0, 1, "", "W"),
+ /* vindex | no change */
+ new VMOp(opc_ret, "ret", 0, 0, "", ""),
+ /* ??? | ..., index => ... */
+ new VMOp(opc_tableswitch, "tableswitch", 1, 0, "I", ""),
+ /* ??? | ..., key => ... */
+ new VMOp(opc_lookupswitch, "lookupswitch", 1, 0, "I", ""),
+ /* | ..., value => [empty] */
+ new VMOp(opc_ireturn, "ireturn", 1, 0, "I", ""),
+ /* | ..., value<h/l>, value<h/l> => [empty] */
+ new VMOp(opc_lreturn, "lreturn", 2, 0, "J", ""),
+ /* | ..., value => [empty] */
+ new VMOp(opc_freturn, "freturn", 1, 0, "F", ""),
+ /* | ..., value<h/l>, value<h/l> => [empty] */
+ new VMOp(opc_dreturn, "dreturn", 2, 0, "D", ""),
+ /* | ..., value => [empty] */
+ new VMOp(opc_areturn, "areturn", 1, 0, "A", ""),
+ /* | ... => [empty] */
+ new VMOp(opc_return, "return", 0, 0, "", ""),
+ /* idxbyte1, idxbyte2 | ... => ..., value [ value2 ] */
+ new VMOp(opc_getstatic, "getstatic", 0, -1, "", "?"),
+ /* idxbyte1, idxbyte2 | ..., value [ value2 ] => ... */
+ new VMOp(opc_putstatic, "putstatic", -1, 0, "?", ""),
+ /* idxbyte1, idxbyte2 | ..., objectref => ..., value [ value2 ] */
+ new VMOp(opc_getfield, "getfield", 1, -1, "A", "?"),
+ /* idxbyte1, idxbyte2 | ..., objectref, value [ value2 ] => ... */
+ new VMOp(opc_putfield, "putfield", -1, 0, "A?", ""),
+ /* idxbyte1, idxbyte2 | ..., objectref, [args] => ... */
+ new VMOp(opc_invokevirtual, "invokevirtual", -1, -1, "A?", "?"),
+ /* idxbyte1, idxbyte2 | ..., objectref, [args] => ... */
+ new VMOp(opc_invokespecial, "invokespecial", -1, -1, "A?", "?"),
+ /* idxbyte1, idxbyte2 | ..., [args] => ... */
+ new VMOp(opc_invokestatic, "invokestatic", -1, -1, "?", "?"),
+ /* idxbyte1, idxbyte2, nargs, rsvd | ..., objectref, [args] => ... */
+ new VMOp(opc_invokeinterface, "invokeinterface", -1, -1, "A?", "?"),
+ /* */
+ new VMOp(opc_xxxunusedxxx, "xxxunusedxxx", 0, 0, "", ""),
+ /* idxbyte1, idxbyte2 | ... => ..., objectref */
+ new VMOp(opc_new, "new", 0, 1, "", "A"),
+ /* atype | ..., size => ..., result */
+ new VMOp(opc_newarray, "newarray", 1, 1, "I", "A"),
+ /* indexbyte1, indexbyte2 | ..., size => ..., result */
+ new VMOp(opc_anewarray, "anewarray", 1, 1, "I", "A"),
+ /* | ..., objectref => ..., length */
+ new VMOp(opc_arraylength, "arraylength", 1, 1, "A", "I"),
+ /* | ..., objectref => [undefined] */
+ new VMOp(opc_athrow, "athrow", 1, 0, "A", "?"),
+ /* idxbyte1, idxbyte2 | ..., objectref => ..., objectref */
+ new VMOp(opc_checkcast, "checkcast", 1, 1, "A", "A"),
+ /* idxbyte1, idxbyte2 | ..., objectref => ..., result */
+ new VMOp(opc_instanceof, "instanceof", 1, 1, "A", "I"),
+ /* | ..., objectref => ... */
+ new VMOp(opc_monitorenter, "monitorenter", 1, 0, "A", ""),
+ /* | ..., objectref => ... */
+ new VMOp(opc_monitorexit, "monitorexit", 1, 0, "A", ""),
+ /* an instruction | special */
+ new VMOp(opc_wide, "wide", 0, 0, "", ""),
+ /* indexbyte1, indexbyte2, dimensions | ..., size1, ..., sizen => ..., result*/
+ new VMOp(opc_multianewarray, "multianewarray", -1, 1, "?", "A"),
+ /* brbyte1, brbyte2 | ..., value => ... */
+ new VMOp(opc_ifnull, "ifnull", 1, 0, "A", ""),
+ /* brbyte1, brbyte2 | ..., value => ... */
+ new VMOp(opc_ifnonnull, "ifnonnull", 1, 0, "A", ""),
+ /* brbyte1, brbyte2, brbyte3, brbyte4 | no change */
+ new VMOp(opc_goto_w, "goto_w", 0, 0, "", ""),
+ /* brbyte1, brbyte2, brbyte3, brbyte4 | ... => ..., return_addr */
+ new VMOp(opc_jsr_w, "jsr_w", 0, 1, "", "W") };
+
+ /**
+ * Check that each entry in the ops array has a valid VMOp entry
+ */
+ private static void check() {
+ for (int i=0; i<=opc_jsr_w; i++) {
+ VMOp op = ops[i];
+ if (op == null)
+ throw new InsnError ("null VMOp for " + i);
+ if (op.opcode() != i)
+ throw new InsnError ("bad opcode for " + i);
+
+ if (1 == 0) {
+ /* check arg/result data */
+ checkTypes(op.argTypes(), op.nStackArgs(), op);
+ checkTypes(op.resultTypes(), op.nStackResults(), op);
+ }
+ }
+ }
+
+ private static void checkTypes(String types, int n, VMOp op) {
+ for (int i=0; i<types.length(); i++) {
+ char c = types.charAt(i);
+ if (c == '?')
+ return;
+ if (c == 'J' || c == 'X' || c == 'D')
+ n -= 2;
+ else
+ n -= 1;
+ }
+ if (n != 0)
+ throw new InsnError ("Bad arg/result for VMOp " + op.opcodeName);
+ }
+
+ static {
+ check();
+ }
+}