hg: valhalla/valhalla: 8205549: [lworld] Unsafe support for flattened field of value type

mandy chung mandy.chung at oracle.com
Tue Jul 3 14:39:07 UTC 2018


I see the problem as this is not fully initialized value object.  I 
created https://bugs.openjdk.java.net/browse/JDK-8206274 to track it.

Mandy

On 7/3/18 12:31 AM, Tobias Hartmann wrote:
> Hi Mandy,
> 
> with this patch, I still get a NPE with the following test
> 
> public class Test {
> 
>      __ByValue final class MyValue1 {
>          //__NotFlattened final int x = 42;
>          final int x = 42;
>      }
> 
>      public void test() {
>          MyValue1 vt = __MakeDefault MyValue1();
>          System.out.println(vt.toString());
>      }
> 
>      public static void main(String[] args) {
>          (new Test()).test();
>      }
> }
> 
> Exception in thread "main" java.lang.NullPointerException
> 	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
> 	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
> 	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
> 	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
> 	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
> 	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
> 	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
> 	at java.base/java.lang.invoke.ValueBootstrapMethods.toString(ValueBootstrapMethods.java:236)
> 	at Test$MyValue1.toString(Test.java:4)
> 	at Test.test(Test.java:10)
> 	at Test.main(Test.java:14)
> 
> I get this with both versions (flattened and non-flattened field x).
> 
> Thanks,
> Tobias
> 
> On 02.07.2018 18:54, 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 mailing list