Search in sources :

Example 1 with GraalHotSpotVMConfigNode

use of org.graalvm.compiler.hotspot.nodes.GraalHotSpotVMConfigNode in project graal by oracle.

the class AMD64HotSpotAddressLowering method improveUncompression.

@Override
protected final boolean improveUncompression(AMD64AddressNode addr, CompressionNode compression, ValueNode other) {
    CompressEncoding encoding = compression.getEncoding();
    Scale scale = Scale.fromShift(encoding.getShift());
    if (scale == null) {
        return false;
    }
    if (heapBaseRegister != null && encoding.getBase() == heapBase) {
        if ((!generatePIC || compression.stamp(NodeView.DEFAULT) instanceof ObjectStamp) && other == null) {
            // With PIC it is only legal to do for oops since the base value may be
            // different at runtime.
            ValueNode base = compression.graph().unique(new HeapBaseNode(heapBaseRegister));
            addr.setBase(base);
        } else {
            return false;
        }
    } else if (encoding.getBase() != 0 || (generatePIC && compression.stamp(NodeView.DEFAULT) instanceof KlassPointerStamp)) {
        if (generatePIC) {
            if (other == null) {
                ValueNode base = compression.graph().unique(new GraalHotSpotVMConfigNode(config, config.MARKID_NARROW_KLASS_BASE_ADDRESS, JavaKind.Long));
                addr.setBase(base);
            } else {
                return false;
            }
        } else {
            if (updateDisplacement(addr, encoding.getBase(), false)) {
                addr.setBase(other);
            } else {
                return false;
            }
        }
    } else {
        addr.setBase(other);
    }
    addr.setScale(scale);
    addr.setIndex(compression.getValue());
    return true;
}
Also used : GraalHotSpotVMConfigNode(org.graalvm.compiler.hotspot.nodes.GraalHotSpotVMConfigNode) ObjectStamp(org.graalvm.compiler.core.common.type.ObjectStamp) KlassPointerStamp(org.graalvm.compiler.hotspot.nodes.type.KlassPointerStamp) CompressEncoding(org.graalvm.compiler.core.common.CompressEncoding) ValueNode(org.graalvm.compiler.nodes.ValueNode) Scale(org.graalvm.compiler.asm.amd64.AMD64Address.Scale)

Aggregations

Scale (org.graalvm.compiler.asm.amd64.AMD64Address.Scale)1 CompressEncoding (org.graalvm.compiler.core.common.CompressEncoding)1 ObjectStamp (org.graalvm.compiler.core.common.type.ObjectStamp)1 GraalHotSpotVMConfigNode (org.graalvm.compiler.hotspot.nodes.GraalHotSpotVMConfigNode)1 KlassPointerStamp (org.graalvm.compiler.hotspot.nodes.type.KlassPointerStamp)1 ValueNode (org.graalvm.compiler.nodes.ValueNode)1