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.facebook.presto.byteCode.instruction.BasicInstruction.java

License:Apache License

@Override
public void accept(MethodVisitor visitor) {
    visitor.visitInsn(opCode);
}

From source file:com.facebook.presto.byteCode.OpCodes.java

License:Apache License

public void accept(MethodVisitor visitor) {
    visitor.visitInsn(opCode);
}

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

License:Open Source License

@Override
public void astore(final MethodVisitor method) {
    method.visitInsn(AASTORE);
}

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

License:Open Source License

@Override
public Type aload(final MethodVisitor method) {
    method.visitInsn(AALOAD);
    return getElementType();
}

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

License:Open Source License

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

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

License:Open Source License

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

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

License:Open Source License

@Override
public void _return(final MethodVisitor method) {
    method.visitInsn(IRETURN);
}

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

License:Open Source License

@Override
public Type ldc(final MethodVisitor method, final Object c) {
    assert c instanceof Boolean;
    method.visitInsn((Boolean) c ? ICONST_1 : ICONST_0);
    return BOOLEAN;
}

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

License:Open Source License

@Override
public Type convert(final MethodVisitor method, final Type to) {
    if (isEquivalentTo(to)) {
        return to;
    }/*from   w ww . j a  v a  2  s  . com*/

    if (to.isNumber()) {
        method.visitInsn(I2D);
    } else if (to.isLong()) {
        method.visitInsn(I2L);
    } else if (to.isInteger()) {
        //nop
    } else if (to.isString()) {
        invokestatic(method, TO_STRING);
    } else if (to.isObject()) {
        invokestatic(method, VALUE_OF);
    } else {
        throw new UnsupportedOperationException("Illegal conversion " + this + " -> " + to);
    }

    return to;
}

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

License:Open Source License

@Override
public Type add(final MethodVisitor method, final int programPoint) {
    // Adding booleans in JavaScript is perfectly valid, they add as if false=0 and true=1
    if (programPoint == INVALID_PROGRAM_POINT) {
        method.visitInsn(IADD);
    } else {/*  www.j av a2  s . com*/
        method.visitInvokeDynamicInsn("iadd", "(II)I", MATHBOOTSTRAP, programPoint);
    }
    return INT;
}