@@ -184,22 +184,25 @@ public void verifyBarriers(StructuredGraph graph) {
184
184
node instanceof LoweredAtomicReadAndWriteNode ) {
185
185
LIRLowerableAccess read = (LIRLowerableAccess ) node ;
186
186
Stamp stamp = read .getAccessStamp (NodeView .DEFAULT );
187
+ BarrierType barrierType = read .getBarrierType ();
187
188
if (!stamp .isObjectStamp ()) {
188
- GraalError .guarantee (read . getBarrierType () == BarrierType .NONE , "no barriers for primitive reads: %s" , read );
189
+ GraalError .guarantee (barrierType == BarrierType .NONE , "no barriers for primitive reads: %s" , read );
189
190
continue ;
190
191
}
191
192
192
- BarrierType expectedBarrier = barrierForLocation (read . getBarrierType () , read .getLocationIdentity (), JavaKind .Object );
193
+ BarrierType expectedBarrier = barrierForLocation (barrierType , read .getLocationIdentity (), JavaKind .Object );
193
194
if (expectedBarrier != null ) {
194
- GraalError .guarantee (expectedBarrier == read . getBarrierType () , "expected %s but found %s in %s" , expectedBarrier , read . getBarrierType () , read );
195
+ GraalError .guarantee (expectedBarrier == barrierType , "expected %s but found %s in %s" , expectedBarrier , barrierType , read );
195
196
continue ;
196
197
}
197
198
198
199
ValueNode base = read .getAddress ().getBase ();
199
200
if (!base .stamp (NodeView .DEFAULT ).isObjectStamp ()) {
200
- GraalError .guarantee (read .getBarrierType () == BarrierType .NONE , "no barrier for non-heap read: %s" , read );
201
+ GraalError .guarantee (barrierType == BarrierType .NONE , "no barrier for non-heap read: %s" , read );
202
+ } else if (node instanceof AbstractCompareAndSwapNode || node instanceof LoweredAtomicReadAndWriteNode ) {
203
+ GraalError .guarantee (barrierType == BarrierType .FIELD || barrierType == BarrierType .ARRAY , "missing barriers for heap read: %s" , read );
201
204
} else {
202
- GraalError .guarantee (read . getBarrierType () == BarrierType .READ , "missing barriers for heap read: %s" , read );
205
+ GraalError .guarantee (barrierType == BarrierType .READ , "missing barriers for heap read: %s" , read );
203
206
}
204
207
} else if (node instanceof AddressableMemoryAccess ) {
205
208
AddressableMemoryAccess access = (AddressableMemoryAccess ) node ;
0 commit comments