< prev index next >
src/java.base/share/classes/jdk/internal/misc/Unsafe.java
Print this page
*** 181,190 ****
--- 181,199 ----
*/
public boolean isValueType(Class<?> c) {
return c.isValue() && c == c.asValueType();
}
+ private static final int JVM_ACC_FLATTENED = 0x00008000; // HotSpot-specific bit
+
+ /**
+ * Returns true if the given field is flattened.
+ */
+ public boolean isFlattened(Field f) {
+ return (f.getModifiers() & JVM_ACC_FLATTENED) == JVM_ACC_FLATTENED;
+ }
+
/**
* Returns true if the given class is a flattened array.
*/
public native boolean isFlattenedArray(Class<?> arrayClass);
*** 234,245 ****
/**
* Stores the given value into a given Java variable.
*
* Unless the reference {@code o} being stored is either null
! * or matches the field type and not in a value container,
! * the results are undefined.
*
* @param o Java heap object in which the variable resides, if any, else
* null
* @param offset indication of where the variable resides in a Java heap
* object, if any, else a memory address locating the variable
--- 243,253 ----
/**
* Stores the given value into a given Java variable.
*
* Unless the reference {@code o} being stored is either null
! * or matches the field type, the results are undefined.
*
* @param o Java heap object in which the variable resides, if any, else
* null
* @param offset indication of where the variable resides in a Java heap
* object, if any, else a memory address locating the variable
*** 250,259 ****
--- 258,294 ----
* @throws RuntimeException No defined exceptions are thrown, not even
* {@link NullPointerException}
*/
public native <V> void putValue(Object o, long offset, Class<?> vc, V v);
+ /**
+ * Returns an object instance with a private buffered value whose layout
+ * and contents is exactly the given value instance. The return object
+ * is in the larval state that can be updated using the unsafe put operation.
+ *
+ * @param value a value instance
+ * @param <V> the type of the given value instance
+ */
+ public native <V> V makePrivateBuffer(V value);
+
+ /**
+ * Exits the larval state and returns a value instance.
+ *
+ * @param value a value instance
+ * @param <V> the type of the given value instance
+ */
+ public native <V> V finishPrivateBuffer(V value);
+
+ /**
+ * Returns the header size of the given value class
+ *
+ * @param vc Value class
+ * @param <V> value clas
+ * @return the header size of the value class
+ */
+ public native <V> long valueHeaderSize(Class<V> vc);
+
/** @see #getInt(Object, long) */
@HotSpotIntrinsicCandidate
public native boolean getBoolean(Object o, long offset);
/** @see #putInt(Object, long, int) */
< prev index next >