Review Request JDK-8206121: [lworld] ensure non-nullable on setting value field via reflection and VarHandle
Paul Sandoz
paul.sandoz at oracle.com
Thu Jul 5 18:29:54 UTC 2018
Hi Mandy,
It looks reasonable as an initial solution but i think the right long term solution should be for Class.cast to fail. Perhaps that is already tracked under a different issue?
Both the VarHandle code and the LF code perform cast checks for refs so we should be able to piggy back off them for values without an explicit null check.
MethodHandleTest.java
—
130 if (c.isValue())
131 ensureImmutable(f);
132 else
133 ensureNullableOrNot(f);
134 }
s/ensureImmutable/ensureNonNullable/
s/ensureNullableOrNot/ensureNullable/
? AFAICT you are not checking finality of a value type held in a ref but the the assignment of null.
Paul.
> On Jul 5, 2018, at 9:02 AM, mandy chung <mandy.chung at oracle.com> wrote:
>
> Webrev at:
> http://cr.openjdk.java.net/~mchung/valhalla/webrevs/8206121/webrev.00
>
> Add null check in value field access in LambdaForm for DMH and VarHandle. For DMH, a new FT_CHECK_VALUE kind indicates that
> a value field requires a null check. A value may be flattened
> or non-flattened that will use the linker method with and without
> the field type. So adjust the way to compute the index to the
> ACCESSOR_FORMS cache as it will have a different LF for flattened
> and non-flattened value field. The test verifies nullability
> and immutability.
>
> Mandy
More information about the valhalla-dev
mailing list