Example usage for org.objectweb.asm MethodVisitor visitMethodInsn

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

Introduction

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

Prototype

public void visitMethodInsn(final int opcode, final String owner, final String name, final String descriptor,
        final boolean isInterface) 

Source Link

Document

Visits a method instruction.

Usage

From source file:com.cinnober.msgcodec.blink.BaseByteCodeGenerator.java

License:Open Source License

/**
 * Generate value encoding using the blink output.
 *
 * <p>Defaults to <code>writeBigInt[Null].</code>
 *
 * @param required true if the field is required, otherwise false.
 * @param mv the method visitor, not null.
 * @see #generateEncodeValue// ww  w  .  jav a  2s  . co m
 */
protected void generateEncodeBigIntValue(boolean required, MethodVisitor mv) {
    if (required) {
        mv.visitMethodInsn(INVOKESTATIC, blinkOutputIName, "writeBigInt",
                "(Lcom/cinnober/msgcodec/io/ByteSink;Ljava/math/BigInteger;)V", false);
    } else {
        mv.visitMethodInsn(INVOKESTATIC, blinkOutputIName, "writeBigIntNull",
                "(Lcom/cinnober/msgcodec/io/ByteSink;Ljava/math/BigInteger;)V", false);
    }
}

From source file:com.cinnober.msgcodec.blink.BaseByteCodeGenerator.java

License:Open Source License

/**
 * Generate value encoding using the blink output.
 *
 * <p>Defaults to <code>writeFloat64[Null].</code>
 *
 * @param required true if the field is required, otherwise false.
 * @param mv the method visitor, not null.
 * @see #generateEncodeValue//from  w  w w  . j a  v a  2  s .  c  o  m
 */
protected void generateEncodeFloat64Value(boolean required, MethodVisitor mv) {
    if (required) {
        mv.visitMethodInsn(INVOKESTATIC, blinkOutputIName, "writeFloat64",
                "(Lcom/cinnober/msgcodec/io/ByteSink;D)V", false);
    } else {
        mv.visitMethodInsn(INVOKESTATIC, blinkOutputIName, "writeFloat64Null",
                "(Lcom/cinnober/msgcodec/io/ByteSink;Ljava/lang/Double;)V", false);
    }
}

From source file:com.cinnober.msgcodec.blink.BaseByteCodeGenerator.java

License:Open Source License

/**
 * Generate value encoding using the blink output.
 *
 * <p>Defaults to <code>writeFloat32[Null].</code>
 *
 * @param required true if the field is required, otherwise false.
 * @param mv the method visitor, not null.
 * @see #generateEncodeValue//  w w  w.  jav  a 2s  .c om
 */
protected void generateEncodeFloat32Value(boolean required, MethodVisitor mv) {
    if (required) {
        mv.visitMethodInsn(INVOKESTATIC, blinkOutputIName, "writeFloat32",
                "(Lcom/cinnober/msgcodec/io/ByteSink;F)V", false);
    } else {
        mv.visitMethodInsn(INVOKESTATIC, blinkOutputIName, "writeFloat32Null",
                "(Lcom/cinnober/msgcodec/io/ByteSink;Ljava/lang/Float;)V", false);
    }
}

From source file:com.cinnober.msgcodec.blink.BaseByteCodeGenerator.java

License:Open Source License

/**
 * Generate value encoding using the blink output.
 *
 * <p>Defaults to <code>writeUInt64[Null].</code>
 *
 * @param required true if the field is required, otherwise false.
 * @param mv the method visitor, not null.
 * @see #generateEncodeValue//  w w  w. j  ava 2 s .  c om
 */
protected void generateEncodeUInt64Value(boolean required, MethodVisitor mv) {
    if (required) {
        mv.visitMethodInsn(INVOKESTATIC, blinkOutputIName, "writeUInt64",
                "(Lcom/cinnober/msgcodec/io/ByteSink;J)V", false);
    } else {
        mv.visitMethodInsn(INVOKESTATIC, blinkOutputIName, "writeUInt64Null",
                "(Lcom/cinnober/msgcodec/io/ByteSink;Ljava/lang/Long;)V", false);
    }
}

From source file:com.cinnober.msgcodec.blink.BaseByteCodeGenerator.java

License:Open Source License

/**
 * Generate value encoding using the blink output.
 *
 * <p>Defaults to <code>writeInt64[Null].</code>
 *
 * @param required true if the field is required, otherwise false.
 * @param mv the method visitor, not null.
 * @see #generateEncodeValue//  ww  w .  j av  a 2  s.  com
 */
protected void generateEncodeInt64Value(boolean required, MethodVisitor mv) {
    if (required) {
        mv.visitMethodInsn(INVOKESTATIC, blinkOutputIName, "writeInt64",
                "(Lcom/cinnober/msgcodec/io/ByteSink;J)V", false);
    } else {
        mv.visitMethodInsn(INVOKESTATIC, blinkOutputIName, "writeInt64Null",
                "(Lcom/cinnober/msgcodec/io/ByteSink;Ljava/lang/Long;)V", false);
    }
}

From source file:com.cinnober.msgcodec.blink.BaseByteCodeGenerator.java

License:Open Source License

/**
 * Generate value encoding using the blink output.
 *
 * <p>Defaults to <code>writeUInt32[Null].</code>
 *
 * @param required true if the field is required, otherwise false.
 * @param mv the method visitor, not null.
 * @see #generateEncodeValue/*from   w w  w  .  j  a  v  a  2s  .c  o m*/
 */
protected void generateEncodeUInt32Value(boolean required, MethodVisitor mv) {
    if (required) {
        mv.visitMethodInsn(INVOKESTATIC, blinkOutputIName, "writeUInt32",
                "(Lcom/cinnober/msgcodec/io/ByteSink;I)V", false);
    } else {
        mv.visitMethodInsn(INVOKESTATIC, blinkOutputIName, "writeUInt32Null",
                "(Lcom/cinnober/msgcodec/io/ByteSink;Ljava/lang/Integer;)V", false);
    }
}

From source file:com.cinnober.msgcodec.blink.BaseByteCodeGenerator.java

License:Open Source License

/**
 * Generate value encoding using the blink output.
 *
 * <p>Defaults to <code>writeInt32[Null].</code>
 *
 * @param required true if the field is required, otherwise false.
 * @param mv the method visitor, not null.
 * @see #generateEncodeValue/*from  w  ww . j av a 2 s. c o  m*/
 */
protected void generateEncodeInt32Value(boolean required, MethodVisitor mv) {
    if (required) {
        mv.visitMethodInsn(INVOKESTATIC, blinkOutputIName, "writeInt32",
                "(Lcom/cinnober/msgcodec/io/ByteSink;I)V", false);
    } else {
        mv.visitMethodInsn(INVOKESTATIC, blinkOutputIName, "writeInt32Null",
                "(Lcom/cinnober/msgcodec/io/ByteSink;Ljava/lang/Integer;)V", false);
    }
}

From source file:com.cinnober.msgcodec.blink.BaseByteCodeGenerator.java

License:Open Source License

/**
 * Generate value encoding using the blink output.
 *
 * <p>Defaults to <code>writeUInt16Null].</code>
 *
 * @param required true if the field is required, otherwise false.
 * @param mv the method visitor, not null.
 * @see #generateEncodeValue/*from  w w  w.j a va 2s.  co  m*/
 */
protected void generateEncodeCharacterValue(boolean required, MethodVisitor mv) {
    if (required) {
        mv.visitInsn(I2S);
        mv.visitMethodInsn(INVOKESTATIC, blinkOutputIName, "writeUInt16",
                "(Lcom/cinnober/msgcodec/io/ByteSink;S)V", false);
    } else {
        Label nullLabel = new Label();
        mv.visitInsn(DUP);
        mv.visitJumpInsn(IFNULL, nullLabel);
        unbox(mv, Character.class);
        mv.visitInsn(I2S);
        box(mv, Short.class);
        mv.visitLabel(nullLabel);
        mv.visitTypeInsn(CHECKCAST, Type.getInternalName(Short.class));
        mv.visitMethodInsn(INVOKESTATIC, blinkOutputIName, "writeUInt16Null",
                "(Lcom/cinnober/msgcodec/io/ByteSink;Ljava/lang/Short;)V", false);
    }
}

From source file:com.cinnober.msgcodec.blink.BaseByteCodeGenerator.java

License:Open Source License

/**
 * Generate value encoding using the blink output.
 *
 * <p>Defaults to <code>writeUInt16Null].</code>
 *
 * @param required true if the field is required, otherwise false.
 * @param mv the method visitor, not null.
 * @see #generateEncodeValue/*from   w  w w  .  j  a  va  2 s  . co  m*/
 */
protected void generateEncodeUInt16Value(boolean required, MethodVisitor mv) {
    if (required) {
        mv.visitMethodInsn(INVOKESTATIC, blinkOutputIName, "writeUInt16",
                "(Lcom/cinnober/msgcodec/io/ByteSink;S)V", false);
    } else {
        mv.visitMethodInsn(INVOKESTATIC, blinkOutputIName, "writeUInt16Null",
                "(Lcom/cinnober/msgcodec/io/ByteSink;Ljava/lang/Short;)V", false);
    }
}

From source file:com.cinnober.msgcodec.blink.BaseByteCodeGenerator.java

License:Open Source License

/**
 * Generate value encoding using the blink output.
 *
 * <p>Defaults to <code>writeInt16[Null].</code>
 *
 * @param required true if the field is required, otherwise false.
 * @param mv the method visitor, not null.
 * @see #generateEncodeValue/*from w  w w .j av a2 s.  com*/
 */
protected void generateEncodeInt16Value(boolean required, MethodVisitor mv) {
    if (required) {
        mv.visitMethodInsn(INVOKESTATIC, blinkOutputIName, "writeInt16",
                "(Lcom/cinnober/msgcodec/io/ByteSink;S)V", false);
    } else {
        mv.visitMethodInsn(INVOKESTATIC, blinkOutputIName, "writeInt16Null",
                "(Lcom/cinnober/msgcodec/io/ByteSink;Ljava/lang/Short;)V", false);
    }
}