当前位置: 首页>>代码示例>>Java>>正文


Java InstructionAdapter.pop方法代码示例

本文整理汇总了Java中jdk.internal.org.objectweb.asm.commons.InstructionAdapter.pop方法的典型用法代码示例。如果您正苦于以下问题:Java InstructionAdapter.pop方法的具体用法?Java InstructionAdapter.pop怎么用?Java InstructionAdapter.pop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jdk.internal.org.objectweb.asm.commons.InstructionAdapter的用法示例。


在下文中一共展示了InstructionAdapter.pop方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertReturnValue

import jdk.internal.org.objectweb.asm.commons.InstructionAdapter; //导入方法依赖的package包/类
private static void convertReturnValue(final InstructionAdapter mv, final Class<?> origReturnType) {
    if (origReturnType == void.class) {
        mv.pop();
    } else if (origReturnType == Object.class) {
        // Must hide ConsString (and potentially other internal Nashorn types) from callers
        EXPORT_RETURN_VALUE.invoke(mv);
    } else if (origReturnType == byte.class) {
        mv.visitInsn(I2B);
    } else if (origReturnType == short.class) {
        mv.visitInsn(I2S);
    } else if (origReturnType == float.class) {
        mv.visitInsn(D2F);
    } else if (origReturnType == char.class) {
        TO_CHAR_PRIMITIVE.invoke(mv);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:JavaAdapterBytecodeGenerator.java

示例2: invokeGetGlobalWithNullCheck

import jdk.internal.org.objectweb.asm.commons.InstructionAdapter; //导入方法依赖的package包/类
private static void invokeGetGlobalWithNullCheck(final InstructionAdapter mv) {
    invokeGetGlobal(mv);
    mv.dup();
    mv.invokevirtual(OBJECT_TYPE_NAME, "getClass", GET_CLASS_METHOD_DESCRIPTOR, false); // check against null Context
    mv.pop();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:7,代码来源:JavaAdapterBytecodeGenerator.java

示例3: convertReturnValue

import jdk.internal.org.objectweb.asm.commons.InstructionAdapter; //导入方法依赖的package包/类
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));
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:57,代码来源:JavaAdapterBytecodeGenerator.java

示例4: invokeGetGlobalWithNullCheck

import jdk.internal.org.objectweb.asm.commons.InstructionAdapter; //导入方法依赖的package包/类
private static void invokeGetGlobalWithNullCheck(final InstructionAdapter mv) {
    invokeGetGlobal(mv);
    mv.dup();
    mv.invokevirtual(OBJECT_TYPE_NAME, "getClass", GET_CLASS_METHOD_DESCRIPTOR); // check against null Context
    mv.pop();
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:7,代码来源:JavaAdapterBytecodeGenerator.java


注:本文中的jdk.internal.org.objectweb.asm.commons.InstructionAdapter.pop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。