private void visitJOP(int op, Label label){ mn.visitJumpInsn(op,label); } private void visitIIOP(int op, int a, int b){
@Override public void visitJumpInsn(final int opcode, final Label label) { super.visitJumpInsn(opcode, label); LabelNode labelNode = ((JumpInsnNode) instructions.getLast()).label; if (opcode == JSR && !subroutinesInsns.containsKey(labelNode)) { subroutinesInsns.put(labelNode, new BitSet()); } }
@Override public void visitJumpInsn(final int opcode, final Label label) { super.visitJumpInsn(opcode, label); LabelNode labelNode = ((JumpInsnNode) instructions.getLast()).label; if (opcode == JSR && !subroutinesInsns.containsKey(labelNode)) { subroutinesInsns.put(labelNode, new BitSet()); } }
@Override public void visitJumpInsn(final int opcode, final Label label) { super.visitJumpInsn(opcode, label); LabelNode labelNode = ((JumpInsnNode) instructions.getLast()).label; if (opcode == JSR && !subroutinesInsns.containsKey(labelNode)) { subroutinesInsns.put(labelNode, new BitSet()); } }
/** * Detects a JSR instruction and sets a flag to indicate we will need to do * inlining. */ @Override public void visitJumpInsn(final int opcode, final Label lbl) { super.visitJumpInsn(opcode, lbl); LabelNode ln = ((JumpInsnNode) instructions.getLast()).label; if (opcode == JSR && !subroutineHeads.containsKey(ln)) { subroutineHeads.put(ln, new BitSet()); } }
@Override public void visitJumpInsn(int opcode, Label label) { usedLabels.add(getLabelNode(label)); super.visitJumpInsn(opcode, label); }
@Override public void visitJumpInsn(final int opcode, final Label label) { usedLabels.add(getLabelNode(label)); super.visitJumpInsn(opcode, label); }
@Override public void visitCode() { super.visitCode(); Label l0 = new Label(); super.visitLabel(l0); super.visitVarInsn(Opcodes.ALOAD, 1); super.visitMethodInsn(Opcodes.INVOKESTATIC, "logisticspipes/proxy/cc/LPASMHookCC", "handleCCWrappedILuaObject", "(Ldan200/computercraft/api/lua/ILuaObject;)Z"); Label l1 = new Label(); super.visitJumpInsn(Opcodes.IFEQ, l1); Label l2 = new Label(); super.visitLabel(l2); super.visitVarInsn(Opcodes.ALOAD, 1); super.visitMethodInsn(Opcodes.INVOKESTATIC, "logisticspipes/proxy/cc/LPASMHookCC", "returnCCWrappedILuaObject", "(Ldan200/computercraft/api/lua/ILuaObject;)Lorg/luaj/vm2/LuaTable;"); super.visitInsn(Opcodes.ARETURN); super.visitLabel(l1); } };
@Override public void visitLineNumber(int line, Label start) { if (!added) { added = true; super.visitVarInsn(Opcodes.ALOAD, 1); super.visitMethodInsn(Opcodes.INVOKESTATIC, "logisticspipes/proxy/cc/LPASMHookCC", "handleCCToObject", "(Lorg/luaj/vm2/LuaValue;)Z"); start = new Label(); super.visitJumpInsn(Opcodes.IFEQ, start); Label l5 = new Label(); super.visitLabel(l5); super.visitVarInsn(Opcodes.ALOAD, 1); super.visitMethodInsn(Opcodes.INVOKESTATIC, "logisticspipes/proxy/cc/LPASMHookCC", "returnCCToObject", "(Lorg/luaj/vm2/LuaValue;)Ljava/lang/Object;"); super.visitInsn(Opcodes.ARETURN); super.visitLabel(start); } super.visitLineNumber(line, start); } };
private MethodNode generateIsBlockingWithShield() { MethodNode mv = new MethodNode(ACC_PUBLIC, "isBlockingWithShield", "()Z", null, null); mv.visitCode(); Label l0 = new Label(); mv.visitLabel(l0); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESTATIC, UTILITY_CLASS, "canBlockWithShield", "(L" + entityPlayerClassName + ";)Z"); Label l1 = new Label(); mv.visitJumpInsn(IFEQ, l1); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(GETFIELD, entityPlayerClassName, "isShielding", "Z"); mv.visitJumpInsn(IFEQ, l1); mv.visitInsn(ICONST_1); Label l2 = new Label(); mv.visitJumpInsn(GOTO, l2); mv.visitLabel(l1); mv.visitFrame(F_SAME, 0, null, 0, null); mv.visitInsn(ICONST_0); mv.visitLabel(l2); mv.visitFrame(F_SAME1, 0, null, 1, new Object[]{INTEGER}); mv.visitInsn(IRETURN); Label l3 = new Label(); mv.visitLabel(l3); mv.visitLocalVariable("this", "L" + entityPlayerClassName + ";", null, l0, l3, 0); mv.visitMaxs(1, 1); mv.visitEnd(); return mv; }
mv.visitVarInsn(ILOAD, 1); Label l1 = new Label(); mv.visitJumpInsn(IFEQ, l1); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESTATIC, UTILITY_CLASS, "canBlockWithShield", "(L" + entityPlayerClassName + ";)Z"); mv.visitJumpInsn(IFEQ, l1); mv.visitInsn(ICONST_1); Label l2 = new Label(); mv.visitJumpInsn(GOTO, l2); mv.visitLabel(l1); mv.visitFrame(F_SAME1, 0, null, 1, new Object[]{entityPlayerClassName});
m.visitLdcInsn(new Long(0)); m.visitInsn(LCMP); m.visitJumpInsn(IFEQ, next); m.visitInsn(ICONST_0); m.visitInsn(IRETURN); m.visitFieldInsn(GETFIELD, tranlocalName, "___origin", originDesc); next = new Label(); m.visitJumpInsn(IFNONNULL, next); m.visitInsn(ICONST_1); m.visitInsn(IRETURN); case Type.SHORT: case Type.INT: m.visitJumpInsn(IF_ICMPEQ, next); break; case Type.FLOAT: m.visitInsn(FCMPL); m.visitJumpInsn(IFEQ, next); break; case Type.LONG: m.visitInsn(LCMP); m.visitJumpInsn(IFEQ, next); break; case Type.DOUBLE: m.visitInsn(DCMPL); m.visitJumpInsn(IFEQ, next); break; case Type.OBJECT:
mv.visitJumpInsn(IFEQ, l1); Label l2 = new Label(); mv.visitLabel(l2);
mv.visitLabel(l8); Label l9 = new Label(); mv.visitJumpInsn(GOTO, l9); Label l10 = new Label(); mv.visitLabel(l10); mv.visitVarInsn(ALOAD, 7); mv.visitInsn(ARRAYLENGTH); mv.visitJumpInsn(IF_ICMPLT, l10); Label l12 = new Label(); mv.visitLabel(l12); mv.visitLabel(l15); Label l16 = new Label(); mv.visitJumpInsn(GOTO, l16); Label l17 = new Label(); mv.visitLabel(l17); mv.visitVarInsn(ALOAD, 9); mv.visitInsn(ARRAYLENGTH); mv.visitJumpInsn(IF_ICMPLT, l17); Label l19 = new Label(); mv.visitLabel(l19); mv.visitLabel(l22); Label l23 = new Label(); mv.visitJumpInsn(GOTO, l23); Label l24 = new Label(); mv.visitLabel(l24);
mv.visitLabel(l5); Label l6 = new Label(); mv.visitJumpInsn(GOTO, l6); Label l7 = new Label(); mv.visitLabel(l7); mv.visitVarInsn(ALOAD, 7); mv.visitInsn(ARRAYLENGTH); mv.visitJumpInsn(IF_ICMPLT, l7); Label l9 = new Label(); mv.visitLabel(l9); mv.visitLabel(l12); Label l13 = new Label(); mv.visitJumpInsn(GOTO, l13); Label l14 = new Label(); mv.visitLabel(l14); mv.visitVarInsn(ALOAD, 9); mv.visitInsn(ARRAYLENGTH); mv.visitJumpInsn(IF_ICMPLT, l14); Label l16 = new Label(); mv.visitLabel(l16); mv.visitLabel(l19); Label l20 = new Label(); mv.visitJumpInsn(GOTO, l20); Label l21 = new Label(); mv.visitLabel(l21);