Java Code Examples for org.objectweb.asm.Opcodes#IFEQ

The following examples show how to use org.objectweb.asm.Opcodes#IFEQ . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LayerCustomHeadVisitor.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
    if (checkTargetInsn(opcode, owner, name, desc)) {
    	markPatchedSuccessfully();
        Label endLabel = new Label();
        Label skipLabel = new Label();
        super.visitVarInsn(Opcodes.ALOAD, 1); //load entity
        super.visitMethodInsn(Opcodes.INVOKESTATIC, ARMOR_HOOKS_OWNER, ARMOR_HOOKS_METHOD_NAME, ARMOR_HOOKS_SIGNATURE, false);
        super.visitJumpInsn(Opcodes.IFEQ, skipLabel);
        for (int i = 0; i < 4; i++) super.visitInsn(Opcodes.POP); //pop this, entity, stack, transformType
        super.visitJumpInsn(Opcodes.GOTO, endLabel);
        super.visitLabel(skipLabel);
        super.visitMethodInsn(opcode, owner, name, desc, itf);
        super.visitLabel(endLabel);
        return;
    }
    super.visitMethodInsn(opcode, owner, name, desc, itf);
}
 
Example 2
Source File: NodeUtils.java    From obfuscator with MIT License 6 votes vote down vote up
public static int getInvertedJump(int opcode) {
    int i = -1;

    switch (opcode) {
        case Opcodes.IFEQ:
            i = Opcodes.IFNE;
            break;
        case Opcodes.IFNE:
            i = Opcodes.IFEQ;
            break;
        case Opcodes.IF_ACMPEQ:
            i = Opcodes.IF_ACMPNE;
            break;
        case Opcodes.IF_ACMPNE:
            i = Opcodes.IF_ACMPEQ;
            break;
    }
    return i;
}
 
Example 3
Source File: ConditionalJumpStmt.java    From maple-ir with GNU General Public License v3.0 6 votes vote down vote up
public static ComparisonType getType(int opcode) {
	switch (opcode) {
		case Opcodes.IF_ACMPEQ:
		case Opcodes.IF_ICMPEQ:
		case Opcodes.IFEQ:
			return EQ;
		case Opcodes.IF_ACMPNE:
		case Opcodes.IF_ICMPNE:
		case Opcodes.IFNE:
			return NE;
		case Opcodes.IF_ICMPGT:
		case Opcodes.IFGT:
			return GT;
		case Opcodes.IF_ICMPGE:
		case Opcodes.IFGE:
			return GE;
		case Opcodes.IF_ICMPLT:
		case Opcodes.IFLT:
			return LT;
		case Opcodes.IF_ICMPLE:
		case Opcodes.IFLE:
			return LE;
		default:
			throw new IllegalArgumentException(Printer.OPCODES[opcode]);
	}
}
 
Example 4
Source File: StackHelper.java    From zelixkiller with GNU General Public License v3.0 6 votes vote down vote up
public InsnValue compareConstant(AbstractInsnNode insn, InsnValue value) {
	if (value.getValue() == null) {
		return InsnValue.INT_VALUE;
	}
	int i = ((Number)value.getValue()).intValue();
	switch (insn.getOpcode()) {
	case Opcodes.IFEQ:
		return InsnValue.intValue(i == 0);
	case Opcodes.IFNE:
		return InsnValue.intValue(i != 0);
	case Opcodes.IFLE:
		return InsnValue.intValue(i <= 0);
	case Opcodes.IFLT:
		return InsnValue.intValue(i < 0);
	case Opcodes.IFGE:
		return InsnValue.intValue(i >= 0);
	case Opcodes.IFGT:
		return InsnValue.intValue(i > 0);
	}

	return null;
}
 
Example 5
Source File: NetworkManagerVisitor.java    From ForgeWurst with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void visitJumpInsn(int opcode, Label label)
{
	super.visitJumpInsn(opcode, label);
	
	if(done || opcode != Opcodes.IFEQ)
		return;
	
	System.out.println(
		"NetworkManagerVisitor.ChannelRead0Visitor.visitJumpInsn()");
	
	mv.visitVarInsn(Opcodes.ALOAD, 2);
	mv.visitMethodInsn(Opcodes.INVOKESTATIC,
		"net/wurstclient/forge/compatibility/WEventFactory",
		"onReceivePacket", "(Lnet/minecraft/network/Packet;)Z", false);
	Label l1 = new Label();
	mv.visitJumpInsn(Opcodes.IFNE, l1);
	mv.visitInsn(Opcodes.RETURN);
	mv.visitLabel(l1);
	mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
	
	done = true;
}
 
