1 /* 2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package jdk.experimental.bytecode; 27 28 import jdk.experimental.bytecode.MacroCodeBuilder.CondKind; 29 30 public enum Opcode { 31 32 NOP(0), 33 ACONST_NULL(1), 34 ICONST_M1(2), 35 ICONST_0(3), 36 ICONST_1(4), 37 ICONST_2(5), 38 ICONST_3(6), 39 ICONST_4(7), 40 ICONST_5(8), 41 LCONST_0(9), 42 LCONST_1(10), 43 FCONST_0(11), 44 FCONST_1(12), 45 FCONST_2(13), 46 DCONST_0(14), 47 DCONST_1(15), 48 BIPUSH(16), 49 SIPUSH(17), 50 LDC(18), 51 LDC_W(19), 52 LDC2_W(20), 53 ILOAD(21), 54 LLOAD(22), 55 FLOAD(23), 56 DLOAD(24), 57 ALOAD(25), 58 ILOAD_0(26), 59 ILOAD_1(27), 60 ILOAD_2(28), 61 ILOAD_3(29), 62 LLOAD_0(30), 63 LLOAD_1(31), 64 LLOAD_2(32), 65 LLOAD_3(33), 66 FLOAD_0(34), 67 FLOAD_1(35), 68 FLOAD_2(36), 69 FLOAD_3(37), 70 DLOAD_0(38), 71 DLOAD_1(39), 72 DLOAD_2(40), 73 DLOAD_3(41), 74 ALOAD_0(42), 75 ALOAD_1(43), 76 ALOAD_2(44), 77 ALOAD_3(45), 78 IALOAD(46), 79 LALOAD(47), 80 FALOAD(48), 81 DALOAD(49), 82 AALOAD(50), 83 BALOAD(51), 84 CALOAD(52), 85 SALOAD(53), 86 ISTORE(54), 87 LSTORE(55), 88 FSTORE(56), 89 DSTORE(57), 90 ASTORE(58), 91 ISTORE_0(59), 92 ISTORE_1(60), 93 ISTORE_2(61), 94 ISTORE_3(62), 95 LSTORE_0(63), 96 LSTORE_1(64), 97 LSTORE_2(65), 98 LSTORE_3(66), 99 FSTORE_0(67), 100 FSTORE_1(68), 101 FSTORE_2(69), 102 FSTORE_3(70), 103 DSTORE_0(71), 104 DSTORE_1(72), 105 DSTORE_2(73), 106 DSTORE_3(74), 107 ASTORE_0(75), 108 ASTORE_1(76), 109 ASTORE_2(77), 110 ASTORE_3(78), 111 IASTORE(79), 112 LASTORE(80), 113 FASTORE(81), 114 DASTORE(82), 115 AASTORE(83), 116 BASTORE(84), 117 CASTORE(85), 118 SASTORE(86), 119 POP(87), 120 POP2(88), 121 DUP(89), 122 DUP_X1(90), 123 DUP_X2(91), 124 DUP2(92), 125 DUP2_X1(93), 126 DUP2_X2(94), 127 SWAP(95), 128 IADD(96), 129 LADD(97), 130 FADD(98), 131 DADD(99), 132 ISUB(100), 133 LSUB(101), 134 FSUB(102), 135 DSUB(103), 136 IMUL(104), 137 LMUL(105), 138 FMUL(106), 139 DMUL(107), 140 IDIV(108), 141 LDIV(109), 142 FDIV(110), 143 DDIV(111), 144 IREM(112), 145 LREM(113), 146 FREM(114), 147 DREM(115), 148 INEG(116), 149 LNEG(117), 150 FNEG(118), 151 DNEG(119), 152 ISHL(120), 153 LSHL(121), 154 ISHR(122), 155 LSHR(123), 156 IUSHR(124), 157 LUSHR(125), 158 IAND(126), 159 LAND(127), 160 IOR(128), 161 LOR(129), 162 IXOR(130), 163 LXOR(131), 164 IINC(132), 165 I2L(133), 166 I2F(134), 167 I2D(135), 168 L2I(136), 169 L2F(137), 170 L2D(138), 171 F2I(139), 172 F2L(140), 173 F2D(141), 174 D2I(142), 175 D2L(143), 176 D2F(144), 177 I2B(145), 178 I2C(146), 179 I2S(147), 180 LCMP(148), 181 FCMPL(149), 182 FCMPG(150), 183 DCMPL(151), 184 DCMPG(152), 185 IFEQ(153), 186 IFNE(154), 187 IFLT(155), 188 IFGE(156), 189 IFGT(157), 190 IFLE(158), 191 IF_ICMPEQ(159), 192 IF_ICMPNE(160), 193 IF_ICMPLT(161), 194 IF_ICMPGE(162), 195 IF_ICMPGT(163), 196 IF_ICMPLE(164), 197 IF_ACMPEQ(165), 198 IF_ACMPNE(166), 199 GOTO_(167), 200 JSR(168), 201 RET(169), 202 TABLESWITCH(170), 203 LOOKUPSWITCH(171), 204 IRETURN(172), 205 LRETURN(173), 206 FRETURN(174), 207 DRETURN(175), 208 ARETURN(176), 209 RETURN(177), 210 GETSTATIC(178), 211 PUTSTATIC(179), 212 GETFIELD(180), 213 PUTFIELD(181), 214 INVOKEVIRTUAL(182), 215 INVOKESPECIAL(183), 216 INVOKESTATIC(184), 217 INVOKEINTERFACE(185), 218 INVOKEDYNAMIC(186), 219 NEW(187), 220 NEWARRAY(188), 221 ANEWARRAY(189), 222 ARRAYLENGTH(190), 223 ATHROW(191), 224 CHECKCAST(192), 225 INSTANCEOF(193), 226 MONITORENTER(194), 227 MONITOREXIT(195), 228 WIDE(196), 229 MULTIANEWARRAY(197), 230 IF_NULL(198), 231 IF_NONNULL(199), 232 GOTO_W(200), 233 JSR_W(201), 234 VLOAD(203), 235 VSTORE(204), 236 VALOAD(205), 237 VASTORE(206), 238 VRETURN(207), 239 VDEFAULT(208), 240 VWITHFIELD(209), 241 VBOX(210), 242 VUNBOX(211), 243 TYPED(212); 244 245 int code; 246 247 Opcode(int code) { 248 this.code = code; 249 } 250 251 protected Opcode at(TypeTag type) { 252 return at(type, 1); 253 } 254 255 protected Opcode at(CondKind cond) { 256 return at(cond.offset, 1); 257 } 258 259 protected Opcode at(TypeTag type, int multiplier) { 260 return at(type.offset, multiplier); 261 } 262 263 private Opcode at(int offset, int multiplier) { 264 if (offset < 0) throw new AssertionError(); 265 return Opcode.values()[code + (multiplier * offset)]; 266 } 267 }