Search in sources :

Example 6 with CompressEncoding

use of org.graalvm.compiler.core.common.CompressEncoding in project graal by oracle.

the class SubstrateAMD64AddressLowering method improveUncompression.

@Override
protected final boolean improveUncompression(AMD64AddressNode addr, CompressionNode compression, ValueNode other) {
    assert SubstrateOptions.UseHeapBaseRegister.getValue();
    CompressEncoding encoding = compression.getEncoding();
    Scale scale = Scale.fromShift(encoding.getShift());
    if (scale == null) {
        return false;
    }
    long encodingBase = encoding.getBase();
    ValueNode base = other;
    if (heapBaseRegister != null && encodingBase == heapBase) {
        if (other != null) {
            return false;
        }
        base = compression.graph().unique(new HeapBaseNode(heapBaseRegister));
    } else if (encodingBase != 0) {
        if (!updateDisplacement(addr, encodingBase, false)) {
            return false;
        }
    }
    addr.setBase(base);
    addr.setScale(scale);
    addr.setIndex(compression.getValue());
    return true;
}
Also used : CompressEncoding(org.graalvm.compiler.core.common.CompressEncoding) ValueNode(org.graalvm.compiler.nodes.ValueNode) Scale(org.graalvm.compiler.asm.amd64.AMD64Address.Scale)

Example 7 with CompressEncoding

use of org.graalvm.compiler.core.common.CompressEncoding in project graal by oracle.

the class SPARCHotSpotLIRGenerator method emitNullCheck.

@Override
public void emitNullCheck(Value address, LIRFrameState state) {
    PlatformKind kind = address.getPlatformKind();
    if (kind == WORD) {
        CompressEncoding encoding = config.getOopEncoding();
        Value uncompressed = emitUncompress(address, encoding, false);
        append(new NullCheckOp(asAddressValue(uncompressed), state));
    } else {
        super.emitNullCheck(address, state);
    }
}
Also used : NullCheckOp(org.graalvm.compiler.lir.sparc.SPARCMove.NullCheckOp) CompressEncoding(org.graalvm.compiler.core.common.CompressEncoding) 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) PlatformKind(jdk.vm.ci.meta.PlatformKind)

Example 8 with CompressEncoding

use of org.graalvm.compiler.core.common.CompressEncoding in project graal by oracle.

the class NativeImageHeap method writeReference.

void writeReference(RelocatableBuffer buffer, int index, Object target, Object reason) {
    assert !(target instanceof WordBase) : "word values are not references";
    mustBeAligned(index);
    if (target != null) {
        ObjectInfo targetInfo = objects.get(target);
        verifyTargetDidNotChange(target, reason, targetInfo);
        if (useHeapBase()) {
            CompressEncoding compressEncoding = ImageSingletons.lookup(CompressEncoding.class);
            int shift = compressEncoding.getShift();
            writePointer(buffer, index, targetInfo.getOffsetInSection() >>> shift);
        } else {
            buffer.addDirectRelocationWithoutAddend(index, objectSize(), target);
        }
    }
}
Also used : WordBase(org.graalvm.word.WordBase) CompressEncoding(org.graalvm.compiler.core.common.CompressEncoding)

Example 9 with CompressEncoding

use of org.graalvm.compiler.core.common.CompressEncoding in project graal by oracle.

the class DataPatchTest method registerInvocationPlugins.

@Override
protected void registerInvocationPlugins(InvocationPlugins invocationPlugins) {
    Registration r = new Registration(invocationPlugins, DataPatchTest.class);
    r.register1("compressUncompress", Object.class, new InvocationPlugin() {

        @Override
        public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode arg) {
            CompressEncoding encoding = runtime().getVMConfig().getOopEncoding();
            ValueNode compressed = b.add(HotSpotCompressionNode.compress(arg, encoding));
            ValueNode proxy = b.add(new OpaqueNode(compressed));
            b.addPush(JavaKind.Object, HotSpotCompressionNode.uncompress(proxy, encoding));
            return true;
        }
    });
    super.registerInvocationPlugins(invocationPlugins);
}
Also used : GraphBuilderContext(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext) Registration(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration) ValueNode(org.graalvm.compiler.nodes.ValueNode) CompressEncoding(org.graalvm.compiler.core.common.CompressEncoding) InvocationPlugin(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin) OpaqueNode(org.graalvm.compiler.nodes.debug.OpaqueNode) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Example 10 with CompressEncoding

use of org.graalvm.compiler.core.common.CompressEncoding in project graal by oracle.

the class AMD64HotSpotLIRGenerator method emitNullCheck.

@Override
public void emitNullCheck(Value address, LIRFrameState state) {
    if (address.getValueKind().getPlatformKind() == getLIRKindTool().getNarrowOopKind().getPlatformKind()) {
        CompressEncoding encoding = config.getOopEncoding();
        Value uncompressed;
        if (encoding.getShift() <= 3) {
            LIRKind wordKind = LIRKind.unknownReference(target().arch.getWordKind());
            uncompressed = new AMD64AddressValue(wordKind, getProviders().getRegisters().getHeapBaseRegister().asValue(wordKind), asAllocatable(address), Scale.fromInt(1 << encoding.getShift()), 0);
        } else {
            uncompressed = emitUncompress(address, encoding, false);
        }
        append(new AMD64Move.NullCheckOp(asAddressValue(uncompressed), state));
        return;
    }
    super.emitNullCheck(address, state);
}
Also used : AMD64AddressValue(org.graalvm.compiler.lir.amd64.AMD64AddressValue) CompressEncoding(org.graalvm.compiler.core.common.CompressEncoding) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) RegisterValue(jdk.vm.ci.code.RegisterValue) AMD64AddressValue(org.graalvm.compiler.lir.amd64.AMD64AddressValue) LIRKind(org.graalvm.compiler.core.common.LIRKind) AMD64Move(org.graalvm.compiler.lir.amd64.AMD64Move)

Aggregations

CompressEncoding (org.graalvm.compiler.core.common.CompressEncoding)14 ValueNode (org.graalvm.compiler.nodes.ValueNode)3 HostedProviders (com.oracle.graal.pointsto.meta.HostedProviders)2 HostedOptionValues (com.oracle.svm.core.option.HostedOptionValues)2 RuntimeOptionValues (com.oracle.svm.core.option.RuntimeOptionValues)2 Register (jdk.vm.ci.code.Register)2 RegisterValue (jdk.vm.ci.code.RegisterValue)2 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)2 Value (jdk.vm.ci.meta.Value)2 Label (org.graalvm.compiler.asm.Label)2 ObjectStamp (org.graalvm.compiler.core.common.type.ObjectStamp)2 LIRValueUtil.isConstantValue (org.graalvm.compiler.lir.LIRValueUtil.isConstantValue)2 TruffleCallBoundaryInstrumentation (org.graalvm.compiler.truffle.compiler.hotspot.TruffleCallBoundaryInstrumentation)2 AnalysisPolicy (com.oracle.graal.pointsto.AnalysisPolicy)1 UnsupportedFeatureException (com.oracle.graal.pointsto.constraints.UnsupportedFeatureException)1 SubstitutionProcessor (com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor)1 AnalysisMetaAccess (com.oracle.graal.pointsto.meta.AnalysisMetaAccess)1 AnalysisMethod (com.oracle.graal.pointsto.meta.AnalysisMethod)1 AnalysisType (com.oracle.graal.pointsto.meta.AnalysisType)1 AnalysisUniverse (com.oracle.graal.pointsto.meta.AnalysisUniverse)1