Example 6
Source File: RuntimeInstrument.java    From dacapobench with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unused")
protected void onMethodEnter() {
	if (done) return;

	overridden = true;
	Label start  = new Label();
	Label normal = new Label();
	super.visitLabel(start);
	super.visitFieldInsn(Opcodes.GETSTATIC, CONFIGURATION, CONFIGURATION_FIELD_NAME, Type.INT_TYPE.getDescriptor());
	super.visitInsn(Opcodes.DUP);
	super.visitJumpInsn(Opcodes.IFEQ, normal);
	super.visitInsn(Opcodes.IRETURN);
	super.visitLabel(normal);
	super.visitInsn(Opcodes.POP);
	Label end = new Label();
	super.visitJumpInsn(Opcodes.GOTO, end);
	super.visitLabel(end);
	super.visitTryCatchBlock(start, normal, end, Type.getType(Throwable.class).getDescriptor());
}
 
Example 7
Source File: RemoveConditionalMutator.java    From pitest with Apache License 2.0 6 votes vote down vote up
private boolean canMutate(final int opcode) {
  switch (opcode) {
  case Opcodes.IFLE:
  case Opcodes.IFGE:
  case Opcodes.IFGT:
  case Opcodes.IFLT:
  case Opcodes.IF_ICMPGE:
  case Opcodes.IF_ICMPGT:
  case Opcodes.IF_ICMPLE:
  case Opcodes.IF_ICMPLT:
    return (RemoveConditionalMutator.this.kind == Choice.ORDER);
  case Opcodes.IFEQ:
  case Opcodes.IFNE:
  case Opcodes.IFNONNULL:
  case Opcodes.IFNULL:
  case Opcodes.IF_ICMPNE:
  case Opcodes.IF_ICMPEQ:
  case Opcodes.IF_ACMPEQ:
  case Opcodes.IF_ACMPNE:
    return (RemoveConditionalMutator.this.kind == Choice.EQUAL);
  default:
    return false;
  }
}
 
Example 8
Source File: ReturnValuesMutator.java    From pitest with Apache License 2.0 6 votes vote down vote up
/**
 * Mutates a primitive float return (<code>Opcode.FRETURN</code>). The
 * strategy used was translated from jumble BCEL code. The following is
 * complicated by the problem of <tt>NaN</tt>s. By default the new value is
 * <code>-(x + 1)</code>, but this doesn't work for <tt>NaN</tt>s. But for a
 * <tt>NaN</tt> <code>x != x</code> is true, and we use this to detect them.
 *
 * @see #mutatePrimitiveDoubleReturn()
 */
private void mutatePrimitiveFloatReturn() {
  if (shouldMutate("primitive float", "(x != NaN)? -(x + 1) : -1 ")) {
    final Label label = new Label();

    super.visitInsn(Opcodes.DUP);
    super.visitInsn(Opcodes.DUP);
    super.visitInsn(Opcodes.FCMPG);
    super.visitJumpInsn(Opcodes.IFEQ, label);

    super.visitInsn(Opcodes.POP);
    super.visitInsn(Opcodes.FCONST_0);

    // the following code is executed in NaN case, too
    super.visitLabel(label);
    super.visitInsn(Opcodes.FCONST_1);
    super.visitInsn(Opcodes.FADD);
    super.visitInsn(Opcodes.FNEG);
    super.visitInsn(Opcodes.FRETURN);
  }
}
 
Example 9
Source File: ReturnValuesMutator.java    From pitest with Apache License 2.0 6 votes vote down vote up
/**
 * Mutates a primitive double return (<code>Opcode.DRETURN</code>). The
 * strategy used was translated from jumble BCEL code. The following is
 * complicated by the problem of <tt>NaN</tt>s. By default the new value is
 * <code>-(x + 1)</code>, but this doesn't work for <tt>NaN</tt>s. But for a
 * <tt>NaN</tt> <code>x != x</code> is true, and we use this to detect them.
 *
 * @see #mutatePrimitiveFloatReturn()
 */
