org.objectweb.asm.Opcodes# IF_ICMPLT 源码实例Demo

下面列出了org.objectweb.asm.Opcodes# IF_ICMPLT 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: maple-ir   文件: ConditionalJumpStmt.java

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]);
	}
}
 

public static RelationalOperationBS createRelationOperation(RelationalOperation.Operator operator) {
    int jumpOpcode;
    switch (operator) {
        case EQUAL:
            jumpOpcode = Opcodes.IF_ICMPNE;
            break;
        case DIFFERENT:
            jumpOpcode = Opcodes.IF_ICMPEQ;
            break;
        case LESS:
            jumpOpcode = Opcodes.IF_ICMPGE;
            break;
        case LESSEQ:
            jumpOpcode = Opcodes.IF_ICMPGT;
            break;
        case MORE:
            jumpOpcode = Opcodes.IF_ICMPLE;
            break;
        case MOREEQ:
            jumpOpcode = Opcodes.IF_ICMPLT;
            break;
        default:
            throw new UnsupportedOperationException(operator.name());
    }
    return new RelationalOperationBS(jumpOpcode);
}
 
源代码3 项目: pitest   文件: RemoveConditionalMutator.java

private void emptyStack(final int opcode) {
  switch (opcode) {
  // EQUAL
  case Opcodes.IF_ICMPNE:
  case Opcodes.IF_ICMPEQ:
  case Opcodes.IF_ACMPEQ:
  case Opcodes.IF_ACMPNE:
    // ORDER
  case Opcodes.IF_ICMPGE:
  case Opcodes.IF_ICMPGT:
  case Opcodes.IF_ICMPLE:
  case Opcodes.IF_ICMPLT:
    super.visitInsn(Opcodes.POP2);
    break;
  default:
    super.visitInsn(Opcodes.POP);
  }

}
 
源代码4 项目: pitest   文件: RemoveConditionalMutator.java

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;
  }
}
 
源代码5 项目: javaide   文件: ApiDetector.java

@Override
protected void add(@NonNull AbstractInsnNode from, @NonNull AbstractInsnNode to) {
    if (from.getType() == AbstractInsnNode.JUMP_INSN &&
            from.getPrevious() != null &&
            from.getPrevious().getType() == AbstractInsnNode.INT_INSN) {
        IntInsnNode intNode = (IntInsnNode) from.getPrevious();
        if (intNode.getPrevious() != null && isSdkVersionLookup(intNode.getPrevious())) {
            JumpInsnNode jumpNode = (JumpInsnNode) from;
            int api = intNode.operand;
            boolean isJumpEdge = to == jumpNode.label;
            boolean includeEdge;
            switch (from.getOpcode()) {
                case Opcodes.IF_ICMPNE:
                    includeEdge = api < mRequiredApi || isJumpEdge;
                    break;
                case Opcodes.IF_ICMPLE:
                    includeEdge = api < mRequiredApi - 1 || isJumpEdge;
                    break;
                case Opcodes.IF_ICMPLT:
                    includeEdge = api < mRequiredApi || isJumpEdge;
                    break;

                case Opcodes.IF_ICMPGE:
                    includeEdge = api < mRequiredApi || !isJumpEdge;
                    break;
                case Opcodes.IF_ICMPGT:
                    includeEdge = api < mRequiredApi - 1 || !isJumpEdge;
                    break;
                default:
                    // unexpected comparison for int API level
                    includeEdge = true;
            }
            if (!includeEdge) {
                return;
            }
        }
    }

    super.add(from, to);
}
 
源代码6 项目: bazel   文件: BytecodeTypeInference.java

@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);
}
 

@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);
}
 
源代码8 项目: Concurnas   文件: InstructionAdapter.java

@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();
  }
}
 
源代码9 项目: Concurnas   文件: GeneratorAdapter.java

/**
 * Generates the instructions to jump to a label based on the comparison of the top two stack
 * values.
 *
 * @param type the type of the top two stack values.
 * @param mode how these values must be compared. One of EQ, NE, LT, GE, GT, LE.
 * @param label where to jump if the comparison result is {@literal true}.
 */
public void ifCmp(final Type type, final int mode, final Label label) {
  switch (type.getSort()) {
    case Type.LONG:
      mv.visitInsn(Opcodes.LCMP);
      break;
    case Type.DOUBLE:
      mv.visitInsn(mode == GE || mode == GT ? Opcodes.DCMPL : Opcodes.DCMPG);
      break;
    case Type.FLOAT:
      mv.visitInsn(mode == GE || mode == GT ? Opcodes.FCMPL : Opcodes.FCMPG);
      break;
    case Type.ARRAY:
    case Type.OBJECT:
      if (mode == EQ) {
        mv.visitJumpInsn(Opcodes.IF_ACMPEQ, label);
        return;
      } else if (mode == NE) {
        mv.visitJumpInsn(Opcodes.IF_ACMPNE, label);
        return;
      } else {
        throw new IllegalArgumentException("Bad comparison for type " + type);
      }
    default:
      int intOp = -1;
      switch (mode) {
        case EQ:
          intOp = Opcodes.IF_ICMPEQ;
          break;
        case NE:
          intOp = Opcodes.IF_ICMPNE;
          break;
        case GE:
          intOp = Opcodes.IF_ICMPGE;
          break;
        case LT:
          intOp = Opcodes.IF_ICMPLT;
          break;
        case LE:
          intOp = Opcodes.IF_ICMPLE;
          break;
        case GT:
          intOp = Opcodes.IF_ICMPGT;
          break;
        default:
          throw new IllegalArgumentException("Bad comparison mode " + mode);
      }
      mv.visitJumpInsn(intOp, label);
      return;
  }
  mv.visitJumpInsn(mode, label);
}
 
