Example usage for org.objectweb.asm Opcodes SIPUSH

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

Introduction

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

Prototype

int SIPUSH

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

Click Source Link

Usage

From source file:com.toolazydogs.maiden.agent.asm.AsmUtilsTest.java

License:Apache License

@Test
public void testPushInteger() {
    MethodVisitor methodVisitor = mock(MethodVisitor.class);

    AsmUtils.push(methodVisitor, 59);/*from www.  ja  v a  2  s .  c  om*/

    verify(methodVisitor).visitIntInsn(Opcodes.BIPUSH, 59);
    verify(methodVisitor, never()).visitIntInsn(Opcodes.SIPUSH, 59);

    AsmUtils.push(methodVisitor, 32760);

    verify(methodVisitor, never()).visitIntInsn(Opcodes.BIPUSH, 32760);
    verify(methodVisitor).visitIntInsn(Opcodes.SIPUSH, 32760);
}

From source file:com.toolazydogs.maiden.agent.asm.WaitNotifyMethodVisitor.java

License:Apache License

public void visitIntInsn(int opcode, int operand) {
    LOGGER.entering(CLASS_NAME, "visitInsn", new Object[] { opcode, operand });

    if (state == State.FOUND_MILLISECONDS && (opcode == Opcodes.BIPUSH || opcode == Opcodes.SIPUSH)) {
        nanoseconds = opcode;/* ww  w  .  j a  va2 s .  c om*/
        state = State.FOUND_NANOSECONDS;
    } else {
        flush();
        visitor.visitIntInsn(opcode, operand);
    }

    LOGGER.exiting(CLASS_NAME, "visitIntInsn");
}

From source file:com.trigersoft.jaque.expression.ExpressionMethodVisitor.java

License:Apache License

@Override
public void visitIntInsn(int opcode, int operand) {
    switch (opcode) {
    case Opcodes.BIPUSH:
    case Opcodes.SIPUSH:
        _exprStack.push(Expression.constant(operand, Integer.TYPE));
        break;/*  ww w  . j  a  v a2 s .  c om*/
    default:
        throw notLambda(opcode);
    }
}

From source file:de.fhkoeln.gm.cui.javahardener.CheckNullMethodVisitor.java

License:Open Source License

/**
 * Push the default value to the stack for the given type.
 * /*from   www . j  a  v a  2 s .  com*/
 * @param type
 */
private void pushDefault(Type type) {
    switch (type.getSort()) {
    case Type.VOID:
        break;
    case Type.BOOLEAN:
        super.visitIntInsn(Opcodes.BIPUSH, 0); // Push false to the stack
        break;
    case Type.BYTE:
        super.visitIntInsn(Opcodes.BIPUSH, 0); // Push byte 0 to the stack
        break;
    case Type.CHAR:
        super.visitIntInsn(Opcodes.BIPUSH, 0); // Push char 0 to the stack
        break;
    case Type.SHORT:
        super.visitIntInsn(Opcodes.SIPUSH, 0); // Push short 0 to the stack
        break;
    case Type.INT:
        super.visitInsn(Opcodes.ICONST_0); // Push int 0 to the stack
        break;
    case Type.FLOAT:
        super.visitInsn(Opcodes.FCONST_0); // Push float 0 to the stack
        break;
    case Type.LONG:
        super.visitInsn(Opcodes.LCONST_0); // Push long 0 to the stack
        break;
    case Type.DOUBLE:
        super.visitInsn(Opcodes.DCONST_0); // Push double 0 to the stack
        break;
    default:
        super.visitInsn(Opcodes.ACONST_NULL); // Push NULL to the stack
        break;
    }
}

From source file:de.tuberlin.uebb.jbop.optimizer.utils.NodeHelper.java

License:Open Source License

/**
 * Gets the correct push opcode for the number.
 * /*from w  w w.  j  a v a 2s  .  co  m*/
 * @param newNumber
 *          the new number
 * @return the opcode push
 */
public static int getopcodePush(final int newNumber) {
    if (newNumber >= CONST_LOW_BYTE && newNumber <= CONST_HIGH_BYTE) {
        return Opcodes.BIPUSH;
    }
    return Opcodes.SIPUSH;
}

From source file:de.tuberlin.uebb.jbop.optimizer.utils.NodeHelper.java

License:Open Source License

/**
 * Checks if node is sipush./*from   w  w w. j av a  2 s  .co  m*/
 * 
 * @param node
 *          the node
 * @return true if node is sipush
 */
public static boolean isSipush(final AbstractInsnNode node) {
    if (node == null) {
        return false;
    }
    return node.getOpcode() == Opcodes.SIPUSH;
}

From source file:de.unisb.cs.st.javalanche.mutation.bytecodeMutations.replaceIntegerConstant.AbstractRicMethodAdapter.java

License:Open Source License

@Override
public void visitIntInsn(int opcode, int operand) {
    if (mutationCode) {
        super.visitIntInsn(opcode, operand);
        return;/* w ww .  ja  va  2 s . c  om*/
    }
    if (opcode == Opcodes.BIPUSH || opcode == Opcodes.SIPUSH) {
        intConstant(operand);
        if (forwardCalls) {
            super.visitIntInsn(opcode, operand);
        }
    } else {
        super.visitIntInsn(opcode, operand);
    }
}

From source file:de.unisb.cs.st.javalanche.mutation.bytecodeMutations.replaceIntegerConstant.RicMethodAdapter.java

License:Open Source License

@Override
public void visitIntInsn(int opcode, int operand) {
    if (mutationCode) {
        super.visitIntInsn(opcode, operand);
        return;/*from   www  .j  av a 2s . co  m*/
    }
    if (opcode == Opcodes.BIPUSH || opcode == Opcodes.SIPUSH) {
        intConstant(operand);
    } else {
        super.visitIntInsn(opcode, operand);
    }
}

From source file:de.unisb.cs.st.javaslicer.common.classRepresentation.instructions.IntPush.java

License:Open Source License

public IntPush(final ReadMethod readMethod, final int opcode, final int operand, final int lineNumber) {
    super(readMethod, opcode, lineNumber);
    assert opcode == Opcodes.BIPUSH || opcode == Opcodes.SIPUSH;
    this.operand = operand;
}

From source file:de.unisb.cs.st.javaslicer.common.classRepresentation.instructions.IntPush.java

License:Open Source License

private IntPush(final ReadMethod readMethod, final int lineNumber, final int opcode, final int operand,
        final int index) {
    super(readMethod, opcode, lineNumber, index);
    assert opcode == Opcodes.BIPUSH || opcode == Opcodes.SIPUSH;
    this.operand = operand;
}