This commit is contained in:
Phil Race 2017-06-07 06:45:09 -07:00
commit e7a9736953
13 changed files with 401 additions and 401 deletions

View File

@ -2880,19 +2880,19 @@ public final class Class<T> implements java.io.Serializable,
static <T> boolean casReflectionData(Class<?> clazz, static <T> boolean casReflectionData(Class<?> clazz,
SoftReference<ReflectionData<T>> oldData, SoftReference<ReflectionData<T>> oldData,
SoftReference<ReflectionData<T>> newData) { SoftReference<ReflectionData<T>> newData) {
return unsafe.compareAndSwapObject(clazz, reflectionDataOffset, oldData, newData); return unsafe.compareAndSetObject(clazz, reflectionDataOffset, oldData, newData);
} }
static <T> boolean casAnnotationType(Class<?> clazz, static <T> boolean casAnnotationType(Class<?> clazz,
AnnotationType oldType, AnnotationType oldType,
AnnotationType newType) { AnnotationType newType) {
return unsafe.compareAndSwapObject(clazz, annotationTypeOffset, oldType, newType); return unsafe.compareAndSetObject(clazz, annotationTypeOffset, oldType, newType);
} }
static <T> boolean casAnnotationData(Class<?> clazz, static <T> boolean casAnnotationData(Class<?> clazz,
AnnotationData oldData, AnnotationData oldData,
AnnotationData newData) { AnnotationData newData) {
return unsafe.compareAndSwapObject(clazz, annotationDataOffset, oldData, newData); return unsafe.compareAndSetObject(clazz, annotationDataOffset, oldData, newData);
} }
} }

View File

