Java Code Examples for jdk.internal.org.objectweb.asm.Opcodes#T_SHORT

The following examples show how to use jdk.internal.org.objectweb.asm.Opcodes#T_SHORT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InstructionAdapter.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void newarray(final Type type) {
    int typ;
    switch (type.getSort()) {
    case Type.BOOLEAN:
        typ = Opcodes.T_BOOLEAN;
        break;
    case Type.CHAR:
        typ = Opcodes.T_CHAR;
        break;
    case Type.BYTE:
        typ = Opcodes.T_BYTE;
        break;
    case Type.SHORT:
        typ = Opcodes.T_SHORT;
        break;
    case Type.INT:
        typ = Opcodes.T_INT;
        break;
    case Type.FLOAT:
        typ = Opcodes.T_FLOAT;
        break;
    case Type.LONG:
        typ = Opcodes.T_LONG;
        break;
    case Type.DOUBLE:
        typ = Opcodes.T_DOUBLE;
        break;
    default:
        mv.visitTypeInsn(Opcodes.ANEWARRAY, type.getInternalName());
        return;
    }
    mv.visitIntInsn(Opcodes.NEWARRAY, typ);
}
 
Example 2
Source File: GeneratorAdapter.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Generates the instruction to create a new array.
 *
 * @param type
 *            the type of the array elements.
 */
public void newArray(final Type type) {
    int typ;
    switch (type.getSort()) {
    case Type.BOOLEAN:
        typ = Opcodes.T_BOOLEAN;
        break;
    case Type.CHAR:
        typ = Opcodes.T_CHAR;
        break;
    case Type.BYTE:
        typ = Opcodes.T_BYTE;
        break;
    case Type.SHORT:
        typ = Opcodes.T_SHORT;
        break;
    case Type.INT:
        typ = Opcodes.T_INT;
        break;
    case Type.FLOAT:
        typ = Opcodes.T_FLOAT;
        break;
    case Type.LONG:
        typ = Opcodes.T_LONG;
        break;
    case Type.DOUBLE:
        typ = Opcodes.T_DOUBLE;
        break;
    default:
        typeInsn(Opcodes.ANEWARRAY, type);
        return;
    }
    mv.visitIntInsn(Opcodes.NEWARRAY, typ);
}
 
Example 3
Source File: InstructionAdapter.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
  * Generates the instruction to create and push on the stack an array of the given type.
  *
  * @param type an array Type.
  */
public void newarray(final Type type) {
    int arrayType;
    switch (type.getSort()) {
        case Type.BOOLEAN:
            arrayType = Opcodes.T_BOOLEAN;
            break;
        case Type.CHAR:
            arrayType = Opcodes.T_CHAR;
            break;
        case Type.BYTE:
            arrayType = Opcodes.T_BYTE;
            break;
        case Type.SHORT:
            arrayType = Opcodes.T_SHORT;
            break;
        case Type.INT:
            arrayType = Opcodes.T_INT;
            break;
        case Type.FLOAT:
            arrayType = Opcodes.T_FLOAT;
            break;
        case Type.LONG:
            arrayType = Opcodes.T_LONG;
            break;
        case Type.DOUBLE:
            arrayType = Opcodes.T_DOUBLE;
            break;
        default:
            mv.visitTypeInsn(Opcodes.ANEWARRAY, type.getInternalName());
            return;
    }
    mv.visitIntInsn(Opcodes.NEWARRAY, arrayType);
}
 
Example 4
Source File: GeneratorAdapter.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Generates the instruction to create a new array.
 *
 * @param type
 *            the type of the array elements.
 */
public void newArray(final Type type) {
    int typ;
    switch (type.getSort()) {
    case Type.BOOLEAN:
        typ = Opcodes.T_BOOLEAN;
        break;
    case Type.CHAR:
        typ = Opcodes.T_CHAR;
        break;
    case Type.BYTE:
        typ = Opcodes.T_BYTE;
        break;
    case Type.SHORT:
        typ = Opcodes.T_SHORT;
        break;
    case Type.INT:
        typ = Opcodes.T_INT;
        break;
    case Type.FLOAT:
        typ = Opcodes.T_FLOAT;
        break;
    case Type.LONG:
        typ = Opcodes.T_LONG;
        break;
    case Type.DOUBLE:
        typ = Opcodes.T_DOUBLE;
        break;
    default:
        typeInsn(Opcodes.ANEWARRAY, type);
        return;
    }
    mv.visitIntInsn(Opcodes.NEWARRAY, typ);
}
 
