Java Code Examples for jdk.internal.org.objectweb.asm.Type#CHAR

The following examples show how to use jdk.internal.org.objectweb.asm.Type#CHAR . 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: GeneratorAdapter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private static Type getBoxedType(final Type type) {
    switch (type.getSort()) {
    case Type.BYTE:
        return BYTE_TYPE;
    case Type.BOOLEAN:
        return BOOLEAN_TYPE;
    case Type.SHORT:
        return SHORT_TYPE;
    case Type.CHAR:
        return CHARACTER_TYPE;
    case Type.INT:
        return INTEGER_TYPE;
    case Type.FLOAT:
        return FLOAT_TYPE;
    case Type.LONG:
        return LONG_TYPE;
    case Type.DOUBLE:
        return DOUBLE_TYPE;
    }
    return type;
}
 
Example 2
Source File: GeneratorAdapter.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static Type getBoxedType(final Type type) {
    switch (type.getSort()) {
    case Type.BYTE:
        return BYTE_TYPE;
    case Type.BOOLEAN:
        return BOOLEAN_TYPE;
    case Type.SHORT:
        return SHORT_TYPE;
    case Type.CHAR:
        return CHARACTER_TYPE;
    case Type.INT:
        return INTEGER_TYPE;
    case Type.FLOAT:
        return FLOAT_TYPE;
    case Type.LONG:
        return LONG_TYPE;
    case Type.DOUBLE:
        return DOUBLE_TYPE;
    }
    return type;
}
 
Example 3
Source File: GeneratorAdapter.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static Type getBoxedType(final Type type) {
    switch (type.getSort()) {
    case Type.BYTE:
        return BYTE_TYPE;
    case Type.BOOLEAN:
        return BOOLEAN_TYPE;
    case Type.SHORT:
        return SHORT_TYPE;
    case Type.CHAR:
        return CHARACTER_TYPE;
    case Type.INT:
        return INTEGER_TYPE;
    case Type.FLOAT:
        return FLOAT_TYPE;
    case Type.LONG:
        return LONG_TYPE;
    case Type.DOUBLE:
        return DOUBLE_TYPE;
    }
    return type;
}
 
Example 4
Source File: GeneratorAdapter.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Generates the instructions to unbox the top stack value. This value is
 * replaced by its unboxed equivalent on top of the stack.
 *
 * @param type
 *            the type of the top stack value.
 */
public void unbox(final Type type) {
    Type t = NUMBER_TYPE;
    Method sig = null;
    switch (type.getSort()) {
    case Type.VOID:
        return;
    case Type.CHAR:
        t = CHARACTER_TYPE;
        sig = CHAR_VALUE;
        break;
    case Type.BOOLEAN:
        t = BOOLEAN_TYPE;
        sig = BOOLEAN_VALUE;
        break;
    case Type.DOUBLE:
        sig = DOUBLE_VALUE;
        break;
    case Type.FLOAT:
        sig = FLOAT_VALUE;
        break;
    case Type.LONG:
        sig = LONG_VALUE;
        break;
    case Type.INT:
    case Type.SHORT:
    case Type.BYTE:
        sig = INT_VALUE;
    }
    if (sig == null) {
        checkCast(type);
    } else {
        checkCast(t);
        invokeVirtual(t, sig);
    }
}
 
Example 5
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 6
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 7
Source File: LocalVariablesSorter.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new local variable of the given type.
 *
 * @param type
 *            the type of the local variable to be created.
 * @return the identifier of the newly created local variable.
 */
public int newLocal(final Type type) {
    Object t;
    switch (type.getSort()) {
    case Type.BOOLEAN:
    case Type.CHAR:
    case Type.BYTE:
    case Type.SHORT:
    case Type.INT:
        t = Opcodes.INTEGER;
        break;
    case Type.FLOAT:
        t = Opcodes.FLOAT;
        break;
    case Type.LONG:
        t = Opcodes.LONG;
        break;
    case Type.DOUBLE:
        t = Opcodes.DOUBLE;
        break;
    case Type.ARRAY:
        t = type.getDescriptor();
        break;
    // case Type.OBJECT:
    default:
        t = type.getInternalName();
        break;
    }
    int local = newLocalMapping(type);
    setLocalType(local, type);
    setFrameLocal(local, t);
    changed = true;
    return local;
}
 
