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


Java JavaConstant.forDouble方法代码示例

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


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

示例1: doubleTest

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Test
public void doubleTest() {
    CodeGenTest test = new CodeGenTest() {

        @Override
        public byte[] generateCode(CompilationResult compResult, TargetDescription target, RegisterConfig registerConfig, CallingConvention cc) {
            AMD64MacroAssembler asm = new AMD64MacroAssembler(target);
            Register ret = registerConfig.getReturnRegister(JavaKind.Double);
            Data data = new SerializableData(JavaConstant.forDouble(84.72), 8);
            DataSectionReference ref = compResult.getDataSection().insertData(data);
            compResult.recordDataPatch(asm.position(), ref);
            asm.movdbl(ret, asm.getPlaceholder(-1));
            asm.ret(0);
            return asm.close(true);
        }
    };
    assertReturn("doubleStub", test, 84.72);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:SimpleAssemblerTest.java

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: testDouble

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

示例9: 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

示例10: 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


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