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


Java JavaConstant.forFloat方法代码示例

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


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

示例1: zapValueForKind

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Override
protected JavaConstant zapValueForKind(PlatformKind kind) {
    long dead = 0xDEADDEADDEADDEADL;
    switch ((SPARCKind) kind) {
        case BYTE:
            return JavaConstant.forByte((byte) dead);
        case HWORD:
            return JavaConstant.forShort((short) dead);
        case WORD:
            return JavaConstant.forInt((int) dead);
        case XWORD:
            return JavaConstant.forLong(dead);
        case SINGLE:
        case V32_BYTE:
        case V32_HWORD:
            return JavaConstant.forFloat(Float.intBitsToFloat((int) dead));
        case DOUBLE:
        case V64_BYTE:
        case V64_HWORD:
        case V64_WORD:
            return JavaConstant.forDouble(Double.longBitsToDouble(dead));
        default:
            throw new IllegalArgumentException(kind.toString());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:SPARCLIRGenerator.java

示例2: zapValueForKind

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Override
protected JavaConstant zapValueForKind(PlatformKind kind) {
    long dead = 0xDEADDEADDEADDEADL;
    switch ((AArch64Kind) kind) {
        case BYTE:
            return JavaConstant.forByte((byte) dead);
        case WORD:
            return JavaConstant.forShort((short) dead);
        case DWORD:
            return JavaConstant.forInt((int) dead);
        case QWORD:
            return JavaConstant.forLong(dead);
        case SINGLE:
            return JavaConstant.forFloat(Float.intBitsToFloat((int) dead));
        case DOUBLE:
            return JavaConstant.forDouble(Double.longBitsToDouble(dead));
        default:
            throw GraalError.shouldNotReachHere();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:AArch64LIRGenerator.java

示例3: zapValueForKind

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Override
protected JavaConstant zapValueForKind(PlatformKind kind) {
    long dead = 0xDEADDEADDEADDEADL;
    switch ((AMD64Kind) kind) {
        case BYTE:
            return JavaConstant.forByte((byte) dead);
        case WORD:
            return JavaConstant.forShort((short) dead);
        case DWORD:
            return JavaConstant.forInt((int) dead);
        case QWORD:
            return JavaConstant.forLong(dead);
        case SINGLE:
            return JavaConstant.forFloat(Float.intBitsToFloat((int) dead));
        default:
            // we don't support vector types, so just zap with double for all of them
            return JavaConstant.forDouble(Double.longBitsToDouble(dead));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:AMD64LIRGenerator.java

示例4: readConstant

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
static final ClassfileConstant readConstant(DataInputStream stream) throws IOException {
    byte tag = stream.readByte();

    switch (tag) {
        case ClassfileConstant.CONSTANT_Class:
            return new ClassfileConstant.ClassRef(stream);
        case ClassfileConstant.CONSTANT_Fieldref:
            return new ClassfileConstant.FieldRef(stream);
        case ClassfileConstant.CONSTANT_Methodref:
            return new ClassfileConstant.MethodRef(stream);
        case ClassfileConstant.CONSTANT_InterfaceMethodref:
            return new ClassfileConstant.InterfaceMethodRef(stream);
        case ClassfileConstant.CONSTANT_String:
            return new ClassfileConstant.StringRef(stream);
        case ClassfileConstant.CONSTANT_Integer:
            return new ClassfileConstant.Primitive(tag, JavaConstant.forInt(stream.readInt()));
        case ClassfileConstant.CONSTANT_Float:
            return new ClassfileConstant.Primitive(tag, JavaConstant.forFloat(stream.readFloat()));
        case ClassfileConstant.CONSTANT_Long:
            return new ClassfileConstant.Primitive(tag, JavaConstant.forLong(stream.readLong()));
        case ClassfileConstant.CONSTANT_Double:
            return new ClassfileConstant.Primitive(tag, JavaConstant.forDouble(stream.readDouble()));
        case ClassfileConstant.CONSTANT_NameAndType:
            return new ClassfileConstant.NameAndType(stream);
        case ClassfileConstant.CONSTANT_Utf8:
            return new ClassfileConstant.Utf8(stream.readUTF());
        case ClassfileConstant.CONSTANT_MethodHandle:
            skipFully(stream, 3); // reference_kind, reference_index
            return new ClassfileConstant.Unsupported(tag, "CONSTANT_MethodHandle_info");
        case ClassfileConstant.CONSTANT_MethodType:
            skipFully(stream, 2); // descriptor_index
            return new ClassfileConstant.Unsupported(tag, "CONSTANT_MethodType_info");
        case ClassfileConstant.CONSTANT_InvokeDynamic:
            skipFully(stream, 4); // bootstrap_method_attr_index, name_and_type_index
            return new ClassfileConstant.Unsupported(tag, "CONSTANT_InvokeDynamic_info");
        default:
            throw new GraalError("Invalid constant pool tag: " + tag);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:40,代码来源:ClassfileConstantPool.java

示例5: deserialize

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Override
public SerializableConstant deserialize(ByteBuffer buffer) {
    switch (getBits()) {
        case 32:
            return JavaConstant.forFloat(buffer.getFloat());
        case 64:
            return JavaConstant.forDouble(buffer.getDouble());
        default:
            throw GraalError.shouldNotReachHere();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:FloatStamp.java

示例6: asConstant

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Override
public JavaConstant asConstant() {
    if (nonNaN && Double.compare(lowerBound, upperBound) == 0) {
        switch (getBits()) {
            case 32:
                return JavaConstant.forFloat((float) lowerBound);
            case 64:
                return JavaConstant.forDouble(lowerBound);
        }
    }
    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:FloatStamp.java

示例7: testFloat

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Test
public void testFloat() {
    float[] a = new float[]{Float.MIN_VALUE, Float.MIN_VALUE + 1, -1, 0, 1, Float.MAX_VALUE - 1, Float.MAX_VALUE};
    for (float i : a) {
        ConstantNode node = ConstantNode.forFloat(i, graph);
        JavaConstant expected = JavaConstant.forFloat(-i);
        assertEquals(expected, ArithmeticOpTable.forStamp(node.stamp()).getNeg().foldConstant(node.asConstant()));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:NegateNodeCanonicalizationTest.java

示例8: readPrimitiveConstant

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Override
public JavaConstant readPrimitiveConstant(JavaKind kind, Constant baseConstant, long initialDisplacement, int bits) {
    try {
        long rawValue = readRawValue(baseConstant, initialDisplacement, kind, bits);
        switch (kind) {
            case Boolean:
                return JavaConstant.forBoolean(rawValue != 0);
            case Byte:
                return JavaConstant.forByte((byte) rawValue);
            case Char:
                return JavaConstant.forChar((char) rawValue);
            case Short:
                return JavaConstant.forShort((short) rawValue);
            case Int:
                return JavaConstant.forInt((int) rawValue);
            case Long:
                return JavaConstant.forLong(rawValue);
            case Float:
                return JavaConstant.forFloat(Float.intBitsToFloat((int) rawValue));
            case Double:
                return JavaConstant.forDouble(Double.longBitsToDouble(rawValue));
            default:
                throw new IllegalArgumentException("Unsupported kind: " + kind);
        }
    } catch (NullPointerException e) {
        return null;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:HotSpotMemoryAccessProviderImpl.java

示例9: isEmbeddableDataProvider

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@DataProvider(name = "isEmbeddableDataProvider")
public static Object[][] isEmbeddableDataProvider() {
    return new Object[][]{{JavaConstant.forBoolean(DUMMY_CLASS_INSTANCE.booleanField), true},
                    {JavaConstant.forByte(DUMMY_CLASS_INSTANCE.byteField), true},
                    {JavaConstant.forShort(DUMMY_CLASS_INSTANCE.shortField), true},
                    {JavaConstant.forInt(DUMMY_CLASS_INSTANCE.intField), true},
                    {JavaConstant.forLong(DUMMY_CLASS_INSTANCE.longField), true},
                    {JavaConstant.forChar(DUMMY_CLASS_INSTANCE.charField), true},
                    {JavaConstant.forFloat(DUMMY_CLASS_INSTANCE.floatField), true},
                    {JavaConstant.forDouble(DUMMY_CLASS_INSTANCE.doubleField), true},
                    {CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectField), true},
                    {JavaConstant.NULL_POINTER, true}, {null, true}};
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:IsEmbeddableDataProvider.java

示例10: testConstFloat

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Test
public void testConstFloat() {
    DebugInfoCompiler compiler = (asm, values) -> {
        values[0] = JavaConstant.forFloat(42.0f);
        return null;
    };
    testFloatOnStack(compiler);
    testFloatInLocal(compiler);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:SimpleDebugInfoTest.java


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