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


Java JavaConstant.isNull方法代码示例

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


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

示例1: canMoveConst2Stack

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
public static boolean canMoveConst2Stack(JavaConstant input) {
    switch (input.getJavaKind().getStackKind()) {
        case Int:
            break;
        case Long:
            break;
        case Float:
            break;
        case Double:
            break;
        case Object:
            if (input.isNull()) {
                return true;
            } else {
                return false;
            }
        default:
            return false;
    }
    return true;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:AMD64Move.java

示例2: isInstanceTest

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Test
public void isInstanceTest() {
    for (ConstantValue cv : constants()) {
        JavaConstant c = cv.value;
        if (c.getJavaKind() == JavaKind.Object && !c.isNull()) {
            ResolvedJavaType cType = metaAccess.lookupJavaType(c);
            for (ResolvedJavaType t : javaTypes) {
                if (t.isAssignableFrom(cType)) {
                    assertTrue(t.isInstance(c));
                } else {
                    assertFalse(t.isInstance(c));
                }
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:TestResolvedJavaType.java

示例3: canInlineConstant

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Override
public boolean canInlineConstant(Constant con) {
    if (con instanceof JavaConstant) {
        JavaConstant c = (JavaConstant) con;
        switch (c.getJavaKind()) {
            case Boolean:
            case Byte:
            case Char:
            case Short:
            case Int:
                return SPARCAssembler.isSimm13(c.asInt());
            case Long:
                return SPARCAssembler.isSimm13(c.asLong());
            case Object:
                return c.isNull();
            default:
                return false;
        }
    }
    return false;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:SPARCMoveFactory.java

示例4: isSimm13

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
public static boolean isSimm13(JavaConstant constant) {
    long bits;
    switch (constant.getJavaKind()) {
        case Double:
            bits = Double.doubleToRawLongBits(constant.asDouble());
            break;
        case Float:
            bits = Float.floatToRawIntBits(constant.asFloat());
            break;
        case Object:
            return constant.isNull();
        default:
            bits = constant.asLong();
            break;
    }
    return constant.isNull() || isSimm13(bits);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:SPARCAssembler.java

示例5: emitCompareMemoryConOp

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
protected boolean emitCompareMemoryConOp(OperandSize size, ConstantValue a, AMD64AddressValue b, LIRFrameState state) {
    if (JavaConstant.isNull(a.getConstant())) {
        append(new AMD64BinaryConsumer.MemoryConstOp(CMP, size, b, 0, state));
        return true;
    } else if (a.getConstant() instanceof VMConstant && size == DWORD) {
        VMConstant vc = (VMConstant) a.getConstant();
        append(new AMD64BinaryConsumer.MemoryVMConstOp(CMP.getMIOpcode(size, false), b, vc, state));
        return true;
    } else {
        long value = a.getJavaConstant().asLong();
        if (NumUtil.is32bit(value)) {
            append(new AMD64BinaryConsumer.MemoryConstOp(CMP, size, b, (int) value, state));
            return true;
        } else {
            return emitCompareRegMemoryOp(size, asAllocatable(a), b, state);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:AMD64LIRGenerator.java

示例6: const2stack

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
private static void const2stack(CompilationResultBuilder crb, AArch64MacroAssembler masm, Value result, JavaConstant constant) {
    try (ScratchRegister addrReg = masm.getScratchRegister()) {
        StackSlot slot = (StackSlot) result;
        AArch64Address resultAddress = loadStackSlotAddress(crb, masm, slot, addrReg.getRegister());
        if (constant.isDefaultForKind() || constant.isNull()) {
            emitStore(crb, masm, (AArch64Kind) result.getPlatformKind(), resultAddress, zr.asValue(LIRKind.combine(result)));
        } else {
            try (ScratchRegister sc = masm.getScratchRegister()) {
                Value scratchRegisterValue = sc.getRegister().asValue(LIRKind.combine(result));
                const2reg(crb, masm, scratchRegisterValue, constant);
                emitStore(crb, masm, (AArch64Kind) result.getPlatformKind(), resultAddress, scratchRegisterValue);
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:AArch64Move.java

示例7: asObject

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Override
public <T> T asObject(Class<T> type, JavaConstant constant) {
    if (constant.isNull()) {
        return null;
    }
    HotSpotObjectConstant hsConstant = (HotSpotObjectConstant) constant;
    return hsConstant.asObject(type);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:HotSpotSnippetReflectionProvider.java

示例8: loadSimm13

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
public Value loadSimm13(Value value) {
    if (isJavaConstant(value)) {
        JavaConstant c = asJavaConstant(value);
        if (c.isNull() || SPARCAssembler.isSimm13(c)) {
            return value;
        }
    }
    return load(value);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:SPARCLIRGenerator.java

示例9: forConstant

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
public static Stamp forConstant(JavaConstant value) {
    JavaKind kind = value.getJavaKind();
    switch (kind) {
        case Boolean:
        case Byte:
        case Char:
        case Short:
        case Int:
        case Long:
            long mask = value.asLong() & CodeUtil.mask(kind.getBitCount());
            return forInteger(kind.getStackKind(), value.asLong(), value.asLong(), mask, mask);
        case Float:
            return forFloat(kind, value.asFloat(), value.asFloat(), !Float.isNaN(value.asFloat()));
        case Double:
            return forFloat(kind, value.asDouble(), value.asDouble(), !Double.isNaN(value.asDouble()));
        case Illegal:
            return forKind(JavaKind.Illegal);
        case Object:
            if (value.isNull()) {
                return alwaysNull();
            } else {
                return objectNonNull();
            }
        default:
            throw new GraalError("unexpected kind: %s", kind);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:StampFactory.java

示例10: isArithmeticConstant

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
protected static boolean isArithmeticConstant(JavaConstant constValue) {
    switch (constValue.getJavaKind()) {
        case Int:
        case Long:
            return AArch64MacroAssembler.isArithmeticImmediate(constValue.asLong());
        case Object:
            return constValue.isNull();
        default:
            return false;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:AArch64ArithmeticLIRGenerator.java

示例11: unboxPrimitive

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Override
public JavaConstant unboxPrimitive(JavaConstant source) {
    if (source == null || !source.getJavaKind().isObject()) {
        return null;
    }
    if (source.isNull()) {
        return null;
    }
    return JavaConstant.forBoxedPrimitive(((HotSpotObjectConstantImpl) source).object());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:HotSpotConstantReflectionProvider.java

示例12: asBoxedValue

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
static Object asBoxedValue(Constant constant) {
    if (JavaConstant.isNull(constant)) {
        return null;
    } else if (constant instanceof HotSpotObjectConstantImpl) {
        return ((HotSpotObjectConstantImpl) constant).object;
    } else {
        return ((JavaConstant) constant).asBoxedPrimitive();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:HotSpotObjectConstantImpl.java

示例13: canStoreConstant

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
/**
 * Checks whether the supplied constant can be used without loading it into a register for store
 * operations, i.e., on the right hand side of a memory access.
 *
 * @param c The constant to check.
 * @return True if the constant can be used directly, false if the constant needs to be in a
 *         register.
 */
protected static final boolean canStoreConstant(JavaConstant c) {
    // there is no immediate move of 64-bit constants on Intel
    switch (c.getJavaKind()) {
        case Long:
            return NumUtil.isInt(c.asLong());
        case Double:
            return false;
        case Object:
            return c.isNull();
        default:
            return true;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:AMD64LIRGenerator.java

示例14: lookupJavaTypeConstantTest

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Test
public void lookupJavaTypeConstantTest() {
    for (ConstantValue cv : constants()) {
        JavaConstant c = cv.value;
        if (c.getJavaKind() == JavaKind.Object && !c.isNull()) {
            Object o = cv.boxed;
            ResolvedJavaType type = metaAccess.lookupJavaType(c);
            assertNotNull(type);
            assertTrue(type.equals(metaAccess.lookupJavaType(o.getClass())));
        } else {
            assertEquals(metaAccess.lookupJavaType(c), null);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:TestMetaAccessProvider.java

示例15: const2reg

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
private static void const2reg(CompilationResultBuilder crb, AArch64MacroAssembler masm, Value result, JavaConstant input) {
    Register dst = asRegister(result);
    switch (input.getJavaKind().getStackKind()) {
        case Int:
            final int value = input.asInt();
            int maskedValue;
            switch (input.getJavaKind()) {
                case Boolean:
                case Byte:
                    maskedValue = value & 0xFF;
                    break;
                case Char:
                case Short:
                    maskedValue = value & 0xFFFF;
                    break;
                case Int:
                    maskedValue = value;
                    break;
                default:
                    throw GraalError.shouldNotReachHere();
            }
            masm.mov(dst, maskedValue);
            break;
        case Long:
            masm.mov(dst, input.asLong());
            break;
        case Float:
            if (AArch64MacroAssembler.isFloatImmediate(input.asFloat())) {
                masm.fmov(32, dst, input.asFloat());
            } else {
                masm.fldr(32, dst, (AArch64Address) crb.asFloatConstRef(input));
            }
            break;
        case Double:
            if (AArch64MacroAssembler.isDoubleImmediate(input.asDouble())) {
                masm.fmov(64, dst, input.asDouble());
            } else {
                masm.fldr(64, dst, (AArch64Address) crb.asDoubleConstRef(input));
            }
            break;
        case Object:
            if (input.isNull()) {
                masm.mov(dst, 0);
            } else if (crb.target.inlineObjects) {
                crb.recordInlineDataInCode(input);
                masm.movNativeAddress(dst, 0xDEADDEADDEADDEADL);
            } else {
                masm.ldr(64, dst, (AArch64Address) crb.recordDataReferenceInCode(input, 8));
            }
            break;
        default:
            throw GraalError.shouldNotReachHere("kind=" + input.getJavaKind().getStackKind());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:55,代码来源:AArch64Move.java


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