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

The following examples show how to use jdk.internal.org.objectweb.asm.Type#VOID . 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: BasicInterpreter.java    From jdk8u-dev-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 2
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 3
Source File: GeneratorAdapter.java    From openjdk-8-source 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 4
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 5
Source File: BasicInterpreter.java    From nashorn 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 6
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 7
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 8
Source File: GeneratorAdapter.java    From jdk8u-dev-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 9
Source File: BasicInterpreter.java    From hottub 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 10
Source File: GeneratorAdapter.java    From openjdk-8 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 11
Source File: GeneratorAdapter.java    From dragonwell8_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 12
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 13
Source File: GeneratorAdapter.java    From openjdk-jdk8u 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 14
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 15
Source File: GeneratorAdapter.java    From jdk8u60 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 16
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 17
Source File: BasicInterpreter.java    From TencentKona-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 18
Source File: GeneratorAdapter.java    From TencentKona-8 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 19
Source File: BasicInterpreter.java    From dragonwell8_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 20
Source File: JavaAdapterBytecodeGenerator.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private void convertReturnValue(final InstructionAdapter mv, final Class<?> returnType, final Type asmReturnType) {
    switch(asmReturnType.getSort()) {
    case Type.VOID:
        mv.pop();
        break;
    case Type.BOOLEAN:
        JSType.TO_BOOLEAN.invoke(mv);
        break;
    case Type.BYTE:
        JSType.TO_INT32.invoke(mv);
        mv.visitInsn(Opcodes.I2B);
        break;
    case Type.SHORT:
        JSType.TO_INT32.invoke(mv);
        mv.visitInsn(Opcodes.I2S);
        break;
    case Type.CHAR:
        // JSType doesn't have a TO_CHAR, so we have services supply us one.
        mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "toCharPrimitive", TO_CHAR_PRIMITIVE_METHOD_DESCRIPTOR, false);
        break;
    case Type.INT:
        JSType.TO_INT32.invoke(mv);
        break;
    case Type.LONG:
        JSType.TO_LONG.invoke(mv);
        break;
    case Type.FLOAT:
        JSType.TO_NUMBER.invoke(mv);
        mv.visitInsn(Opcodes.D2F);
        break;
    case Type.DOUBLE:
        JSType.TO_NUMBER.invoke(mv);
        break;
    default:
        if(asmReturnType.equals(OBJECT_TYPE)) {
            // Must hide ConsString (and potentially other internal Nashorn types) from callers
            mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "exportReturnValue", EXPORT_RETURN_VALUE_METHOD_DESCRIPTOR, false);
        } else if(asmReturnType.equals(STRING_TYPE)){
            // Well-known conversion to String. Not using the JSType one as we want to preserve null as null instead
            // of the string "n,u,l,l".
            mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "toString", TO_STRING_METHOD_DESCRIPTOR, false);
        } else {
            // Invoke converter method handle for everything else. Note that we could have just added an asType or
            // filterReturnValue to the invoked handle instead, but then every instance would have the function
            // method handle wrapped in a separate converter method handle, making handle.invokeExact() megamorphic.
            if(classOverride) {
                mv.getstatic(generatedClassName, converterFields.get(returnType), METHOD_HANDLE_TYPE_DESCRIPTOR);
            } else {
                mv.visitVarInsn(ALOAD, 0);
                mv.getfield(generatedClassName, converterFields.get(returnType), METHOD_HANDLE_TYPE_DESCRIPTOR);
            }
            mv.swap();
            emitInvokeExact(mv, MethodType.methodType(returnType, Object.class));
        }
    }
}