# HG changeset patch # User Christos Kotselidis # Date 1367181286 -7200 # Node ID c21b1e5b515ccdca81acda3dc38304e7b4358641 # Parent 9591dc4a62faa43d60ef3a33eb5f1c0d65ae4f90 Small refactoring diff -r 9591dc4a62fa -r c21b1e5b515c graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierVerificationPhase.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierVerificationPhase.java Sun Apr 28 21:51:57 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierVerificationPhase.java Sun Apr 28 22:34:46 2013 +0200 @@ -105,20 +105,21 @@ } private static boolean validateBarrier(Node write, SerialWriteBarrier barrier) { + ValueNode writtenObject = null; + LocationNode writtenLocation = null; if (write instanceof WriteNode) { - WriteNode writeNode = (WriteNode) write; - if ((barrier.getObject() == writeNode.object()) && (!barrier.usePrecise() || (barrier.usePrecise() && barrier.getLocation() == writeNode.location()))) { - return true; - } - return false; + writtenObject = ((WriteNode) write).object(); + writtenLocation = ((WriteNode) write).location(); } else if (write instanceof CompareAndSwapNode) { - CompareAndSwapNode casNode = (CompareAndSwapNode) write; - if ((barrier.getObject() == casNode.object()) && (!barrier.usePrecise() || (barrier.usePrecise() && barrier.getLocation() == casNode.getLocation()))) { - return true; - } - return false; + writtenObject = ((CompareAndSwapNode) write).object(); + writtenLocation = ((CompareAndSwapNode) write).getLocation(); + } else { + assert false : "Node must be of type requiring a write barrier"; } - assert false : "Node must be of type requiring a write barrier"; + + if ((barrier.getObject() == writtenObject) && (!barrier.usePrecise() || (barrier.usePrecise() && barrier.getLocation() == writtenLocation))) { + return true; + } return false; } }