< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/gc/g1/G1BarrierSet.java

Print this page

        

*** 24,33 **** --- 24,34 ---- package org.graalvm.compiler.hotspot.gc.g1; import org.graalvm.compiler.debug.GraalError; + import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig; import org.graalvm.compiler.hotspot.gc.shared.BarrierSet; import org.graalvm.compiler.nodes.StructuredGraph; import org.graalvm.compiler.nodes.ValueNode; import org.graalvm.compiler.nodes.extended.ArrayRangeWrite; import org.graalvm.compiler.nodes.java.AbstractCompareAndSwapNode;
*** 39,52 **** import org.graalvm.compiler.nodes.memory.address.AddressNode; import org.graalvm.compiler.nodes.type.StampTool; public class G1BarrierSet extends BarrierSet { @Override public void addReadNodeBarriers(ReadNode node, StructuredGraph graph) { ! if (node.getBarrierType() != HeapAccess.BarrierType.NONE) { ! assert (node.getBarrierType() == HeapAccess.BarrierType.PRECISE); G1ReferentFieldReadBarrier barrier = graph.add(new G1ReferentFieldReadBarrier(node.getAddress(), node, false)); graph.addAfterFixed(node, barrier); } } --- 40,56 ---- import org.graalvm.compiler.nodes.memory.address.AddressNode; import org.graalvm.compiler.nodes.type.StampTool; public class G1BarrierSet extends BarrierSet { + public G1BarrierSet(GraalHotSpotVMConfig vmConfig) { + super(vmConfig); + } + @Override public void addReadNodeBarriers(ReadNode node, StructuredGraph graph) { ! if (node.getBarrierType() == HeapAccess.BarrierType.WEAK_FIELD) { G1ReferentFieldReadBarrier barrier = graph.add(new G1ReferentFieldReadBarrier(node.getAddress(), node, false)); graph.addAfterFixed(node, barrier); } }
*** 55,73 **** HeapAccess.BarrierType barrierType = node.getBarrierType(); switch (barrierType) { case NONE: // nothing to do break; ! case IMPRECISE: ! case PRECISE: ! boolean precise = barrierType == HeapAccess.BarrierType.PRECISE; ! if (!node.getLocationIdentity().isInit()) { ! // The pre barrier does nothing if the value being read is null, so it can ! // be explicitly skipped when this is an initializing store. ! addG1PreWriteBarrier(node, node.getAddress(), null, true, node.getNullCheck(), graph); } - addG1PostWriteBarrier(node, node.getAddress(), node.value(), precise, graph); break; default: throw new GraalError("unexpected barrier type: " + barrierType); } } --- 59,81 ---- HeapAccess.BarrierType barrierType = node.getBarrierType(); switch (barrierType) { case NONE: // nothing to do break; ! case FIELD: ! case ARRAY: ! case UNKNOWN: ! boolean init = node.getLocationIdentity().isInit(); ! if (!init || !getVMConfig().useDeferredInitBarriers) { ! if (!init) { ! // The pre barrier does nothing if the value being read is null, so it can ! // be explicitly skipped when this is an initializing store. ! addG1PreWriteBarrier(node, node.getAddress(), null, true, node.getNullCheck(), graph); ! } ! boolean precise = barrierType != HeapAccess.BarrierType.FIELD; ! addG1PostWriteBarrier(node, node.getAddress(), node.value(), precise, graph); } break; default: throw new GraalError("unexpected barrier type: " + barrierType); } }
*** 77,89 **** HeapAccess.BarrierType barrierType = node.getBarrierType(); switch (barrierType) { case NONE: // nothing to do break; ! case IMPRECISE: ! case PRECISE: ! boolean precise = barrierType == HeapAccess.BarrierType.PRECISE; addG1PreWriteBarrier(node, node.getAddress(), null, true, node.getNullCheck(), graph); addG1PostWriteBarrier(node, node.getAddress(), node.getNewValue(), precise, graph); break; default: throw new GraalError("unexpected barrier type: " + barrierType); --- 85,98 ---- HeapAccess.BarrierType barrierType = node.getBarrierType(); switch (barrierType) { case NONE: // nothing to do break; ! case FIELD: ! case ARRAY: ! case UNKNOWN: ! boolean precise = barrierType != HeapAccess.BarrierType.FIELD; addG1PreWriteBarrier(node, node.getAddress(), null, true, node.getNullCheck(), graph); addG1PostWriteBarrier(node, node.getAddress(), node.getNewValue(), precise, graph); break; default: throw new GraalError("unexpected barrier type: " + barrierType);
*** 95,107 **** HeapAccess.BarrierType barrierType = node.getBarrierType(); switch (barrierType) { case NONE: // nothing to do break; ! case IMPRECISE: ! case PRECISE: ! boolean precise = barrierType == HeapAccess.BarrierType.PRECISE; addG1PreWriteBarrier(node, node.getAddress(), node.getExpectedValue(), false, false, graph); addG1PostWriteBarrier(node, node.getAddress(), node.getNewValue(), precise, graph); break; default: throw new GraalError("unexpected barrier type: " + barrierType); --- 104,117 ---- HeapAccess.BarrierType barrierType = node.getBarrierType(); switch (barrierType) { case NONE: // nothing to do break; ! case FIELD: ! case ARRAY: ! case UNKNOWN: ! boolean precise = barrierType != HeapAccess.BarrierType.FIELD; addG1PreWriteBarrier(node, node.getAddress(), node.getExpectedValue(), false, false, graph); addG1PostWriteBarrier(node, node.getAddress(), node.getNewValue(), precise, graph); break; default: throw new GraalError("unexpected barrier type: " + barrierType);
< prev index next >