comparison graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DirectCompareAndSwapNode.java @ 7530:5e3d1a68664e

applied mx eclipseformat to all Java files
author Doug Simon <doug.simon@oracle.com>
date Wed, 23 Jan 2013 16:34:57 +0100
parents 2912b72d840a
children b66a826acf4b
comparison
equal deleted inserted replaced
7529:4a11124a3563 7530:5e3d1a68664e
29 import com.oracle.graal.nodes.extended.*; 29 import com.oracle.graal.nodes.extended.*;
30 import com.oracle.graal.nodes.java.*; 30 import com.oracle.graal.nodes.java.*;
31 import com.oracle.graal.word.*; 31 import com.oracle.graal.word.*;
32 32
33 /** 33 /**
34 * A special purpose store node that differs from {@link CompareAndSwapNode} in that 34 * A special purpose store node that differs from {@link CompareAndSwapNode} in that it is not a
35 * it is not a {@link StateSplit} and it {@linkplain #compareAndSwap(Object, long, Word, Word) returns} 35 * {@link StateSplit} and it {@linkplain #compareAndSwap(Object, long, Word, Word) returns} either
36 * either the expected value or the compared against value instead of a boolean. 36 * the expected value or the compared against value instead of a boolean.
37 */ 37 */
38 public class DirectCompareAndSwapNode extends FixedWithNextNode implements LIRGenLowerable, MemoryCheckpoint { 38 public class DirectCompareAndSwapNode extends FixedWithNextNode implements LIRGenLowerable, MemoryCheckpoint {
39 39
40 @Input private ValueNode object; 40 @Input private ValueNode object;
41 @Input private ValueNode offset; 41 @Input private ValueNode offset;
47 this.object = object; 47 this.object = object;
48 this.offset = offset; 48 this.offset = offset;
49 this.expectedValue = expected; 49 this.expectedValue = expected;
50 this.newValue = newValue; 50 this.newValue = newValue;
51 } 51 }
52
53 52
54 @Override 53 @Override
55 public void generate(LIRGenerator gen) { 54 public void generate(LIRGenerator gen) {
56 ((HotSpotLIRGenerator) gen).visitDirectCompareAndSwap(this); 55 ((HotSpotLIRGenerator) gen).visitDirectCompareAndSwap(this);
57 } 56 }
71 public ValueNode newValue() { 70 public ValueNode newValue() {
72 return newValue; 71 return newValue;
73 } 72 }
74 73
75 /** 74 /**
76 * Compares an expected value with the actual value in a location denoted by an object and a given offset. 75 * Compares an expected value with the actual value in a location denoted by an object and a
77 * Iff they are same, {@code newValue} is placed into the location and the {@code expectedValue} is returned. 76 * given offset. Iff they are same, {@code newValue} is placed into the location and the
78 * Otherwise, the actual value is returned. 77 * {@code expectedValue} is returned. Otherwise, the actual value is returned. All of the above
79 * All of the above is performed in one atomic hardware transaction. 78 * is performed in one atomic hardware transaction.
80 * 79 *
81 * @param object the object containing a field to be atomically tested and updated 80 * @param object the object containing a field to be atomically tested and updated
82 * @param offset offset from {@code object} of the field 81 * @param offset offset from {@code object} of the field
83 * @param expectedValue if this value is currently in the field, perform the swap 82 * @param expectedValue if this value is currently in the field, perform the swap
84 * @param newValue the new value to put into the field 83 * @param newValue the new value to put into the field
85 * @return either {@code expectedValue} or the actual value 84 * @return either {@code expectedValue} or the actual value