[lworld] RFR: Unsafe primitives for values

Mandy Chung mandy.chung at oracle.com
Tue Dec 11 19:29:24 UTC 2018



This patch adds Unsafe primitives to test if a field is flattened
and to allow updating a value using putXXX in a private buffered
value that is in a larval state.

The new Unsafe APIs for values include the following:

boolean Unsafe::isFlattened(Field f);
boolean Unsafe::isFlattenedArray(Class<?> arrayClass);
<V> long valueHeaderSize(Class<V> vc);
<V> V makePrivateBuffer(V value);
<V> V finishPrivateBuffer(V value);
<V> V getValue(Object o, long offset, Class<?> vc);
<V> void putValue(Object o, long offset, Class<?> vc, V v);

makePrivateBuffer creates a value instance whose layout and
contents is exactly the same as the input value and marks it in
larval state and finishPrivateBuffer will exit the larval state.
In between Unsafe.putXXX on the buffer will update the larval
value instance.


More information about the valhalla-dev mailing list