Search in sources :

Example 6 with LocationIdentity

use of org.graalvm.word.LocationIdentity in project graal by oracle.

the class DefaultHotSpotLoweringProvider method createReadHub.

@Override
protected ValueNode createReadHub(StructuredGraph graph, ValueNode object, LoweringTool tool) {
    if (tool.getLoweringStage() != LoweringTool.StandardLoweringStage.LOW_TIER) {
        return graph.unique(new LoadHubNode(tool.getStampProvider(), object));
    }
    assert !object.isConstant() || object.isNullConstant();
    KlassPointerStamp hubStamp = KlassPointerStamp.klassNonNull();
    if (runtime.getVMConfig().useCompressedClassPointers) {
        hubStamp = hubStamp.compressed(runtime.getVMConfig().getKlassEncoding());
    }
    AddressNode address = createOffsetAddress(graph, object, runtime.getVMConfig().hubOffset);
    LocationIdentity hubLocation = runtime.getVMConfig().useCompressedClassPointers ? COMPRESSED_HUB_LOCATION : HUB_LOCATION;
    FloatingReadNode memoryRead = graph.unique(new FloatingReadNode(address, hubLocation, null, hubStamp, null, BarrierType.NONE));
    if (runtime.getVMConfig().useCompressedClassPointers) {
        return HotSpotCompressionNode.uncompress(memoryRead, runtime.getVMConfig().getKlassEncoding());
    } else {
        return memoryRead;
    }
}
Also used : LoadHubNode(org.graalvm.compiler.nodes.extended.LoadHubNode) KlassPointerStamp(org.graalvm.compiler.hotspot.nodes.type.KlassPointerStamp) FloatingReadNode(org.graalvm.compiler.nodes.memory.FloatingReadNode) GetObjectAddressNode(org.graalvm.compiler.hotspot.nodes.GetObjectAddressNode) ComputeObjectAddressNode(org.graalvm.compiler.hotspot.nodes.ComputeObjectAddressNode) AddressNode(org.graalvm.compiler.nodes.memory.address.AddressNode) LocationIdentity(org.graalvm.word.LocationIdentity)

Example 7 with LocationIdentity

use of org.graalvm.word.LocationIdentity in project graal by oracle.

the class HotSpotHostForeignCallsProvider method registerCheckcastArraycopyDescriptor.

private void registerCheckcastArraycopyDescriptor(boolean uninit, long routine) {
    String name = "Object" + (uninit ? "Uninit" : "") + "Checkcast";
    // Input:
    // c_rarg0 - source array address
    // c_rarg1 - destination array address
    // c_rarg2 - element count, treated as ssize_t, can be zero
    // c_rarg3 - size_t ckoff (super_check_offset)
    // c_rarg4 - oop ckval (super_klass)
    // return: 0 = success, n = number of copied elements xor'd with -1.
    ForeignCallDescriptor desc = new ForeignCallDescriptor(name, int.class, Word.class, Word.class, Word.class, Word.class, Word.class);
    LocationIdentity killed = NamedLocationIdentity.any();
    registerForeignCall(desc, routine, NativeCall, DESTROYS_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, killed);
    checkcastArraycopyDescriptors[uninit ? 1 : 0] = desc;
}
Also used : ForeignCallDescriptor(org.graalvm.compiler.core.common.spi.ForeignCallDescriptor) LocationIdentity(org.graalvm.word.LocationIdentity) NamedLocationIdentity(org.graalvm.compiler.nodes.NamedLocationIdentity)

Example 8 with LocationIdentity

use of org.graalvm.word.LocationIdentity in project graal by oracle.

the class Block method calcKillLocations.

private LocationSet calcKillLocations() {
    LocationSet result = new LocationSet();
    for (FixedNode node : this.getNodes()) {
        if (node instanceof MemoryCheckpoint.Single) {
            LocationIdentity identity = ((MemoryCheckpoint.Single) node).getLocationIdentity();
            result.add(identity);
        } else if (node instanceof MemoryCheckpoint.Multi) {
            for (LocationIdentity identity : ((MemoryCheckpoint.Multi) node).getLocationIdentities()) {
                result.add(identity);
            }
        }
        if (result.isAny()) {
            break;
        }
    }
    return result;
}
Also used : MemoryCheckpoint(org.graalvm.compiler.nodes.memory.MemoryCheckpoint) LocationIdentity(org.graalvm.word.LocationIdentity) FixedNode(org.graalvm.compiler.nodes.FixedNode)

Example 9 with LocationIdentity

use of org.graalvm.word.LocationIdentity in project graal by oracle.

the class ReferenceGetLoopTest method checkMidTierGraph.

@Override
protected boolean checkMidTierGraph(StructuredGraph graph) {
    final LoopsData loops = new LoopsData(graph);
    boolean found = false;
    for (LoopEx loop : loops.loops()) {
        for (Node node : loop.inside().nodes()) {
            if (node instanceof Access) {
                Access access = (Access) node;
                LocationIdentity location = access.getLocationIdentity();
                if (location instanceof FieldLocationIdentity) {
                    ResolvedJavaField field = ((FieldLocationIdentity) location).getField();
                    if (field.getName().equals("referent") && field.getDeclaringClass().equals(getMetaAccess().lookupJavaType(Reference.class))) {
                        found = true;
                    }
                }
            }
        }
    }
    if (!found) {
        assertTrue(false, "Reference.referent not found in loop: " + getCanonicalGraphString(graph, true, false));
    }
    return true;
}
Also used : FieldLocationIdentity(org.graalvm.compiler.nodes.FieldLocationIdentity) LoopsData(org.graalvm.compiler.loop.LoopsData) LoopEx(org.graalvm.compiler.loop.LoopEx) Node(org.graalvm.compiler.graph.Node) Access(org.graalvm.compiler.nodes.memory.Access) FieldLocationIdentity(org.graalvm.compiler.nodes.FieldLocationIdentity) LocationIdentity(org.graalvm.word.LocationIdentity) ResolvedJavaField(jdk.vm.ci.meta.ResolvedJavaField)

Example 10 with LocationIdentity

use of org.graalvm.word.LocationIdentity in project graal by oracle.

the class BytecodeParser method genGetField.

private void genGetField(ResolvedJavaField resolvedField, ValueNode receiver) {
    if (!parsingIntrinsic() && GeneratePIC.getValue(getOptions())) {
        graph.recordField(resolvedField);
    }
    for (NodePlugin plugin : graphBuilderConfig.getPlugins().getNodePlugins()) {
        if (plugin.handleLoadField(this, receiver, resolvedField)) {
            return;
        }
    }
    ValueNode fieldRead = append(genLoadField(receiver, resolvedField));
    if (resolvedField.getDeclaringClass().getName().equals("Ljava/lang/ref/Reference;") && resolvedField.getName().equals("referent")) {
        LocationIdentity referentIdentity = new FieldLocationIdentity(resolvedField);
        append(new MembarNode(0, referentIdentity));
    }
    JavaKind fieldKind = resolvedField.getJavaKind();
    if (resolvedField.isVolatile() && fieldRead instanceof LoadFieldNode) {
        StateSplitProxyNode readProxy = append(genVolatileFieldReadProxy(fieldRead));
        frameState.push(fieldKind, readProxy);
        readProxy.setStateAfter(frameState.create(stream.nextBCI(), readProxy));
    } else {
        frameState.push(fieldKind, fieldRead);
    }
}
Also used : FieldLocationIdentity(org.graalvm.compiler.nodes.FieldLocationIdentity) NodePlugin(org.graalvm.compiler.nodes.graphbuilderconf.NodePlugin) StateSplitProxyNode(org.graalvm.compiler.nodes.extended.StateSplitProxyNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) FieldLocationIdentity(org.graalvm.compiler.nodes.FieldLocationIdentity) LocationIdentity(org.graalvm.word.LocationIdentity) MembarNode(org.graalvm.compiler.nodes.extended.MembarNode) LoadFieldNode(org.graalvm.compiler.nodes.java.LoadFieldNode) JavaKind(jdk.vm.ci.meta.JavaKind)

Aggregations

LocationIdentity (org.graalvm.word.LocationIdentity)32 ValueNode (org.graalvm.compiler.nodes.ValueNode)12 FieldLocationIdentity (org.graalvm.compiler.nodes.FieldLocationIdentity)11 NamedLocationIdentity (org.graalvm.compiler.nodes.NamedLocationIdentity)11 JavaKind (jdk.vm.ci.meta.JavaKind)10 MemoryCheckpoint (org.graalvm.compiler.nodes.memory.MemoryCheckpoint)10 ResolvedJavaType (jdk.vm.ci.meta.ResolvedJavaType)6 Stamp (org.graalvm.compiler.core.common.type.Stamp)5 AbstractBeginNode (org.graalvm.compiler.nodes.AbstractBeginNode)5 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)5 AddressNode (org.graalvm.compiler.nodes.memory.address.AddressNode)4 CInterfaceLocationIdentity (com.oracle.svm.core.c.struct.CInterfaceLocationIdentity)3 ResolvedJavaField (jdk.vm.ci.meta.ResolvedJavaField)3 Node (org.graalvm.compiler.graph.Node)3 AbstractMergeNode (org.graalvm.compiler.nodes.AbstractMergeNode)3 StructFieldInfo (com.oracle.svm.hosted.c.info.StructFieldInfo)2 JavaConstant (jdk.vm.ci.meta.JavaConstant)2 ForeignCallDescriptor (org.graalvm.compiler.core.common.spi.ForeignCallDescriptor)2 KlassPointerStamp (org.graalvm.compiler.hotspot.nodes.type.KlassPointerStamp)2 FixedNode (org.graalvm.compiler.nodes.FixedNode)2