List of usage examples for org.objectweb.asm Opcodes DUP
int DUP
To view the source code for org.objectweb.asm Opcodes DUP.
Click Source Link
From source file:com.github.malamut2.low.AllocationMethodAdapter.java
License:Apache License
void calculateArrayLengthAndDispatch(String typeName, int dimCount) { // Since the dimensions of the array are not known at instrumentation // time, we take the created multi-dimensional array and peel off nesting // levels from the left. For each nesting layer we probe the array length // and accumulate a partial product which we can then feed the recording // function.//from w ww . j a v a 2 s . c om // below we note the partial product of dimensions 1 to X-1 as productToX // (so productTo1 == 1 == no dimensions yet). We denote by aref0 the // array reference at the current nesting level (the containing aref's [0] // element). If we hit a level whose arraylength is 0 there's no point // continuing so we shortcut out. Label zeroDimension = new Label(); super.visitInsn(Opcodes.DUP); // -> stack: ... origaref aref0 super.visitLdcInsn(1); // -> stack: ... origaref aref0 productTo1 for (int i = 0; i < dimCount; ++i) { // pre: stack: ... origaref aref0 productToI super.visitInsn(Opcodes.SWAP); // -> stack: ... origaref productToI aref super.visitInsn(Opcodes.DUP_X1); // -> stack: ... origaref aref0 productToI aref super.visitInsn(Opcodes.ARRAYLENGTH); // -> stack: ... origaref aref0 productToI dimI Label nonZeroDimension = new Label(); super.visitInsn(Opcodes.DUP); // -> stack: ... origaref aref0 productToI dimI dimI super.visitJumpInsn(Opcodes.IFNE, nonZeroDimension); // -> stack: ... origaref aref0 productToI dimI super.visitInsn(Opcodes.POP); // -> stack: ... origaref aref0 productToI super.visitJumpInsn(Opcodes.GOTO, zeroDimension); super.visitLabel(nonZeroDimension); // -> stack: ... origaref aref0 productToI max(dimI,1) super.visitInsn(Opcodes.IMUL); // -> stack: ... origaref aref0 productTo{I+1} if (i < dimCount - 1) { super.visitInsn(Opcodes.SWAP); // -> stack: ... origaref productTo{I+1} aref0 super.visitInsn(Opcodes.ICONST_0); // -> stack: ... origaref productTo{I+1} aref0 0 super.visitInsn(Opcodes.AALOAD); // -> stack: ... origaref productTo{I+1} aref0' super.visitInsn(Opcodes.SWAP); } // post: stack: ... origaref aref0 productTo{I+1} } super.visitLabel(zeroDimension); super.visitInsn(Opcodes.SWAP); // -> stack: ... origaref product aref0 super.visitInsn(Opcodes.POP); // -> stack: ... origaref product super.visitInsn(Opcodes.SWAP); // -> stack: ... product origaref invokeRecordAllocation(typeName); }
From source file:com.github.wreulicke.bean.validation.ASMMethodParameterValidationInjector.java
License:Open Source License
private void inject(MethodNode node, ClassNode clazzNode) { if (Modifier.isStatic(node.access) || Modifier.isAbstract(node.access) || Modifier.isAbstract(node.access) || "<init>".equals(node.name) || "<clinit>".equals(node.name)) { return;//from w w w. ja v a 2 s. co m } InsnList list = new InsnList(); int index = node.localVariables.size(); list.add(new MethodInsnNode(INVOKESTATIC, "javax/validation/Validation", "buildDefaultValidatorFactory", "()Ljavax/validation/ValidatorFactory;", false)); list.add(new MethodInsnNode(INVOKEINTERFACE, "javax/validation/ValidatorFactory", "getValidator", "()Ljavax/validation/Validator;", true)); list.add(new MethodInsnNode(INVOKEINTERFACE, "javax/validation/Validator", "forExecutables", "()Ljavax/validation/executable/ExecutableValidator;", true)); list.add(new VarInsnNode(Opcodes.ASTORE, index)); list.add(new VarInsnNode(Opcodes.ALOAD, index)); list.add(new VarInsnNode(Opcodes.ALOAD, 0)); list.add(new LdcInsnNode(Type.getType("L" + clazzNode.name + ";"))); list.add(new LdcInsnNode(node.name)); @SuppressWarnings("unchecked") List<LocalVariableNode> variables = node.localVariables; Type[] args = Type.getArgumentTypes(node.desc); list.add(new LdcInsnNode(args.length)); list.add(new TypeInsnNode(Opcodes.ANEWARRAY, "java/lang/Class")); for (int i = 0; i < args.length; i++) { int paramIndex = 1 + i; list.add(new InsnNode(Opcodes.DUP)); list.add(new LdcInsnNode(i)); list.add(new LdcInsnNode(Type.getType(variables.get(paramIndex).desc))); list.add(new InsnNode(Opcodes.AASTORE)); } list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "java/lang/Class", "getMethod", "(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;", false)); list.add(new LdcInsnNode(args.length)); list.add(new TypeInsnNode(Opcodes.ANEWARRAY, "java/lang/Object")); for (int i = 0; i < args.length; i++) { int paramIndex = i + 1; list.add(new InsnNode(Opcodes.DUP)); list.add(new LdcInsnNode(i)); list.add(new VarInsnNode(Opcodes.ALOAD, paramIndex)); list.add(new InsnNode(Opcodes.AASTORE)); } list.add(new InsnNode(Opcodes.ICONST_0)); list.add(new TypeInsnNode(Opcodes.ANEWARRAY, "java/lang/Class")); list.add(new MethodInsnNode(INVOKEINTERFACE, "javax/validation/executable/ExecutableValidator", "validateParameters", "(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;[Ljava/lang/Class;)Ljava/util/Set;", true)); list.add(new MethodInsnNode(INVOKESTATIC, "com/github/wreulicke/bean/validation/Constraints", "throwIfNeeded", "(Ljava/util/Set;)V", false)); node.instructions.insert(list); }
From source file:com.google.code.jconts.instrument.gen.AsyncMethodAdapter.java
License:Apache License
@Override public void visitMethodInsn(int opcode, String owner, String name, String desc) { checkProlog();/*w w w . j ava2s .co m*/ if (opcode == Opcodes.INVOKESTATIC && ASYNC_NAME.equals(owner) && ARETURN_NAME.equals(name)) { if (ARETURN_VOID_DESC.equals(desc)) { mv.visitInsn(Opcodes.ACONST_NULL); } // state variable target.visitVarInsn(Opcodes.ALOAD, info.isStatic() ? 0 : 1); mv.visitFieldInsn(Opcodes.GETFIELD, info.stateClassName, CONTINUATION_FIELD, CONTINUATION_DESC); mv.visitInsn(Opcodes.SWAP); mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, CONTINUATION_NAME, CONTINUATION_INVOKE_NAME, CONTINUATION_INVOKE_DESC); // Will be dropped while replacing ARETURN with RETURN. // FIXME: Should verify this value is NOT used. mv.visitInsn(Opcodes.ACONST_NULL); return; } if (opcode == Opcodes.INVOKESTATIC && ASYNC_NAME.equals(owner) && AWAIT_NAME.equals(name) && AWAIT_DESC.equals(desc)) { // Computation<T> is on stack // FIXME: ... // if (stack.size() != 1) { // throw new IllegalStateException( // "Stack preserving is not supported!"); // } int index = dispatchTable.size(); // Save state List<Type> l = new ArrayList<Type>(locals); if (!info.isStatic()) { l.remove(0); } // state.varX = locX String[] vars = info.tracker.stateFields(l.toArray(new Type[0])); for (int i = 0; i < vars.length; ++i) { // state variable target.visitVarInsn(Opcodes.ALOAD, info.isStatic() ? 0 : 1); mv.visitVarInsn(l.get(i).getOpcode(Opcodes.ILOAD), i + info.thisOffset); mv.visitFieldInsn(Opcodes.PUTFIELD, info.stateClassName, vars[i], l.get(i).getDescriptor()); } // Create instance of continuation // new Continuation([this, ]state, index); mv.visitTypeInsn(Opcodes.NEW, info.continuationClassName); mv.visitInsn(Opcodes.DUP); // "this' for new Continuation([this, ]state, index) if (!info.isStatic()) { mv.visitVarInsn(Opcodes.ALOAD, 0); } // state and index target.visitVarInsn(Opcodes.ALOAD, 0 + info.thisOffset); mv.visitIntInsn(Opcodes.BIPUSH, index); String ctorDesc; if (info.isStatic()) { ctorDesc = Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] { info.stateType, Type.INT_TYPE }); } else { ctorDesc = Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] { Type.getObjectType(info.owner), info.stateType, Type.INT_TYPE }); } mv.visitMethodInsn(Opcodes.INVOKESPECIAL, info.continuationClassName, CTOR_NAME, ctorDesc); mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, COMPUTATION_NAME, COMPUTATION_EXECUTE_NAME, COMPUTATION_EXECUTE_DESC); super.visitInsn(Opcodes.RETURN); // Restore state // mv.visitFrame(Opcodes.F_SAME, 0, new Object[0], 0, new // Object[0]); Label label = new Label(); int invokeIndex = dispatchTable.size(); dispatchTable.add(label); // for invoke dispatchTable.add(label); // for setException mv.visitLabel(label); for (int i = 0; i < vars.length; ++i) { // state variable target.visitVarInsn(Opcodes.ALOAD, info.isStatic() ? 0 : 1); mv.visitFieldInsn(Opcodes.GETFIELD, info.stateClassName, vars[i], l.get(i).getDescriptor()); mv.visitVarInsn(l.get(i).getOpcode(Opcodes.ISTORE), i + info.thisOffset); } // if (index == invokeIndex) goto invokeLabel; Label invokeLabel = new Label(); target.visitVarInsn(Opcodes.ILOAD, 1 + info.thisOffset); mv.visitIntInsn(Opcodes.BIPUSH, invokeIndex); mv.visitJumpInsn(Opcodes.IF_ICMPEQ, invokeLabel); // Throw exception target.visitVarInsn(Opcodes.ALOAD, info.isStatic() ? 0 : 1); mv.visitFieldInsn(Opcodes.GETFIELD, info.stateClassName, "exception", THROWABLE_DESC); mv.visitInsn(Opcodes.ATHROW); // Push result value // invokeLabel: mv.visitLabel(invokeLabel); target.visitVarInsn(Opcodes.ALOAD, info.isStatic() ? 0 : 1); mv.visitFieldInsn(Opcodes.GETFIELD, info.stateClassName, "result", OBJECT_DESC); return; } super.visitMethodInsn(opcode, owner, name, desc); }
From source file:com.google.code.jconts.instrument.gen.TramplineMethodGenerator.java
License:Apache License
public void accept(ClassVisitor cv) { MethodVisitor mv = cv.visitMethod(info.access, info.name, info.desc, info.signature, info.exceptions); mv.visitCode();// www . j ava 2 s . c o m mv.visitTypeInsn(Opcodes.NEW, info.computationClassName); mv.visitInsn(Opcodes.DUP); // "this' for new Computation(this, state) if (!info.isStatic()) { mv.visitVarInsn(Opcodes.ALOAD, 0); } // new State() mv.visitTypeInsn(Opcodes.NEW, info.stateClassName); mv.visitInsn(Opcodes.DUP); mv.visitMethodInsn(Opcodes.INVOKESPECIAL, info.stateClassName, CTOR_NAME, DEFAULT_CTOR_DESC); // state.varX = argX String[] names = info.entryLocalsVars; for (int i = 0; i < info.entryLocals.length; ++i) { mv.visitInsn(Opcodes.DUP); mv.visitVarInsn(info.entryLocals[i].getOpcode(Opcodes.ILOAD), i + info.thisOffset); mv.visitFieldInsn(Opcodes.PUTFIELD, info.stateClassName, names[i], info.entryLocals[i].getDescriptor()); } // new Computation(this, state); String ctorDesc; if (info.isStatic()) { ctorDesc = Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] { info.stateType }); } else { ctorDesc = Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] { Type.getObjectType(info.owner), info.stateType }); } mv.visitMethodInsn(Opcodes.INVOKESPECIAL, info.computationClassName, CTOR_NAME, ctorDesc); mv.visitInsn(Opcodes.ARETURN); mv.visitMaxs(info.isStatic() ? 5 : 6, info.isStatic() ? info.entryLocals.length : info.entryLocals.length + 1); mv.visitEnd(); }
From source file:com.google.devtools.build.android.desugar.BytecodeTypeInference.java
License:Open Source License
@Override public void visitInsn(int opcode) { switch (opcode) { case Opcodes.NOP: case Opcodes.INEG: case Opcodes.LNEG: case Opcodes.FNEG: case Opcodes.DNEG: case Opcodes.I2B: case Opcodes.I2C: case Opcodes.I2S: case Opcodes.RETURN: break;//from www. ja va 2s . c o m case Opcodes.ACONST_NULL: push(InferredType.NULL); break; case Opcodes.ICONST_M1: case Opcodes.ICONST_0: case Opcodes.ICONST_1: case Opcodes.ICONST_2: case Opcodes.ICONST_3: case Opcodes.ICONST_4: case Opcodes.ICONST_5: push(InferredType.INT); break; case Opcodes.LCONST_0: case Opcodes.LCONST_1: push(InferredType.LONG); push(InferredType.TOP); break; case Opcodes.FCONST_0: case Opcodes.FCONST_1: case Opcodes.FCONST_2: push(InferredType.FLOAT); break; case Opcodes.DCONST_0: case Opcodes.DCONST_1: push(InferredType.DOUBLE); push(InferredType.TOP); break; case Opcodes.IALOAD: case Opcodes.BALOAD: case Opcodes.CALOAD: case Opcodes.SALOAD: pop(2); push(InferredType.INT); break; case Opcodes.LALOAD: case Opcodes.D2L: pop(2); push(InferredType.LONG); push(InferredType.TOP); break; case Opcodes.DALOAD: case Opcodes.L2D: pop(2); push(InferredType.DOUBLE); push(InferredType.TOP); break; case Opcodes.AALOAD: InferredType arrayType = pop(2); InferredType elementType = arrayType.getElementTypeIfArrayOrThrow(); push(elementType); break; case Opcodes.IASTORE: case Opcodes.BASTORE: case Opcodes.CASTORE: case Opcodes.SASTORE: case Opcodes.FASTORE: case Opcodes.AASTORE: pop(3); break; case Opcodes.LASTORE: case Opcodes.DASTORE: pop(4); break; case Opcodes.POP: case Opcodes.IRETURN: case Opcodes.FRETURN: case Opcodes.ARETURN: case Opcodes.ATHROW: case Opcodes.MONITORENTER: case Opcodes.MONITOREXIT: pop(); break; case Opcodes.POP2: case Opcodes.LRETURN: case Opcodes.DRETURN: pop(2); break; case Opcodes.DUP: push(top()); break; case Opcodes.DUP_X1: { InferredType top = pop(); InferredType next = pop(); push(top); push(next); push(top); break; } case Opcodes.DUP_X2: { InferredType top = pop(); InferredType next = pop(); InferredType bottom = pop(); push(top); push(bottom); push(next); push(top); break; } case Opcodes.DUP2: { InferredType top = pop(); InferredType next = pop(); push(next); push(top); push(next); push(top); break; } case Opcodes.DUP2_X1: { InferredType top = pop(); InferredType next = pop(); InferredType bottom = pop(); push(next); push(top); push(bottom); push(next); push(top); break; } case Opcodes.DUP2_X2: { InferredType t1 = pop(); InferredType t2 = pop(); InferredType t3 = pop(); InferredType t4 = pop(); push(t2); push(t1); push(t4); push(t3); push(t2); push(t1); break; } case Opcodes.SWAP: { InferredType top = pop(); InferredType next = pop(); push(top); push(next); break; } case Opcodes.IADD: case Opcodes.ISUB: case Opcodes.IMUL: case Opcodes.IDIV: case Opcodes.IREM: case Opcodes.ISHL: case Opcodes.ISHR: case Opcodes.IUSHR: case Opcodes.IAND: case Opcodes.IOR: case Opcodes.IXOR: case Opcodes.L2I: case Opcodes.D2I: case Opcodes.FCMPL: case Opcodes.FCMPG: pop(2); push(InferredType.INT); break; case Opcodes.LADD: case Opcodes.LSUB: case Opcodes.LMUL: case Opcodes.LDIV: case Opcodes.LREM: case Opcodes.LAND: case Opcodes.LOR: case Opcodes.LXOR: pop(4); push(InferredType.LONG); push(InferredType.TOP); break; case Opcodes.LSHL: case Opcodes.LSHR: case Opcodes.LUSHR: pop(3); push(InferredType.LONG); push(InferredType.TOP); break; case Opcodes.I2L: case Opcodes.F2L: pop(); push(InferredType.LONG); push(InferredType.TOP); break; case Opcodes.I2F: pop(); push(InferredType.FLOAT); break; case Opcodes.LCMP: case Opcodes.DCMPG: case Opcodes.DCMPL: pop(4); push(InferredType.INT); break; case Opcodes.I2D: case Opcodes.F2D: pop(); push(InferredType.DOUBLE); push(InferredType.TOP); break; case Opcodes.F2I: case Opcodes.ARRAYLENGTH: pop(); push(InferredType.INT); break; case Opcodes.FALOAD: case Opcodes.FADD: case Opcodes.FSUB: case Opcodes.FMUL: case Opcodes.FDIV: case Opcodes.FREM: case Opcodes.L2F: case Opcodes.D2F: pop(2); push(InferredType.FLOAT); break; case Opcodes.DADD: case Opcodes.DSUB: case Opcodes.DMUL: case Opcodes.DDIV: case Opcodes.DREM: pop(4); push(InferredType.DOUBLE); push(InferredType.TOP); break; default: throw new RuntimeException("Unhandled opcode " + opcode); } super.visitInsn(opcode); }
From source file:com.google.devtools.build.android.desugar.LambdaClassFixer.java
License:Open Source License
@Override public void visitEnd() { checkState(!hasState || hasFactory, "Expected factory method for capturing lambda %s", getInternalName()); if (!hasState) { checkState(signature == null, "Didn't expect generic constructor signature %s %s", getInternalName(), signature);/*from w ww. j a v a2 s.c o m*/ checkState(lambdaInfo.factoryMethodDesc().startsWith("()"), "Expected 0-arg factory method for %s but found %s", getInternalName(), lambdaInfo.factoryMethodDesc()); // Since this is a stateless class we populate and use a static singleton field "$instance". // Field is package-private so we can read it from the class that had the invokedynamic. String singletonFieldDesc = lambdaInfo.factoryMethodDesc().substring("()".length()); super.visitField(Opcodes.ACC_STATIC | Opcodes.ACC_FINAL, SINGLETON_FIELD_NAME, singletonFieldDesc, (String) null, (Object) null).visitEnd(); MethodVisitor codeBuilder = super.visitMethod(Opcodes.ACC_STATIC, "<clinit>", "()V", (String) null, new String[0]); codeBuilder.visitTypeInsn(Opcodes.NEW, getInternalName()); codeBuilder.visitInsn(Opcodes.DUP); codeBuilder.visitMethodInsn(Opcodes.INVOKESPECIAL, getInternalName(), "<init>", checkNotNull(desc, "didn't see a constructor for %s", getInternalName()), /*itf*/ false); codeBuilder.visitFieldInsn(Opcodes.PUTSTATIC, getInternalName(), SINGLETON_FIELD_NAME, singletonFieldDesc); codeBuilder.visitInsn(Opcodes.RETURN); codeBuilder.visitMaxs(2, 0); // two values are pushed onto the stack codeBuilder.visitEnd(); } copyRewrittenLambdaMethods(); if (!allowDefaultMethods) { copyBridgeMethods(interfaces); } super.visitEnd(); }
From source file:com.google.devtools.build.android.desugar.LambdaDesugaring.java
License:Open Source License
@Override public void visitEnd() { for (Map.Entry<Handle, MethodReferenceBridgeInfo> bridge : bridgeMethods.entrySet()) { Handle original = bridge.getKey(); Handle neededMethod = bridge.getValue().bridgeMethod(); checkState(/*from ww w. ja v a 2 s .c o m*/ neededMethod.getTag() == Opcodes.H_INVOKESTATIC || neededMethod.getTag() == Opcodes.H_INVOKEVIRTUAL, "Cannot generate bridge method %s to reach %s", neededMethod, original); checkState(bridge.getValue().referenced() != null, "Need referenced method %s to generate bridge %s", original, neededMethod); int access = Opcodes.ACC_BRIDGE | Opcodes.ACC_SYNTHETIC | Opcodes.ACC_FINAL; if (neededMethod.getTag() == Opcodes.H_INVOKESTATIC) { access |= Opcodes.ACC_STATIC; } MethodVisitor bridgeMethod = super.visitMethod(access, neededMethod.getName(), neededMethod.getDesc(), (String) null, toInternalNames(bridge.getValue().referenced().getExceptionTypes())); // Bridge is a factory method calling a constructor if (original.getTag() == Opcodes.H_NEWINVOKESPECIAL) { bridgeMethod.visitTypeInsn(Opcodes.NEW, original.getOwner()); bridgeMethod.visitInsn(Opcodes.DUP); } int slot = 0; if (neededMethod.getTag() != Opcodes.H_INVOKESTATIC) { bridgeMethod.visitVarInsn(Opcodes.ALOAD, slot++); } Type neededType = Type.getMethodType(neededMethod.getDesc()); for (Type arg : neededType.getArgumentTypes()) { bridgeMethod.visitVarInsn(arg.getOpcode(Opcodes.ILOAD), slot); slot += arg.getSize(); } bridgeMethod.visitMethodInsn(invokeOpcode(original), original.getOwner(), original.getName(), original.getDesc(), original.isInterface()); bridgeMethod.visitInsn(neededType.getReturnType().getOpcode(Opcodes.IRETURN)); bridgeMethod.visitMaxs(0, 0); // rely on class writer to compute these bridgeMethod.visitEnd(); } super.visitEnd(); }
From source file:com.google.devtools.build.wireless.testing.java.injector.j2me.J2mePrintServant.java
License:Apache License
/** * Initialize a string buffer.//from www. ja v a 2 s. c o m * * @see PrintServant#initializePrinting() */ @Override protected void initializePrinting() { mv.visitTypeInsn(Opcodes.NEW, ClassNames.STRING_BUFFER); mv.visitInsn(Opcodes.DUP); mv.visitMethodInsn(Opcodes.INVOKESPECIAL, ClassNames.STRING_BUFFER, "<init>", "()V"); }
From source file:com.google.devtools.build.wireless.testing.java.injector.TypeDescriptor.java
License:Apache License
/** * Creates an instance of {@link TypeDescriptor}. * /*from w w w . j a v a 2 s . c o m*/ * @param description The description of this type. * @param dupOpcode The opcode to be used to duplicate this type. * @param loadOpcode The opcode to be used to duplicate this type. * @param storeOpcode The opcode to be used to duplicate this type. */ private TypeDescriptor(char description, int dupOpcode, int loadOpcode, int storeOpcode) { this(description, (dupOpcode == Opcodes.DUP) ? 1 : 2, dupOpcode, loadOpcode, storeOpcode); }
From source file:com.google.devtools.build.wireless.testing.java.injector.TypeDescriptorTest.java
License:Apache License
/** * Test method for {@link TypeDescriptor#getDupOpcode()}. */// w w w . j av a 2 s . co m public void testGetDupOpcode() { try { TypeDescriptor.VOID.getDupOpcode(); fail("Void should have thrown an exception!"); } catch (IllegalStateException e) { // OK! } assertEquals("Wrong DUP instruction", Opcodes.DUP, TypeDescriptor.BOOLEAN.getDupOpcode()); assertEquals("Wrong DUP instruction", Opcodes.DUP, TypeDescriptor.BYTE.getDupOpcode()); assertEquals("Wrong DUP instruction", Opcodes.DUP, TypeDescriptor.CHAR.getDupOpcode()); assertEquals("Wrong DUP instruction", Opcodes.DUP, TypeDescriptor.INTEGER.getDupOpcode()); assertEquals("Wrong DUP instruction", Opcodes.DUP, TypeDescriptor.SHORT.getDupOpcode()); assertEquals("Wrong DUP instruction", Opcodes.DUP2, TypeDescriptor.LONG.getDupOpcode()); assertEquals("Wrong DUP instruction", Opcodes.DUP, TypeDescriptor.FLOAT.getDupOpcode()); assertEquals("Wrong DUP instruction", Opcodes.DUP2, TypeDescriptor.DOUBLE.getDupOpcode()); assertEquals("Wrong DUP instruction", Opcodes.DUP, TypeDescriptor.CLASS.getDupOpcode()); assertEquals("Wrong DUP instruction", Opcodes.DUP, TypeDescriptor.ARRAY.getDupOpcode()); }