Example usage for org.objectweb.asm Opcodes JSR

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

Introduction

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

Prototype

int JSR

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

Click Source Link

Usage

From source file:org.mutabilitydetector.checkers.settermethod.AssignmentGuardFinder.java

License:Apache License

private static boolean isConditionCheckInstruction(final AbstractInsnNode insn) {
    final int opcode = insn.getOpcode();
    return AbstractInsnNode.JUMP_INSN == insn.getType() && opcode != Opcodes.GOTO && opcode != Opcodes.JSR
            && opcode != Opcodes.RET;
}

From source file:org.spongepowered.asm.mixin.injection.points.JumpInsnPoint.java

License:MIT License

public JumpInsnPoint(InjectionPointData data) {
    this.opCode = data.getOpcode(-1, Opcodes.IFEQ, Opcodes.IFNE, Opcodes.IFLT, Opcodes.IFGE, Opcodes.IFGT,
            Opcodes.IFLE, Opcodes.IF_ICMPEQ, Opcodes.IF_ICMPNE, Opcodes.IF_ICMPLT, Opcodes.IF_ICMPGE,
            Opcodes.IF_ICMPGT, Opcodes.IF_ICMPLE, Opcodes.IF_ACMPEQ, Opcodes.IF_ACMPNE, Opcodes.GOTO,
            Opcodes.JSR, Opcodes.IFNULL, Opcodes.IFNONNULL, -1);
    this.ordinal = data.getOrdinal();
}

From source file:serianalyzer.JVMImpl.java

License:Open Source License

/**
 * @param opcode//from www.  ja  v  a2 s.  c  om
 * @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;
}

From source file:v6.java.preverifier.MethodRewriter.java

License:Open Source License

/**
 * Visit the specified instruction and do the right thing.
 * //www  .j  a v  a2s.c o m
 * @param method
 * @param region
 * @param insnNode
 * @throws AnalyzerException
 */
private void visitInstruction(MethodNode method, Region region, AbstractInsnNode insnNode)
        throws AnalyzerException {
    int opcode = insnNode.getOpcode();
    switch (opcode) {
    case Opcodes.JSR:
        visitJumpToSubroutine(method, region, (JumpInsnNode) insnNode);
        break;

    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.GOTO:
    case Opcodes.IFNULL:
    case Opcodes.IFNONNULL:
        visitJump(method, region, (JumpInsnNode) insnNode);
        break;

    case Opcodes.LOOKUPSWITCH:
        visitLookupSwitch(method, region, (LookupSwitchInsnNode) insnNode);
        break;

    case Opcodes.TABLESWITCH:
        visitTableSwitch(method, region, (TableSwitchInsnNode) insnNode);
        break;

    default:
        insnNode.accept(method);
    }
}

From source file:v6.java.preverifier.PreverifierMethodNode.java

License:Open Source License

/**
 * @see org.objectweb.asm.CodeVisitor#visitJumpInsn(int,
 *      org.objectweb.asm.Label)/* w w w .j  a  va  2  s  . co  m*/
 */
public void visitJumpInsn(int opcode, Label label) {
    if (isDisallowedInstruction(opcode)) {
        ClassNodeErrorInformation classInfo = new ClassNodeErrorInformation(classNode);
        MethodNodeErrorInformation methodInfo = new MethodNodeErrorInformation(classInfo, this);

        PreverificationErrorLocation location = new PreverificationErrorLocation(
                PreverificationErrorLocationType.METHOD_INSTRUCTION, classInfo, methodInfo, null, lineNumber);
        PreverificationError error = new PreverificationError(PreverificationErrorType.FLOATING_POINT, location,
                null);
        addError(error);
    } else if (opcode == Opcodes.JSR) {
        // Don't follow JSR's as they will be removed anyway...
        jsrInstructionIndices.add(new Integer(instructions.size()));
    }

    super.visitJumpInsn(opcode, label);
}