Example usage for org.objectweb.asm MethodVisitor visitInsn

List of usage examples for org.objectweb.asm MethodVisitor visitInsn

Introduction

In this page you can find the example usage for org.objectweb.asm MethodVisitor visitInsn.

Prototype

public void visitInsn(final int opcode) 

Source Link

Document

Visits a zero operand instruction.

Usage

From source file:com.gargoylesoftware.js.nashorn.internal.codegen.types.IntType.java

License:Open Source License

@Override
public Type mul(final MethodVisitor method, final int programPoint) {
    if (programPoint == INVALID_PROGRAM_POINT) {
        method.visitInsn(IMUL);
    } else {/*w w  w . j a  v a  2 s. c o  m*/
        method.visitInvokeDynamicInsn("imul", "(II)I", MATHBOOTSTRAP, programPoint);
    }
    return INT;
}

From source file:com.gargoylesoftware.js.nashorn.internal.codegen.types.IntType.java

License:Open Source License

@Override
public Type neg(final MethodVisitor method, final int programPoint) {
    if (programPoint == INVALID_PROGRAM_POINT) {
        method.visitInsn(INEG);
    } else {//from   w w w  .j  a v  a  2  s.co  m
        method.visitInvokeDynamicInsn("ineg", "(I)I", MATHBOOTSTRAP, programPoint);
    }
    return INT;
}

From source file:com.gargoylesoftware.js.nashorn.internal.codegen.types.IntType.java

License:Open Source License

@Override
public Type loadForcedInitializer(final MethodVisitor method) {
    method.visitInsn(ICONST_0);
    return INT;
}

From source file:com.gargoylesoftware.js.nashorn.internal.codegen.types.LongType.java

License:Open Source License

@Override
public Type cmp(final MethodVisitor method) {
    method.visitInsn(LCMP);
    return INT;
}

From source file:com.gargoylesoftware.js.nashorn.internal.codegen.types.LongType.java

License:Open Source License

@Override
public Type ldc(final MethodVisitor method, final Object c) {
    assert c instanceof Long;

    final long value = (Long) c;

    if (value == 0L) {
        method.visitInsn(LCONST_0);
    } else if (value == 1L) {
        method.visitInsn(LCONST_1);//ww  w  .ja va 2  s.  c  o  m
    } else {
        method.visitLdcInsn(c);
    }

    return Type.LONG;
}

From source file:com.gargoylesoftware.js.nashorn.internal.codegen.types.LongType.java

License:Open Source License

@Override
public Type convert(final MethodVisitor method, final Type to) {
    if (isEquivalentTo(to)) {
        return to;
    }// w  w w . j  a  va2 s. c  om

    if (to.isNumber()) {
        method.visitInsn(L2D);
    } else if (to.isInteger()) {
        invokestatic(method, JSType.TO_INT32_L);
    } else if (to.isBoolean()) {
        method.visitInsn(L2I);
    } else if (to.isObject()) {
        invokestatic(method, VALUE_OF);
    } else {
        assert false : "Illegal conversion " + this + " -> " + to;
    }

    return to;
}

From source file:com.gargoylesoftware.js.nashorn.internal.codegen.types.LongType.java

License:Open Source License

@Override
public Type add(final MethodVisitor method, final int programPoint) {
    if (programPoint == INVALID_PROGRAM_POINT) {
        method.visitInsn(LADD);
    } else {//from   w  w  w . j a va  2 s.c  o m
        method.visitInvokeDynamicInsn("ladd", "(JJ)J", MATHBOOTSTRAP, programPoint);
    }
    return LONG;
}

From source file:com.gargoylesoftware.js.nashorn.internal.codegen.types.LongType.java

License:Open Source License

@Override
public Type sub(final MethodVisitor method, final int programPoint) {
    if (programPoint == INVALID_PROGRAM_POINT) {
        method.visitInsn(LSUB);
    } else {//w w w .ja  v a 2s.com
        method.visitInvokeDynamicInsn("lsub", "(JJ)J", MATHBOOTSTRAP, programPoint);
    }
    return LONG;
}

From source file:com.gargoylesoftware.js.nashorn.internal.codegen.types.LongType.java

License:Open Source License

@Override
public Type mul(final MethodVisitor method, final int programPoint) {
    if (programPoint == INVALID_PROGRAM_POINT) {
        method.visitInsn(LMUL);
    } else {//from   www . j  a  v  a 2 s. c  om
        method.visitInvokeDynamicInsn("lmul", "(JJ)J", MATHBOOTSTRAP, programPoint);
    }
    return LONG;
}

From source file:com.gargoylesoftware.js.nashorn.internal.codegen.types.LongType.java

License:Open Source License

@Override
public Type shr(final MethodVisitor method) {
    method.visitInsn(LUSHR);
    return LONG;
}