Example usage for org.objectweb.asm Opcodes NOP

List of usage examples for org.objectweb.asm Opcodes NOP

Introduction

In this page you can find the example usage for org.objectweb.asm Opcodes NOP.

Prototype

int NOP

To view the source code for org.objectweb.asm Opcodes NOP.

Click Source Link

Usage

From source file:com.android.tools.klint.detector.api.LintUtils.java

License:Apache License

/**
 * Returns the previous opcode prior to the given node, ignoring label and
 * line number nodes/* ww w .ja v  a2 s  .  co  m*/
 *
 * @param node the node to look up the previous opcode for
 * @return the previous opcode, or {@link Opcodes#NOP} if no previous node
 *         was found
 */
public static int getPrevOpcode(@NonNull AbstractInsnNode node) {
    AbstractInsnNode prev = getPrevInstruction(node);
    if (prev != null) {
        return prev.getOpcode();
    } else {
        return Opcodes.NOP;
    }
}

From source file:com.android.tools.klint.detector.api.LintUtils.java

License:Apache License

/**
 * Returns the next opcode after to the given node, ignoring label and line
 * number nodes/*from  w ww .j av  a 2 s  .c  o m*/
 *
 * @param node the node to look up the next opcode for
 * @return the next opcode, or {@link Opcodes#NOP} if no next node was found
 */
public static int getNextOpcode(@NonNull AbstractInsnNode node) {
    AbstractInsnNode next = getNextInstruction(node);
    if (next != null) {
        return next.getOpcode();
    } else {
        return Opcodes.NOP;
    }
}

From source file:com.appfour.codestripper.Main.java

License:Open Source License

public static void main(String[] args) throws Exception {
    if (args.length != 2) {
        System.out.println("Usage: java " + Main.class.getCanonicalName() + " <source dir> <dest file>");
        System.exit(1);// w  w  w  . ja va  2s.c  o  m
    }

    File outFile = new File(args[1]);
    ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(outFile));
    zipOut.setLevel(9);
    Set<String> writtenEntries = new HashSet<String>();
    for (File file : new File(args[0]).listFiles()) {
        if (file.getName().toLowerCase(Locale.US).endsWith(".jar")) {
            System.err.println("Processing JAR: " + file.getPath());
            ZipInputStream zipIn = new ZipInputStream(new FileInputStream(file));
            ZipEntry entry;
            while ((entry = zipIn.getNextEntry()) != null) {
                if (entry.isDirectory())
                    continue;
                if (entry.getName().toLowerCase(Locale.US).endsWith(".class")) {
                    if (writtenEntries.contains(entry.getName())) {
                        System.out.println("\tIgnoring duplicate CLASS: " + entry.getName());
                        continue;
                    }
                    writtenEntries.add(entry.getName());
                    System.out.println("\tProcessing CLASS: " + entry.getName());
                    ClassReader cr = new ClassReader(zipIn);
                    ClassWriter cw = new ClassWriter(0);
                    final boolean[] skip = new boolean[1];
                    ClassVisitor cv = new ClassVisitor(Opcodes.ASM5, cw) {
                        @Override
                        public void visit(int version, int access, String name, String signature,
                                String superName, String[] interfaces) {
                            if (!INCLUDE_PACKAGE_PRIVATE_CLASSES
                                    && (access & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED)) == 0) {
                                skip[0] = true;
                            }
                            super.visit(version, access, name, signature, superName, interfaces);
                        }

                        @Override
                        public void visitSource(String source, String debug) {
                            // ignore
                        }

                        @Override
                        public FieldVisitor visitField(int access, String name, String desc, String signature,
                                Object value) {
                            if ((access & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED)) == 0)
                                return null;
                            return super.visitField(access, name, desc, signature, value);
                        }

                        @Override
                        public MethodVisitor visitMethod(int access, String name, String desc, String signature,
                                String[] exceptions) {
                            if ((access & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED)) == 0)
                                return null;
                            return new MethodVisitor(Opcodes.ASM5,
                                    super.visitMethod(access, name, desc, signature, exceptions)) {
                                @Override
                                public void visitCode() {
                                    // ignore
                                    super.visitCode();
                                    super.visitInsn(Opcodes.NOP);
                                }

                                @Override
                                public void visitFieldInsn(int opcode, String owner, String name, String desc) {
                                    // ignore
                                }

                                @Override
                                public void visitIincInsn(int var, int increment) {
                                    // ignore
                                }

                                @Override
                                public void visitFrame(int type, int nLocal, Object[] local, int nStack,
                                        Object[] stack) {
                                    // ignore
                                }

                                @Override
                                public void visitInsn(int opcode) {
                                    // ignore
                                }

                                @Override
                                public void visitJumpInsn(int opcode, Label label) {
                                    // ignore
                                }

                                @Override
                                public void visitLabel(Label label) {
                                    // ignore
                                }

                                @Override
                                public void visitLdcInsn(Object cst) {
                                    // ignore
                                }

                                @Override
                                public void visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels) {
                                    // ignore
                                }

                                @Override
                                public void visitIntInsn(int opcode, int operand) {
                                    // ignore
                                }

                                @Override
                                public AnnotationVisitor visitInsnAnnotation(int typeRef, TypePath typePath,
                                        String desc, boolean visible) {
                                    // ignore
                                    return null;
                                }

                                @Override
                                public void visitInvokeDynamicInsn(String name, String desc, Handle bsm,
                                        Object... bsmArgs) {
                                    // ignore
                                }

                                @Override
                                public void visitMethodInsn(int opcode, String owner, String name,
                                        String desc) {
                                    // ignore
                                }

                                @Override
                                public void visitMultiANewArrayInsn(String desc, int dims) {
                                    // ignore
                                }

                                @Override
                                public void visitTableSwitchInsn(int min, int max, Label dflt,
                                        Label... labels) {
                                    // ignore
                                }

                                @Override
                                public AnnotationVisitor visitTryCatchAnnotation(int typeRef, TypePath typePath,
                                        String desc, boolean visible) {
                                    // ignore
                                    return null;
                                };

                                @Override
                                public void visitTryCatchBlock(Label start, Label end, Label handler,
                                        String type) {
                                    // ignore
                                }

                                @Override
                                public void visitLineNumber(int line, Label start) {
                                    // ignore
                                }

                                @Override
                                public AnnotationVisitor visitLocalVariableAnnotation(int typeRef,
                                        TypePath typePath, Label[] start, Label[] end, int[] index, String desc,
                                        boolean visible) {
                                    // ignore
                                    return null;
                                }

                                @Override
                                public void visitParameter(String name, int access) {
                                    // ignore
                                }

                                @Override
                                public AnnotationVisitor visitParameterAnnotation(int parameter, String desc,
                                        boolean visible) {
                                    // ignore
                                    return null;
                                }

                                @Override
                                public void visitTypeInsn(int opcode, String type) {
                                    // ignore
                                }

                                @Override
                                public void visitVarInsn(int opcode, int var) {
                                    // ignore
                                }

                            };
                        }

                        @Override
                        public void visitAttribute(Attribute attr) {
                            System.out.println("\t\tProcessing attr " + attr.type);
                            if (attr.isCodeAttribute())
                                return;

                            super.visitAttribute(attr);
                        }
                    };
                    cr.accept(cv, 0);
                    if (!skip[0]) {
                        byte[] b2 = cw.toByteArray(); // b2 represents the same class as b1
                        entry.setSize(b2.length);
                        entry.setCompressedSize(-1);
                        entry.setMethod(ZipEntry.DEFLATED);
                        zipOut.putNextEntry(entry);
                        new DataOutputStream(zipOut).write(b2);
                    }
                } else {
                    if (writtenEntries.contains(entry.getName())) {
                        System.out.println("\tIgnoring duplicate RESOURCE: " + entry.getName());
                        continue;
                    }
                    ByteArrayOutputStream bos = new ByteArrayOutputStream();
                    transfer(zipIn, bos, false);
                    writtenEntries.add(entry.getName());
                    System.out.println("\tProcessing RESOURCE: " + entry.getName());
                    entry.setSize(bos.size());
                    entry.setCompressedSize(-1);
                    entry.setMethod(ZipEntry.DEFLATED);
                    zipOut.putNextEntry(entry);
                    transfer(new ByteArrayInputStream(bos.toByteArray()), zipOut, false);
                }
            }
            zipIn.close();
        }
    }
    zipOut.close();
}

