Search in sources :

Example 6 with HotSpotObjectConstant

use of jdk.vm.ci.hotspot.HotSpotObjectConstant in project graal by oracle.

the class SPARCHotSpotLIRGenerator method emitCompare.

@Override
protected boolean emitCompare(SPARCKind cmpKind, Value a, Value b) {
    Value localA = a;
    Value localB = b;
    if (isConstantValue(a)) {
        Constant c = asConstant(a);
        if (HotSpotCompressedNullConstant.COMPRESSED_NULL.equals(c)) {
            localA = SPARC.g0.asValue(LIRKind.value(WORD));
        } else if (c instanceof HotSpotObjectConstant) {
            localA = load(localA);
        }
    }
    if (isConstantValue(b)) {
        Constant c = asConstant(b);
        if (HotSpotCompressedNullConstant.COMPRESSED_NULL.equals(c)) {
            localB = SPARC.g0.asValue(LIRKind.value(WORD));
        } else if (c instanceof HotSpotObjectConstant) {
            localB = load(localB);
        }
    }
    return super.emitCompare(cmpKind, localA, localB);
}
Also used : Constant(jdk.vm.ci.meta.Constant) JavaConstant(jdk.vm.ci.meta.JavaConstant) HotSpotCompressedNullConstant(jdk.vm.ci.hotspot.HotSpotCompressedNullConstant) HotSpotObjectConstant(jdk.vm.ci.hotspot.HotSpotObjectConstant) LIRValueUtil.asConstant(org.graalvm.compiler.lir.LIRValueUtil.asConstant) LIRValueUtil.isConstantValue(org.graalvm.compiler.lir.LIRValueUtil.isConstantValue) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) SPARCImmediateAddressValue(org.graalvm.compiler.lir.sparc.SPARCImmediateAddressValue) RegisterValue(jdk.vm.ci.code.RegisterValue) SPARCAddressValue(org.graalvm.compiler.lir.sparc.SPARCAddressValue) HotSpotObjectConstant(jdk.vm.ci.hotspot.HotSpotObjectConstant)

Example 7 with HotSpotObjectConstant

use of jdk.vm.ci.hotspot.HotSpotObjectConstant in project graal by oracle.

the class AMD64HotSpotLIRGenerator method emitLoadObjectAddress.

@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;
}
Also used : Variable(org.graalvm.compiler.lir.Variable) LIRKind(org.graalvm.compiler.core.common.LIRKind) HotSpotObjectConstant(jdk.vm.ci.hotspot.HotSpotObjectConstant)

Example 8 with HotSpotObjectConstant

use of jdk.vm.ci.hotspot.HotSpotObjectConstant in project graal by oracle.

the class AArch64HotSpotLIRGenerator method emitCompareBranch.

@Override
public void emitCompareBranch(PlatformKind cmpKind, Value x, Value y, Condition cond, boolean unorderedIsTrue, LabelRef trueDestination, LabelRef falseDestination, double trueDestinationProbability) {
    Value localX = x;
    Value localY = y;
    if (localX instanceof HotSpotObjectConstant) {
        localX = load(localX);
    }
    if (localY instanceof HotSpotObjectConstant) {
        localY = load(localY);
    }
    super.emitCompareBranch(cmpKind, localX, localY, cond, unorderedIsTrue, trueDestination, falseDestination, trueDestinationProbability);
}
Also used : LIRValueUtil.isConstantValue(org.graalvm.compiler.lir.LIRValueUtil.isConstantValue) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) AArch64AddressValue(org.graalvm.compiler.lir.aarch64.AArch64AddressValue) RegisterValue(jdk.vm.ci.code.RegisterValue) HotSpotObjectConstant(jdk.vm.ci.hotspot.HotSpotObjectConstant)

Example 9 with HotSpotObjectConstant

use of jdk.vm.ci.hotspot.HotSpotObjectConstant in project graal by oracle.

the class CallSiteTargetNode method tryFold.

public static ConstantNode tryFold(ValueNode callSite, MetaAccessProvider metaAccess, Assumptions assumptions) {
    if (callSite != null && callSite.isConstant() && !callSite.isNullConstant()) {
        HotSpotObjectConstant c = (HotSpotObjectConstant) callSite.asConstant();
        JavaConstant target = c.getCallSiteTarget(assumptions);
        if (target != null) {
            return ConstantNode.forConstant(target, metaAccess);
        }
    }
    return null;
}
Also used : JavaConstant(jdk.vm.ci.meta.JavaConstant) HotSpotObjectConstant(jdk.vm.ci.hotspot.HotSpotObjectConstant)

Example 10 with HotSpotObjectConstant

use of jdk.vm.ci.hotspot.HotSpotObjectConstant in project graal by oracle.

the class IdentityHashCodeNode method canonical.

@Override
public Node canonical(CanonicalizerTool tool) {
    if (object.isConstant()) {
        assert object.stamp(NodeView.DEFAULT) instanceof AbstractObjectStamp;
        JavaConstant c = (JavaConstant) object.asConstant();
        if (ImmutableCode.getValue(tool.getOptions())) {
            return this;
        }
        JavaConstant identityHashCode = null;
        if (c.isNull()) {
            identityHashCode = JavaConstant.forInt(0);
        } else {
            identityHashCode = JavaConstant.forInt(((HotSpotObjectConstant) c).getIdentityHashCode());
        }
        return new ConstantNode(identityHashCode, StampFactory.forConstant(identityHashCode));
    }
    return this;
}
Also used : ConstantNode(org.graalvm.compiler.nodes.ConstantNode) AbstractObjectStamp(org.graalvm.compiler.core.common.type.AbstractObjectStamp) JavaConstant(jdk.vm.ci.meta.JavaConstant) HotSpotObjectConstant(jdk.vm.ci.hotspot.HotSpotObjectConstant)

Aggregations

HotSpotObjectConstant (jdk.vm.ci.hotspot.HotSpotObjectConstant)12 Value (jdk.vm.ci.meta.Value)7 RegisterValue (jdk.vm.ci.code.RegisterValue)4 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)4 JavaConstant (jdk.vm.ci.meta.JavaConstant)4 LIRValueUtil.isConstantValue (org.graalvm.compiler.lir.LIRValueUtil.isConstantValue)4 HotSpotMetaspaceConstant (jdk.vm.ci.hotspot.HotSpotMetaspaceConstant)3 PermanentBailoutException (org.graalvm.compiler.core.common.PermanentBailoutException)3 HotSpotLIRGenerator (org.graalvm.compiler.hotspot.HotSpotLIRGenerator)3 HotSpotCompressedNullConstant (jdk.vm.ci.hotspot.HotSpotCompressedNullConstant)2 Constant (jdk.vm.ci.meta.Constant)2 AbstractObjectStamp (org.graalvm.compiler.core.common.type.AbstractObjectStamp)2 GraalError (org.graalvm.compiler.debug.GraalError)2 LIRValueUtil.asConstant (org.graalvm.compiler.lir.LIRValueUtil.asConstant)2 AArch64AddressValue (org.graalvm.compiler.lir.aarch64.AArch64AddressValue)2 SPARCAddressValue (org.graalvm.compiler.lir.sparc.SPARCAddressValue)2 SPARCImmediateAddressValue (org.graalvm.compiler.lir.sparc.SPARCImmediateAddressValue)2 ConstantNode (org.graalvm.compiler.nodes.ConstantNode)2 HotSpotResolvedJavaField (jdk.vm.ci.hotspot.HotSpotResolvedJavaField)1 HotSpotResolvedJavaType (jdk.vm.ci.hotspot.HotSpotResolvedJavaType)1