changeset 9408:c21b1e5b515c

Small refactoring
author Christos Kotselidis <christos.kotselidis@oracle.com>
date Sun, 28 Apr 2013 22:34:46 +0200
parents 9591dc4a62fa
children 16a10b48e526
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierVerificationPhase.java
diffstat 1 files changed, 12 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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;
     }
 }