< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/gc/shared/CardTableBarrierSet.java
Print this page
@@ -24,10 +24,11 @@
package org.graalvm.compiler.hotspot.gc.shared;
import org.graalvm.compiler.debug.GraalError;
+import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
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;
import org.graalvm.compiler.nodes.java.LoweredAtomicReadAndWriteNode;
@@ -38,26 +39,34 @@
import org.graalvm.compiler.nodes.memory.address.AddressNode;
import org.graalvm.compiler.nodes.type.StampTool;
public class CardTableBarrierSet extends BarrierSet {
+ public CardTableBarrierSet(GraalHotSpotVMConfig vmConfig) {
+ super(vmConfig);
+ }
+
@Override
public void addReadNodeBarriers(ReadNode node, StructuredGraph graph) {
- assert node.getBarrierType() == HeapAccess.BarrierType.NONE : "Non precise read barrier has been attached to read node.";
+ // Nothing to do here.
}
@Override
public void addWriteNodeBarriers(WriteNode node, StructuredGraph graph) {
HeapAccess.BarrierType barrierType = node.getBarrierType();
switch (barrierType) {
case NONE:
// nothing to do
break;
- case IMPRECISE:
- case PRECISE:
- boolean precise = barrierType == HeapAccess.BarrierType.PRECISE;
- addSerialPostWriteBarrier(node, node.getAddress(), node.value(), precise, graph);
+ case FIELD:
+ case ARRAY:
+ case UNKNOWN:
+ boolean precise = barrierType != HeapAccess.BarrierType.FIELD;
+ boolean init = node.getLocationIdentity().isInit();
+ if (!init || !getVMConfig().useDeferredInitBarriers) {
+ addSerialPostWriteBarrier(node, node.getAddress(), node.value(), precise, graph);
+ }
break;
default:
throw new GraalError("unexpected barrier type: " + barrierType);
}
}
@@ -67,13 +76,14 @@
HeapAccess.BarrierType barrierType = node.getBarrierType();
switch (barrierType) {
case NONE:
// nothing to do
break;
- case IMPRECISE:
- case PRECISE:
- boolean precise = barrierType == HeapAccess.BarrierType.PRECISE;
+ case FIELD:
+ case ARRAY:
+ case UNKNOWN:
+ boolean precise = barrierType != HeapAccess.BarrierType.FIELD;
addSerialPostWriteBarrier(node, node.getAddress(), node.getNewValue(), precise, graph);
break;
default:
throw new GraalError("unexpected barrier type: " + barrierType);
}
@@ -84,13 +94,14 @@
HeapAccess.BarrierType barrierType = node.getBarrierType();
switch (barrierType) {
case NONE:
// nothing to do
break;
- case IMPRECISE:
- case PRECISE:
- boolean precise = barrierType == HeapAccess.BarrierType.PRECISE;
+ case FIELD:
+ case ARRAY:
+ case UNKNOWN:
+ boolean precise = barrierType != HeapAccess.BarrierType.FIELD;
addSerialPostWriteBarrier(node, node.getAddress(), node.getNewValue(), precise, graph);
break;
default:
throw new GraalError("unexpected barrier type: " + barrierType);
}
< prev index next >