Example 8
Source File: GeneratorAdapter.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
  * Generates the instructions to unbox the top stack value. This value is replaced by its unboxed
  * equivalent on top of the stack.
  *
  * @param type the type of the top stack value.
  */
public void unbox(final Type type) {
    Type boxedType = NUMBER_TYPE;
    Method unboxMethod;
    switch (type.getSort()) {
        case Type.VOID:
            return;
        case Type.CHAR:
            boxedType = CHARACTER_TYPE;
            unboxMethod = CHAR_VALUE;
            break;
        case Type.BOOLEAN:
            boxedType = BOOLEAN_TYPE;
            unboxMethod = BOOLEAN_VALUE;
            break;
        case Type.DOUBLE:
            unboxMethod = DOUBLE_VALUE;
            break;
        case Type.FLOAT:
            unboxMethod = FLOAT_VALUE;
            break;
        case Type.LONG:
            unboxMethod = LONG_VALUE;
            break;
        case Type.INT:
        case Type.SHORT:
        case Type.BYTE:
            unboxMethod = INT_VALUE;
            break;
        default:
            unboxMethod = null;
            break;
    }
    if (unboxMethod == null) {
        checkCast(type);
    } else {
        checkCast(boxedType);
        invokeVirtual(boxedType, unboxMethod);
    }
}
 
Example 9
Source File: LocalVariablesSorter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new local variable of the given type.
 *
 * @param type
 *            the type of the local variable to be created.
 * @return the identifier of the newly created local variable.
 */
public int newLocal(final Type type) {
    Object t;
    switch (type.getSort()) {
    case Type.BOOLEAN:
    case Type.CHAR:
    case Type.BYTE:
    case Type.SHORT:
    case Type.INT:
        t = Opcodes.INTEGER;
        break;
    case Type.FLOAT:
        t = Opcodes.FLOAT;
        break;
    case Type.LONG:
        t = Opcodes.LONG;
        break;
    case Type.DOUBLE:
        t = Opcodes.DOUBLE;
        break;
    case Type.ARRAY:
        t = type.getDescriptor();
        break;
    // case Type.OBJECT:
    default:
        t = type.getInternalName();
        break;
    }
    int local = newLocalMapping(type);
    setLocalType(local, type);
    setFrameLocal(local, t);
    changed = true;
    return local;
}
 
Example 10
Source File: LocalVariablesSorter.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new local variable of the given type.
 *
 * @param type
 *            the type of the local variable to be created.
 * @return the identifier of the newly created local variable.
 */
public int newLocal(final Type type) {
    Object t;
    switch (type.getSort()) {
    case Type.BOOLEAN:
    case Type.CHAR:
    case Type.BYTE:
    case Type.SHORT:
    case Type.INT:
        t = Opcodes.INTEGER;
        break;
    case Type.FLOAT:
        t = Opcodes.FLOAT;
        break;
    case Type.LONG:
        t = Opcodes.LONG;
        break;
    case Type.DOUBLE:
        t = Opcodes.DOUBLE;
        break;
    case Type.ARRAY:
        t = type.getDescriptor();
        break;
    // case Type.OBJECT:
    default:
        t = type.getInternalName();
        break;
    }
    int local = newLocalMapping(type);
    setLocalType(local, type);
    setFrameLocal(local, t);
    changed = true;
    return local;
}
 
Example 11
Source File: BasicInterpreter.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public BasicValue newValue(final Type type) {
    if (type == null) {
        return BasicValue.UNINITIALIZED_VALUE;
    }
    switch (type.getSort()) {
    case Type.VOID:
        return null;
    case Type.BOOLEAN:
    case Type.CHAR:
    case Type.BYTE:
    case Type.SHORT:
    case Type.INT:
        return BasicValue.INT_VALUE;
    case Type.FLOAT:
        return BasicValue.FLOAT_VALUE;
    case Type.LONG:
        return BasicValue.LONG_VALUE;
    case Type.DOUBLE:
        return BasicValue.DOUBLE_VALUE;
    case Type.ARRAY:
    case Type.OBJECT:
        return BasicValue.REFERENCE_VALUE;
    default:
        throw new Error("Internal error");
    }
}
 
Example 12
Source File: LocalVariablesSorter.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new local variable of the given type.
 *
 * @param type
 *            the type of the local variable to be created.
 * @return the identifier of the newly created local variable.
 */
public int newLocal(final Type type) {
    Object t;
    switch (type.getSort()) {
    case Type.BOOLEAN:
    case Type.CHAR:
    case Type.BYTE:
    case Type.SHORT:
    case Type.INT:
        t = Opcodes.INTEGER;
        break;
    case Type.FLOAT:
        t = Opcodes.FLOAT;
        break;
    case Type.LONG:
        t = Opcodes.LONG;
        break;
    case Type.DOUBLE:
        t = Opcodes.DOUBLE;
        break;
    case Type.ARRAY:
        t = type.getDescriptor();
        break;
    // case Type.OBJECT:
    default:
        t = type.getInternalName();
        break;
    }
    int local = newLocalMapping(type);
    setLocalType(local, type);
    setFrameLocal(local, t);
    changed = true;
    return local;
}
 
Example 13
Source File: BasicInterpreter.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public BasicValue newValue(final Type type) {
    if (type == null) {
        return BasicValue.UNINITIALIZED_VALUE;
    }
    switch (type.getSort()) {
    case Type.VOID:
        return null;
    case Type.BOOLEAN:
    case Type.CHAR:
    case Type.BYTE:
    case Type.SHORT:
    case Type.INT:
        return BasicValue.INT_VALUE;
    case Type.FLOAT:
        return BasicValue.FLOAT_VALUE;
    case Type.LONG:
        return BasicValue.LONG_VALUE;
    case Type.DOUBLE:
        return BasicValue.DOUBLE_VALUE;
    case Type.ARRAY:
    case Type.OBJECT:
        return BasicValue.REFERENCE_VALUE;
    default:
        throw new Error("Internal error");
    }
}
 
Example 14
Source File: InstructionAdapter.java    From openjdk-jdk9 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 15
Source File: SimpleVerifier.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public BasicValue newValue(final Type type) {
    if (type == null) {
        return BasicValue.UNINITIALIZED_VALUE;
    }

    boolean isArray = type.getSort() == Type.ARRAY;
    if (isArray) {
        switch (type.getElementType().getSort()) {
        case Type.BOOLEAN:
        case Type.CHAR:
        case Type.BYTE:
        case Type.SHORT:
            return new BasicValue(type);
        }
    }

    BasicValue v = super.newValue(type);
    if (BasicValue.REFERENCE_VALUE.equals(v)) {
        if (isArray) {
            v = newValue(type.getElementType());
            String desc = v.getType().getDescriptor();
            for (int i = 0; i < type.getDimensions(); ++i) {
                desc = '[' + desc;
            }
            v = new BasicValue(Type.getType(desc));
        } else {
            v = new BasicValue(type);
        }
    }
    return v;
}
 
Example 16
Source File: GeneratorAdapter.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
  * Generates the instruction to push the given value on the stack.
  *
  * @param value the value to be pushed on the stack.
  */
public void push(final Type value) {
    if (value == null) {
        mv.visitInsn(Opcodes.ACONST_NULL);
    } else {
        switch (value.getSort()) {
            case Type.BOOLEAN:
                mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Boolean", "TYPE", CLASS_DESCRIPTOR);
                break;
            case Type.CHAR:
                mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Character", "TYPE", CLASS_DESCRIPTOR);
                break;
            case Type.BYTE:
                mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Byte", "TYPE", CLASS_DESCRIPTOR);
                break;
            case Type.SHORT:
                mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Short", "TYPE", CLASS_DESCRIPTOR);
                break;
            case Type.INT:
                mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Integer", "TYPE", CLASS_DESCRIPTOR);
                break;
            case Type.FLOAT:
                mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Float", "TYPE", CLASS_DESCRIPTOR);
                break;
            case Type.LONG:
                mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Long", "TYPE", CLASS_DESCRIPTOR);
                break;
            case Type.DOUBLE:
                mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/Double", "TYPE", CLASS_DESCRIPTOR);
                break;
            default:
                mv.visitLdcInsn(value);
                break;
        }
    }
}
 
Example 17
Source File: GeneratorAdapter.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Generates the instructions to unbox the top stack value. This value is
 * replaced by its unboxed equivalent on top of the stack.
 *
 * @param type
 *            the type of the top stack value.
 */
public void unbox(final Type type) {
    Type t = NUMBER_TYPE;
    Method sig = null;
    switch (type.getSort()) {
    case Type.VOID:
        return;
    case Type.CHAR:
        t = CHARACTER_TYPE;
        sig = CHAR_VALUE;
        break;
    case Type.BOOLEAN:
        t = BOOLEAN_TYPE;
        sig = BOOLEAN_VALUE;
        break;
    case Type.DOUBLE:
        sig = DOUBLE_VALUE;
        break;
    case Type.FLOAT:
        sig = FLOAT_VALUE;
        break;
    case Type.LONG:
        sig = LONG_VALUE;
        break;
    case Type.INT:
    case Type.SHORT:
    case Type.BYTE:
        sig = INT_VALUE;
    }
    if (sig == null) {
        checkCast(type);
    } else {
        checkCast(t);
        invokeVirtual(t, sig);
    }
}
 
Example 18
Source File: BasicInterpreter.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public BasicValue newValue(final Type type) {
    if (type == null) {
        return BasicValue.UNINITIALIZED_VALUE;
    }
    switch (type.getSort()) {
    case Type.VOID:
        return null;
    case Type.BOOLEAN:
    case Type.CHAR:
    case Type.BYTE:
    case Type.SHORT:
    case Type.INT:
        return BasicValue.INT_VALUE;
    case Type.FLOAT:
        return BasicValue.FLOAT_VALUE;
    case Type.LONG:
        return BasicValue.LONG_VALUE;
    case Type.DOUBLE:
        return BasicValue.DOUBLE_VALUE;
    case Type.ARRAY:
    case Type.OBJECT:
        return BasicValue.REFERENCE_VALUE;
    default:
        throw new Error("Internal error");
    }
}
 
Example 19
Source File: BasicInterpreter.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public BasicValue newValue(final Type type) {
    if (type == null) {
        return BasicValue.UNINITIALIZED_VALUE;
    }
    switch (type.getSort()) {
    case Type.VOID:
        return null;
    case Type.BOOLEAN:
    case Type.CHAR:
    case Type.BYTE:
    case Type.SHORT:
    case Type.INT:
        return BasicValue.INT_VALUE;
    case Type.FLOAT:
        return BasicValue.FLOAT_VALUE;
    case Type.LONG:
        return BasicValue.LONG_VALUE;
    case Type.DOUBLE:
        return BasicValue.DOUBLE_VALUE;
    case Type.ARRAY:
    case Type.OBJECT:
        return BasicValue.REFERENCE_VALUE;
    default:
        throw new Error("Internal error");
    }
}
 
Example 20
Source File: GeneratorAdapter.java    From nashorn with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Generates the instruction to push the given value on the stack.
 *
 * @param value the value to be pushed on the stack.
 */
public void push(final Type value) {
    if (value == null) {
        mv.visitInsn(Opcodes.ACONST_NULL);
    } else {
        switch (value.getSort()) {
            case Type.BOOLEAN:
                mv.visitFieldInsn(Opcodes.GETSTATIC,
                        "java/lang/Boolean",
                        "TYPE",
                        CLDESC);
                break;
            case Type.CHAR:
                mv.visitFieldInsn(Opcodes.GETSTATIC,
                        "java/lang/Character",
                        "TYPE",
                        CLDESC);
                break;
            case Type.BYTE:
                mv.visitFieldInsn(Opcodes.GETSTATIC,
                        "java/lang/Byte",
                        "TYPE",
                        CLDESC);
                break;
            case Type.SHORT:
                mv.visitFieldInsn(Opcodes.GETSTATIC,
                        "java/lang/Short",
                        "TYPE",
                        CLDESC);
                break;
            case Type.INT:
                mv.visitFieldInsn(Opcodes.GETSTATIC,
                        "java/lang/Integer",
                        "TYPE",
                        CLDESC);
                break;
            case Type.FLOAT:
                mv.visitFieldInsn(Opcodes.GETSTATIC,
                        "java/lang/Float",
                        "TYPE",
                        CLDESC);
                break;
            case Type.LONG:
                mv.visitFieldInsn(Opcodes.GETSTATIC,
                        "java/lang/Long",
                        "TYPE",
                        CLDESC);
                break;
            case Type.DOUBLE:
                mv.visitFieldInsn(Opcodes.GETSTATIC,
                        "java/lang/Double",
                        "TYPE",
                        CLDESC);
                break;
            default:
                mv.visitLdcInsn(value);
        }
    }
}