RFR: JDK-8205549 JDK-8205698 Support of flattened values in Unsafe

mandy chung mandy.chung at oracle.com
Fri Jun 29 04:47:20 UTC 2018


This patch introduces Unsafe::getValue and Unsafe::putValue API.

http://cr.openjdk.java.net/~mchung/valhalla/webrevs/unsafe-flat-fields-webrev/ 


A flattenable object field can be flattened.  The decision to flatten
an object field is made at class loading time in this implementation
When an object field is accessed, we will query if the field is
flattened or not. java.lang.reflect.Field and java.lang.invoke.MemberName
are extended to indicate if it's flattened.

A new MethodHandleTest and existing tests are updated to test value
type and non-value type containing flat fields via MethodHandle,
VarHandle, and core reflection.  It also tests direct method handle
of array element getter and setters.  VarHandle support for value
arrays depend on JDK-8205698.  I will look into this next.

- ValueFieldInstanceReadWrite and ValueFieldInstanceReadOnly are added
specially for flat field.  The implementation does not flatten static
fields and hence I decide not to add unused ValueFieldStaticXXX class.
I left the other VarHandle operations such as compareAndSet as is and
look at them again.

- I removed check_putfield_access in unsafe.cpp and move the check of
non-null value to put on a flat field to java.  We will go through
over places that does not allow setting value field to null, as a
separate task.

- I keep the assert and logging in Unsafe_GetValue and Unsafe_PutValue
for diagnosis.  I will remove it when we add the VarHandle support for
value arrays.

I quite like this patch coming along.

Thanks
Mandy



More information about the valhalla-dev mailing list