changeset 16642:78b8af271e86

[SPARC] compareAndSwap must not modify the new value.
author Stefan Anzinger <stefan.anzinger@gmail.com>
date Thu, 24 Jul 2014 15:38:05 -0700
parents 422eda5267b3
children b1af1727a783
files graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotNodeLIRBuilder.java
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotNodeLIRBuilder.java	Thu Jul 24 08:19:30 2014 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotNodeLIRBuilder.java	Thu Jul 24 15:38:05 2014 -0700
@@ -73,7 +73,8 @@
         Value offset = operand(x.offset());
         Variable cmpValue = (Variable) gen.loadNonConst(operand(x.expectedValue()));
         Variable newValue = gen.load(operand(x.newValue()));
-
+        Variable newValueTemp = gen.newVariable(newValue.getLIRKind());
+        getGen().emitMove(newValueTemp, newValue);
         LIRKind kind = cmpValue.getLIRKind();
         assert kind.equals(newValue.getLIRKind());
 
@@ -88,8 +89,8 @@
             }
         }
 
-        append(new CompareAndSwapOp(address, cmpValue, newValue));
-        setResult(x, gen.emitMove(newValue));
+        append(new CompareAndSwapOp(address, cmpValue, newValueTemp));
+        setResult(x, gen.emitMove(newValueTemp));
     }
 
     @Override