本文整理汇总了Java中jdk.vm.ci.meta.PrimitiveConstant.asLong方法的典型用法代码示例。如果您正苦于以下问题:Java PrimitiveConstant.asLong方法的具体用法?Java PrimitiveConstant.asLong怎么用?Java PrimitiveConstant.asLong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jdk.vm.ci.meta.PrimitiveConstant
的用法示例。
在下文中一共展示了PrimitiveConstant.asLong方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: optimizeNormalizeCompare
import jdk.vm.ci.meta.PrimitiveConstant; //导入方法依赖的package包/类
@Override
protected LogicNode optimizeNormalizeCompare(ConstantReflectionProvider constantReflection, MetaAccessProvider metaAccess, OptionValues options, Integer smallestCompareWidth,
Constant constant, NormalizeCompareNode normalizeNode, boolean mirrored) {
PrimitiveConstant primitive = (PrimitiveConstant) constant;
ValueNode a = normalizeNode.getX();
ValueNode b = normalizeNode.getY();
long cst = primitive.asLong();
if (cst == 0) {
if (normalizeNode.getX().getStackKind() == JavaKind.Double || normalizeNode.getX().getStackKind() == JavaKind.Float) {
return FloatEqualsNode.create(constantReflection, metaAccess, options, smallestCompareWidth, a, b);
} else {
return IntegerEqualsNode.create(constantReflection, metaAccess, options, smallestCompareWidth, a, b);
}
} else if (cst == 1) {
if (normalizeNode.getX().getStackKind() == JavaKind.Double || normalizeNode.getX().getStackKind() == JavaKind.Float) {
return FloatLessThanNode.create(b, a, !normalizeNode.isUnorderedLess);
} else {
return IntegerLessThanNode.create(constantReflection, metaAccess, options, smallestCompareWidth, b, a);
}
} else if (cst == -1) {
if (normalizeNode.getX().getStackKind() == JavaKind.Double || normalizeNode.getX().getStackKind() == JavaKind.Float) {
return FloatLessThanNode.create(a, b, normalizeNode.isUnorderedLess);
} else {
return IntegerLessThanNode.create(constantReflection, metaAccess, options, smallestCompareWidth, a, b);
}
} else {
return LogicConstantNode.contradiction();
}
}
示例2: asRawPointer
import jdk.vm.ci.meta.PrimitiveConstant; //导入方法依赖的package包/类
private static long asRawPointer(Constant base) {
if (base instanceof HotSpotMetaspaceConstantImpl) {
MetaspaceWrapperObject meta = HotSpotMetaspaceConstantImpl.getMetaspaceObject(base);
return meta.getMetaspacePointer();
} else if (base instanceof PrimitiveConstant) {
PrimitiveConstant prim = (PrimitiveConstant) base;
if (prim.getJavaKind().isNumericInteger()) {
return prim.asLong();
}
}
throw new IllegalArgumentException(String.valueOf(base));
}