本文整理汇总了Java中jdk.vm.ci.meta.PrimitiveConstant类的典型用法代码示例。如果您正苦于以下问题:Java PrimitiveConstant类的具体用法?Java PrimitiveConstant怎么用?Java PrimitiveConstant使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PrimitiveConstant类属于jdk.vm.ci.meta包,在下文中一共展示了PrimitiveConstant类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: emitCCall
import jdk.vm.ci.meta.PrimitiveConstant; //导入依赖的package包/类
@Override
public void emitCCall(long address, CallingConvention nativeCallingConvention, Value[] args, int numberOfFloatingPointArguments) {
Value[] argLocations = new Value[args.length];
getResult().getFrameMapBuilder().callsMethod(nativeCallingConvention);
// TODO(mg): in case a native function uses floating point varargs, the ABI requires that
// RAX contains the length of the varargs
PrimitiveConstant intConst = JavaConstant.forInt(numberOfFloatingPointArguments);
AllocatableValue numberOfFloatingPointArgumentsRegister = AMD64.rax.asValue(LIRKind.value(AMD64Kind.DWORD));
emitMoveConstant(numberOfFloatingPointArgumentsRegister, intConst);
for (int i = 0; i < args.length; i++) {
Value arg = args[i];
AllocatableValue loc = nativeCallingConvention.getArgument(i);
emitMove(loc, arg);
argLocations[i] = loc;
}
Value ptr = emitLoadConstant(LIRKind.value(AMD64Kind.QWORD), JavaConstant.forLong(address));
append(new AMD64CCall(nativeCallingConvention.getReturn(), ptr, numberOfFloatingPointArgumentsRegister, argLocations));
}
示例2: canonical
import jdk.vm.ci.meta.PrimitiveConstant; //导入依赖的package包/类
private static ValueNode canonical(XorNode self, BinaryOp<Xor> op, Stamp stamp, ValueNode forX, ValueNode forY) {
if (GraphUtil.unproxify(forX) == GraphUtil.unproxify(forY)) {
return ConstantNode.forPrimitive(stamp, op.getZero(forX.stamp()));
}
if (forX.isConstant() && !forY.isConstant()) {
return new XorNode(forY, forX);
}
if (forY.isConstant()) {
Constant c = forY.asConstant();
if (op.isNeutral(c)) {
return forX;
}
if (c instanceof PrimitiveConstant && ((PrimitiveConstant) c).getJavaKind().isNumericInteger()) {
long rawY = ((PrimitiveConstant) c).asLong();
long mask = CodeUtil.mask(PrimitiveStamp.getBits(stamp));
if ((rawY & mask) == mask) {
return new NotNode(forX);
}
}
return reassociate(self != null ? self : (XorNode) new XorNode(forX, forY).maybeCommuteInputs(), ValueNode.isConstantPredicate(), forX, forY);
}
return self != null ? self : new XorNode(forX, forY).maybeCommuteInputs();
}
示例3: updateAlignedDisjoint
import jdk.vm.ci.meta.PrimitiveConstant; //导入依赖的package包/类
public void updateAlignedDisjoint() {
JavaKind componentKind = elementKind;
if (srcPos == destPos) {
// Can treat as disjoint
disjoint = true;
}
PrimitiveConstant constantSrc = (PrimitiveConstant) srcPos.stamp().asConstant();
PrimitiveConstant constantDst = (PrimitiveConstant) destPos.stamp().asConstant();
if (constantSrc != null && constantDst != null) {
if (!aligned) {
aligned = isHeapWordAligned(constantSrc, componentKind) && isHeapWordAligned(constantDst, componentKind);
}
if (constantSrc.asInt() >= constantDst.asInt()) {
// low to high copy so treat as disjoint
disjoint = true;
}
}
}
示例4: canonical
import jdk.vm.ci.meta.PrimitiveConstant; //导入依赖的package包/类
private static ValueNode canonical(UnsignedMulHighNode self, ValueNode forY) {
if (forY.isConstant()) {
Constant c = forY.asConstant();
if (c instanceof PrimitiveConstant && ((PrimitiveConstant) c).getJavaKind().isNumericInteger()) {
long i = ((PrimitiveConstant) c).asLong();
if (i == 0 || i == 1) {
return ConstantNode.forIntegerStamp(self.stamp(), 0);
}
}
}
return self;
}
示例5: canonical
import jdk.vm.ci.meta.PrimitiveConstant; //导入依赖的package包/类
private static ValueNode canonical(IntegerMulHighNode self, ValueNode forY) {
if (forY.isConstant()) {
Constant c = forY.asConstant();
if (c instanceof PrimitiveConstant && ((PrimitiveConstant) c).getJavaKind().isNumericInteger()) {
long i = ((PrimitiveConstant) c).asLong();
if (i == 0 || i == 1) {
return ConstantNode.forIntegerStamp(self.stamp(), 0);
}
}
}
return self;
}
示例6: isCompatible
import jdk.vm.ci.meta.PrimitiveConstant; //导入依赖的package包/类
@Override
public boolean isCompatible(Constant constant) {
if (constant instanceof PrimitiveConstant) {
PrimitiveConstant prim = (PrimitiveConstant) constant;
return prim.getJavaKind().isNumericFloat();
}
return false;
}
示例7: constant
import jdk.vm.ci.meta.PrimitiveConstant; //导入依赖的package包/类
@Override
public Stamp constant(Constant c, MetaAccessProvider meta) {
if (c instanceof PrimitiveConstant) {
long value = ((PrimitiveConstant) c).asLong();
return StampFactory.forInteger(getBits(), value, value);
}
return this;
}
示例8: isCompatible
import jdk.vm.ci.meta.PrimitiveConstant; //导入依赖的package包/类
@Override
public boolean isCompatible(Constant constant) {
if (constant instanceof PrimitiveConstant) {
PrimitiveConstant prim = (PrimitiveConstant) constant;
return prim.getJavaKind().isNumericInteger();
}
return false;
}
示例9: isCompatible
import jdk.vm.ci.meta.PrimitiveConstant; //导入依赖的package包/类
@Override
public boolean isCompatible(Constant constant) {
if (constant instanceof PrimitiveConstant) {
PrimitiveConstant prim = (PrimitiveConstant) constant;
return prim.getJavaKind() == JavaKind.Illegal;
}
return false;
}
示例10: isCompatible
import jdk.vm.ci.meta.PrimitiveConstant; //导入依赖的package包/类
@Override
public boolean isCompatible(Constant constant) {
if (constant instanceof PrimitiveConstant) {
return ((PrimitiveConstant) constant).getJavaKind().isNumericInteger();
} else {
return constant instanceof DataPointerConstant;
}
}
示例11: generate
import jdk.vm.ci.meta.PrimitiveConstant; //导入依赖的package包/类
@Override
public void generate(LIRGeneratorTool gen) {
FrameMapBuilder frameMapBuilder = gen.getResult().getFrameMapBuilder();
// create slots
PrimitiveConstant constantValue = JavaConstant.forBoxedPrimitive(primitive);
VirtualStackSlot s1 = frameMapBuilder.allocateSpillSlot(LIRKind.fromJavaKind(gen.target().arch, constantValue.getJavaKind()));
// move stuff around
gen.emitMoveConstant(s1, constantValue);
gen.emitBlackhole(s1);
setResult(gen.emitMove(s1));
}
示例12: canonical
import jdk.vm.ci.meta.PrimitiveConstant; //导入依赖的package包/类
private static ValueNode canonical(AndNode self, BinaryOp<And> op, Stamp stamp, ValueNode forX, ValueNode forY) {
if (GraphUtil.unproxify(forX) == GraphUtil.unproxify(forY)) {
return forX;
}
if (forX.isConstant() && !forY.isConstant()) {
return new AndNode(forY, forX);
}
if (forY.isConstant()) {
Constant c = forY.asConstant();
if (op.isNeutral(c)) {
return forX;
}
if (c instanceof PrimitiveConstant && ((PrimitiveConstant) c).getJavaKind().isNumericInteger()) {
long rawY = ((PrimitiveConstant) c).asLong();
long mask = CodeUtil.mask(PrimitiveStamp.getBits(stamp));
if ((rawY & mask) == 0) {
return ConstantNode.forIntegerStamp(stamp, 0);
}
if (forX instanceof SignExtendNode) {
SignExtendNode ext = (SignExtendNode) forX;
if (rawY == ((1L << ext.getInputBits()) - 1)) {
return new ZeroExtendNode(ext.getValue(), ext.getResultBits());
}
}
IntegerStamp xStamp = (IntegerStamp) forX.stamp();
if (((xStamp.upMask() | xStamp.downMask()) & ~rawY) == 0) {
// No bits are set which are outside the mask, so the mask will have no effect.
return forX;
}
}
return reassociate(self != null ? self : (AndNode) new AndNode(forX, forY).maybeCommuteInputs(), ValueNode.isConstantPredicate(), forX, forY);
}
if (forX instanceof NotNode && forY instanceof NotNode) {
return new NotNode(OrNode.create(((NotNode) forX).getValue(), ((NotNode) forY).getValue()));
}
return self != null ? self : new AndNode(forX, forY).maybeCommuteInputs();
}
示例13: 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();
}
}
示例14: canonical
import jdk.vm.ci.meta.PrimitiveConstant; //导入依赖的package包/类
private static ValueNode canonical(DivNode self, BinaryOp<Div> op, ValueNode forX, ValueNode forY) {
if (forY.isConstant()) {
Constant c = forY.asConstant();
if (op.isNeutral(c)) {
return forX;
}
if (c instanceof PrimitiveConstant && ((PrimitiveConstant) c).getJavaKind().isNumericInteger()) {
long i = ((PrimitiveConstant) c).asLong();
boolean signFlip = false;
if (i < 0) {
i = -i;
signFlip = true;
}
ValueNode divResult = null;
if (CodeUtil.isPowerOf2(i)) {
divResult = new RightShiftNode(forX, ConstantNode.forInt(CodeUtil.log2(i)));
}
if (divResult != null) {
if (signFlip) {
return NegateNode.create(divResult);
} else {
return divResult;
}
}
}
}
return self != null ? self : new DivNode(forX, forY);
}
示例15: canonical
import jdk.vm.ci.meta.PrimitiveConstant; //导入依赖的package包/类
private static ValueNode canonical(OrNode self, BinaryOp<Or> op, Stamp stamp, ValueNode forX, ValueNode forY) {
if (GraphUtil.unproxify(forX) == GraphUtil.unproxify(forY)) {
return forX;
}
if (forX.isConstant() && !forY.isConstant()) {
return new OrNode(forY, forX);
}
if (forY.isConstant()) {
Constant c = forY.asConstant();
if (op.isNeutral(c)) {
return forX;
}
if (c instanceof PrimitiveConstant && ((PrimitiveConstant) c).getJavaKind().isNumericInteger()) {
long rawY = ((PrimitiveConstant) c).asLong();
long mask = CodeUtil.mask(PrimitiveStamp.getBits(stamp));
if ((rawY & mask) == mask) {
return ConstantNode.forIntegerStamp(stamp, mask);
}
}
return reassociate(self != null ? self : (OrNode) new OrNode(forX, forY).maybeCommuteInputs(), ValueNode.isConstantPredicate(), forX, forY);
}
if (forX instanceof NotNode && forY instanceof NotNode) {
return new NotNode(AndNode.create(((NotNode) forX).getValue(), ((NotNode) forY).getValue()));
}
return self != null ? self : new OrNode(forX, forY).maybeCommuteInputs();
}