Skip to content

Commit 0b9d9e3

Browse files
[GR-63772] Fix serial GC write barrier verification.
PullRequest: graal/20461
2 parents ac282f9 + 6428228 commit 0b9d9e3

File tree

1 file changed

+6
-11
lines changed
  • substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/graal

1 file changed

+6
-11
lines changed

substratevm/src/com.oracle.svm.core.genscavenge/src/com/oracle/svm/core/genscavenge/graal/BarrierSnippets.java

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
import jdk.graal.compiler.core.common.GraalOptions;
5050
import jdk.graal.compiler.core.common.spi.ForeignCallDescriptor;
5151
import jdk.graal.compiler.graph.Node;
52+
import jdk.graal.compiler.graph.Node.ConstantNodeParameter;
53+
import jdk.graal.compiler.graph.Node.NodeIntrinsic;
5254
import jdk.graal.compiler.nodes.BreakpointNode;
5355
import jdk.graal.compiler.nodes.NamedLocationIdentity;
5456
import jdk.graal.compiler.nodes.extended.BranchProbabilityNode;
@@ -74,8 +76,7 @@ public class BarrierSnippets extends SubstrateTemplates implements Snippets {
7476
public static final LocationIdentity CARD_REMEMBERED_SET_LOCATION = NamedLocationIdentity.mutable("CardRememberedSet");
7577

7678
private static final SnippetRuntime.SubstrateForeignCallDescriptor POST_WRITE_BARRIER = SnippetRuntime.findForeignCall(BarrierSnippets.class, "postWriteBarrierStub",
77-
NO_SIDE_EFFECT,
78-
CARD_REMEMBERED_SET_LOCATION);
79+
NO_SIDE_EFFECT, CARD_REMEMBERED_SET_LOCATION);
7980

8081
private final SnippetInfo postWriteBarrierSnippet;
8182

@@ -108,8 +109,8 @@ public static void postWriteBarrierStub(Object object) {
108109
}
109110
}
110111

111-
@Node.NodeIntrinsic(ForeignCallNode.class)
112-
private static native void callPostWriteBarrierStub(@Node.ConstantNodeParameter ForeignCallDescriptor descriptor, Object object);
112+
@NodeIntrinsic(ForeignCallNode.class)
113+
private static native void callPostWriteBarrierStub(@ConstantNodeParameter ForeignCallDescriptor descriptor, Object object);
113114

114115
@Snippet
115116
public static void postWriteBarrierSnippet(Object object, @ConstantParameter boolean shouldOutline, @ConstantParameter boolean alwaysAlignedChunk, @ConstantParameter boolean verifyOnly) {
@@ -120,20 +121,14 @@ public static void postWriteBarrierSnippet(Object object, @ConstantParameter boo
120121
if (SerialGCOptions.VerifyWriteBarriers.getValue() && alwaysAlignedChunk) {
121122
/*
122123
* To increase verification coverage, we do the verification before checking if a
123-
* barrier is needed at all. And in addition to verifying that the object is in an
124-
* aligned chunk, we also verify that it is not an array at all because most arrays are
125-
* small and therefore in an aligned chunk.
124+
* barrier is needed at all.
126125
*/
127-
128126
if (BranchProbabilityNode.probability(BranchProbabilityNode.SLOW_PATH_PROBABILITY, ObjectHeaderImpl.isUnalignedHeader(objectHeader))) {
129127
BreakpointNode.breakpoint();
130128
}
131129
if (BranchProbabilityNode.probability(BranchProbabilityNode.SLOW_PATH_PROBABILITY, fixedObject == null)) {
132130
BreakpointNode.breakpoint();
133131
}
134-
if (BranchProbabilityNode.probability(BranchProbabilityNode.SLOW_PATH_PROBABILITY, fixedObject.getClass().isArray())) {
135-
BreakpointNode.breakpoint();
136-
}
137132
}
138133

139134
boolean needsBarrier = RememberedSet.get().hasRememberedSet(objectHeader);

0 commit comments

Comments
 (0)