Example 5
Source File: InvokerBytecodeGenerator.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private byte arrayTypeCode(Wrapper elementType) {
    switch (elementType) {
        case BOOLEAN: return Opcodes.T_BOOLEAN;
        case BYTE:    return Opcodes.T_BYTE;
        case CHAR:    return Opcodes.T_CHAR;
        case SHORT:   return Opcodes.T_SHORT;
        case INT:     return Opcodes.T_INT;
        case LONG:    return Opcodes.T_LONG;
        case FLOAT:   return Opcodes.T_FLOAT;
        case DOUBLE:  return Opcodes.T_DOUBLE;
        case OBJECT:  return 0; // in place of Opcodes.T_OBJECT
        default:      throw new InternalError();
    }
}
 
Example 6
Source File: GeneratorAdapter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Generates the instruction to create a new array.
 *
 * @param type
 *            the type of the array elements.
 */
public void newArray(final Type type) {
    int typ;
    switch (type.getSort()) {
    case Type.BOOLEAN:
        typ = Opcodes.T_BOOLEAN;
        break;
    case Type.CHAR:
        typ = Opcodes.T_CHAR;
        break;
    case Type.BYTE:
        typ = Opcodes.T_BYTE;
        break;
    case Type.SHORT:
        typ = Opcodes.T_SHORT;
        break;
    case Type.INT:
        typ = Opcodes.T_INT;
        break;
    case Type.FLOAT:
        typ = Opcodes.T_FLOAT;
        break;
    case Type.LONG:
        typ = Opcodes.T_LONG;
        break;
    case Type.DOUBLE:
        typ = Opcodes.T_DOUBLE;
        break;
    default:
        typeInsn(Opcodes.ANEWARRAY, type);
        return;
    }
    mv.visitIntInsn(Opcodes.NEWARRAY, typ);
}
 
Example 7
Source File: InstructionAdapter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void newarray(final Type type) {
    int typ;
    switch (type.getSort()) {
    case Type.BOOLEAN:
        typ = Opcodes.T_BOOLEAN;
        break;
    case Type.CHAR:
        typ = Opcodes.T_CHAR;
        break;
    case Type.BYTE:
        typ = Opcodes.T_BYTE;
        break;
    case Type.SHORT:
        typ = Opcodes.T_SHORT;
        break;
    case Type.INT:
        typ = Opcodes.T_INT;
        break;
    case Type.FLOAT:
        typ = Opcodes.T_FLOAT;
        break;
    case Type.LONG:
        typ = Opcodes.T_LONG;
        break;
    case Type.DOUBLE:
        typ = Opcodes.T_DOUBLE;
        break;
    default:
        mv.visitTypeInsn(Opcodes.ANEWARRAY, type.getInternalName());
        return;
    }
    mv.visitIntInsn(Opcodes.NEWARRAY, typ);
}
 
Example 8
Source File: InstructionAdapter.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void newarray(final Type type) {
    int typ;
    switch (type.getSort()) {
    case Type.BOOLEAN:
        typ = Opcodes.T_BOOLEAN;
        break;
    case Type.CHAR:
        typ = Opcodes.T_CHAR;
        break;
    case Type.BYTE:
        typ = Opcodes.T_BYTE;
        break;
    case Type.SHORT:
        typ = Opcodes.T_SHORT;
        break;
    case Type.INT:
        typ = Opcodes.T_INT;
        break;
    case Type.FLOAT:
        typ = Opcodes.T_FLOAT;
        break;
    case Type.LONG:
        typ = Opcodes.T_LONG;
        break;
    case Type.DOUBLE:
        typ = Opcodes.T_DOUBLE;
        break;
    default:
        mv.visitTypeInsn(Opcodes.ANEWARRAY, type.getInternalName());
        return;
    }
    mv.visitIntInsn(Opcodes.NEWARRAY, typ);
}
 
Example 9
Source File: GeneratorAdapter.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Generates the instruction to create a new array.
 *
 * @param type
 *            the type of the array elements.
 */
