hg: valhalla/valhalla: Add the new Unsafe primitives to update values in a private buffer.

mandy.chung at oracle.com mandy.chung at oracle.com
Mon Dec 17 23:18:40 UTC 2018


Changeset: 127ed6c19242
Author:    mchung
Date:      2018-12-17 15:19 -0800
URL:       http://hg.openjdk.java.net/valhalla/valhalla/rev/127ed6c19242

Add the new Unsafe primitives to update values in a private buffer.
and test method to test if a field is flattened and if an array class
is a flattened array.

The 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.

! src/hotspot/share/oops/markOop.hpp
! src/hotspot/share/prims/unsafe.cpp
! src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java
! src/java.base/share/classes/java/lang/invoke/MemberName.java
! src/java.base/share/classes/java/lang/invoke/VarHandles.java
! src/java.base/share/classes/java/lang/reflect/ReflectAccess.java
! src/java.base/share/classes/jdk/internal/misc/Unsafe.java
! src/java.base/share/classes/jdk/internal/reflect/LangReflectAccess.java
! src/java.base/share/classes/jdk/internal/reflect/UnsafeFieldAccessorImpl.java
! src/java.base/share/classes/jdk/internal/reflect/UnsafeObjectFieldAccessorImpl.java
! src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java
! src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java
! src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticObjectFieldAccessorImpl.java
! test/hotspot/jtreg/compiler/valhalla/valuetypes/TestIntrinsics.java
+ test/hotspot/jtreg/runtime/valhalla/valuetypes/UnsafeTest.java



More information about the valhalla-dev mailing list