mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
Reviewed-by: dholmes, thartmann
This commit is contained in:
parent
fd8d1cd6bf
commit
5e6d6b8642
70 changed files with 643 additions and 603 deletions
|
@ -1222,6 +1222,6 @@ class Random implements java.io.Serializable {
|
|||
} catch (Exception ex) { throw new Error(ex); }
|
||||
}
|
||||
private void resetSeed(long seedVal) {
|
||||
unsafe.putObjectVolatile(this, seedOffset, new AtomicLong(seedVal));
|
||||
unsafe.putReferenceVolatile(this, seedOffset, new AtomicLong(seedVal));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -757,16 +757,16 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
static final <K,V> Node<K,V> tabAt(Node<K,V>[] tab, int i) {
|
||||
return (Node<K,V>)U.getObjectAcquire(tab, ((long)i << ASHIFT) + ABASE);
|
||||
return (Node<K,V>)U.getReferenceAcquire(tab, ((long)i << ASHIFT) + ABASE);
|
||||
}
|
||||
|
||||
static final <K,V> boolean casTabAt(Node<K,V>[] tab, int i,
|
||||
Node<K,V> c, Node<K,V> v) {
|
||||
return U.compareAndSetObject(tab, ((long)i << ASHIFT) + ABASE, c, v);
|
||||
return U.compareAndSetReference(tab, ((long)i << ASHIFT) + ABASE, c, v);
|
||||
}
|
||||
|
||||
static final <K,V> void setTabAt(Node<K,V>[] tab, int i, Node<K,V> v) {
|
||||
U.putObjectRelease(tab, ((long)i << ASHIFT) + ABASE, v);
|
||||
U.putReferenceRelease(tab, ((long)i << ASHIFT) + ABASE, v);
|
||||
}
|
||||
|
||||
/* ---------------- Fields -------------- */
|
||||
|
|
|
@ -976,13 +976,13 @@ public class ThreadLocalRandom extends Random {
|
|||
* Erases ThreadLocals by nulling out Thread maps.
|
||||
*/
|
||||
static final void eraseThreadLocals(Thread thread) {
|
||||
U.putObject(thread, THREADLOCALS, null);
|
||||
U.putObject(thread, INHERITABLETHREADLOCALS, null);
|
||||
U.putReference(thread, THREADLOCALS, null);
|
||||
U.putReference(thread, INHERITABLETHREADLOCALS, null);
|
||||
}
|
||||
|
||||
static final void setInheritedAccessControlContext(Thread thread,
|
||||
AccessControlContext acc) {
|
||||
U.putObjectRelease(thread, INHERITEDACCESSCONTROLCONTEXT, acc);
|
||||
U.putReferenceRelease(thread, INHERITEDACCESSCONTROLCONTEXT, acc);
|
||||
}
|
||||
|
||||
// Serialization support
|
||||
|
|
|
@ -439,39 +439,39 @@ public abstract class AtomicReferenceFieldUpdater<T,V> {
|
|||
public final boolean compareAndSet(T obj, V expect, V update) {
|
||||
accessCheck(obj);
|
||||
valueCheck(update);
|
||||
return U.compareAndSetObject(obj, offset, expect, update);
|
||||
return U.compareAndSetReference(obj, offset, expect, update);
|
||||
}
|
||||
|
||||
public final boolean weakCompareAndSet(T obj, V expect, V update) {
|
||||
// same implementation as strong form for now
|
||||
accessCheck(obj);
|
||||
valueCheck(update);
|
||||
return U.compareAndSetObject(obj, offset, expect, update);
|
||||
return U.compareAndSetReference(obj, offset, expect, update);
|
||||
}
|
||||
|
||||
public final void set(T obj, V newValue) {
|
||||
accessCheck(obj);
|
||||
valueCheck(newValue);
|
||||
U.putObjectVolatile(obj, offset, newValue);
|
||||
U.putReferenceVolatile(obj, offset, newValue);
|
||||
}
|
||||
|
||||
public final void lazySet(T obj, V newValue) {
|
||||
accessCheck(obj);
|
||||
valueCheck(newValue);
|
||||
U.putObjectRelease(obj, offset, newValue);
|
||||
U.putReferenceRelease(obj, offset, newValue);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public final V get(T obj) {
|
||||
accessCheck(obj);
|
||||
return (V)U.getObjectVolatile(obj, offset);
|
||||
return (V)U.getReferenceVolatile(obj, offset);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public final V getAndSet(T obj, V newValue) {
|
||||
accessCheck(obj);
|
||||
valueCheck(newValue);
|
||||
return (V)U.getAndSetObject(obj, offset, newValue);
|
||||
return (V)U.getAndSetReference(obj, offset, newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ public class LockSupport {
|
|||
|
||||
private static void setBlocker(Thread t, Object arg) {
|
||||
// Even though volatile, hotspot doesn't need a write barrier here.
|
||||
U.putObject(t, PARKBLOCKER, arg);
|
||||
U.putReference(t, PARKBLOCKER, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -291,7 +291,7 @@ public class LockSupport {
|
|||
public static Object getBlocker(Thread t) {
|
||||
if (t == null)
|
||||
throw new NullPointerException();
|
||||
return U.getObjectVolatile(t, PARKBLOCKER);
|
||||
return U.getReferenceVolatile(t, PARKBLOCKER);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
package java.util.zip;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.file.attribute.FileTime;
|
||||
import java.security.AccessController;
|
||||
|
@ -40,7 +39,6 @@ import java.util.concurrent.TimeUnit;
|
|||
import static java.util.zip.ZipConstants.ENDHDR;
|
||||
|
||||
import jdk.internal.misc.Unsafe;
|
||||
import sun.nio.ch.DirectBuffer;
|
||||
|
||||
class ZipUtils {
|
||||
|
||||
|
@ -295,7 +293,7 @@ class ZipUtils {
|
|||
private static final long byteBufferOffsetOffset = unsafe.objectFieldOffset(ByteBuffer.class, "offset");
|
||||
|
||||
static byte[] getBufferArray(ByteBuffer byteBuffer) {
|
||||
return (byte[]) unsafe.getObject(byteBuffer, byteBufferArrayOffset);
|
||||
return (byte[]) unsafe.getReference(byteBuffer, byteBufferArrayOffset);
|
||||
}
|
||||
|
||||
static int getBufferOffset(ByteBuffer byteBuffer) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue