All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jdk.graal.compiler.nodes.gc.BarrierSet Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
 * Copyright (c) 2019, Red Hat Inc. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */
package jdk.graal.compiler.nodes.gc;

import org.graalvm.word.LocationIdentity;

import jdk.graal.compiler.core.common.memory.BarrierType;
import jdk.graal.compiler.core.common.type.Stamp;
import jdk.graal.compiler.nodes.StructuredGraph;
import jdk.graal.compiler.nodes.ValueNode;
import jdk.graal.compiler.nodes.extended.RawStoreNode;
import jdk.graal.compiler.nodes.memory.FixedAccessNode;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.ResolvedJavaField;

public interface BarrierSet {

    boolean hasWriteBarrier();

    boolean hasReadBarrier();

    /**
     * Checks whether writing to {@link LocationIdentity#INIT_LOCATION} can be performed with an
     * intervening allocation.
     */
    default BarrierType postAllocationInitBarrier(BarrierType original) {
        return original;
    }

    void addBarriers(FixedAccessNode n);

    BarrierType fieldReadBarrierType(ResolvedJavaField field, JavaKind storageKind);

    BarrierType fieldWriteBarrierType(ResolvedJavaField field, JavaKind storageKind);

    BarrierType readBarrierType(LocationIdentity location, ValueNode address, Stamp loadStamp);

    /**
     * @param location
     */
    default BarrierType writeBarrierType(LocationIdentity location) {
        return BarrierType.NONE;
    }

    BarrierType writeBarrierType(RawStoreNode store);

    BarrierType arrayWriteBarrierType(JavaKind storageKind);

    BarrierType readWriteBarrier(ValueNode object, ValueNode value);

    /**
     * Determine whether writes of the given {@code storageKind} may ever need a pre-write barrier.
     *
     * @return {@code false} if no writes of {@code storageKind} ever need a pre-write barrier;
     *         {@code true} if writes of {@code storageKind} may need a pre-write barrier at least
     *         under certain circumstances.
     */
    boolean mayNeedPreWriteBarrier(JavaKind storageKind);

    /**
     * Perform verification of inserted or missing barriers.
     *
     * @param graph the grraph to verify.
     */
    default void verifyBarriers(StructuredGraph graph) {
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy