Search in sources :

Example 51 with JavaKind

use of jdk.vm.ci.meta.JavaKind in project graal by oracle.

the class StandardGraphBuilderPlugins method registerJMHBlackholePlugins.

private static void registerJMHBlackholePlugins(InvocationPlugins plugins, BytecodeProvider bytecodeProvider) {
    InvocationPlugin blackholePlugin = new InvocationPlugin() {

        @Override
        public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver blackhole, ValueNode value) {
            blackhole.get();
            b.add(new BlackholeNode(value));
            return true;
        }
    };
    String[] names = { "org.openjdk.jmh.infra.Blackhole", "org.openjdk.jmh.logic.BlackHole" };
    for (String name : names) {
        Registration r = new Registration(plugins, name, bytecodeProvider);
        for (JavaKind kind : JavaKind.values()) {
            if ((kind.isPrimitive() && kind != JavaKind.Void) || kind == JavaKind.Object) {
                Class<?> javaClass = kind == JavaKind.Object ? Object.class : kind.toJavaClass();
                r.registerOptional2("consume", Receiver.class, javaClass, blackholePlugin);
            }
        }
        r.registerOptional2("consume", Receiver.class, Object[].class, blackholePlugin);
    }
}
Also used : BlackholeNode(org.graalvm.compiler.nodes.debug.BlackholeNode) GraphBuilderContext(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext) Registration(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration) ValueNode(org.graalvm.compiler.nodes.ValueNode) InvocationPlugin(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin) Receiver(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) JavaKind(jdk.vm.ci.meta.JavaKind)

Example 52 with JavaKind

use of jdk.vm.ci.meta.JavaKind in project graal by oracle.

the class StandardGraphBuilderPlugins method registerBoxingPlugins.

protected static void registerBoxingPlugins(InvocationPlugins plugins) {
    for (JavaKind kind : JavaKind.values()) {
        if (kind.isPrimitive() && kind != JavaKind.Void) {
            new BoxPlugin(kind).register(plugins);
            new UnboxPlugin(kind).register(plugins);
        }
    }
}
Also used : JavaKind(jdk.vm.ci.meta.JavaKind)

Example 53 with JavaKind

use of jdk.vm.ci.meta.JavaKind in project graal by oracle.

the class DefaultJavaLoweringProvider method lowerLoadIndexedNode.

protected void lowerLoadIndexedNode(LoadIndexedNode loadIndexed, LoweringTool tool) {
    StructuredGraph graph = loadIndexed.graph();
    ValueNode array = loadIndexed.array();
    array = createNullCheckedValue(array, loadIndexed, tool);
    JavaKind elementKind = loadIndexed.elementKind();
    Stamp loadStamp = loadStamp(loadIndexed.stamp(NodeView.DEFAULT), elementKind);
    GuardingNode boundsCheck = getBoundsCheck(loadIndexed, array, tool);
    AddressNode address = createArrayIndexAddress(graph, array, elementKind, loadIndexed.index(), boundsCheck);
    ReadNode memoryRead = graph.add(new ReadNode(address, NamedLocationIdentity.getArrayLocation(elementKind), loadStamp, BarrierType.NONE));
    memoryRead.setGuard(boundsCheck);
    ValueNode readValue = implicitLoadConvert(graph, elementKind, memoryRead);
    loadIndexed.replaceAtUsages(readValue);
    graph.replaceFixed(loadIndexed, memoryRead);
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) ObjectStamp(org.graalvm.compiler.core.common.type.ObjectStamp) Stamp(org.graalvm.compiler.core.common.type.Stamp) IntegerStamp(org.graalvm.compiler.core.common.type.IntegerStamp) ValueNode(org.graalvm.compiler.nodes.ValueNode) OffsetAddressNode(org.graalvm.compiler.nodes.memory.address.OffsetAddressNode) AddressNode(org.graalvm.compiler.nodes.memory.address.AddressNode) JavaReadNode(org.graalvm.compiler.nodes.extended.JavaReadNode) ReadNode(org.graalvm.compiler.nodes.memory.ReadNode) GuardingNode(org.graalvm.compiler.nodes.extended.GuardingNode) JavaKind(jdk.vm.ci.meta.JavaKind)

Example 54 with JavaKind

use of jdk.vm.ci.meta.JavaKind in project graal by oracle.

the class DefaultJavaLoweringProvider method createUnsafeRead.

protected ReadNode createUnsafeRead(StructuredGraph graph, RawLoadNode load, GuardingNode guard) {
    boolean compressible = load.accessKind() == JavaKind.Object;
    JavaKind readKind = load.accessKind();
    Stamp loadStamp = loadStamp(load.stamp(NodeView.DEFAULT), readKind, compressible);
    AddressNode address = createUnsafeAddress(graph, load.object(), load.offset());
    ReadNode memoryRead = graph.add(new ReadNode(address, load.getLocationIdentity(), loadStamp, BarrierType.NONE));
    if (guard == null) {
        // An unsafe read must not float otherwise it may float above
        // a test guaranteeing the read is safe.
        memoryRead.setForceFixed(true);
    } else {
        memoryRead.setGuard(guard);
    }
    ValueNode readValue = performBooleanCoercionIfNecessary(implicitLoadConvert(graph, readKind, memoryRead, compressible), readKind);
    load.replaceAtUsages(readValue);
    return memoryRead;
}
Also used : ObjectStamp(org.graalvm.compiler.core.common.type.ObjectStamp) Stamp(org.graalvm.compiler.core.common.type.Stamp) IntegerStamp(org.graalvm.compiler.core.common.type.IntegerStamp) ValueNode(org.graalvm.compiler.nodes.ValueNode) OffsetAddressNode(org.graalvm.compiler.nodes.memory.address.OffsetAddressNode) AddressNode(org.graalvm.compiler.nodes.memory.address.AddressNode) JavaReadNode(org.graalvm.compiler.nodes.extended.JavaReadNode) ReadNode(org.graalvm.compiler.nodes.memory.ReadNode) JavaKind(jdk.vm.ci.meta.JavaKind)

Example 55 with JavaKind

use of jdk.vm.ci.meta.JavaKind in project graal by oracle.

the class DefaultJavaLoweringProvider method lowerUnsafeStoreNode.

protected void lowerUnsafeStoreNode(RawStoreNode store) {
    StructuredGraph graph = store.graph();
    boolean compressible = store.value().getStackKind() == JavaKind.Object;
    JavaKind valueKind = store.accessKind();
    ValueNode value = implicitStoreConvert(graph, valueKind, store.value(), compressible);
    AddressNode address = createUnsafeAddress(graph, store.object(), store.offset());
    WriteNode write = graph.add(new WriteNode(address, store.getLocationIdentity(), value, unsafeStoreBarrierType(store)));
    write.setStateAfter(store.stateAfter());
    graph.replaceFixedWithFixed(store, write);
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) ValueNode(org.graalvm.compiler.nodes.ValueNode) OffsetAddressNode(org.graalvm.compiler.nodes.memory.address.OffsetAddressNode) AddressNode(org.graalvm.compiler.nodes.memory.address.AddressNode) WriteNode(org.graalvm.compiler.nodes.memory.WriteNode) AtomicReadAndWriteNode(org.graalvm.compiler.nodes.java.AtomicReadAndWriteNode) JavaWriteNode(org.graalvm.compiler.nodes.extended.JavaWriteNode) LoweredAtomicReadAndWriteNode(org.graalvm.compiler.nodes.java.LoweredAtomicReadAndWriteNode) JavaKind(jdk.vm.ci.meta.JavaKind)

Aggregations

JavaKind (jdk.vm.ci.meta.JavaKind)90 ValueNode (org.graalvm.compiler.nodes.ValueNode)44 ResolvedJavaType (jdk.vm.ci.meta.ResolvedJavaType)24 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)17 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)16 AddressNode (org.graalvm.compiler.nodes.memory.address.AddressNode)13 OffsetAddressNode (org.graalvm.compiler.nodes.memory.address.OffsetAddressNode)12 JavaType (jdk.vm.ci.meta.JavaType)11 Stamp (org.graalvm.compiler.core.common.type.Stamp)10 LocationIdentity (org.graalvm.word.LocationIdentity)10 ArrayList (java.util.ArrayList)9 JavaConstant (jdk.vm.ci.meta.JavaConstant)9 AbstractMergeNode (org.graalvm.compiler.nodes.AbstractMergeNode)8 FrameState (org.graalvm.compiler.nodes.FrameState)8 GraphBuilderContext (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext)8 Signature (jdk.vm.ci.meta.Signature)7 ConstantNode (org.graalvm.compiler.nodes.ConstantNode)7 ObjectLayout (com.oracle.svm.core.config.ObjectLayout)6 ObjectStamp (org.graalvm.compiler.core.common.type.ObjectStamp)6 InvokeWithExceptionNode (org.graalvm.compiler.nodes.InvokeWithExceptionNode)6