From source file:com.codename1.tools.translator.bytecodes.BasicInstruction.java

License:Open Source License

@Override
public void appendInstruction(StringBuilder b, List<Instruction> instructions) {
    switch (opcode) {
    case Opcodes.NOP:
        break;//from www. j  av a 2s. c o m

    case Opcodes.ACONST_NULL:
        b.append("    PUSH_POINTER(JAVA_NULL); /* ACONST_NULL */\n");
        break;

    case Opcodes.ICONST_M1:
        b.append("    PUSH_INT(-1); /* ICONST_M1 */\n");
        break;

    case Opcodes.ICONST_0:
        b.append("    PUSH_INT(0); /* ICONST_0 */\n");
        break;

    case Opcodes.ICONST_1:
        b.append("    PUSH_INT(1); /* ICONST_1 */\n");
        break;

    case Opcodes.ICONST_2:
        b.append("    PUSH_INT(2); /* ICONST_2 */\n");
        break;

    case Opcodes.ICONST_3:
        b.append("    PUSH_INT(3); /* ICONST_3 */\n");
        break;

    case Opcodes.ICONST_4:
        b.append("    PUSH_INT(4); /* ICONST_4 */\n");
        break;

    case Opcodes.ICONST_5:
        b.append("    PUSH_INT(5); /* ICONST_5 */\n");
        break;

    case Opcodes.LCONST_0:
        b.append("    PUSH_LONG(0); /* LCONST_0 */\n");
        break;

    case Opcodes.LCONST_1:
        b.append("    PUSH_LONG(1); /* LCONST_1 */\n");
        break;

    case Opcodes.FCONST_0:
        b.append("    PUSH_FLOAT(0); /* FCONST_0 */\n");
        break;

    case Opcodes.FCONST_1:
        b.append("    PUSH_FLOAT(1); /* FCONST_1 */\n");
        break;

    case Opcodes.FCONST_2:
        b.append("    PUSH_FLOAT(2); /* FCONST_2 */\n");
        break;

    case Opcodes.DCONST_0:
        b.append("    PUSH_DOUBLE(0); /* DCONST_0 */\n");
        break;

    case Opcodes.DCONST_1:
        b.append("    PUSH_DOUBLE(1); /* DCONST_1 */\n");
        break;

    case Opcodes.BALOAD:
        b.append("    { CHECK_ARRAY_ACCESS(2, SP[-1].data.i); /* BALOAD */ \n"
                + "    SP--; SP[-1].type = CN1_TYPE_INT; \n"
                + "    SP[-1].data.i = ((JAVA_ARRAY_BYTE*) (*(JAVA_ARRAY)SP[-1].data.o).data)[(*SP).data.i]; \n"
                + "    }\n");
        break;

    case Opcodes.CALOAD:
        b.append("    CHECK_ARRAY_ACCESS(2, SP[-1].data.i); /* CALOAD */\n"
                + "    SP--; SP[-1].type = CN1_TYPE_INT; \n"
                + "    SP[-1].data.i = ((JAVA_ARRAY_CHAR*) (*(JAVA_ARRAY)SP[-1].data.o).data)[(*SP).data.i];\n");
        break;

    case Opcodes.IALOAD:
        b.append("    CHECK_ARRAY_ACCESS(2, SP[-1].data.i); /* IALOAD */\n"
                + "    SP--; SP[-1].type = CN1_TYPE_INT; \n"
                + "    SP[-1].data.i = ((JAVA_ARRAY_INT*) (*(JAVA_ARRAY)SP[-1].data.o).data)[(*SP).data.i];\n");
        break;

    case Opcodes.SALOAD:
        b.append("    CHECK_ARRAY_ACCESS(2, SP[-1].data.i); \n" + "    SP--; SP[-1].type = CN1_TYPE_INT; \n"
                + "    SP[-1].data.i = ((JAVA_ARRAY_SHORT*) (*(JAVA_ARRAY)SP[-1].data.o).data)[(*SP).data.i]; /* SALOAD */\n");
        break;

    case Opcodes.LALOAD:
        b.append("    CHECK_ARRAY_ACCESS(2, SP[-1].data.i); /* LALOAD */\n"
                + "    SP--; SP[-1].type = CN1_TYPE_LONG; \n"
                + "    SP[-1].data.l = LONG_ARRAY_LOOKUP((JAVA_ARRAY)SP[-1].data.o, (*SP).data.i);\n");
        break;

    case Opcodes.FALOAD:
        b.append("    CHECK_ARRAY_ACCESS(2, SP[-1].data.i); /* FALOAD */\n"
                + "    SP--; SP[-1].type = CN1_TYPE_FLOAT; \n"
                + "    SP[-1].data.f = FLOAT_ARRAY_LOOKUP((JAVA_ARRAY)SP[-1].data.o, (*SP).data.i);\n");
        break;

    case Opcodes.DALOAD:
        b.append("    CHECK_ARRAY_ACCESS(2, SP[-1].data.i); /* DALOAD */\n"
                + "    SP--; SP[-1].type = CN1_TYPE_DOUBLE; \n"
                + "    SP[-1].data.d = DOUBLE_ARRAY_LOOKUP((JAVA_ARRAY)SP[-1].data.o, (*SP).data.i);\n");
        break;

    case Opcodes.AALOAD:
        b.append("    CHECK_ARRAY_ACCESS(2, SP[-1].data.i); /* AALOAD */\n"
                + "    SP--; SP[-1].type = CN1_TYPE_INVALID; \n"
                + "    SP[-1].data.o = ((JAVA_ARRAY_OBJECT*) (*(JAVA_ARRAY)SP[-1].data.o).data)[(*SP).data.i]; \n"
                + "    SP[-1].type = CN1_TYPE_OBJECT; \n");
        break;

    case Opcodes.BASTORE:
        b.append("    CHECK_ARRAY_ACCESS(3, SP[-2].data.i); /* BASTORE */\n"
                + "    ((JAVA_ARRAY_BYTE*) (*(JAVA_ARRAY)SP[-3].data.o).data)[SP[-2].data.i] = SP[-1].data.i; SP -= 3;\n");
        break;

    case Opcodes.CASTORE:
        b.append("    CHECK_ARRAY_ACCESS(3, SP[-2].data.i); /* CASTORE */\n"
                + "    ((JAVA_ARRAY_CHAR*) (*(JAVA_ARRAY)SP[-3].data.o).data)[SP[-2].data.i] = SP[-1].data.i; SP -= 3;\n\n");
        break;

    case Opcodes.SASTORE:
        b.append("    CHECK_ARRAY_ACCESS(3, SP[-2].data.i); /* SASTORE */\n"
                + "    ((JAVA_ARRAY_SHORT*) (*(JAVA_ARRAY)SP[-3].data.o).data)[SP[-2].data.i] = SP[-1].data.i; SP -= 3;\n");
        break;

    case Opcodes.IASTORE:
        b.append("    CHECK_ARRAY_ACCESS(3, SP[-2].data.i); /* IASTORE */\n"
                + "    ((JAVA_ARRAY_INT*) (*(JAVA_ARRAY)SP[-3].data.o).data)[SP[-2].data.i] = SP[-1].data.i; SP -= 3;\n");
        break;

    case Opcodes.LASTORE:
        b.append("    CHECK_ARRAY_ACCESS(3, SP[-2].data.i); /* LASTORE */\n"
                + "    LONG_ARRAY_LOOKUP((JAVA_ARRAY)SP[-3].data.o, SP[-2].data.i) = SP[-1].data.l; SP -= 3;\n");
        break;

    case Opcodes.FASTORE:
        b.append("    CHECK_ARRAY_ACCESS(3, SP[-2].data.i); /* FASTORE */\n"
                + "    FLOAT_ARRAY_LOOKUP((JAVA_ARRAY)SP[-3].data.o, SP[-2].data.i) = SP[-1].data.f; SP -= 3;\n");
        break;

    case Opcodes.DASTORE:
        b.append("    CHECK_ARRAY_ACCESS(3, SP[-2].data.i); /* DASTORE */\n"
                + "    DOUBLE_ARRAY_LOOKUP((JAVA_ARRAY)SP[-3].data.o, SP[-2].data.i) = SP[-1].data.d; SP -= 3;\n");
        break;

    case Opcodes.AASTORE:
        b.append("    CHECK_ARRAY_ACCESS(3, SP[-2].data.i); { /* BC_AASTORE */\n"
                + "    JAVA_OBJECT aastoreTmp = SP[-3].data.o; \n"
                + "    ((JAVA_ARRAY_OBJECT*) (*(JAVA_ARRAY)aastoreTmp).data)[SP[-2].data.i] = SP[-1].data.o; \n"
                + "    SP -= 3; }\n");
        break;

    case Opcodes.POP:
        b.append("    SP--; /* POP */\n");
        break;

    case Opcodes.POP2:
        b.append("    popMany(threadStateData, 2, &SP); /* POP2 */\n");
        break;

    /*case Opcodes.DUP:
        b.append("    PUSH_INT(PEEK_INT(1));\n");
        break;
            
    case Opcodes.DUP_X1:
        b.append("    DUP_X1();\n");
        break;
                
    case Opcodes.DUP_X2:
        b.append("    DUP_X2();\n");
        break;*/

    case Opcodes.DUP:
        b.append("    BC_DUP(); /* DUP */\n");
        break;

    case Opcodes.DUP2:
        b.append("    BC_DUP2(); /* DUP2 */\n");
        break;

    case Opcodes.DUP_X1:
        b.append("    BC_DUP2_X1(); /* DUP_X1 */\n");
        break;

    case Opcodes.DUP2_X1:
        b.append("    BC_DUP2_X1(); /* DUP2_X1 */\n");
        break;

    case Opcodes.DUP_X2:
        b.append("    BC_DUP2_X2(); /* DUP_X2 */\n");
        break;

    case Opcodes.DUP2_X2:
        b.append("    BC_DUP2_X2(); /* DUP2_X2 */\n");
        break;

    case Opcodes.SWAP:
        b.append("    swapStack(SP); /* SWAP */\n");
        break;

    case Opcodes.IADD:
        b.append("    SP--; SP[-1].data.i = SP[-1].data.i + (*SP).data.i; /* IADD */\n");
        break;

    case Opcodes.LADD:
        b.append("    SP--; SP[-1].data.l = SP[-1].data.l + (*SP).data.l; /* LADD */\n");
        break;

    case Opcodes.FADD:
        b.append("    SP--; SP[-1].data.f = SP[-1].data.f + (*SP).data.f; /* FADD */\n");
        break;

    case Opcodes.DADD:
        b.append("    SP--; SP[-1].data.d = SP[-1].data.d + (*SP).data.d; /* DADD */\n");
        break;

    case Opcodes.ISUB:
        b.append("    SP--; SP[-1].data.i = (SP[-1].data.i - (*SP).data.i); /* ISUB */\n");
        break;

    case Opcodes.LSUB:
        b.append("    SP--; SP[-1].data.l = (SP[-1].data.l - (*SP).data.l); /* LSUB */\n");
        break;

    case Opcodes.FSUB:
        b.append("    SP--; SP[-1].data.f = (SP[-1].data.f - (*SP).data.f); /* FSUB */\n");
        break;

    case Opcodes.DSUB:
        b.append("    SP--; SP[-1].data.d = (SP[-1].data.d - (*SP).data.d); /* DSUB */\n");
        break;

    case Opcodes.IMUL:
        b.append("    SP--; SP[-1].data.i = SP[-1].data.i * (*SP).data.i; /* IMUL */\n");
        break;

    case Opcodes.LMUL:
        b.append("    SP--; SP[-1].data.l = SP[-1].data.l * (*SP).data.l; /* LMUL */\n");
        break;

    case Opcodes.FMUL:
        b.append("    SP--; SP[-1].data.f = SP[-1].data.f * (*SP).data.f; /* FMUL */\n");
        break;

    case Opcodes.DMUL:
        b.append("    SP--; SP[-1].data.d = SP[-1].data.d * (*SP).data.d; /* DMUL */\n");
        break;

    case Opcodes.IDIV:
        b.append("    SP--; SP[-1].data.i = SP[-1].data.i / (*SP).data.i; /* IDIV */\n");
        break;

    case Opcodes.LDIV:
        b.append("    SP--; SP[-1].data.l = SP[-1].data.l / (*SP).data.l; /* LDIV */\n");
        break;

    case Opcodes.FDIV:
        b.append("    SP--; SP[-1].data.f = SP[-1].data.f / (*SP).data.f; /* FDIV */\n");
        break;

    case Opcodes.DDIV:
        b.append("    SP--; SP[-1].data.d = SP[-1].data.d / (*SP).data.d; /* DDIV */\n");
        break;

    case Opcodes.IREM:
        b.append("    SP--; SP[-1].data.i = SP[-1].data.i % (*SP).data.i; /* IREM */\n");
        break;

    case Opcodes.LREM:
        b.append("    SP--; SP[-1].data.l = SP[-1].data.l % (*SP).data.l; /* LREM */\n");
        break;

    case Opcodes.FREM:
        b.append("    SP--; SP[-1].data.f = fmod(SP[-1].data.f, (*SP).data.f); /* FREM */\n");
        break;

    case Opcodes.DREM:
        b.append("    SP--; SP[-1].data.d = fmod(SP[-1].data.d, (*SP).data.d); /* DREM */\n");
        break;

    case Opcodes.INEG:
        b.append("    SP[-1].data.i *= -1; /* INEG */\n");
        break;

    case Opcodes.LNEG:
        b.append("    SP[-1].data.l *= -1; /* LNEG */\n");
        break;

    case Opcodes.FNEG:
        b.append("    SP[-1].data.f *= -1; /* FNEG */\n");
        break;

    case Opcodes.DNEG:
        b.append("    SP[-1].data.d *= -1; /* DNEG */\n");
        break;

    case Opcodes.ISHL:
        b.append("    SP--; SP[-1].data.i = (SP[-1].data.i << (0x1f & (*SP).data.i)); /* ISHL */\n");
        break;

    case Opcodes.LSHL:
        b.append("    SP--; SP[-1].data.l = (SP[-1].data.l << (0x3f & (*SP).data.i)); /* LSHL */\n");
        break;

    case Opcodes.ISHR:
        b.append("    SP--; SP[-1].data.i = (SP[-1].data.i >> (0x1f & (*SP).data.i)); /* ISHR */\n");
        break;

    case Opcodes.LSHR:
        b.append("    SP--; SP[-1].data.l = (SP[-1].data.l >> (0x3f & (*SP).data.l)); /* LSHR */\n");
        break;

    case Opcodes.IUSHR:
        b.append(
                "    SP--; SP[-1].data.i = (((unsigned int)SP[-1].data.i) >> (0x1f & ((unsigned int)(*SP).data.i))); /* IUSHR */\n");
        break;

    case Opcodes.LUSHR:
        b.append(
                "    SP--; SP[-1].data.l = (((unsigned long long)SP[-1].data.l) >> (0x3f & ((unsigned long long)(*SP).data.i))); /* LUSHR */\n");
        break;

    case Opcodes.IAND:
        b.append("    SP--; SP[-1].data.i = SP[-1].data.i & (*SP).data.i; /* IAND */\n");
        break;

    case Opcodes.LAND:
        b.append("    SP--; SP[-1].data.l = SP[-1].data.l & (*SP).data.l; /* LAND */\n");
        break;

    case Opcodes.IOR:
        b.append("    SP--; SP[-1].data.i = SP[-1].data.i | (*SP).data.i; /* IOR */\n");
        break;

    case Opcodes.LOR:
        b.append("    SP--; SP[-1].data.l = SP[-1].data.l | (*SP).data.l; /* LOR */\n");
        break;

    case Opcodes.IXOR:
        b.append("    SP--; SP[-1].data.i = SP[-1].data.i ^ (*SP).data.i; /* IXOR */\n");
        break;

    case Opcodes.LXOR:
        b.append("    SP--; SP[-1].data.l = SP[-1].data.l ^ (*SP).data.l; /* LXOR */\n");
        break;

    case Opcodes.I2L:
        b.append("    SP[-1].data.l = SP[-1].data.i; /* I2L */\n");
        break;

    case Opcodes.I2F:
        b.append("    SP[-1].data.f = (JAVA_FLOAT)SP[-1].data.i; /* I2F */\n");
        break;

    case Opcodes.I2D:
        b.append("    SP[-1].data.d = SP[-1].data.i; /* I2D */;\n");
        break;

    case Opcodes.L2I:
        b.append("    SP[-1].data.i = (JAVA_INT)SP[-1].data.l; /* L2I */\n");
        break;

    case Opcodes.L2F:
        b.append("    SP[-1].data.f = (JAVA_FLOAT)SP[-1].data.l; /* L2F */\n");
        break;

    case Opcodes.L2D:
        b.append("    SP[-1].data.d = (JAVA_DOUBLE)SP[-1].data.l; /* L2D */\n");
        break;

    case Opcodes.F2I:
        b.append("    SP[-1].data.i = (JAVA_INT)SP[-1].data.f; /* F2I */\n");
        break;

    case Opcodes.F2L:
        b.append("    SP[-1].data.l = (JAVA_LONG)SP[-1].data.f; /* F2L */\n");
        break;

    case Opcodes.F2D:
        b.append("    SP[-1].data.d = SP[-1].data.f; /* F2D */\n");
        break;

    case Opcodes.D2I:
        b.append("    SP[-1].data.i = (JAVA_INT)SP[-1].data.d; /* D2I */\n");
        break;

    case Opcodes.D2L:
        b.append("    SP[-1].data.l = (JAVA_LONG)SP[-1].data.d; /* D2L */\n");
        break;

    case Opcodes.D2F:
        b.append("    SP[-1].data.f = (JAVA_FLOAT)SP[-1].data.d; /* D2F */\n");
        break;

    case Opcodes.I2B:
        b.append("    SP[-1].data.i = ((SP[-1].data.i << 24) >> 24); /* I2B */\n");
        break;

    case Opcodes.I2C:
        b.append("    SP[-1].data.i = (SP[-1].data.i & 0xffff); /* I2C */\n");
        break;

    case Opcodes.I2S:
        b.append("    SP[-1].data.i = ((SP[-1].data.i << 16) >> 16); /* I2S */\n");
        break;

    case Opcodes.LCMP:
        b.append("    BC_LCMP();\n");
        break;

    case Opcodes.FCMPG:
    case Opcodes.FCMPL:
        b.append("    BC_FCMPL();\n");
        break;

    case Opcodes.DCMPL:
    case Opcodes.DCMPG:
        b.append("    BC_DCMPL();\n");
        break;

    case Opcodes.IRETURN:
        appendSynchronized(b);

        if (TryCatch.isTryCatchInMethod()) {
            b.append(
                    "    releaseForReturnInException(threadStateData, cn1LocalsBeginInThread, methodBlockOffset); return SP[-1].data.i;\n");
            //                    b.append(maxLocals);
            //                    b.append(", stack, locals, methodBlockOffset); \n    return SP[-1].data.i;\n");
        } else {
            b.append("    releaseForReturn(threadStateData, cn1LocalsBeginInThread); return SP[-1].data.i;\n");
            //                    b.append(maxLocals);
            //                    b.append(", stack, locals); \n    return SP[-1].data.i;\n");
        }
        break;

    case Opcodes.LRETURN:
        appendSynchronized(b);

        if (TryCatch.isTryCatchInMethod()) {
            b.append(
                    "    releaseForReturnInException(threadStateData, cn1LocalsBeginInThread, methodBlockOffset); \n    return POP_LONG();\n");
        } else {
            b.append(
                    "    releaseForReturn(threadStateData, cn1LocalsBeginInThread); \n    return POP_LONG();\n");
        }
        break;

    case Opcodes.FRETURN:
        appendSynchronized(b);

        if (TryCatch.isTryCatchInMethod()) {
            b.append(
                    "    releaseForReturnInException(threadStateData, cn1LocalsBeginInThread, methodBlockOffset); \n    return POP_FLOAT();\n");
        } else {
            b.append(
                    "    releaseForReturn(threadStateData, cn1LocalsBeginInThread); \n    return POP_FLOAT();\n");
        }
        break;

    case Opcodes.DRETURN:
        appendSynchronized(b);

        if (TryCatch.isTryCatchInMethod()) {
            b.append(
                    "    releaseForReturnInException(threadStateData, cn1LocalsBeginInThread, methodBlockOffset); \n    return POP_DOUBLE();\n");
        } else {
            b.append(
                    "    releaseForReturn(threadStateData, cn1LocalsBeginInThread); \n    return POP_DOUBLE();\n");
        }
        break;

    case Opcodes.ARETURN:
        appendSynchronized(b);

        if (TryCatch.isTryCatchInMethod()) {
            b.append(
                    "    releaseForReturnInException(threadStateData, cn1LocalsBeginInThread, methodBlockOffset); \n    return POP_OBJ();\n");
        } else {
            b.append(
                    "    releaseForReturn(threadStateData, cn1LocalsBeginInThread); \n    return POP_OBJ();\n");
        }
        break;

    case Opcodes.RETURN:
        appendSynchronized(b);

        if (!hasInstructions) {
            b.append("    return;\n");
            break;
        }
        if (TryCatch.isTryCatchInMethod()) {
            b.append(
                    "    releaseForReturnInException(threadStateData, cn1LocalsBeginInThread, methodBlockOffset); \n    return;\n");
        } else {
            b.append("    releaseForReturn(threadStateData, cn1LocalsBeginInThread); \n    return;\n");
        }
        break;

    case Opcodes.ARRAYLENGTH:
        b.append("    { /* ARRAYLENGTH */\n" + "        if(SP[-1].data.o == JAVA_NULL) { \n"
                + "            throwException(threadStateData, __NEW_INSTANCE_java_lang_NullPointerException(threadStateData)); \n"
                + "        }; \n" + "        SP[-1].type = CN1_TYPE_INT; \n"
                + "        SP[-1].data.i = (*((JAVA_ARRAY)SP[-1].data.o)).length; \n" + "    }\n");
        break;

    case Opcodes.ATHROW:
        //b.append("    NSLog(@\"Exception thrown %s %d %s %s\\n\", __FILE__, __LINE__, __PRETTY_FUNCTION__, __FUNCTION__);\n");
        b.append("    throwException(threadStateData, POP_OBJ());\n");
        break;

    case Opcodes.MONITORENTER:
        b.append("    monitorEnter(threadStateData, POP_OBJ());\n");
        break;

    case Opcodes.MONITOREXIT:
        b.append("    monitorExit(threadStateData, POP_OBJ());\n");
        break;

    // int instructions
    case Opcodes.SIPUSH:
    case Opcodes.BIPUSH:
        b.append("    PUSH_INT(");
        b.append(value);
        b.append(");\n");
        break;

    case Opcodes.NEWARRAY:
        switch (value) {
        case 4: // boolean
            b.append(
                    "    SP--; PUSH_OBJ(allocArray(threadStateData, (*SP).data.i, &class_array1__JAVA_BOOLEAN, sizeof(JAVA_ARRAY_BOOLEAN), 1));\n");
            break;
        case 5: // char
            b.append(
                    "    SP--; PUSH_OBJ(allocArray(threadStateData, (*SP).data.i, &class_array1__JAVA_CHAR, sizeof(JAVA_ARRAY_CHAR), 1));\n");
            break;
        case 6: // float
            b.append(
                    "    SP--; PUSH_OBJ(allocArray(threadStateData, (*SP).data.i, &class_array1__JAVA_FLOAT, sizeof(JAVA_ARRAY_FLOAT), 1));\n");
            break;
        case 7: // double
            b.append(
                    "    SP--; PUSH_OBJ(allocArray(threadStateData, (*SP).data.i, &class_array1__JAVA_DOUBLE, sizeof(JAVA_ARRAY_DOUBLE), 1));\n");
            break;
        case 8: // byte
            b.append(
                    "    SP--; PUSH_OBJ(allocArray(threadStateData, (*SP).data.i, &class_array1__JAVA_BYTE, sizeof(JAVA_ARRAY_BYTE), 1));\n");
            break;
        case 9: // short
            b.append(
                    "    SP--; PUSH_OBJ(allocArray(threadStateData, (*SP).data.i, &class_array1__JAVA_SHORT, sizeof(JAVA_ARRAY_SHORT), 1));\n");
            break;
        case 10: // int
            b.append(
                    "    SP--; PUSH_OBJ(allocArray(threadStateData, (*SP).data.i, &class_array1__JAVA_INT, sizeof(JAVA_ARRAY_INT), 1));\n");
            break;
        case 11: // long 
            b.append(
                    "    SP--; PUSH_OBJ(allocArray(threadStateData, (*SP).data.i, &class_array1__JAVA_LONG, sizeof(JAVA_ARRAY_LONG), 1));\n");
            break;
        }
        break;
    }
}