@ -2884,7 +2884,7 @@ public abstract class ClassLoader {
} catch (NoSuchFieldException e) { } catch (NoSuchFieldException e) {
throw new InternalError(e); throw new InternalError(e);
} }
return unsafe.compareAndSwapObject(this, offset, null, obj); return unsafe.compareAndSetObject(this, offset, null, obj);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -125,7 +125,7 @@ final class VarHandle$Type$s {
@ForceInline @ForceInline
static boolean compareAndSet(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) { static boolean compareAndSet(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) {
return UNSAFE.compareAndSwap$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)), return UNSAFE.compareAndSet$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)),
handle.fieldOffset, handle.fieldOffset,
{#if[Object]?handle.fieldType.cast(expected):expected}, {#if[Object]?handle.fieldType.cast(expected):expected},
{#if[Object]?handle.fieldType.cast(value):value}); {#if[Object]?handle.fieldType.cast(value):value});
@ -133,7 +133,7 @@ final class VarHandle$Type$s {
@ForceInline @ForceInline
static $type$ compareAndExchange(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) { static $type$ compareAndExchange(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) {
return UNSAFE.compareAndExchange$Type$Volatile(Objects.requireNonNull(handle.receiverType.cast(holder)), return UNSAFE.compareAndExchange$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)),
handle.fieldOffset, handle.fieldOffset,
{#if[Object]?handle.fieldType.cast(expected):expected}, {#if[Object]?handle.fieldType.cast(expected):expected},
{#if[Object]?handle.fieldType.cast(value):value}); {#if[Object]?handle.fieldType.cast(value):value});
@ -157,7 +157,7 @@ final class VarHandle$Type$s {
@ForceInline @ForceInline
static boolean weakCompareAndSetPlain(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) { static boolean weakCompareAndSetPlain(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) {
return UNSAFE.weakCompareAndSwap$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)), return UNSAFE.weakCompareAndSet$Type$Plain(Objects.requireNonNull(handle.receiverType.cast(holder)),
handle.fieldOffset, handle.fieldOffset,
{#if[Object]?handle.fieldType.cast(expected):expected}, {#if[Object]?handle.fieldType.cast(expected):expected},
{#if[Object]?handle.fieldType.cast(value):value}); {#if[Object]?handle.fieldType.cast(value):value});
@ -165,7 +165,7 @@ final class VarHandle$Type$s {
@ForceInline @ForceInline
static boolean weakCompareAndSet(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) { static boolean weakCompareAndSet(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) {
return UNSAFE.weakCompareAndSwap$Type$Volatile(Objects.requireNonNull(handle.receiverType.cast(holder)), return UNSAFE.weakCompareAndSet$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)),
handle.fieldOffset, handle.fieldOffset,
{#if[Object]?handle.fieldType.cast(expected):expected}, {#if[Object]?handle.fieldType.cast(expected):expected},
{#if[Object]?handle.fieldType.cast(value):value}); {#if[Object]?handle.fieldType.cast(value):value});
@ -173,7 +173,7 @@ final class VarHandle$Type$s {
@ForceInline @ForceInline
static boolean weakCompareAndSetAcquire(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) { static boolean weakCompareAndSetAcquire(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) {
return UNSAFE.weakCompareAndSwap$Type$Acquire(Objects.requireNonNull(handle.receiverType.cast(holder)), return UNSAFE.weakCompareAndSet$Type$Acquire(Objects.requireNonNull(handle.receiverType.cast(holder)),
handle.fieldOffset, handle.fieldOffset,
{#if[Object]?handle.fieldType.cast(expected):expected}, {#if[Object]?handle.fieldType.cast(expected):expected},
{#if[Object]?handle.fieldType.cast(value):value}); {#if[Object]?handle.fieldType.cast(value):value});
@ -181,7 +181,7 @@ final class VarHandle$Type$s {
@ForceInline @ForceInline
static boolean weakCompareAndSetRelease(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) { static boolean weakCompareAndSetRelease(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) {
return UNSAFE.weakCompareAndSwap$Type$Release(Objects.requireNonNull(handle.receiverType.cast(holder)), return UNSAFE.weakCompareAndSet$Type$Release(Objects.requireNonNull(handle.receiverType.cast(holder)),
handle.fieldOffset, handle.fieldOffset,
{#if[Object]?handle.fieldType.cast(expected):expected}, {#if[Object]?handle.fieldType.cast(expected):expected},
{#if[Object]?handle.fieldType.cast(value):value}); {#if[Object]?handle.fieldType.cast(value):value});
@ -275,7 +275,7 @@ final class VarHandle$Type$s {
handle.fieldOffset, handle.fieldOffset,
value); value);
} }
@ForceInline @ForceInline
static $type$ getAndBitwiseXor(FieldInstanceReadWrite handle, Object holder, $type$ value) { static $type$ getAndBitwiseXor(FieldInstanceReadWrite handle, Object holder, $type$ value) {
return UNSAFE.getAndBitwiseXor$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)), return UNSAFE.getAndBitwiseXor$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)),
@ -392,7 +392,7 @@ final class VarHandle$Type$s {
@ForceInline @ForceInline
static boolean compareAndSet(FieldStaticReadWrite handle, $type$ expected, $type$ value) { static boolean compareAndSet(FieldStaticReadWrite handle, $type$ expected, $type$ value) {
return UNSAFE.compareAndSwap$Type$(handle.base, return UNSAFE.compareAndSet$Type$(handle.base,
handle.fieldOffset, handle.fieldOffset,
{#if[Object]?handle.fieldType.cast(expected):expected}, {#if[Object]?handle.fieldType.cast(expected):expected},
{#if[Object]?handle.fieldType.cast(value):value}); {#if[Object]?handle.fieldType.cast(value):value});
@ -401,7 +401,7 @@ final class VarHandle$Type$s {
@ForceInline @ForceInline
static $type$ compareAndExchange(FieldStaticReadWrite handle, $type$ expected, $type$ value) { static $type$ compareAndExchange(FieldStaticReadWrite handle, $type$ expected, $type$ value) {
return UNSAFE.compareAndExchange$Type$Volatile(handle.base, return UNSAFE.compareAndExchange$Type$(handle.base,
handle.fieldOffset, handle.fieldOffset,
{#if[Object]?handle.fieldType.cast(expected):expected}, {#if[Object]?handle.fieldType.cast(expected):expected},
{#if[Object]?handle.fieldType.cast(value):value}); {#if[Object]?handle.fieldType.cast(value):value});
@ -425,7 +425,7 @@ final class VarHandle$Type$s {
@ForceInline @ForceInline
static boolean weakCompareAndSetPlain(FieldStaticReadWrite handle, $type$ expected, $type$ value) { static boolean weakCompareAndSetPlain(FieldStaticReadWrite handle, $type$ expected, $type$ value) {
return UNSAFE.weakCompareAndSwap$Type$(handle.base, return UNSAFE.weakCompareAndSet$Type$Plain(handle.base,
handle.fieldOffset, handle.fieldOffset,
{#if[Object]?handle.fieldType.cast(expected):expected}, {#if[Object]?handle.fieldType.cast(expected):expected},
{#if[Object]?handle.fieldType.cast(value):value}); {#if[Object]?handle.fieldType.cast(value):value});
@ -433,7 +433,7 @@ final class VarHandle$Type$s {
@ForceInline @ForceInline
static boolean weakCompareAndSet(FieldStaticReadWrite handle, $type$ expected, $type$ value) { static boolean weakCompareAndSet(FieldStaticReadWrite handle, $type$ expected, $type$ value) {
return UNSAFE.weakCompareAndSwap$Type$Volatile(handle.base, return UNSAFE.weakCompareAndSet$Type$(handle.base,
handle.fieldOffset, handle.fieldOffset,
{#if[Object]?handle.fieldType.cast(expected):expected}, {#if[Object]?handle.fieldType.cast(expected):expected},
{#if[Object]?handle.fieldType.cast(value):value}); {#if[Object]?handle.fieldType.cast(value):value});
@ -441,7 +441,7 @@ final class VarHandle$Type$s {
@ForceInline @ForceInline
static boolean weakCompareAndSetAcquire(FieldStaticReadWrite handle, $type$ expected, $type$ value) { static boolean weakCompareAndSetAcquire(FieldStaticReadWrite handle, $type$ expected, $type$ value) {
return UNSAFE.weakCompareAndSwap$Type$Acquire(handle.base, return UNSAFE.weakCompareAndSet$Type$Acquire(handle.base,
handle.fieldOffset, handle.fieldOffset,
{#if[Object]?handle.fieldType.cast(expected):expected}, {#if[Object]?handle.fieldType.cast(expected):expected},
{#if[Object]?handle.fieldType.cast(value):value}); {#if[Object]?handle.fieldType.cast(value):value});
@ -449,7 +449,7 @@ final class VarHandle$Type$s {
@ForceInline @ForceInline
static boolean weakCompareAndSetRelease(FieldStaticReadWrite handle, $type$ expected, $type$ value) { static boolean weakCompareAndSetRelease(FieldStaticReadWrite handle, $type$ expected, $type$ value) {
return UNSAFE.weakCompareAndSwap$Type$Release(handle.base, return UNSAFE.weakCompareAndSet$Type$Release(handle.base,
handle.fieldOffset, handle.fieldOffset,
{#if[Object]?handle.fieldType.cast(expected):expected}, {#if[Object]?handle.fieldType.cast(expected):expected},
{#if[Object]?handle.fieldType.cast(value):value}); {#if[Object]?handle.fieldType.cast(value):value});
@ -689,7 +689,7 @@ final class VarHandle$Type$s {
#else[Object] #else[Object]
$type$[] array = ($type$[]) oarray; $type$[] array = ($type$[]) oarray;
#end[Object] #end[Object]
return UNSAFE.compareAndSwap$Type$(array, return UNSAFE.compareAndSet$Type$(array,
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
{#if[Object]?handle.componentType.cast(expected):expected}, {#if[Object]?handle.componentType.cast(expected):expected},
{#if[Object]?handle.componentType.cast(value):value}); {#if[Object]?handle.componentType.cast(value):value});
@ -702,7 +702,7 @@ final class VarHandle$Type$s {
#else[Object] #else[Object]
$type$[] array = ($type$[]) oarray; $type$[] array = ($type$[]) oarray;
#end[Object] #end[Object]
return UNSAFE.compareAndExchange$Type$Volatile(array, return UNSAFE.compareAndExchange$Type$(array,
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
{#if[Object]?handle.componentType.cast(expected):expected}, {#if[Object]?handle.componentType.cast(expected):expected},
{#if[Object]?handle.componentType.cast(value):value}); {#if[Object]?handle.componentType.cast(value):value});
@ -741,7 +741,7 @@ final class VarHandle$Type$s {
#else[Object] #else[Object]
$type$[] array = ($type$[]) oarray; $type$[] array = ($type$[]) oarray;
#end[Object] #end[Object]
return UNSAFE.weakCompareAndSwap$Type$(array, return UNSAFE.weakCompareAndSet$Type$Plain(array,
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
{#if[Object]?handle.componentType.cast(expected):expected}, {#if[Object]?handle.componentType.cast(expected):expected},
{#if[Object]?handle.componentType.cast(value):value}); {#if[Object]?handle.componentType.cast(value):value});
@ -754,7 +754,7 @@ final class VarHandle$Type$s {
#else[Object] #else[Object]
$type$[] array = ($type$[]) oarray; $type$[] array = ($type$[]) oarray;
#end[Object] #end[Object]
return UNSAFE.weakCompareAndSwap$Type$Volatile(array, return UNSAFE.weakCompareAndSet$Type$(array,
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
{#if[Object]?handle.componentType.cast(expected):expected}, {#if[Object]?handle.componentType.cast(expected):expected},
{#if[Object]?handle.componentType.cast(value):value}); {#if[Object]?handle.componentType.cast(value):value});
@ -767,7 +767,7 @@ final class VarHandle$Type$s {
#else[Object] #else[Object]
$type$[] array = ($type$[]) oarray; $type$[] array = ($type$[]) oarray;
#end[Object] #end[Object]
return UNSAFE.weakCompareAndSwap$Type$Acquire(array, return UNSAFE.weakCompareAndSet$Type$Acquire(array,
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
{#if[Object]?handle.componentType.cast(expected):expected}, {#if[Object]?handle.componentType.cast(expected):expected},
{#if[Object]?handle.componentType.cast(value):value}); {#if[Object]?handle.componentType.cast(value):value});
@ -780,7 +780,7 @@ final class VarHandle$Type$s {
#else[Object] #else[Object]
$type$[] array = ($type$[]) oarray; $type$[] array = ($type$[]) oarray;
#end[Object] #end[Object]
return UNSAFE.weakCompareAndSwap$Type$Release(array, return UNSAFE.weakCompareAndSet$Type$Release(array,
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
{#if[Object]?handle.componentType.cast(expected):expected}, {#if[Object]?handle.componentType.cast(expected):expected},
{#if[Object]?handle.componentType.cast(value):value}); {#if[Object]?handle.componentType.cast(value):value});
@ -897,7 +897,7 @@ final class VarHandle$Type$s {
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
value); value);
} }
@ForceInline @ForceInline
static $type$ getAndBitwiseXor(Array handle, Object oarray, int index, $type$ value) { static $type$ getAndBitwiseXor(Array handle, Object oarray, int index, $type$ value) {
$type$[] array = ($type$[]) oarray; $type$[] array = ($type$[]) oarray;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -186,7 +186,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
@ForceInline @ForceInline
static boolean compareAndSet(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { static boolean compareAndSet(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
byte[] ba = (byte[]) oba; byte[] ba = (byte[]) oba;
return UNSAFE.compareAndSwap$RawType$( return UNSAFE.compareAndSet$RawType$(
ba, ba,
address(ba, index(ba, index)), address(ba, index(ba, index)),
convEndian(handle.be, expected), convEndian(handle.be, value)); convEndian(handle.be, expected), convEndian(handle.be, value));
@ -196,7 +196,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
static $type$ compareAndExchange(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { static $type$ compareAndExchange(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
byte[] ba = (byte[]) oba; byte[] ba = (byte[]) oba;
return convEndian(handle.be, return convEndian(handle.be,
UNSAFE.compareAndExchange$RawType$Volatile( UNSAFE.compareAndExchange$RawType$(
ba, ba,
address(ba, index(ba, index)), address(ba, index(ba, index)),
convEndian(handle.be, expected), convEndian(handle.be, value))); convEndian(handle.be, expected), convEndian(handle.be, value)));
@ -225,7 +225,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
@ForceInline @ForceInline
static boolean weakCompareAndSetPlain(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { static boolean weakCompareAndSetPlain(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
byte[] ba = (byte[]) oba; byte[] ba = (byte[]) oba;
return UNSAFE.weakCompareAndSwap$RawType$( return UNSAFE.weakCompareAndSet$RawType$Plain(
ba, ba,
address(ba, index(ba, index)), address(ba, index(ba, index)),
convEndian(handle.be, expected), convEndian(handle.be, value)); convEndian(handle.be, expected), convEndian(handle.be, value));
@ -234,7 +234,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
@ForceInline @ForceInline
static boolean weakCompareAndSet(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { static boolean weakCompareAndSet(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
byte[] ba = (byte[]) oba; byte[] ba = (byte[]) oba;
return UNSAFE.weakCompareAndSwap$RawType$Volatile( return UNSAFE.weakCompareAndSet$RawType$(
ba, ba,
address(ba, index(ba, index)), address(ba, index(ba, index)),
convEndian(handle.be, expected), convEndian(handle.be, value)); convEndian(handle.be, expected), convEndian(handle.be, value));
@ -243,7 +243,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
@ForceInline @ForceInline
static boolean weakCompareAndSetAcquire(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { static boolean weakCompareAndSetAcquire(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
byte[] ba = (byte[]) oba; byte[] ba = (byte[]) oba;
return UNSAFE.weakCompareAndSwap$RawType$Acquire( return UNSAFE.weakCompareAndSet$RawType$Acquire(
ba, ba,
address(ba, index(ba, index)), address(ba, index(ba, index)),
convEndian(handle.be, expected), convEndian(handle.be, value)); convEndian(handle.be, expected), convEndian(handle.be, value));
@ -252,7 +252,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
@ForceInline @ForceInline
static boolean weakCompareAndSetRelease(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { static boolean weakCompareAndSetRelease(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) {
byte[] ba = (byte[]) oba; byte[] ba = (byte[]) oba;
return UNSAFE.weakCompareAndSwap$RawType$Release( return UNSAFE.weakCompareAndSet$RawType$Release(
ba, ba,
address(ba, index(ba, index)), address(ba, index(ba, index)),
convEndian(handle.be, expected), convEndian(handle.be, value)); convEndian(handle.be, expected), convEndian(handle.be, value));
@ -336,7 +336,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
do { do {
nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset); nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset);
expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue);
} while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(ba, offset, } while (!UNSAFE.weakCompareAndSet$RawType$(ba, offset,
nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue + delta))); nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue + delta)));
return expectedValue; return expectedValue;
} }
@ -389,7 +389,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
do { do {
nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset); nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset);
expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue);
} while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(ba, offset, } while (!UNSAFE.weakCompareAndSet$RawType$(ba, offset,
nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue | value))); nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue | value)));
return expectedValue; return expectedValue;
} }
@ -440,7 +440,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
do { do {
nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset); nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset);
expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue);
} while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(ba, offset, } while (!UNSAFE.weakCompareAndSet$RawType$(ba, offset,
nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue & value))); nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue & value)));
return expectedValue; return expectedValue;
} }
@ -491,7 +491,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
do { do {
nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset); nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset);
expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue);
} while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(ba, offset, } while (!UNSAFE.weakCompareAndSet$RawType$(ba, offset,
nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue ^ value))); nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue ^ value)));
return expectedValue; return expectedValue;
} }
@ -625,7 +625,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
@ForceInline @ForceInline
static boolean compareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { static boolean compareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
ByteBuffer bb = (ByteBuffer) obb; ByteBuffer bb = (ByteBuffer) obb;
return UNSAFE.compareAndSwap$RawType$( return UNSAFE.compareAndSet$RawType$(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getObject(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
convEndian(handle.be, expected), convEndian(handle.be, value)); convEndian(handle.be, expected), convEndian(handle.be, value));
@ -635,7 +635,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
static $type$ compareAndExchange(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { static $type$ compareAndExchange(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
ByteBuffer bb = (ByteBuffer) obb; ByteBuffer bb = (ByteBuffer) obb;
return convEndian(handle.be, return convEndian(handle.be,
UNSAFE.compareAndExchange$RawType$Volatile( UNSAFE.compareAndExchange$RawType$(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getObject(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
convEndian(handle.be, expected), convEndian(handle.be, value))); convEndian(handle.be, expected), convEndian(handle.be, value)));
@ -664,7 +664,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
@ForceInline @ForceInline
static boolean weakCompareAndSetPlain(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { static boolean weakCompareAndSetPlain(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
ByteBuffer bb = (ByteBuffer) obb; ByteBuffer bb = (ByteBuffer) obb;
return UNSAFE.weakCompareAndSwap$RawType$( return UNSAFE.weakCompareAndSet$RawType$Plain(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getObject(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
convEndian(handle.be, expected), convEndian(handle.be, value)); convEndian(handle.be, expected), convEndian(handle.be, value));
@ -673,7 +673,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
@ForceInline @ForceInline
static boolean weakCompareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { static boolean weakCompareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
ByteBuffer bb = (ByteBuffer) obb; ByteBuffer bb = (ByteBuffer) obb;
return UNSAFE.weakCompareAndSwap$RawType$Volatile( return UNSAFE.weakCompareAndSet$RawType$(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getObject(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
convEndian(handle.be, expected), convEndian(handle.be, value)); convEndian(handle.be, expected), convEndian(handle.be, value));
@ -682,7 +682,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
@ForceInline @ForceInline
static boolean weakCompareAndSetAcquire(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { static boolean weakCompareAndSetAcquire(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
ByteBuffer bb = (ByteBuffer) obb; ByteBuffer bb = (ByteBuffer) obb;
return UNSAFE.weakCompareAndSwap$RawType$Acquire( return UNSAFE.weakCompareAndSet$RawType$Acquire(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getObject(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
convEndian(handle.be, expected), convEndian(handle.be, value)); convEndian(handle.be, expected), convEndian(handle.be, value));
@ -691,7 +691,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
@ForceInline @ForceInline
static boolean weakCompareAndSetRelease(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { static boolean weakCompareAndSetRelease(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) {
ByteBuffer bb = (ByteBuffer) obb; ByteBuffer bb = (ByteBuffer) obb;
return UNSAFE.weakCompareAndSwap$RawType$Release( return UNSAFE.weakCompareAndSet$RawType$Release(
UNSAFE.getObject(bb, BYTE_BUFFER_HB), UNSAFE.getObject(bb, BYTE_BUFFER_HB),
address(bb, indexRO(bb, index)), address(bb, indexRO(bb, index)),
convEndian(handle.be, expected), convEndian(handle.be, value)); convEndian(handle.be, expected), convEndian(handle.be, value));
@ -776,7 +776,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
do { do {
nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset); nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset);
expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue);
} while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(base, offset, } while (!UNSAFE.weakCompareAndSet$RawType$(base, offset,
nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue + delta))); nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue + delta)));
return expectedValue; return expectedValue;
} }
@ -830,7 +830,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
do { do {
nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset); nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset);
expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue);
} while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(base, offset, } while (!UNSAFE.weakCompareAndSet$RawType$(base, offset,
nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue | value))); nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue | value)));
return expectedValue; return expectedValue;
} }
@ -882,12 +882,12 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
do { do {
nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset); nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset);
expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue);
} while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(base, offset, } while (!UNSAFE.weakCompareAndSet$RawType$(base, offset,
nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue & value))); nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue & value)));
return expectedValue; return expectedValue;
} }
@ForceInline @ForceInline
static $type$ getAndBitwiseXor(ByteBufferHandle handle, Object obb, int index, $type$ value) { static $type$ getAndBitwiseXor(ByteBufferHandle handle, Object obb, int index, $type$ value) {
ByteBuffer bb = (ByteBuffer) obb; ByteBuffer bb = (ByteBuffer) obb;
@ -935,7 +935,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
do { do {
nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset); nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset);
expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue);
} while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(base, offset, } while (!UNSAFE.weakCompareAndSet$RawType$(base, offset,
nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue ^ value))); nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue ^ value)));
return expectedValue; return expectedValue;
} }

View File

@ -768,7 +768,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
static final <K,V> boolean casTabAt(Node<K,V>[] tab, int i, static final <K,V> boolean casTabAt(Node<K,V>[] tab, int i,
Node<K,V> c, Node<K,V> v) { Node<K,V> c, Node<K,V> v) {
return U.compareAndSwapObject(tab, ((long)i << ASHIFT) + ABASE, c, v); return U.compareAndSetObject(tab, ((long)i << ASHIFT) + ABASE, c, v);
} }
static final <K,V> void setTabAt(Node<K,V>[] tab, int i, Node<K,V> v) { static final <K,V> void setTabAt(Node<K,V>[] tab, int i, Node<K,V> v) {
@ -2299,7 +2299,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
while ((tab = table) == null || tab.length == 0) { while ((tab = table) == null || tab.length == 0) {
if ((sc = sizeCtl) < 0) if ((sc = sizeCtl) < 0)
Thread.yield(); // lost initialization race; just spin Thread.yield(); // lost initialization race; just spin
else if (U.compareAndSwapInt(this, SIZECTL, sc, -1)) { else if (U.compareAndSetInt(this, SIZECTL, sc, -1)) {
try { try {
if ((tab = table) == null || tab.length == 0) { if ((tab = table) == null || tab.length == 0) {
int n = (sc > 0) ? sc : DEFAULT_CAPACITY; int n = (sc > 0) ? sc : DEFAULT_CAPACITY;
@ -2330,13 +2330,13 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
private final void addCount(long x, int check) { private final void addCount(long x, int check) {
CounterCell[] as; long b, s; CounterCell[] as; long b, s;
if ((as = counterCells) != null || if ((as = counterCells) != null ||
!U.compareAndSwapLong(this, BASECOUNT, b = baseCount, s = b + x)) { !U.compareAndSetLong(this, BASECOUNT, b = baseCount, s = b + x)) {
CounterCell a; long v; int m; CounterCell a; long v; int m;
boolean uncontended = true; boolean uncontended = true;
if (as == null || (m = as.length - 1) < 0 || if (as == null || (m = as.length - 1) < 0 ||
(a = as[ThreadLocalRandom.getProbe() & m]) == null || (a = as[ThreadLocalRandom.getProbe() & m]) == null ||
!(uncontended = !(uncontended =
U.compareAndSwapLong(a, CELLVALUE, v = a.value, v + x))) { U.compareAndSetLong(a, CELLVALUE, v = a.value, v + x))) {
fullAddCount(x, uncontended); fullAddCount(x, uncontended);
return; return;
} }
@ -2354,10 +2354,10 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
sc == rs + MAX_RESIZERS || (nt = nextTable) == null || sc == rs + MAX_RESIZERS || (nt = nextTable) == null ||
transferIndex <= 0) transferIndex <= 0)
break; break;
if (U.compareAndSwapInt(this, SIZECTL, sc, sc + 1)) if (U.compareAndSetInt(this, SIZECTL, sc, sc + 1))
transfer(tab, nt); transfer(tab, nt);
} }
else if (U.compareAndSwapInt(this, SIZECTL, sc, else if (U.compareAndSetInt(this, SIZECTL, sc,
(rs << RESIZE_STAMP_SHIFT) + 2)) (rs << RESIZE_STAMP_SHIFT) + 2))
transfer(tab, null); transfer(tab, null);
s = sumCount(); s = sumCount();
@ -2378,7 +2378,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 || if ((sc >>> RESIZE_STAMP_SHIFT) != rs || sc == rs + 1 ||
sc == rs + MAX_RESIZERS || transferIndex <= 0) sc == rs + MAX_RESIZERS || transferIndex <= 0)
break; break;
if (U.compareAndSwapInt(this, SIZECTL, sc, sc + 1)) { if (U.compareAndSetInt(this, SIZECTL, sc, sc + 1)) {
transfer(tab, nextTab); transfer(tab, nextTab);
break; break;
} }
@ -2401,7 +2401,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
Node<K,V>[] tab = table; int n; Node<K,V>[] tab = table; int n;
if (tab == null || (n = tab.length) == 0) { if (tab == null || (n = tab.length) == 0) {
n = (sc > c) ? sc : c; n = (sc > c) ? sc : c;
if (U.compareAndSwapInt(this, SIZECTL, sc, -1)) { if (U.compareAndSetInt(this, SIZECTL, sc, -1)) {
try { try {
if (table == tab) { if (table == tab) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -2418,7 +2418,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
break; break;
else if (tab == table) { else if (tab == table) {
int rs = resizeStamp(n); int rs = resizeStamp(n);
if (U.compareAndSwapInt(this, SIZECTL, sc, if (U.compareAndSetInt(this, SIZECTL, sc,
(rs << RESIZE_STAMP_SHIFT) + 2)) (rs << RESIZE_STAMP_SHIFT) + 2))
transfer(tab, null); transfer(tab, null);
} }
@ -2459,7 +2459,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
i = -1; i = -1;
advance = false; advance = false;
} }
else if (U.compareAndSwapInt else if (U.compareAndSetInt
(this, TRANSFERINDEX, nextIndex, (this, TRANSFERINDEX, nextIndex,
nextBound = (nextIndex > stride ? nextBound = (nextIndex > stride ?
nextIndex - stride : 0))) { nextIndex - stride : 0))) {
@ -2476,7 +2476,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
sizeCtl = (n << 1) - (n >>> 1); sizeCtl = (n << 1) - (n >>> 1);
return; return;
} }
if (U.compareAndSwapInt(this, SIZECTL, sc = sizeCtl, sc - 1)) { if (U.compareAndSetInt(this, SIZECTL, sc = sizeCtl, sc - 1)) {
if ((sc - 2) != resizeStamp(n) << RESIZE_STAMP_SHIFT) if ((sc - 2) != resizeStamp(n) << RESIZE_STAMP_SHIFT)
return; return;
finishing = advance = true; finishing = advance = true;
@ -2601,7 +2601,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
if (cellsBusy == 0) { // Try to attach new Cell if (cellsBusy == 0) { // Try to attach new Cell
CounterCell r = new CounterCell(x); // Optimistic create CounterCell r = new CounterCell(x); // Optimistic create
if (cellsBusy == 0 && if (cellsBusy == 0 &&
U.compareAndSwapInt(this, CELLSBUSY, 0, 1)) { U.compareAndSetInt(this, CELLSBUSY, 0, 1)) {
boolean created = false; boolean created = false;
try { // Recheck under lock try { // Recheck under lock
CounterCell[] rs; int m, j; CounterCell[] rs; int m, j;
@ -2623,14 +2623,14 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
} }
else if (!wasUncontended) // CAS already known to fail else if (!wasUncontended) // CAS already known to fail
wasUncontended = true; // Continue after rehash wasUncontended = true; // Continue after rehash
else if (U.compareAndSwapLong(a, CELLVALUE, v = a.value, v + x)) else if (U.compareAndSetLong(a, CELLVALUE, v = a.value, v + x))
break; break;
else if (counterCells != as || n >= NCPU) else if (counterCells != as || n >= NCPU)
collide = false; // At max size or stale collide = false; // At max size or stale
else if (!collide) else if (!collide)
collide = true; collide = true;
else if (cellsBusy == 0 && else if (cellsBusy == 0 &&
U.compareAndSwapInt(this, CELLSBUSY, 0, 1)) { U.compareAndSetInt(this, CELLSBUSY, 0, 1)) {
try { try {
if (counterCells == as) {// Expand table unless stale if (counterCells == as) {// Expand table unless stale
CounterCell[] rs = new CounterCell[n << 1]; CounterCell[] rs = new CounterCell[n << 1];
@ -2647,7 +2647,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
h = ThreadLocalRandom.advanceProbe(h); h = ThreadLocalRandom.advanceProbe(h);
} }
else if (cellsBusy == 0 && counterCells == as && else if (cellsBusy == 0 && counterCells == as &&
U.compareAndSwapInt(this, CELLSBUSY, 0, 1)) { U.compareAndSetInt(this, CELLSBUSY, 0, 1)) {
boolean init = false; boolean init = false;
try { // Initialize table try { // Initialize table
if (counterCells == as) { if (counterCells == as) {
@ -2662,7 +2662,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
if (init) if (init)
break; break;
} }
else if (U.compareAndSwapLong(this, BASECOUNT, v = baseCount, v + x)) else if (U.compareAndSetLong(this, BASECOUNT, v = baseCount, v + x))
break; // Fall back on using base break; // Fall back on using base
} }
} }
@ -2858,7 +2858,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* Acquires write lock for tree restructuring. * Acquires write lock for tree restructuring.
*/ */
private final void lockRoot() { private final void lockRoot() {
if (!U.compareAndSwapInt(this, LOCKSTATE, 0, WRITER)) if (!U.compareAndSetInt(this, LOCKSTATE, 0, WRITER))
contendedLock(); // offload to separate method contendedLock(); // offload to separate method
} }
@ -2876,14 +2876,14 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
boolean waiting = false; boolean waiting = false;
for (int s;;) { for (int s;;) {
if (((s = lockState) & ~WAITER) == 0) { if (((s = lockState) & ~WAITER) == 0) {
if (U.compareAndSwapInt(this, LOCKSTATE, s, WRITER)) { if (U.compareAndSetInt(this, LOCKSTATE, s, WRITER)) {
if (waiting) if (waiting)
waiter = null; waiter = null;
return; return;
} }
} }
else if ((s & WAITER) == 0) { else if ((s & WAITER) == 0) {
if (U.compareAndSwapInt(this, LOCKSTATE, s, s | WAITER)) { if (U.compareAndSetInt(this, LOCKSTATE, s, s | WAITER)) {
waiting = true; waiting = true;
waiter = Thread.currentThread(); waiter = Thread.currentThread();
} }
@ -2908,7 +2908,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
return e; return e;
e = e.next; e = e.next;
} }
else if (U.compareAndSwapInt(this, LOCKSTATE, s, else if (U.compareAndSetInt(this, LOCKSTATE, s,
s + READER)) { s + READER)) {
TreeNode<K,V> r, p; TreeNode<K,V> r, p;
try { try {

View File

@ -140,7 +140,7 @@ public class AtomicInteger extends Number implements java.io.Serializable {
* the actual value was not equal to the expected value. * the actual value was not equal to the expected value.
*/ */
public final boolean compareAndSet(int expectedValue, int newValue) { public final boolean compareAndSet(int expectedValue, int newValue) {
return U.compareAndSwapInt(this, VALUE, expectedValue, newValue); return U.compareAndSetInt(this, VALUE, expectedValue, newValue);
} }
/** /**
@ -161,7 +161,7 @@ public class AtomicInteger extends Number implements java.io.Serializable {
*/ */
@Deprecated(since="9") @Deprecated(since="9")
public final boolean weakCompareAndSet(int expectedValue, int newValue) { public final boolean weakCompareAndSet(int expectedValue, int newValue) {
return U.weakCompareAndSwapInt(this, VALUE, expectedValue, newValue); return U.weakCompareAndSetIntPlain(this, VALUE, expectedValue, newValue);
} }
/** /**
@ -175,7 +175,7 @@ public class AtomicInteger extends Number implements java.io.Serializable {
* @since 9 * @since 9
*/ */
public final boolean weakCompareAndSetPlain(int expectedValue, int newValue) { public final boolean weakCompareAndSetPlain(int expectedValue, int newValue) {
return U.weakCompareAndSwapInt(this, VALUE, expectedValue, newValue); return U.weakCompareAndSetIntPlain(this, VALUE, expectedValue, newValue);
} }
/** /**
@ -473,7 +473,7 @@ public class AtomicInteger extends Number implements java.io.Serializable {
* @since 9 * @since 9
*/ */
public final int compareAndExchange(int expectedValue, int newValue) { public final int compareAndExchange(int expectedValue, int newValue) {
return U.compareAndExchangeIntVolatile(this, VALUE, expectedValue, newValue); return U.compareAndExchangeInt(this, VALUE, expectedValue, newValue);
} }
/** /**
@ -520,7 +520,7 @@ public class AtomicInteger extends Number implements java.io.Serializable {
* @since 9 * @since 9
*/ */
public final boolean weakCompareAndSetVolatile(int expectedValue, int newValue) { public final boolean weakCompareAndSetVolatile(int expectedValue, int newValue) {
return U.weakCompareAndSwapIntVolatile(this, VALUE, expectedValue, newValue); return U.weakCompareAndSetInt(this, VALUE, expectedValue, newValue);
} }
/** /**
@ -535,7 +535,7 @@ public class AtomicInteger extends Number implements java.io.Serializable {
* @since 9 * @since 9
*/ */
public final boolean weakCompareAndSetAcquire(int expectedValue, int newValue) { public final boolean weakCompareAndSetAcquire(int expectedValue, int newValue) {
return U.weakCompareAndSwapIntAcquire(this, VALUE, expectedValue, newValue); return U.weakCompareAndSetIntAcquire(this, VALUE, expectedValue, newValue);
} }
/** /**
@ -550,7 +550,7 @@ public class AtomicInteger extends Number implements java.io.Serializable {
* @since 9 * @since 9
*/ */
public final boolean weakCompareAndSetRelease(int expectedValue, int newValue) { public final boolean weakCompareAndSetRelease(int expectedValue, int newValue) {
return U.weakCompareAndSwapIntRelease(this, VALUE, expectedValue, newValue); return U.weakCompareAndSetIntRelease(this, VALUE, expectedValue, newValue);
} }
} }

View File

@ -481,12 +481,12 @@ public abstract class AtomicIntegerFieldUpdater<T> {
public final boolean compareAndSet(T obj, int expect, int update) { public final boolean compareAndSet(T obj, int expect, int update) {
accessCheck(obj); accessCheck(obj);
return U.compareAndSwapInt(obj, offset, expect, update); return U.compareAndSetInt(obj, offset, expect, update);
} }
public final boolean weakCompareAndSet(T obj, int expect, int update) { public final boolean weakCompareAndSet(T obj, int expect, int update) {
accessCheck(obj); accessCheck(obj);
return U.compareAndSwapInt(obj, offset, expect, update); return U.compareAndSetInt(obj, offset, expect, update);
} }
public final void set(T obj, int newValue) { public final void set(T obj, int newValue) {

View File

@ -56,7 +56,7 @@ public class AtomicLong extends Number implements java.io.Serializable {
/** /**
* Records whether the underlying JVM supports lockless * Records whether the underlying JVM supports lockless
* compareAndSwap for longs. While the intrinsic compareAndSwapLong * compareAndSet for longs. While the intrinsic compareAndSetLong
* method works in either case, some constructions should be * method works in either case, some constructions should be
* handled at Java level to avoid locking user-visible locks. * handled at Java level to avoid locking user-visible locks.
*/ */
@ -119,7 +119,7 @@ public class AtomicLong extends Number implements java.io.Serializable {
*/ */
public final void set(long newValue) { public final void set(long newValue) {
// Use putLongVolatile instead of ordinary volatile store when // Use putLongVolatile instead of ordinary volatile store when
// using compareAndSwapLong, for sake of some 32bit systems. // using compareAndSetLong, for sake of some 32bit systems.
U.putLongVolatile(this, VALUE, newValue); U.putLongVolatile(this, VALUE, newValue);
} }
@ -156,7 +156,7 @@ public class AtomicLong extends Number implements java.io.Serializable {
* the actual value was not equal to the expected value. * the actual value was not equal to the expected value.
*/ */
public final boolean compareAndSet(long expectedValue, long newValue) { public final boolean compareAndSet(long expectedValue, long newValue) {
return U.compareAndSwapLong(this, VALUE, expectedValue, newValue); return U.compareAndSetLong(this, VALUE, expectedValue, newValue);
} }
/** /**
@ -177,7 +177,7 @@ public class AtomicLong extends Number implements java.io.Serializable {
*/ */
@Deprecated(since="9") @Deprecated(since="9")
public final boolean weakCompareAndSet(long expectedValue, long newValue) { public final boolean weakCompareAndSet(long expectedValue, long newValue) {
return U.weakCompareAndSwapLong(this, VALUE, expectedValue, newValue); return U.weakCompareAndSetLongPlain(this, VALUE, expectedValue, newValue);
} }
/** /**
@ -191,7 +191,7 @@ public class AtomicLong extends Number implements java.io.Serializable {
* @since 9 * @since 9
*/ */
public final boolean weakCompareAndSetPlain(long expectedValue, long newValue) { public final boolean weakCompareAndSetPlain(long expectedValue, long newValue) {
return U.weakCompareAndSwapLong(this, VALUE, expectedValue, newValue); return U.weakCompareAndSetLongPlain(this, VALUE, expectedValue, newValue);
} }
/** /**
@ -487,7 +487,7 @@ public class AtomicLong extends Number implements java.io.Serializable {
* @since 9 * @since 9
*/ */
public final long compareAndExchange(long expectedValue, long newValue) { public final long compareAndExchange(long expectedValue, long newValue) {
return U.compareAndExchangeLongVolatile(this, VALUE, expectedValue, newValue); return U.compareAndExchangeLong(this, VALUE, expectedValue, newValue);
} }
/** /**
@ -534,7 +534,7 @@ public class AtomicLong extends Number implements java.io.Serializable {
* @since 9 * @since 9
*/ */
public final boolean weakCompareAndSetVolatile(long expectedValue, long newValue) { public final boolean weakCompareAndSetVolatile(long expectedValue, long newValue) {
return U.weakCompareAndSwapLongVolatile(this, VALUE, expectedValue, newValue); return U.weakCompareAndSetLong(this, VALUE, expectedValue, newValue);
} }
/** /**
@ -549,7 +549,7 @@ public class AtomicLong extends Number implements java.io.Serializable {
* @since 9 * @since 9
*/ */
public final boolean weakCompareAndSetAcquire(long expectedValue, long newValue) { public final boolean weakCompareAndSetAcquire(long expectedValue, long newValue) {
return U.weakCompareAndSwapLongAcquire(this, VALUE, expectedValue, newValue); return U.weakCompareAndSetLongAcquire(this, VALUE, expectedValue, newValue);
} }
/** /**
@ -564,7 +564,7 @@ public class AtomicLong extends Number implements java.io.Serializable {
* @since 9 * @since 9
*/ */
public final boolean weakCompareAndSetRelease(long expectedValue, long newValue) { public final boolean weakCompareAndSetRelease(long expectedValue, long newValue) {
return U.weakCompareAndSwapLongRelease(this, VALUE, expectedValue, newValue); return U.weakCompareAndSetLongRelease(this, VALUE, expectedValue, newValue);
} }
} }

View File

@ -454,12 +454,12 @@ public abstract class AtomicLongFieldUpdater<T> {
public final boolean compareAndSet(T obj, long expect, long update) { public final boolean compareAndSet(T obj, long expect, long update) {
accessCheck(obj); accessCheck(obj);
return U.compareAndSwapLong(obj, offset, expect, update); return U.compareAndSetLong(obj, offset, expect, update);
} }
public final boolean weakCompareAndSet(T obj, long expect, long update) { public final boolean weakCompareAndSet(T obj, long expect, long update) {
accessCheck(obj); accessCheck(obj);
return U.compareAndSwapLong(obj, offset, expect, update); return U.compareAndSetLong(obj, offset, expect, update);
} }
public final void set(T obj, long newValue) { public final void set(T obj, long newValue) {

View File

@ -432,14 +432,14 @@ public abstract class AtomicReferenceFieldUpdater<T,V> {
public final boolean compareAndSet(T obj, V expect, V update) { public final boolean compareAndSet(T obj, V expect, V update) {
accessCheck(obj); accessCheck(obj);
valueCheck(update); valueCheck(update);
return U.compareAndSwapObject(obj, offset, expect, update); return U.compareAndSetObject(obj, offset, expect, update);
} }
public final boolean weakCompareAndSet(T obj, V expect, V update) { public final boolean weakCompareAndSet(T obj, V expect, V update) {
// same implementation as strong form for now // same implementation as strong form for now
accessCheck(obj); accessCheck(obj);
valueCheck(update); valueCheck(update);
return U.compareAndSwapObject(obj, offset, expect, update); return U.compareAndSetObject(obj, offset, expect, update);
} }
public final void set(T obj, V newValue) { public final void set(T obj, V newValue) {

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -872,7 +872,7 @@ public final class Unsafe {
public final boolean compareAndSwapObject(Object o, long offset, public final boolean compareAndSwapObject(Object o, long offset,
Object expected, Object expected,
Object x) { Object x) {
return theInternalUnsafe.compareAndSwapObject(o, offset, expected, x); return theInternalUnsafe.compareAndSetObject(o, offset, expected, x);
} }
/** /**
@ -888,7 +888,7 @@ public final class Unsafe {
public final boolean compareAndSwapInt(Object o, long offset, public final boolean compareAndSwapInt(Object o, long offset,
int expected, int expected,
int x) { int x) {
return theInternalUnsafe.compareAndSwapInt(o, offset, expected, x); return theInternalUnsafe.compareAndSetInt(o, offset, expected, x);
} }
/** /**
@ -904,7 +904,7 @@ public final class Unsafe {
public final boolean compareAndSwapLong(Object o, long offset, public final boolean compareAndSwapLong(Object o, long offset,
long expected, long expected,
long x) { long x) {
return theInternalUnsafe.compareAndSwapLong(o, offset, expected, x); return theInternalUnsafe.compareAndSetLong(o, offset, expected, x);
} }
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -38,7 +38,7 @@ import sun.security.krb5.Config;
/* /*
* @test * @test
* @bug 8164656 * @bug 8164656 8181461
* @run main/othervm KdcPolicy udp * @run main/othervm KdcPolicy udp
* @run main/othervm KdcPolicy tcp * @run main/othervm KdcPolicy tcp
* @summary krb5.kdc.bad.policy test * @summary krb5.kdc.bad.policy test
@ -110,7 +110,7 @@ public class KdcPolicy {
// It is possible the real KDC cannot fulfil the request // It is possible the real KDC cannot fulfil the request
// in 3s, so it might fail (either 1st time or 2nd time). // in 3s, so it might fail (either 1st time or 2nd time).
writeConf(1, 3000, p1, p3); writeConf(1, 3000, p1, p3);
test("a3000c3000c3000|a3000c3000-|a3000c3000c3000-"); test("a3000c3000c3000|a3000c3000-|a3000c3000c3000a3000-");
// If a test case won't use a real KDC, it can be sped up. // If a test case won't use a real KDC, it can be sped up.
writeConf(3, 5, p1, p2); writeConf(3, 5, p1, p2);