源代码10 项目: zelixkiller   文件: StackHelper.java

public InsnValue compareConstants(AbstractInsnNode insn, InsnValue value1, InsnValue value2) {
	Object o = value1.getValue(), oo = value2.getValue();
	if (o == null || oo == null) {
		// Can't compare since the values haven't been resolved.
		return InsnValue.INT_VALUE;
	}
	int v = 0;
	switch (insn.getOpcode()) {
	case Opcodes.LCMP:
		long l1 = (long) o, l2 = (long) oo;
		v = (l1 == l2) ? 0 : (l2 < l1) ? 1 : -1;
		break;
	case Opcodes.FCMPL:
	case Opcodes.FCMPG:
		float f1 = (float) o, f2 = (float) oo;
		if (f1 == Float.NaN || f2 == Float.NaN) {
			v = insn.getOpcode() == Opcodes.FCMPG ? -1 : 1;
		} else {
			v = (f1 == f2) ? 0 : (f2 < f1) ? 1 : -1;
		}
		break;
	case Opcodes.DCMPL:
	case Opcodes.DCMPG:
		double d1 = (float) o, d2 = (double) oo;
		if (d1 == Float.NaN || d2 == Float.NaN) {
			v = insn.getOpcode() == Opcodes.DCMPG ? -1 : 1;
		} else {
			v = (d1 == d2) ? 0 : (d2 < d1) ? 1 : -1;
		}
		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:
		int i1 = (int) o, i2 = (int) oo;
		switch (insn.getOpcode()) {
		case Opcodes.IF_ICMPEQ:
			v = i2 == i1 ? 1 : 0;
			break;
		case Opcodes.IF_ICMPNE:
			v = i2 != i1 ? 1 : 0;
			break;
		case Opcodes.IF_ICMPLT:
			v = i2 < i1 ? 1 : 0;
			break;
		case Opcodes.IF_ICMPLE:
			v = i2 <= i1 ? 1 : 0;
			break;
		case Opcodes.IF_ICMPGE:
			v = i2 >= i1 ? 1 : 0;
			break;
		case Opcodes.IF_ICMPGT:
			v = i2 > i1 ? 1 : 0;
			break;
		}
		break;
	case Opcodes.IF_ACMPEQ:
	case Opcodes.IF_ACMPNE:
		v = ((insn.getOpcode() == Opcodes.IF_ACMPNE) ? !o.equals(oo) : o.equals(oo)) ? 1 : 0;
		break;
	}
	return InsnValue.intValue(v);
}
 
源代码11 项目: JByteMod-Beta   文件: InstructionAdapter.java

@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();
  }
}
 
源代码12 项目: JByteMod-Beta   文件: GeneratorAdapter.java

/**
 * Generates the instructions to jump to a label based on the comparison of the top two stack
 * values.
 *
 * @param type the type of the top two stack values.
 * @param mode how these values must be compared. One of EQ, NE, LT, GE, GT, LE.
 * @param label where to jump if the comparison result is <tt>true</tt>.
 */
public void ifCmp(final Type type, final int mode, final Label label) {
  switch (type.getSort()) {
    case Type.LONG:
      mv.visitInsn(Opcodes.LCMP);
      break;
    case Type.DOUBLE:
      mv.visitInsn(mode == GE || mode == GT ? Opcodes.DCMPL : Opcodes.DCMPG);
      break;
    case Type.FLOAT:
      mv.visitInsn(mode == GE || mode == GT ? Opcodes.FCMPL : Opcodes.FCMPG);
      break;
    case Type.ARRAY:
    case Type.OBJECT:
      if (mode == EQ) {
        mv.visitJumpInsn(Opcodes.IF_ACMPEQ, label);
        return;
      } else if (mode == NE) {
        mv.visitJumpInsn(Opcodes.IF_ACMPNE, label);
        return;
      } else {
        throw new IllegalArgumentException("Bad comparison for type " + type);
      }
    default:
      int intOp = -1;
      switch (mode) {
        case EQ:
          intOp = Opcodes.IF_ICMPEQ;
          break;
        case NE:
          intOp = Opcodes.IF_ICMPNE;
          break;
        case GE:
          intOp = Opcodes.IF_ICMPGE;
          break;
        case LT:
          intOp = Opcodes.IF_ICMPLT;
          break;
        case LE:
          intOp = Opcodes.IF_ICMPLE;
          break;
        case GT:
          intOp = Opcodes.IF_ICMPGT;
          break;
        default:
          throw new IllegalArgumentException("Bad comparison mode " + mode);
      }
      mv.visitJumpInsn(intOp, label);
      return;
  }
  mv.visitJumpInsn(mode, label);
}
 