From source file:com.codename1.tools.translator.Util.java

License:Open Source License

public static char[] getStackInputTypes(Instruction instr) {
    char[] out = instr.getStackInputTypes();
    if (out != null) {
        return out;
    }/*from   w  w w.j a va 2s .  c om*/

    switch (instr.getOpcode()) {

    case Opcodes.NOP:
    case Opcodes.ACONST_NULL:
    case Opcodes.ICONST_M1:
    case Opcodes.ICONST_0:
    case Opcodes.ICONST_2:
    case Opcodes.ICONST_3:
    case Opcodes.ICONST_4:
    case Opcodes.ICONST_5:
    case Opcodes.LCONST_0:
    case Opcodes.LCONST_1:
    case Opcodes.FCONST_0:
    case Opcodes.FCONST_1:
    case Opcodes.FCONST_2:
    case Opcodes.DCONST_0:
    case Opcodes.DCONST_1:
    case Opcodes.SIPUSH:
    case Opcodes.BIPUSH:
        return new char[0];
    case Opcodes.BALOAD:
    case Opcodes.CALOAD:
    case Opcodes.IALOAD:
    case Opcodes.SALOAD:
    case Opcodes.LALOAD:
    case Opcodes.FALOAD:
    case Opcodes.DALOAD:
    case Opcodes.AALOAD:
        return new char[] { 'i', 'o' };

    case Opcodes.BASTORE:
    case Opcodes.CASTORE:
    case Opcodes.SASTORE:
    case Opcodes.IASTORE:
        return new char[] { 'i', 'i', 'o' };
    case Opcodes.LASTORE:
        return new char[] { 'l', 'i', 'o' };
    case Opcodes.FASTORE:
        return new char[] { 'f', 'i', 'o' };
    case Opcodes.DASTORE:
        return new char[] { 'd', 'i', 'o' };
    case Opcodes.AASTORE:
        return new char[] { 'o', 'i', 'o' };

    case Opcodes.POP:
        return new char[] { '*' };

    case Opcodes.POP2:
        return new char[] { '*', '*' };

    case Opcodes.DUP:
        return new char[] { '0' };

    case Opcodes.DUP2:
    case Opcodes.DUP_X2:
    case Opcodes.DUP2_X2:
        return null; // DUP2 depends on the types on the stack so we don't statically know the input types

    case Opcodes.DUP_X1:
    case Opcodes.DUP2_X1:
        return new char[] { '0', '1' };
    case Opcodes.SWAP:
        return new char[] { '0', '1' };
    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:
        return new char[] { 'i', 'i' };

    case Opcodes.LADD:
    case Opcodes.LSUB:
    case Opcodes.LMUL:
    case Opcodes.LDIV:
    case Opcodes.LREM:
    case Opcodes.LSHL:
    case Opcodes.LSHR:
    case Opcodes.LAND:
    case Opcodes.LOR:
    case Opcodes.LXOR:
    case Opcodes.LCMP:
        return new char[] { 'l', 'l' };
    case Opcodes.FADD:
    case Opcodes.FSUB:
    case Opcodes.FMUL:
    case Opcodes.FDIV:
    case Opcodes.FREM:
    case Opcodes.FCMPG:
    case Opcodes.FCMPL:
        return new char[] { 'f', 'f' };
    case Opcodes.DADD:
    case Opcodes.DSUB:
    case Opcodes.DMUL:
    case Opcodes.DDIV:
    case Opcodes.DREM:
    case Opcodes.DCMPL:
    case Opcodes.DCMPG:
        return new char[] { 'd', 'd' };

    case Opcodes.INEG:
    case Opcodes.I2L:
    case Opcodes.I2F:
    case Opcodes.I2D:
    case Opcodes.I2B:
    case Opcodes.I2C:
    case Opcodes.I2S:
    case Opcodes.NEWARRAY:
        return new char[] { 'i' };
    case Opcodes.LNEG:
    case Opcodes.L2I:
    case Opcodes.L2F:
    case Opcodes.L2D:
        return new char[] { 'l' };

    case Opcodes.FNEG:
    case Opcodes.F2I:
    case Opcodes.F2L:
    case Opcodes.F2D:
        return new char[] { 'f' };
    case Opcodes.DNEG:
    case Opcodes.D2I:
    case Opcodes.D2L:
    case Opcodes.D2F:
        return new char[] { 'd' };
    case Opcodes.LUSHR:
        return new char[] { 'i', 'l' };

    case Opcodes.ARRAYLENGTH:
    case Opcodes.MONITORENTER:
    case Opcodes.MONITOREXIT:
    case Opcodes.ATHROW:
        return new char[] { 'o' };
    default:
        return null;

    }

}

