本文整理汇总了Java中jdk.vm.ci.meta.Constant类的典型用法代码示例。如果您正苦于以下问题:Java Constant类的具体用法?Java Constant怎么用?Java Constant使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Constant类属于jdk.vm.ci.meta包,在下文中一共展示了Constant类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: emitComparison
import jdk.vm.ci.meta.Constant; //导入依赖的package包/类
protected void emitComparison(Constant c) {
JavaConstant jc = (JavaConstant) c;
switch (jc.getJavaKind()) {
case Int:
long lc = jc.asLong();
assert NumUtil.isInt(lc);
masm.cmpl(keyRegister, (int) lc);
break;
case Long:
masm.cmpq(keyRegister, (AMD64Address) crb.asLongConstRef(jc));
break;
case Object:
AMD64Move.const2reg(crb, masm, asRegister(scratch), jc);
masm.cmpptr(keyRegister, asRegister(scratch));
break;
default:
throw new GraalError("switch only supported for int, long and object");
}
}
示例2: constant
import jdk.vm.ci.meta.Constant; //导入依赖的package包/类
@Override
public Stamp constant(Constant c, MetaAccessProvider meta) {
if (isCompressed()) {
if (HotSpotCompressedNullConstant.COMPRESSED_NULL.equals(c)) {
return new KlassPointerStamp(false, true, encoding);
}
} else {
if (JavaConstant.NULL_POINTER.equals(c)) {
return KLASS_ALWAYS_NULL;
}
}
assert c instanceof HotSpotMetaspaceConstant;
assert ((HotSpotMetaspaceConstant) c).isCompressed() == isCompressed();
if (nonNull()) {
return this;
}
if (isCompressed()) {
return new KlassPointerStamp(true, false, encoding);
} else {
return KLASS_NON_NULL;
}
}
示例3: processFixedGuardAndMerge
import jdk.vm.ci.meta.Constant; //导入依赖的package包/类
private void processFixedGuardAndMerge(FixedGuardNode fixedGuard, PhaseContext context, CompareNode compare, ValueNode x, ValuePhiNode xPhi, ValueNode y, ValuePhiNode yPhi,
AbstractMergeNode merge) {
List<EndNode> mergePredecessors = merge.cfgPredecessors().snapshot();
for (int i = 0; i < mergePredecessors.size(); ++i) {
AbstractEndNode mergePredecessor = mergePredecessors.get(i);
if (!mergePredecessor.isAlive()) {
break;
}
Constant xs;
if (xPhi == null) {
xs = x.asConstant();
} else {
xs = xPhi.valueAt(mergePredecessor).asConstant();
}
Constant ys;
if (yPhi == null) {
ys = y.asConstant();
} else {
ys = yPhi.valueAt(mergePredecessor).asConstant();
}
if (xs != null && ys != null && compare.condition().foldCondition(xs, ys, context.getConstantReflection(), compare.unorderedIsTrue()) == fixedGuard.isNegated()) {
visitDeoptBegin(AbstractBeginNode.prevBegin(mergePredecessor), fixedGuard.getAction(), fixedGuard.getReason(), fixedGuard.getSpeculation(), fixedGuard.graph(), context.getLowerer());
}
}
}
示例4: SequentialStrategy
import jdk.vm.ci.meta.Constant; //导入依赖的package包/类
public SequentialStrategy(final double[] keyProbabilities, Constant[] keyConstants) {
super(keyProbabilities);
assert keyProbabilities.length == keyConstants.length;
this.keyConstants = keyConstants;
int keyCount = keyConstants.length;
indexes = new Integer[keyCount];
for (int i = 0; i < keyCount; i++) {
indexes[i] = i;
}
Arrays.sort(indexes, new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
return keyProbabilities[o1] < keyProbabilities[o2] ? 1 : keyProbabilities[o1] > keyProbabilities[o2] ? -1 : 0;
}
});
}
示例5: createLoad
import jdk.vm.ci.meta.Constant; //导入依赖的package包/类
@Override
public LIRInstruction createLoad(AllocatableValue dst, Constant src) {
if (src instanceof JavaConstant) {
JavaConstant javaConstant = (JavaConstant) src;
if (canInlineConstant(javaConstant)) {
return new AArch64Move.LoadInlineConstant(javaConstant, dst);
} else {
// return new AArch64Move.LoadConstantFromTable(javaConstant,
// constantTableBaseProvider.getConstantTableBase(), dst);
return new AArch64Move.LoadInlineConstant(javaConstant, dst);
}
} else if (src instanceof DataPointerConstant) {
return new AArch64Move.LoadDataOp(dst, (DataPointerConstant) src);
} else {
// throw GraalError.shouldNotReachHere(src.getClass().toString());
throw GraalError.unimplemented();
}
}
示例6: canonical
import jdk.vm.ci.meta.Constant; //导入依赖的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();
}
示例7: loadFromConstantTable
import jdk.vm.ci.meta.Constant; //导入依赖的package包/类
/**
* This method creates a load from the constant section. It automatically respects the different
* patterns used for small constant sections (<8k) and large constant sections (>=8k). The
* generated patterns by this method must be understood by
* CodeInstaller::pd_patch_DataSectionReference (jvmciCodeInstaller_sparc.cpp).
*/
public static void loadFromConstantTable(CompilationResultBuilder crb, SPARCMacroAssembler masm, int byteCount, Register constantTableBase, Constant input, Register dest,
SPARCDelayedControlTransfer delaySlotInstruction) {
SPARCAddress address;
ScratchRegister scratch = null;
try {
if (masm.isImmediateConstantLoad()) {
address = new SPARCAddress(constantTableBase, 0);
// Make delayed only, when using immediate constant load.
delaySlotInstruction.emitControlTransfer(crb, masm);
crb.recordDataReferenceInCode(input, byteCount);
} else {
scratch = masm.getScratchRegister();
Register sr = scratch.getRegister();
crb.recordDataReferenceInCode(input, byteCount);
masm.sethix(0, sr, true);
address = new SPARCAddress(sr, 0);
}
masm.ld(address, dest, byteCount, false);
} finally {
if (scratch != null) {
scratch.close();
}
}
}
示例8: isCompatible
import jdk.vm.ci.meta.Constant; //导入依赖的package包/类
@Override
public boolean isCompatible(Constant constant) {
if (constant instanceof HotSpotMetaspaceConstant) {
return ((HotSpotMetaspaceConstant) constant).asResolvedJavaMethod() != null;
} else {
return super.isCompatible(constant);
}
}
示例9: canonical
import jdk.vm.ci.meta.Constant; //导入依赖的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;
}
示例10: canonical
import jdk.vm.ci.meta.Constant; //导入依赖的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;
}
示例11: DataOp
import jdk.vm.ci.meta.Constant; //导入依赖的package包/类
public DataOp(AMD64RMOp opcode, OperandSize size, AllocatableValue x, Constant y, int alignment) {
super(TYPE);
this.opcode = opcode;
this.size = size;
this.x = x;
this.y = y;
this.alignment = alignment;
}
示例12: emitComparison
import jdk.vm.ci.meta.Constant; //导入依赖的package包/类
@Override
protected void emitComparison(Constant c) {
if (c instanceof HotSpotMetaspaceConstant) {
HotSpotMetaspaceConstant meta = (HotSpotMetaspaceConstant) c;
if (meta.isCompressed()) {
crb.recordInlineDataInCode(meta);
masm.cmpl(keyRegister, 0xDEADDEAD);
} else {
AMD64Address addr = (AMD64Address) crb.recordDataReferenceInCode(meta, 8);
masm.cmpq(keyRegister, addr);
}
} else {
super.emitComparison(c);
}
}
示例13: compress
import jdk.vm.ci.meta.Constant; //导入依赖的package包/类
@Override
protected Constant compress(Constant c) {
if (JavaConstant.NULL_POINTER.equals(c)) {
return HotSpotCompressedNullConstant.COMPRESSED_NULL;
} else if (c instanceof HotSpotConstant) {
return ((HotSpotConstant) c).compress();
} else {
throw GraalError.shouldNotReachHere("invalid constant input for compress op: " + c);
}
}
示例14: emitLoadObjectAddress
import jdk.vm.ci.meta.Constant; //导入依赖的package包/类
@Override
public Value emitLoadObjectAddress(Constant constant) {
HotSpotObjectConstant objectConstant = (HotSpotObjectConstant) constant;
LIRKind kind = objectConstant.isCompressed() ? getLIRKindTool().getNarrowOopKind() : getLIRKindTool().getObjectKind();
Variable result = newVariable(kind);
append(new AMD64HotSpotLoadAddressOp(result, constant, HotSpotConstantLoadAction.RESOLVE));
return result;
}
示例15: emitConstant
import jdk.vm.ci.meta.Constant; //导入依赖的package包/类
@Override
public Value emitConstant(LIRKind kind, Constant constant) {
if (moveFactory.canInlineConstant(constant)) {
return new ConstantValue(toRegisterKind(kind), constant);
} else {
return emitLoadConstant(kind, constant);
}
}