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


Java Constant类代码示例

本文整理汇总了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");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:AMD64ControlFlow.java

示例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;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:KlassPointerStamp.java

示例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());
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:ConvertDeoptimizeToGuardPhase.java

示例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;
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:SwitchStrategy.java

示例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();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:AArch64MoveFactory.java

示例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();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:XorNode.java

示例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();
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:SPARCMove.java

示例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);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:MethodPointerStamp.java

示例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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:UnsignedMulHighNode.java

示例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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:IntegerMulHighNode.java

示例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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:AMD64BinaryConsumer.java

示例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);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:AMD64HotSpotStrategySwitchOp.java

示例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);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:HotSpotCompressionNode.java

示例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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:AMD64HotSpotLIRGenerator.java

示例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);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:LIRGenerator.java


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