private void mutatePrimitiveDoubleReturn() {
  if (shouldMutate("primitive double", "(x != NaN)? -(x + 1) : -1 ")) {
    final Label label = new Label();

    super.visitInsn(Opcodes.DUP2);
    super.visitInsn(Opcodes.DUP2);
    super.visitInsn(Opcodes.DCMPG);
    super.visitJumpInsn(Opcodes.IFEQ, label);

    super.visitInsn(Opcodes.POP2);
    super.visitInsn(Opcodes.DCONST_0);

    // the following code is executed in NaN case, too
    super.visitLabel(label);
    super.visitInsn(Opcodes.DCONST_1);
    super.visitInsn(Opcodes.DADD);
    super.visitInsn(Opcodes.DNEG);
    super.visitInsn(Opcodes.DRETURN);
  }
}
 
Example 10
Source File: BuildStackInfoAdapter.java    From copper-engine with Apache License 2.0 5 votes vote down vote up
@Override
public void visitJumpInsn(int arg0, Label arg1) {
    savePreviousFrame();
    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);
}
 
Example 11
Source File: BytecodeTypeInference.java    From bazel with Apache License 2.0 5 votes vote down vote up
@Override
public void visitJumpInsn(int opcode, Label label) {
  switch (opcode) {
    case Opcodes.IFEQ:
    case Opcodes.IFNE:
    case Opcodes.IFLT:
    case Opcodes.IFGE:
    case Opcodes.IFGT:
    case Opcodes.IFLE:
      pop();
      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:
      pop(2);
      break;
    case Opcodes.GOTO:
      break;
    case Opcodes.JSR:
      throw new RuntimeException("The JSR instruction is not supported.");
    case Opcodes.IFNULL:
    case Opcodes.IFNONNULL:
      pop(1);
      break;
    default:
      throw new RuntimeException("Unhandled opcode " + opcode);
  }
  super.visitJumpInsn(opcode, label);
}
 
Example 12
Source File: InstructionAdapter.java    From JReFrameworker with MIT License 4 votes vote down vote up
@Override
public void visitJumpInsn(final int opcode, final Label label) {
  switch (opcode) {
    case Opcodes.IFEQ:
      ifeq(label);
      break;
    case Opcodes.IFNE:
      ifne(label);
      break;
    case Opcodes.IFLT:
      iflt(label);
      break;
    case Opcodes.IFGE:
      ifge(label);
      break;
    case Opcodes.IFGT:
      ifgt(label);
      break;
    case Opcodes.IFLE:
      ifle(label);
      break;
    case Opcodes.IF_ICMPEQ:
      ificmpeq(label);
      break;
    case Opcodes.IF_ICMPNE:
      ificmpne(label);
      break;
    case Opcodes.IF_ICMPLT:
      ificmplt(label);
      break;
    case Opcodes.IF_ICMPGE:
      ificmpge(label);
      break;
    case Opcodes.IF_ICMPGT:
      ificmpgt(label);
      break;
    case Opcodes.IF_ICMPLE:
      ificmple(label);
      break;
    case Opcodes.IF_ACMPEQ:
      ifacmpeq(label);
      break;
    case Opcodes.IF_ACMPNE:
      ifacmpne(label);
      break;
    case Opcodes.GOTO:
      goTo(label);
      break;
    case Opcodes.JSR:
      jsr(label);
      break;
    case Opcodes.IFNULL:
      ifnull(label);
      break;
    case Opcodes.IFNONNULL:
      ifnonnull(label);
      break;
    default:
      throw new IllegalArgumentException();
  }
}
 
Example 13
Source File: InstructionAdapter.java    From JReFrameworker with MIT License 4 votes vote down vote up
@Override
public void visitJumpInsn(final int opcode, final Label label) {
  switch (opcode) {
    case Opcodes.IFEQ:
      ifeq(label);
      break;
    case Opcodes.IFNE:
      ifne(label);
      break;
    case Opcodes.IFLT:
      iflt(label);
      break;
    case Opcodes.IFGE:
      ifge(label);
      break;
    case Opcodes.IFGT:
      ifgt(label);
      break;
    case Opcodes.IFLE:
      ifle(label);
      break;
    case Opcodes.IF_ICMPEQ:
      ificmpeq(label);
      break;
    case Opcodes.IF_ICMPNE:
      ificmpne(label);
      break;
    case Opcodes.IF_ICMPLT:
      ificmplt(label);
      break;
    case Opcodes.IF_ICMPGE:
      ificmpge(label);
      break;
    case Opcodes.IF_ICMPGT:
      ificmpgt(label);
      break;
    case Opcodes.IF_ICMPLE:
      ificmple(label);
      break;
    case Opcodes.IF_ACMPEQ:
      ifacmpeq(label);
      break;
    case Opcodes.IF_ACMPNE:
      ifacmpne(label);
      break;
    case Opcodes.GOTO:
      goTo(label);
      break;
    case Opcodes.JSR:
      jsr(label);
      break;
    case Opcodes.IFNULL:
      ifnull(label);
      break;
    case Opcodes.IFNONNULL:
      ifnonnull(label);
      break;
    default:
      throw new IllegalArgumentException();
  }
}
 
Example 14
Source File: Jump.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void appendInstruction(StringBuilder b, List<Instruction> instructions) {
    b.append("    ");
    
    switch(opcode) {
        case Opcodes.IFEQ:
            b.append("if(POP_INT() == 0) /* IFEQ */ ");
            break;
        case Opcodes.IFNE:
            b.append("if(POP_INT() != 0) /* IFNE */ ");
            break;
        case Opcodes.IFLT:
            b.append("if(POP_INT() < 0) /* IFLT */ ");
            break;
        case Opcodes.IFGE:
            b.append("if(POP_INT() >= 0) /* IFGE */ ");
            break;
        case Opcodes.IFGT:
            b.append("if(POP_INT() > 0) /* IFGT */ ");
            break;
        case Opcodes.IFLE:
            b.append("if(POP_INT() <= 0) /* IFLE */ ");
            break;
        case Opcodes.IF_ICMPEQ:
            b.append("SP-=2; if((*SP).data.i == SP[1].data.i) /* IF_ICMPEQ */ ");
            break;
        case Opcodes.IF_ICMPNE:
            b.append("SP-=2; if((*SP).data.i != SP[1].data.i) /* IF_ICMPNE */ ");
            break;
        case Opcodes.IF_ICMPLT:
            b.append("SP-=2; if((*SP).data.i < SP[1].data.i) /* IF_ICMPLT */ ");
            break;
        case Opcodes.IF_ICMPGE:
            b.append("SP-=2; if((*SP).data.i >= SP[1].data.i) /* IF_ICMPGE */ ");
            break;
        case Opcodes.IF_ICMPGT:
            b.append("SP-=2; if((*SP).data.i > SP[1].data.i) /* IF_ICMPGT */ ");
            break;
        case Opcodes.IF_ICMPLE:
            b.append("SP-=2; if((*SP).data.i <= SP[1].data.i) /* IF_ICMPLE */ ");
            break;
        case Opcodes.IF_ACMPEQ:
            b.append("SP-=2; if((*SP).data.o == SP[1].data.o) /* IF_ACMPEQ */ ");
            break;
        case Opcodes.IF_ACMPNE:
            b.append("SP-=2; if((*SP).data.o != SP[1].data.o) /* IF_ACMPNE */ ");
            break;
        case Opcodes.GOTO:
            // this space intentionally left blank
            break;
        case Opcodes.JSR:
            b.append("/* JSR TODO */");
            /*b.append("PUSH_")
            b.append("goto label_");
            b.append(label.toString());
            b.append(";\n");
            b.append("JSR_RETURN_LABEL_");
            b.append(jsrCounter);
            b.append(":");
            jsrCounter++;*/
            return;
        case Opcodes.IFNULL:
            b.append("if(POP_OBJ() == JAVA_NULL) /* IFNULL */ ");
            break;
        case Opcodes.IFNONNULL:
            b.append("if(POP_OBJ() != JAVA_NULL) /* IFNONNULL */ ");
            break;
    }
   
    if(TryCatch.isTryCatchInMethod()) {
        b.append("JUMP_TO(label_");
        b.append(label.toString());
        b.append(", ");
        b.append(LabelInstruction.getLabelCatchDepth(label, instructions));
        b.append(");\n");
    } else {
        b.append("goto label_");
        b.append(label.toString());
        b.append(";\n");
    }
}
 
