hg: valhalla/valhalla: 8205549: [lworld] Unsafe support for flattened field of value type
karen.kinnear at oracle.com
Wed Jul 11 22:08:58 UTC 2018
Many thanks for jumping in and figuring this out so quickly.
I had some questions about follow-on steps you were planning for lw1 please - could you possibly
file lw1 bugs for the steps you are planning to do so we can sync up?
1. Flattened arrays
— AFAICT you have implemented unsafe support for value types in fields for MethodHandles, VarHandles and Reflection.
What were your plans for array support?
If you add new APIs here, can we disallow a base of zero and require a base that is an array?
2. There were several proposals for explicit new API points for getReference/putReference (your call on naming) and friends that would
know they were dealing with objects. Are you planning to add those for lw1?
And the C2 folks would move the intrinsics today used for getObject/putObject to be used for the new getReference/putReference.
They need to know your timing here please.
3. getObject/putObject and variations
See attached proposal - John bought into steps 1-3. So
Step 2: Were you planning to move conditional logic to jdk.internal.misc.unsafe to split into calls to getValue/getReference for lw1?
Step 3: Are there other JDK uses of getObject/putObject variations that you would change to explicitly use getValue/putValue or getReference/putReference?
What I had proposed was that internal to the JDK we switch over to using the explicit new APIs.
This could allow Remi’s proposal of moving the getObject/putObject split logic into sun.misc.unsafe
For the record I share Frederic’s concern - if you write to a value type that has its default value you overwrite the default value for that type.
Looks like for lw1 folks want to allow this.
5. Writing null. Sounds like John wants this to be the user’s problem, with unpredictable results. Agree with not automatically replacing
null with a default value.
6. For lw1, the vm does not support atomics/volatiles for value types. So glad you added a java workaround.
> On Jul 2, 2018, at 12:54 PM, mandy.chung at oracle.com wrote:
> Changeset: 0dd8795826b3
> Author: mchung
> Date: 2018-07-02 09:53 -0700
> URL: http://hg.openjdk.java.net/valhalla/valhalla/rev/0dd8795826b3
> 8205549: [lworld] Unsafe support for flattened field of value type
> Reviewed-by: psandoz
> ! src/hotspot/share/prims/methodHandles.cpp
> ! src/hotspot/share/prims/unsafe.cpp
> ! src/hotspot/share/runtime/reflection.cpp
> ! src/hotspot/share/utilities/accessFlags.hpp
> ! src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java
> ! src/java.base/share/classes/java/lang/invoke/GenerateJLIClassesHelper.java
> ! src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
> ! src/java.base/share/classes/java/lang/invoke/LambdaForm.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/invoke/X-VarHandle.java.template
> ! src/java.base/share/classes/java/lang/reflect/Modifier.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/ReflectionFactory.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/jdk/valhalla/valuetypes/Line.java
> + test/jdk/valhalla/valuetypes/MethodHandleTest.java
> + test/jdk/valhalla/valuetypes/MutablePath.java
> ! test/jdk/valhalla/valuetypes/ObjectMethods.java
> ! test/jdk/valhalla/valuetypes/Point.java
> ! test/jdk/valhalla/valuetypes/Reflection.java
More information about the valhalla-dev