List of usage examples for org.objectweb.asm Opcodes IF_ICMPLE
int IF_ICMPLE
To view the source code for org.objectweb.asm Opcodes IF_ICMPLE.
Click Source Link
From source file:com.mebigfatguy.exagent.StackTraceMethodVisitor.java
License:Apache License
private void injectCallStackPopulation() { // ExAgent.METHOD_INFO.get(); super.visitFieldInsn(Opcodes.GETSTATIC, EXASUPPORT_CLASS_NAME, "METHOD_INFO", signaturizeClass(THREADLOCAL_CLASS_NAME)); super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, THREADLOCAL_CLASS_NAME, "get", "()Ljava/lang/Object;", false); super.visitTypeInsn(Opcodes.CHECKCAST, LIST_CLASS_NAME); super.visitInsn(Opcodes.DUP); super.visitMethodInsn(Opcodes.INVOKEINTERFACE, LIST_CLASS_NAME, "size", "()I", true); super.visitVarInsn(Opcodes.ISTORE, depthLocalSlot); //new MethodInfo(cls, name, parmMap); super.visitTypeInsn(Opcodes.NEW, METHODINFO_CLASS_NAME); super.visitInsn(Opcodes.DUP); super.visitLdcInsn(clsName.replace('.', '/')); super.visitLdcInsn(methodName); if (parms.isEmpty()) { super.visitMethodInsn(Opcodes.INVOKESTATIC, COLLECTIONS_CLASS_NAME, "emptyList", "()Ljava/util/List;", false);//from w w w .ja v a2s. c o m } else { super.visitTypeInsn(Opcodes.NEW, ARRAYLIST_CLASS_NAME); super.visitInsn(Opcodes.DUP); super.visitIntInsn(Opcodes.BIPUSH, parms.size()); super.visitMethodInsn(Opcodes.INVOKESPECIAL, ARRAYLIST_CLASS_NAME, CTOR_NAME, "(I)V", false); for (Parm parm : parms) { super.visitInsn(Opcodes.DUP); switch (parm.signature) { case "C": super.visitVarInsn(Opcodes.ILOAD, parm.register); super.visitMethodInsn(Opcodes.INVOKESTATIC, STRING_CLASS_NAME, "valueOf", "(C)Ljava/lang/String;", false); break; case "Z": super.visitVarInsn(Opcodes.ILOAD, parm.register); super.visitMethodInsn(Opcodes.INVOKESTATIC, STRING_CLASS_NAME, "valueOf", "(Z)Ljava/lang/String;", false); break; case "B": case "S": case "I": super.visitVarInsn(Opcodes.ILOAD, parm.register); super.visitMethodInsn(Opcodes.INVOKESTATIC, STRING_CLASS_NAME, "valueOf", "(I)Ljava/lang/String;", false); break; case "J": super.visitVarInsn(Opcodes.LLOAD, parm.register); super.visitMethodInsn(Opcodes.INVOKESTATIC, STRING_CLASS_NAME, "valueOf", "(J)Ljava/lang/String;", false); break; case "F": super.visitVarInsn(Opcodes.FLOAD, parm.register); super.visitMethodInsn(Opcodes.INVOKESTATIC, STRING_CLASS_NAME, "valueOf", "(F)Ljava/lang/String;", false); break; case "D": super.visitVarInsn(Opcodes.DLOAD, parm.register); super.visitMethodInsn(Opcodes.INVOKESTATIC, STRING_CLASS_NAME, "valueOf", "(D)Ljava/lang/String;", false); break; default: super.visitVarInsn(Opcodes.ALOAD, parm.register); if (parm.signature.startsWith("[")) { char arrayElemTypeChar = parm.signature.charAt(1); if ((arrayElemTypeChar == 'L') || (arrayElemTypeChar == '[')) { super.visitMethodInsn(Opcodes.INVOKESTATIC, ARRAYS_CLASS_NAME, "toString", "([Ljava/lang/Object;)Ljava/lang/String;", false); } else { super.visitMethodInsn(Opcodes.INVOKESTATIC, ARRAYS_CLASS_NAME, "toString", "([" + arrayElemTypeChar + ")Ljava/lang/String;", false); } } else { super.visitMethodInsn(Opcodes.INVOKESTATIC, STRING_CLASS_NAME, "valueOf", "(Ljava/lang/Object;)Ljava/lang/String;", false); } break; } if (maxParmSize > 0) { super.visitInsn(Opcodes.DUP); super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, STRING_CLASS_NAME, "length", "()I", false); if (maxParmSize <= 127) { super.visitIntInsn(Opcodes.BIPUSH, maxParmSize); } else { super.visitLdcInsn(maxParmSize); } Label falseLabel = new Label(); super.visitJumpInsn(Opcodes.IF_ICMPLE, falseLabel); super.visitIntInsn(Opcodes.BIPUSH, 0); super.visitLdcInsn(maxParmSize); super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, STRING_CLASS_NAME, "substring", "(II)Ljava/lang/String;", false); super.visitLabel(falseLabel); } super.visitMethodInsn(Opcodes.INVOKEINTERFACE, LIST_CLASS_NAME, "add", "(Ljava/lang/Object;)Z", true); super.visitInsn(Opcodes.POP); } } super.visitMethodInsn(Opcodes.INVOKESPECIAL, METHODINFO_CLASS_NAME, CTOR_NAME, "(Ljava/lang/String;Ljava/lang/String;Ljava/util/List;)V", false); //add(methodInfo); super.visitMethodInsn(Opcodes.INVOKEINTERFACE, LIST_CLASS_NAME, "add", "(Ljava/lang/Object;)Z", true); super.visitInsn(Opcodes.POP); }
From source file:com.mebigfatguy.junitflood.jvm.OperandStack.java
License:Apache License
public void performJumpInsn(int opcode, Label label) { switch (opcode) { case Opcodes.IFEQ: case Opcodes.IFNE: case Opcodes.IFLT: case Opcodes.IFGE: case Opcodes.IFGT: case Opcodes.IFLE: case Opcodes.IFNULL: case Opcodes.IFNONNULL: pop();/* w w w. j a va 2 s .c o m*/ break; case Opcodes.IF_ICMPEQ: case Opcodes.IF_ICMPNE: case Opcodes.IF_ICMPLT: case Opcodes.IF_ICMPGE: case Opcodes.IF_ICMPGT: case Opcodes.IF_ICMPLE: case Opcodes.IF_ACMPEQ: case Opcodes.IF_ACMPNE: pop2(); break; case Opcodes.GOTO: //nop break; case Opcodes.JSR: //nop -- a fudge break; } }
From source file:com.nginious.http.xsp.expr.LessOperator.java
License:Apache License
/** * Creates bytecode for evaluating the argument values as integers. The bytecode * is generated using the specified method visitor. * // www . ja v a 2 s.c om * @param visitor the method visitor */ private void compileInt(MethodVisitor visitor) { Label labelFalse = new Label(); Label labelEnd = new Label(); value2.compile(visitor, Type.INT); value1.compile(visitor, Type.INT); visitor.visitJumpInsn(Opcodes.IF_ICMPLE, labelFalse); // True visitor.visitLdcInsn(true); visitor.visitJumpInsn(Opcodes.GOTO, labelEnd); // False visitor.visitLabel(labelFalse); visitor.visitLdcInsn(false); visitor.visitLabel(labelEnd); }
From source file:com.nginious.http.xsp.expr.MoreOperator.java
License:Apache License
/** * Creates bytecode for evaluating the argument values as integers. The bytecode * is generated using the specified method visitor. * //www. j ava2 s. co m * @param visitor the method visitor */ private void compileInt(MethodVisitor visitor) { Label labelFalse = new Label(); Label labelEnd = new Label(); value1.compile(visitor, Type.INT); value2.compile(visitor, Type.INT); visitor.visitJumpInsn(Opcodes.IF_ICMPLE, labelFalse); // True visitor.visitLdcInsn(true); visitor.visitJumpInsn(Opcodes.GOTO, labelEnd); // False visitor.visitLabel(labelFalse); visitor.visitLdcInsn(false); visitor.visitLabel(labelEnd); }
From source file:com.retroduction.carma.transformer.asm.ror.IF_ICMPGT_2_IF_ICMPLE_Transition.java
License:Open Source License
public IF_ICMPGT_2_IF_ICMPLE_Transition() { super(); this.sourceInstruction = Opcodes.IF_ICMPGT; this.targetInstruction = Opcodes.IF_ICMPLE; }
From source file:com.retroduction.carma.transformer.asm.ror.IF_ICMPLE_2_IF_ICMPGT_Transition.java
License:Open Source License
public IF_ICMPLE_2_IF_ICMPGT_Transition() { super(); this.sourceInstruction = Opcodes.IF_ICMPLE; this.targetInstruction = Opcodes.IF_ICMPGT; }
From source file:com.trigersoft.jaque.expression.ExpressionMethodVisitor.java
License:Apache License
@Override public void visitJumpInsn(int opcode, Label label) { int etype;/* w w w .j a v a 2 s . c om*/ switch (opcode) { case Opcodes.GOTO: go(label); return; default: case Opcodes.JSR: throw notLambda(opcode); case Opcodes.IFEQ: etype = ExpressionType.NotEqual; // Equal pushZeroConstantOrReduce(); break; case Opcodes.IFNE: etype = ExpressionType.Equal; // NotEqual pushZeroConstantOrReduce(); break; case Opcodes.IFLT: etype = ExpressionType.GreaterThanOrEqual; // LessThan pushZeroConstantOrReduce(); break; case Opcodes.IFGE: etype = ExpressionType.LessThan; // GreaterThanOrEqual pushZeroConstantOrReduce(); break; case Opcodes.IFGT: etype = ExpressionType.LessThanOrEqual; // GreaterThan pushZeroConstantOrReduce(); break; case Opcodes.IFLE: etype = ExpressionType.GreaterThan; // LessThanOrEqual pushZeroConstantOrReduce(); break; case Opcodes.IF_ICMPEQ: case Opcodes.IF_ACMPEQ: // ?? etype = ExpressionType.NotEqual; // Equal break; case Opcodes.IF_ICMPNE: case Opcodes.IF_ACMPNE: // ?? etype = ExpressionType.Equal; // NotEqual break; case Opcodes.IF_ICMPLT: etype = ExpressionType.GreaterThanOrEqual; // LessThan break; case Opcodes.IF_ICMPGE: etype = ExpressionType.LessThan; // GreaterThanOrEqual break; case Opcodes.IF_ICMPGT: etype = ExpressionType.LessThanOrEqual; // GreaterThan break; case Opcodes.IF_ICMPLE: etype = ExpressionType.GreaterThan; // LessThanOrEqual break; case Opcodes.IFNULL: case Opcodes.IFNONNULL: Expression e = Expression.isNull(_exprStack.pop()); if (opcode == Opcodes.IFNULL) // IFNONNULL e = Expression.logicalNot(e); branch(label, e); return; } Expression second = _exprStack.pop(); Expression first = _exprStack.pop(); Expression e = Expression.binary(etype, first, second); branch(label, e); }
From source file:de.codesourcery.asm.util.ASMUtil.java
License:Apache License
/** * Check whether an instruction is a conditional branch operation. * //w ww . ja v a2 s .c o m * @param node * @return */ public static boolean isConditionalJump(AbstractInsnNode node) { if (node.getType() == AbstractInsnNode.JUMP_INSN) { switch (node.getOpcode()) { case Opcodes.IFEQ: case Opcodes.IFNE: case Opcodes.IFLT: case Opcodes.IFGE: case Opcodes.IFGT: case Opcodes.IFLE: case Opcodes.IF_ICMPEQ: case Opcodes.IF_ICMPNE: case Opcodes.IF_ICMPLT: case Opcodes.IF_ICMPGE: case Opcodes.IF_ICMPGT: case Opcodes.IF_ICMPLE: case Opcodes.IF_ACMPEQ: case Opcodes.IF_ACMPNE: case Opcodes.IFNULL: case Opcodes.IFNONNULL: return true; } } return false; }
From source file:de.scoopgmbh.copper.instrument.BuildStackInfoAdapter.java
License:Apache License
@Override public void visitJumpInsn(int arg0, Label arg1) { savePreviousFrame();/*from ww w .ja v a2 s.c o m*/ switch (arg0) { case Opcodes.IF_ACMPEQ: case Opcodes.IF_ACMPNE: case Opcodes.IF_ICMPEQ: case Opcodes.IF_ICMPGE: case Opcodes.IF_ICMPGT: case Opcodes.IF_ICMPLE: case Opcodes.IF_ICMPLT: case Opcodes.IF_ICMPNE: currentFrame.popStack(); case Opcodes.IFEQ: case Opcodes.IFGE: case Opcodes.IFGT: case Opcodes.IFLE: case Opcodes.IFLT: case Opcodes.IFNE: case Opcodes.IFNONNULL: case Opcodes.IFNULL: currentFrame.popStack(); case Opcodes.GOTO: forwardFrames.put(arg1, new StackInfo(currentFrame)); break; case Opcodes.JSR: currentFrame.pushStack(retAddressType); forwardFrames.put(arg1, new StackInfo(currentFrame)); break; default: logger.debug("Unhandled: "); } if (logger.isDebugEnabled()) logger.debug("jumpInsn " + getOpCode(arg0) + " " + arg1); delegate.visitJumpInsn(arg0, arg1); }
From source file:de.tuberlin.uebb.jbop.optimizer.controlflow.ConstantIfInliner.java
License:Open Source License
private boolean evalTwoOpValue(final Number op1, final Number op2, final int opcode) { switch (opcode) { case Opcodes.IF_ICMPEQ: return op1.intValue() == op2.intValue(); case Opcodes.IF_ICMPNE: return op1.intValue() != op2.intValue(); case Opcodes.IF_ICMPLT: return op1.intValue() < op2.intValue(); case Opcodes.IF_ICMPGE: return op1.intValue() >= op2.intValue(); case Opcodes.IF_ICMPGT: return op1.intValue() > op2.intValue(); case Opcodes.IF_ICMPLE: return op1.intValue() <= op2.intValue(); case Opcodes.IF_ACMPEQ: return op1 == op2; case Opcodes.IF_ACMPNE: return op1 != op2; default:/* www . j a v a 2 s . c om*/ return false; } }