From source file:com.codename1.tools.translator.Util.java

License:Open Source License

public static char[] getStackOutputTypes(Instruction instr) {
    char[] out = instr.getStackOutputTypes();
    if (out != null) {
        return out;
    }//from ww  w  . java 2s .  co  m

    switch (instr.getOpcode()) {
    case Opcodes.NOP:
    case Opcodes.BASTORE:
    case Opcodes.CASTORE:
    case Opcodes.SASTORE:
    case Opcodes.IASTORE:
    case Opcodes.LASTORE:
    case Opcodes.FASTORE:
    case Opcodes.DASTORE:
    case Opcodes.AASTORE:
    case Opcodes.POP:
    case Opcodes.POP2:
    case Opcodes.MONITORENTER:
    case Opcodes.MONITOREXIT:
    case Opcodes.ATHROW:
        return new char[0];

    case Opcodes.ACONST_NULL:
    case Opcodes.AALOAD:
    case Opcodes.NEWARRAY:
        return new char[] { 'o' };

    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:
    case Opcodes.BALOAD:
    case Opcodes.CALOAD:
    case Opcodes.IALOAD:
    case Opcodes.SALOAD:
    case Opcodes.IADD:
    case Opcodes.ISUB:
    case Opcodes.IMUL:
    case Opcodes.IDIV:
    case Opcodes.IREM:
    case Opcodes.INEG:
    case Opcodes.ISHL:
    case Opcodes.ISHR:
    case Opcodes.IUSHR:
    case Opcodes.IAND:
    case Opcodes.IOR:
    case Opcodes.IXOR:
    case Opcodes.F2I:
    case Opcodes.D2I:
    case Opcodes.L2I:
    case Opcodes.I2C:
    case Opcodes.I2S:
    case Opcodes.LCMP:
    case Opcodes.FCMPG:
    case Opcodes.FCMPL:
    case Opcodes.DCMPL:
    case Opcodes.DCMPG:
    case Opcodes.ARRAYLENGTH:
    case Opcodes.SIPUSH:
    case Opcodes.BIPUSH:
        return new char[] { 'i' };
    case Opcodes.LCONST_0:
    case Opcodes.LCONST_1:
    case Opcodes.LALOAD:
    case Opcodes.LADD:
    case Opcodes.LSUB:
    case Opcodes.LMUL:
    case Opcodes.LDIV:
    case Opcodes.LREM:
    case Opcodes.LNEG:
    case Opcodes.LSHL:
    case Opcodes.LSHR:
    case Opcodes.LUSHR:
    case Opcodes.LAND:
    case Opcodes.LOR:
    case Opcodes.LXOR:
    case Opcodes.I2L:
    case Opcodes.F2L:
    case Opcodes.D2L:
        return new char[] { 'l' };
    case Opcodes.FCONST_0:
    case Opcodes.FCONST_1:
    case Opcodes.FCONST_2:
    case Opcodes.FALOAD:
    case Opcodes.FADD:
    case Opcodes.FSUB:
    case Opcodes.FMUL:
    case Opcodes.FDIV:
    case Opcodes.FREM:
    case Opcodes.FNEG:
    case Opcodes.I2F:
    case Opcodes.D2F:
    case Opcodes.L2F:
        return new char[] { 'f' };
    case Opcodes.DCONST_0:
    case Opcodes.DCONST_1:
    case Opcodes.DALOAD:
    case Opcodes.DADD:
    case Opcodes.DSUB:
    case Opcodes.DMUL:
    case Opcodes.DDIV:
    case Opcodes.DREM:
    case Opcodes.DNEG:
    case Opcodes.I2D:
    case Opcodes.F2D:
    case Opcodes.L2D:
        return new char[] { 'd' };
    case Opcodes.DUP:
        return new char[] { '0', '0' };

    case Opcodes.DUP2:
    case Opcodes.DUP_X2:
    case Opcodes.DUP2_X2:
        return null;

    case Opcodes.DUP_X1:
    case Opcodes.DUP2_X1:
        return new char[] { '0', '1', '0' };
    case Opcodes.SWAP:
        return new char[] { '1', '0' };

    default:
        return null;
    }

}

From source file:com.gargoylesoftware.js.nashorn.internal.ir.debug.NashornTextifier.java

License:Open Source License

@Override
public void visitInsn(final int opcode) {
    if (opcode == Opcodes.NOP) {
        if (lastWasEllipse) {
            getNextLabel();/*from   w ww .j  a v a2 s.c om*/
            return;
        } else if (lastWasNop) {
            getNextLabel();
            addText("          ...\n");
            lastWasEllipse = true;
            return;
        } else {
            lastWasNop = true;
        }
    } else {
        lastWasNop = lastWasEllipse = false;
    }
    final StringBuilder sb = new StringBuilder();
    appendOpcode(sb, opcode).append('\n');
    addText(sb);
    checkNoFallThru(opcode, null);
}

From source file:com.github.anba.es6draft.compiler.assembler.InstructionAssembler.java

License:Open Source License

public void nop() {
    methodVisitor.visitInsn(Opcodes.NOP);
}

From source file:com.github.fge.grappa.transform.CodeBlock.java

License:Apache License

public CodeBlock nop() {
    instructionList.add(new InsnNode(Opcodes.NOP));
    return this;
}

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;/* www.  j  a va2 s.  c om*/
    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);
}