Skip to content

Commit

Permalink
Merge pull request #4912 from theresa-m/unsafe_0.13
Browse files Browse the repository at this point in the history
0.13: Fix memory semantics for Unsafe.getAndSet*
  • Loading branch information
DanHeidinga committed Feb 28, 2019
2 parents 70780bb + 7ed0a27 commit d44db0f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions jcl/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
Expand Up @@ -3834,7 +3834,7 @@ public final char getAndAddCharAcquire(Object obj, long offset, char value) {
public final byte getAndSetByte(Object obj, long offset, byte value) {
for (;;) {
byte byteAtOffset = getByteVolatile(obj, offset);
if (weakCompareAndSetByte(obj, offset, byteAtOffset, value)) {
if (compareAndSetByte(obj, offset, byteAtOffset, value)) {
return byteAtOffset;
}
}
Expand Down Expand Up @@ -3894,7 +3894,7 @@ public final byte getAndSetByteAcquire(Object obj, long offset, byte value) {
public final int getAndSetInt(Object obj, long offset, int value) {
for (;;) {
int intAtOffset = getIntVolatile(obj, offset);
if (weakCompareAndSetInt(obj, offset, intAtOffset, value)) {
if (compareAndSetInt(obj, offset, intAtOffset, value)) {
return intAtOffset;
}
}
Expand Down Expand Up @@ -3954,7 +3954,7 @@ public final int getAndSetIntAcquire(Object obj, long offset, int value) {
public final long getAndSetLong(Object obj, long offset, long value) {
for (;;) {
long longAtOffset = getLongVolatile(obj, offset);
if (weakCompareAndSetLong(obj, offset, longAtOffset, value)) {
if (compareAndSetLong(obj, offset, longAtOffset, value)) {
return longAtOffset;
}
}
Expand Down Expand Up @@ -4110,7 +4110,7 @@ public final double getAndSetDoubleAcquire(Object obj, long offset, double value
public final short getAndSetShort(Object obj, long offset, short value) {
for (;;) {
short shortAtOffset = getShortVolatile(obj, offset);
if (weakCompareAndSetShort(obj, offset, shortAtOffset, value)) {
if (compareAndSetShort(obj, offset, shortAtOffset, value)) {
return shortAtOffset;
}
}
Expand Down Expand Up @@ -4170,7 +4170,7 @@ public final short getAndSetShortAcquire(Object obj, long offset, short value) {
public final char getAndSetChar(Object obj, long offset, char value) {
for (;;) {
char charAtOffset = getCharVolatile(obj, offset);
if (weakCompareAndSetChar(obj, offset, charAtOffset, value)) {
if (compareAndSetChar(obj, offset, charAtOffset, value)) {
return charAtOffset;
}
}
Expand Down Expand Up @@ -4278,7 +4278,7 @@ public final boolean getAndSetBooleanAcquire(Object obj, long offset, boolean va
public final Object getAndSetObject(Object obj, long offset, Object value) {
for (;;) {
Object objectAtOffset = getObjectVolatile(obj, offset);
if (weakCompareAndSetObject(obj, offset, objectAtOffset, value)) {
if (compareAndSetObject(obj, offset, objectAtOffset, value)) {
return objectAtOffset;
}
}
Expand Down

0 comments on commit d44db0f

Please sign in to comment.