Methods Summary |
---|
public int | arrayBaseOffset(java.lang.Class clazz)Gets the offset from the start of an array object's memory to
the memory used to store its initial (zeroeth) element.
if (! clazz.isArray()) {
throw new IllegalArgumentException(
"valid for array classes only");
}
return arrayBaseOffset0(clazz);
|
private static native int | arrayBaseOffset0(java.lang.Class clazz)Helper for {@link #arrayBaseOffset}, which does all the work,
assuming the parameter is deemed valid.
|
public int | arrayIndexScale(java.lang.Class clazz)Gets the size of each element of the given array class.
if (! clazz.isArray()) {
throw new IllegalArgumentException(
"valid for array classes only");
}
return arrayIndexScale0(clazz);
|
private static native int | arrayIndexScale0(java.lang.Class clazz)Helper for {@link #arrayIndexScale}, which does all the work,
assuming the parameter is deemed valid.
|
public native boolean | compareAndSwapInt(java.lang.Object obj, long offset, int expectedValue, int newValue)Performs a compare-and-set operation on an int
field within the given object.
|
public native boolean | compareAndSwapLong(java.lang.Object obj, long offset, long expectedValue, long newValue)Performs a compare-and-set operation on a long
field within the given object.
|
public native boolean | compareAndSwapObject(java.lang.Object obj, long offset, java.lang.Object expectedValue, java.lang.Object newValue)Performs a compare-and-set operation on an Object
field (that is, a reference field) within the given object.
|
public native int | getInt(java.lang.Object obj, long offset)Gets an int field from the given object.
|
public native int | getIntVolatile(java.lang.Object obj, long offset)Gets an int field from the given object,
using volatile semantics.
|
public native long | getLong(java.lang.Object obj, long offset)Gets a long field from the given object.
|
public native long | getLongVolatile(java.lang.Object obj, long offset)Gets a long field from the given object,
using volatile semantics.
|
public native java.lang.Object | getObject(java.lang.Object obj, long offset)Gets an Object field from the given object.
|
public native java.lang.Object | getObjectVolatile(java.lang.Object obj, long offset)Gets an Object field from the given object,
using volatile semantics.
|
public static sun.misc.Unsafe | getUnsafe()Gets the unique instance of this class. This is only allowed in
very limited situations.
/*
* Only code on the bootclasspath is allowed to get at the
* Unsafe instance.
*/
ClassLoader calling = VMStack.getCallingClassLoader2();
ClassLoader current = Unsafe.class.getClassLoader();
if ((calling != null) && (calling != Unsafe.class.getClassLoader())) {
throw new SecurityException("Unsafe access denied");
}
return THE_ONE;
|
public long | objectFieldOffset(java.lang.reflect.Field field)Gets the raw byte offset from the start of an object's memory to
the memory used to store the indicated instance field.
if (Modifier.isStatic(field.getModifiers())) {
throw new IllegalArgumentException(
"valid for instance fields only");
}
return objectFieldOffset0(field);
|
private static native long | objectFieldOffset0(java.lang.reflect.Field field)Helper for {@link #objectFieldOffset}, which does all the work,
assuming the parameter is deemed valid.
|
public void | park(boolean absolute, long time)Parks the calling thread for the specified amount of time,
unless the "permit" for the thread is already available (due to
a previous call to {@link #unpark}. This method may also return
spuriously (that is, without the thread being told to unpark
and without the indicated amount of time elapsing).
See {@link java.util.concurrent.locks.LockSupport} for more
in-depth information of the behavior of this method.
if (absolute) {
lang.parkUntil(time);
} else {
lang.parkFor(time);
}
|
public native void | putInt(java.lang.Object obj, long offset, int newValue)Stores an int field into the given object.
|
public native void | putIntVolatile(java.lang.Object obj, long offset, int newValue)Stores an int field into the given object,
using volatile semantics.
|
public native void | putLong(java.lang.Object obj, long offset, long newValue)Stores a long field into the given object.
|
public native void | putLongVolatile(java.lang.Object obj, long offset, long newValue)Stores a long field into the given object,
using volatile semantics.
|
public native void | putObject(java.lang.Object obj, long offset, java.lang.Object newValue)Stores an Object field into the given object.
|
public native void | putObjectVolatile(java.lang.Object obj, long offset, java.lang.Object newValue)Stores an Object field into the given object,
using volatile semantics.
|
public void | unpark(java.lang.Object obj)Unparks the given object, which must be a {@link Thread}.
See {@link java.util.concurrent.locks.LockSupport} for more
in-depth information of the behavior of this method.
if (obj instanceof Thread) {
lang.unpark((Thread) obj);
} else {
throw new IllegalArgumentException("valid for Threads only");
}
|