源代码13 项目: serianalyzer   文件: JVMImpl.java

/**
 * @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;
}
 
源代码14 项目: JReFrameworker   文件: InstructionAdapter.java

@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();
  }
}
 
源代码15 项目: JReFrameworker   文件: GeneratorAdapter.java

/**
 * Generates the instructions to jump to a label based on the comparison of the top two stack
 * values.
 *
 * @param type the type of the top two stack values.
 * @param mode how these values must be compared. One of EQ, NE, LT, GE, GT, LE.
 * @param label where to jump if the comparison result is {@literal true}.
 */
public void ifCmp(final Type type, final int mode, final Label label) {
  switch (type.getSort()) {
    case Type.LONG:
      mv.visitInsn(Opcodes.LCMP);
      break;
    case Type.DOUBLE:
      mv.visitInsn(mode == GE || mode == GT ? Opcodes.DCMPL : Opcodes.DCMPG);
      break;
    case Type.FLOAT:
      mv.visitInsn(mode == GE || mode == GT ? Opcodes.FCMPL : Opcodes.FCMPG);
      break;
    case Type.ARRAY:
    case Type.OBJECT:
      if (mode == EQ) {
        mv.visitJumpInsn(Opcodes.IF_ACMPEQ, label);
        return;
      } else if (mode == NE) {
        mv.visitJumpInsn(Opcodes.IF_ACMPNE, label);
        return;
      } else {
        throw new IllegalArgumentException("Bad comparison for type " + type);
      }
    default:
      int intOp = -1;
      switch (mode) {
        case EQ:
          intOp = Opcodes.IF_ICMPEQ;
          break;
        case NE:
          intOp = Opcodes.IF_ICMPNE;
          break;
        case GE:
          intOp = Opcodes.IF_ICMPGE;
          break;
        case LT:
          intOp = Opcodes.IF_ICMPLT;
          break;
        case LE:
          intOp = Opcodes.IF_ICMPLE;
          break;
        case GT:
          intOp = Opcodes.IF_ICMPGT;
          break;
        default:
          throw new IllegalArgumentException("Bad comparison mode " + mode);
      }
      mv.visitJumpInsn(intOp, label);
      return;
  }
  mv.visitJumpInsn(mode, label);
}
 
源代码16 项目: JReFrameworker   文件: InstructionAdapter.java

@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();
  }
}
 
源代码17 项目: JReFrameworker   文件: GeneratorAdapter.java

/**
 * Generates the instructions to jump to a label based on the comparison of the top two stack
 * values.
 *
 * @param type the type of the top two stack values.
 * @param mode how these values must be compared. One of EQ, NE, LT, GE, GT, LE.
 * @param label where to jump if the comparison result is {@literal true}.
 */
public void ifCmp(final Type type, final int mode, final Label label) {
  switch (type.getSort()) {
    case Type.LONG:
      mv.visitInsn(Opcodes.LCMP);
      break;
    case Type.DOUBLE:
      mv.visitInsn(mode == GE || mode == GT ? Opcodes.DCMPL : Opcodes.DCMPG);
      break;
    case Type.FLOAT:
      mv.visitInsn(mode == GE || mode == GT ? Opcodes.FCMPL : Opcodes.FCMPG);
      break;
    case Type.ARRAY:
    case Type.OBJECT:
      if (mode == EQ) {
        mv.visitJumpInsn(Opcodes.IF_ACMPEQ, label);
        return;
      } else if (mode == NE) {
        mv.visitJumpInsn(Opcodes.IF_ACMPNE, label);
        return;
      } else {
        throw new IllegalArgumentException("Bad comparison for type " + type);
      }
    default:
      int intOp = -1;
      switch (mode) {
        case EQ:
          intOp = Opcodes.IF_ICMPEQ;
          break;
        case NE:
          intOp = Opcodes.IF_ICMPNE;
          break;
        case GE:
          intOp = Opcodes.IF_ICMPGE;
          break;
        case LT:
          intOp = Opcodes.IF_ICMPLT;
          break;
        case LE:
          intOp = Opcodes.IF_ICMPLE;
          break;
        case GT:
          intOp = Opcodes.IF_ICMPGT;
          break;
        default:
          throw new IllegalArgumentException("Bad comparison mode " + mode);
      }
      mv.visitJumpInsn(intOp, label);
      return;
  }
  mv.visitJumpInsn(mode, label);
}
 
源代码18 项目: CodenameOne   文件: Jump.java

@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");
    }
}
 
 方法所在类
 同类方法