Example 15
Source File: UselessArithmeticTransformer.java    From deobfuscator with Apache License 2.0 4 votes vote down vote up
private List<AbstractInsnNode> getPossibleInsns(AbstractInsnNode ain)
{
	List<AbstractInsnNode> instrs = new ArrayList<>();
	while(ain != null)
	{
		if(ain instanceof LineNumberNode || ain instanceof FrameNode)
		{
			ain = ain.getNext();
			continue;
		}
		instrs.add(ain);
		if(instrs.size() >= 23)
			break;
		ain = ain.getNext();
	}
	if(instrs.size() == 23 && instrs.get(0).getOpcode() == Opcodes.ILOAD
		&& instrs.get(1).getOpcode() == Opcodes.ICONST_1
		&& instrs.get(2).getOpcode() == Opcodes.ISUB
		&& instrs.get(3).getOpcode() == Opcodes.ISTORE)
	{
		int var1 = ((VarInsnNode)instrs.get(0)).var;
		int var2 = ((VarInsnNode)instrs.get(3)).var;
		if(instrs.get(4).getOpcode() == Opcodes.ILOAD
			&& ((VarInsnNode)instrs.get(4)).var == var1
			&& instrs.get(5).getOpcode() == Opcodes.ILOAD
			&& ((VarInsnNode)instrs.get(5)).var == var2
			&& instrs.get(6).getOpcode() == Opcodes.IMUL
			&& instrs.get(7).getOpcode() == Opcodes.ISTORE
			&& ((VarInsnNode)instrs.get(7)).var == var2
			&& instrs.get(8).getOpcode() == Opcodes.ILOAD
			&& ((VarInsnNode)instrs.get(8)).var == var2
			&& instrs.get(9).getOpcode() == Opcodes.ICONST_2
			&& instrs.get(10).getOpcode() == Opcodes.IREM
			&& instrs.get(11).getOpcode() == Opcodes.ISTORE
			&& ((VarInsnNode)instrs.get(11)).var == var2
			&& instrs.get(12).getOpcode() == Opcodes.ILOAD
			&& ((VarInsnNode)instrs.get(12)).var == var2
			&& instrs.get(13).getOpcode() == Opcodes.I2L
			&& instrs.get(14).getOpcode() == Opcodes.ICONST_0
			&& instrs.get(15).getOpcode() == Opcodes.I2L
			&& instrs.get(16).getOpcode() == Opcodes.LCMP
			&& instrs.get(17).getOpcode() == Opcodes.ICONST_1
			&& instrs.get(18).getOpcode() == Opcodes.IXOR
			&& instrs.get(19).getOpcode() == Opcodes.ICONST_1
			&& instrs.get(20).getOpcode() == Opcodes.IAND
			&& instrs.get(21).getOpcode() == Opcodes.IFEQ
			&& instrs.get(22).getOpcode() == Opcodes.IINC)
			return instrs;
	}
	return null;
}
 
Example 16
Source File: JVMImpl.java    From serianalyzer with GNU General Public License v3.0 4 votes vote down vote up
/**
 * @param opcode
 * @param label
 * @param s
 * @return
 */
static boolean handleJVMJump ( int opcode, Label label, JVMStackState s ) {
    boolean tainted;
    switch ( opcode ) {
    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:
        BaseType o1 = s.pop();
        BaseType o2 = s.pop();
        tainted = ! ( o1 != null ) || ! ( o2 != null ) || o1.isTainted() || o2.isTainted();
        break;
    case Opcodes.IFEQ:
    case Opcodes.IFNE:
    case Opcodes.IFLT:
    case Opcodes.IFGE:
    case Opcodes.IFGT:
    case Opcodes.IFLE:
    case Opcodes.IFNULL:
    case Opcodes.IFNONNULL:
        BaseType c = s.pop();
        tainted = ( c == null || c.isTainted() );
        break;

    case Opcodes.JSR:
        s.push(new BasicConstant(Type.INT_TYPE, label));
        tainted = false;
        break;
    case Opcodes.GOTO:
        tainted = false;
        break;
    default:
        log.warn("Unsupported opcode " + opcode); //$NON-NLS-1$
        tainted = true;
    }
    return tainted;
}
 