public void newArray(final Type type) {
    int typ;
    switch (type.getSort()) {
    case Type.BOOLEAN:
        typ = Opcodes.T_BOOLEAN;
        break;
    case Type.CHAR:
        typ = Opcodes.T_CHAR;
        break;
    case Type.BYTE:
        typ = Opcodes.T_BYTE;
        break;
    case Type.SHORT:
        typ = Opcodes.T_SHORT;
        break;
    case Type.INT:
        typ = Opcodes.T_INT;
        break;
    case Type.FLOAT:
        typ = Opcodes.T_FLOAT;
        break;
    case Type.LONG:
        typ = Opcodes.T_LONG;
        break;
    case Type.DOUBLE:
        typ = Opcodes.T_DOUBLE;
        break;
    default:
        typeInsn(Opcodes.ANEWARRAY, type);
        return;
    }
    mv.visitIntInsn(Opcodes.NEWARRAY, typ);
}
 
Example 10
Source File: InvokerBytecodeGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private byte arrayTypeCode(Wrapper elementType) {
    switch (elementType) {
        case BOOLEAN: return Opcodes.T_BOOLEAN;
        case BYTE:    return Opcodes.T_BYTE;
        case CHAR:    return Opcodes.T_CHAR;
        case SHORT:   return Opcodes.T_SHORT;
        case INT:     return Opcodes.T_INT;
        case LONG:    return Opcodes.T_LONG;
        case FLOAT:   return Opcodes.T_FLOAT;
        case DOUBLE:  return Opcodes.T_DOUBLE;
        case OBJECT:  return 0; // in place of Opcodes.T_OBJECT
        default:      throw new InternalError();
    }
}
 
Example 11
Source File: GeneratorAdapter.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Generates the instruction to create a new array.
 *
 * @param type
 *            the type of the array elements.
 */
public void newArray(final Type type) {
    int typ;
    switch (type.getSort()) {
    case Type.BOOLEAN:
        typ = Opcodes.T_BOOLEAN;
        break;
    case Type.CHAR:
        typ = Opcodes.T_CHAR;
        break;
    case Type.BYTE:
        typ = Opcodes.T_BYTE;
        break;
    case Type.SHORT:
        typ = Opcodes.T_SHORT;
        break;
    case Type.INT:
        typ = Opcodes.T_INT;
        break;
    case Type.FLOAT:
        typ = Opcodes.T_FLOAT;
        break;
    case Type.LONG:
        typ = Opcodes.T_LONG;
        break;
    case Type.DOUBLE:
        typ = Opcodes.T_DOUBLE;
        break;
    default:
        typeInsn(Opcodes.ANEWARRAY, type);
        return;
    }
    mv.visitIntInsn(Opcodes.NEWARRAY, typ);
}
 
Example 12
Source File: InstructionAdapter.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
public void newarray(final Type type) {
    int typ;
    switch (type.getSort()) {
        case Type.BOOLEAN:
            typ = Opcodes.T_BOOLEAN;
            break;
        case Type.CHAR:
            typ = Opcodes.T_CHAR;
            break;
        case Type.BYTE:
            typ = Opcodes.T_BYTE;
            break;
        case Type.SHORT:
            typ = Opcodes.T_SHORT;
            break;
        case Type.INT:
            typ = Opcodes.T_INT;
            break;
        case Type.FLOAT:
            typ = Opcodes.T_FLOAT;
            break;
        case Type.LONG:
            typ = Opcodes.T_LONG;
            break;
        case Type.DOUBLE:
            typ = Opcodes.T_DOUBLE;
            break;
        default:
            mv.visitTypeInsn(Opcodes.ANEWARRAY, type.getInternalName());
            return;
    }
    mv.visitIntInsn(Opcodes.NEWARRAY, typ);
}
 
Example 13
Source File: InstructionAdapter.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void newarray(final Type type) {
    int typ;
    switch (type.getSort()) {
    case Type.BOOLEAN:
        typ = Opcodes.T_BOOLEAN;
        break;
    case Type.CHAR:
        typ = Opcodes.T_CHAR;
        break;
    case Type.BYTE:
        typ = Opcodes.T_BYTE;
        break;
    case Type.SHORT:
        typ = Opcodes.T_SHORT;
        break;
    case Type.INT:
        typ = Opcodes.T_INT;
        break;
    case Type.FLOAT:
        typ = Opcodes.T_FLOAT;
        break;
    case Type.LONG:
        typ = Opcodes.T_LONG;
        break;
    case Type.DOUBLE:
        typ = Opcodes.T_DOUBLE;
        break;
    default:
        mv.visitTypeInsn(Opcodes.ANEWARRAY, type.getInternalName());
        return;
    }
    mv.visitIntInsn(Opcodes.NEWARRAY, typ);
}
 
Example 14
Source File: GeneratorAdapter.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Generates the instruction to create a new array.
 *
 * @param type
 *            the type of the array elements.
 */
public void newArray(final Type type) {
    int typ;
    switch (type.getSort()) {
    case Type.BOOLEAN:
        typ = Opcodes.T_BOOLEAN;
        break;
    case Type.CHAR:
        typ = Opcodes.T_CHAR;
        break;
    case Type.BYTE:
        typ = Opcodes.T_BYTE;
        break;
    case Type.SHORT:
        typ = Opcodes.T_SHORT;
        break;
    case Type.INT:
        typ = Opcodes.T_INT;
        break;
    case Type.FLOAT:
        typ = Opcodes.T_FLOAT;
        break;
    case Type.LONG:
        typ = Opcodes.T_LONG;
        break;
    case Type.DOUBLE:
        typ = Opcodes.T_DOUBLE;
        break;
    default:
        typeInsn(Opcodes.ANEWARRAY, type);
        return;
    }
    mv.visitIntInsn(Opcodes.NEWARRAY, typ);
}
 
Example 15
Source File: InstructionAdapter.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void newarray(final Type type) {
    int typ;
    switch (type.getSort()) {
    case Type.BOOLEAN:
        typ = Opcodes.T_BOOLEAN;
        break;
    case Type.CHAR:
        typ = Opcodes.T_CHAR;
        break;
    case Type.BYTE:
        typ = Opcodes.T_BYTE;
        break;
    case Type.SHORT:
        typ = Opcodes.T_SHORT;
        break;
    case Type.INT:
        typ = Opcodes.T_INT;
        break;
    case Type.FLOAT:
        typ = Opcodes.T_FLOAT;
        break;
    case Type.LONG:
        typ = Opcodes.T_LONG;
        break;
    case Type.DOUBLE:
        typ = Opcodes.T_DOUBLE;
        break;
    default:
        mv.visitTypeInsn(Opcodes.ANEWARRAY, type.getInternalName());
        return;
    }
    mv.visitIntInsn(Opcodes.NEWARRAY, typ);
}
 
Example 16
Source File: InstructionAdapter.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void newarray(final Type type) {
    int typ;
    switch (type.getSort()) {
    case Type.BOOLEAN:
        typ = Opcodes.T_BOOLEAN;
        break;
    case Type.CHAR:
        typ = Opcodes.T_CHAR;
        break;
    case Type.BYTE:
        typ = Opcodes.T_BYTE;
        break;
    case Type.SHORT:
        typ = Opcodes.T_SHORT;
        break;
    case Type.INT:
        typ = Opcodes.T_INT;
        break;
    case Type.FLOAT:
        typ = Opcodes.T_FLOAT;
        break;
    case Type.LONG:
        typ = Opcodes.T_LONG;
        break;
    case Type.DOUBLE:
        typ = Opcodes.T_DOUBLE;
        break;
    default:
        mv.visitTypeInsn(Opcodes.ANEWARRAY, type.getInternalName());
        return;
    }
    mv.visitIntInsn(Opcodes.NEWARRAY, typ);
}
 
Example 17
Source File: InstructionAdapter.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visitIntInsn(final int opcode, final int operand) {
    switch (opcode) {
    case Opcodes.BIPUSH:
        iconst(operand);
        break;
    case Opcodes.SIPUSH:
        iconst(operand);
        break;
    case Opcodes.NEWARRAY:
        switch (operand) {
        case Opcodes.T_BOOLEAN:
            newarray(Type.BOOLEAN_TYPE);
            break;
        case Opcodes.T_CHAR:
            newarray(Type.CHAR_TYPE);
            break;
        case Opcodes.T_BYTE:
            newarray(Type.BYTE_TYPE);
            break;
        case Opcodes.T_SHORT:
            newarray(Type.SHORT_TYPE);
            break;
        case Opcodes.T_INT:
            newarray(Type.INT_TYPE);
            break;
        case Opcodes.T_FLOAT:
            newarray(Type.FLOAT_TYPE);
            break;
        case Opcodes.T_LONG:
            newarray(Type.LONG_TYPE);
            break;
        case Opcodes.T_DOUBLE:
            newarray(Type.DOUBLE_TYPE);
            break;
        default:
            throw new IllegalArgumentException();
        }
        break;
    default:
        throw new IllegalArgumentException();
    }
}
 
Example 18
Source File: InstructionAdapter.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visitIntInsn(final int opcode, final int operand) {
    switch (opcode) {
    case Opcodes.BIPUSH:
        iconst(operand);
        break;
    case Opcodes.SIPUSH:
        iconst(operand);
        break;
    case Opcodes.NEWARRAY:
        switch (operand) {
        case Opcodes.T_BOOLEAN:
            newarray(Type.BOOLEAN_TYPE);
            break;
        case Opcodes.T_CHAR:
            newarray(Type.CHAR_TYPE);
            break;
        case Opcodes.T_BYTE:
            newarray(Type.BYTE_TYPE);
            break;
        case Opcodes.T_SHORT:
            newarray(Type.SHORT_TYPE);
            break;
        case Opcodes.T_INT:
            newarray(Type.INT_TYPE);
            break;
        case Opcodes.T_FLOAT:
            newarray(Type.FLOAT_TYPE);
            break;
        case Opcodes.T_LONG:
            newarray(Type.LONG_TYPE);
            break;
        case Opcodes.T_DOUBLE:
            newarray(Type.DOUBLE_TYPE);
            break;
        default:
            throw new IllegalArgumentException();
        }
        break;
    default:
        throw new IllegalArgumentException();
    }
}
 
Example 19
Source File: InstructionAdapter.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visitIntInsn(final int opcode, final int operand) {
    switch (opcode) {
    case Opcodes.BIPUSH:
        iconst(operand);
        break;
    case Opcodes.SIPUSH:
        iconst(operand);
        break;
    case Opcodes.NEWARRAY:
        switch (operand) {
        case Opcodes.T_BOOLEAN:
            newarray(Type.BOOLEAN_TYPE);
            break;
        case Opcodes.T_CHAR:
            newarray(Type.CHAR_TYPE);
            break;
        case Opcodes.T_BYTE:
            newarray(Type.BYTE_TYPE);
            break;
        case Opcodes.T_SHORT:
            newarray(Type.SHORT_TYPE);
            break;
        case Opcodes.T_INT:
            newarray(Type.INT_TYPE);
            break;
        case Opcodes.T_FLOAT:
            newarray(Type.FLOAT_TYPE);
            break;
        case Opcodes.T_LONG:
            newarray(Type.LONG_TYPE);
            break;
        case Opcodes.T_DOUBLE:
            newarray(Type.DOUBLE_TYPE);
            break;
        default:
            throw new IllegalArgumentException();
        }
        break;
    default:
        throw new IllegalArgumentException();
    }
}
 
Example 20
Source File: InstructionAdapter.java    From nashorn with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void visitIntInsn(final int opcode, final int operand) {
    switch (opcode) {
        case Opcodes.BIPUSH:
            iconst(operand);
            break;
        case Opcodes.SIPUSH:
            iconst(operand);
            break;
        case Opcodes.NEWARRAY:
            switch (operand) {
                case Opcodes.T_BOOLEAN:
                    newarray(Type.BOOLEAN_TYPE);
                    break;
                case Opcodes.T_CHAR:
                    newarray(Type.CHAR_TYPE);
                    break;
                case Opcodes.T_BYTE:
                    newarray(Type.BYTE_TYPE);
                    break;
                case Opcodes.T_SHORT:
                    newarray(Type.SHORT_TYPE);
                    break;
                case Opcodes.T_INT:
                    newarray(Type.INT_TYPE);
                    break;
                case Opcodes.T_FLOAT:
                    newarray(Type.FLOAT_TYPE);
                    break;
                case Opcodes.T_LONG:
                    newarray(Type.LONG_TYPE);
                    break;
                case Opcodes.T_DOUBLE:
                    newarray(Type.DOUBLE_TYPE);
                    break;
                default:
                    throw new IllegalArgumentException();
            }
            break;
        default:
            throw new IllegalArgumentException();
    }
}