Example 17
Source File: InstructionAdapter.java    From JByteMod-Beta with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visitJumpInsn(final int opcode, final Label label) {
  switch (opcode) {
    case Opcodes.IFEQ:
      ifeq(label);
      break;
    case Opcodes.IFNE:
      ifne(label);
      break;
    case Opcodes.IFLT:
      iflt(label);
      break;
    case Opcodes.IFGE:
      ifge(label);
      break;
    case Opcodes.IFGT:
      ifgt(label);
      break;
    case Opcodes.IFLE:
      ifle(label);
      break;
    case Opcodes.IF_ICMPEQ:
      ificmpeq(label);
      break;
    case Opcodes.IF_ICMPNE:
      ificmpne(label);
      break;
    case Opcodes.IF_ICMPLT:
      ificmplt(label);
      break;
    case Opcodes.IF_ICMPGE:
      ificmpge(label);
      break;
    case Opcodes.IF_ICMPGT:
      ificmpgt(label);
      break;
    case Opcodes.IF_ICMPLE:
      ificmple(label);
      break;
    case Opcodes.IF_ACMPEQ:
      ifacmpeq(label);
      break;
    case Opcodes.IF_ACMPNE:
      ifacmpne(label);
      break;
    case Opcodes.GOTO:
      goTo(label);
      break;
    case Opcodes.JSR:
      jsr(label);
      break;
    case Opcodes.IFNULL:
      ifnull(label);
      break;
    case Opcodes.IFNONNULL:
      ifnonnull(label);
      break;
    default:
      throw new IllegalArgumentException();
  }
}
 
Example 18
Source File: NodeUtils.java    From obfuscator with MIT License 4 votes vote down vote up
public static boolean isConditionalGoto(AbstractInsnNode abstractInsnNode) {
    return abstractInsnNode.getOpcode() >= Opcodes.IFEQ && abstractInsnNode.getOpcode() <= Opcodes.IF_ACMPNE;
}
 
Example 19
Source File: InstructionAdapter.java    From Concurnas with MIT License 4 votes vote down vote up
@Override
public void visitJumpInsn(final int opcode, final Label label) {
  switch (opcode) {
    case Opcodes.IFEQ:
      ifeq(label);
      break;
    case Opcodes.IFNE:
      ifne(label);
      break;
    case Opcodes.IFLT:
      iflt(label);
      break;
    case Opcodes.IFGE:
      ifge(label);
      break;
    case Opcodes.IFGT:
      ifgt(label);
      break;
    case Opcodes.IFLE:
      ifle(label);
      break;
    case Opcodes.IF_ICMPEQ:
      ificmpeq(label);
      break;
    case Opcodes.IF_ICMPNE:
      ificmpne(label);
      break;
    case Opcodes.IF_ICMPLT:
      ificmplt(label);
      break;
    case Opcodes.IF_ICMPGE:
      ificmpge(label);
      break;
    case Opcodes.IF_ICMPGT:
      ificmpgt(label);
      break;
    case Opcodes.IF_ICMPLE:
      ificmple(label);
      break;
    case Opcodes.IF_ACMPEQ:
      ifacmpeq(label);
      break;
    case Opcodes.IF_ACMPNE:
      ifacmpne(label);
      break;
    case Opcodes.GOTO:
      goTo(label);
      break;
    case Opcodes.JSR:
      jsr(label);
      break;
    case Opcodes.IFNULL:
      ifnull(label);
      break;
    case Opcodes.IFNONNULL:
      ifnonnull(label);
      break;
    default:
      throw new IllegalArgumentException();
  }
}
 
Example 20
Source File: EqualsMethod.java    From byte-buddy with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a conditional return that returns on an {@code int} value of not {@code 0}.
 *
 * @return A conditional return that returns on an {@code int} value of not {@code 0}.
 */
protected static ConditionalReturn onNonZeroInteger() {
    return new ConditionalReturn(Opcodes.IFEQ);
}