RFR 8223351 [lworld/lw2] : Primary mirror and nullable mirror for inline type

Mandy Chung mandy.chung at oracle.com
Wed Jun 5 00:27:09 UTC 2019


I have updated the patch to add the indirect projection type. Updated 
webrev:
http://cr.openjdk.java.net/~mchung/valhalla/webrevs/lw2/8223351/webrev.01/

javadoc:
http://cr.openjdk.java.net/~mchung/valhalla/webrevs/lw2/api/java.base/java/lang/Class.html

Summary of the changes:

1. For an inline class V, V.class is the primary mirror.   The secondary 
mirror
     is the indirect projection type which is also the nullable 
projection type.

     Class.forName returns the primary mirror.  The projection types are
     used for reflection APIs to find a field of type V? or a method 
with signature
     with V? (i.e. L-type descriptor).

2. New APIs are added for core reflection to project an inline class its 
indirect
     or nullable projection type as well as query if a Class object is 
indirect or inline
     or nullable.

     Class::asPrimaryType
     Class::asIndirectType
     Class::asNullableType

     Class::isInlineClass  (was Class::isValue)
     Class::isIndirectType
     Class::isNullableType

3. Class::getName returns the same name for inline class and the 
projection type
     as that's the name of the class in the source

4. Class::isAssignableFrom checks properly the subtype relationship
     Point <: Point? and Point? <: Object

Notes:
- I didn't rename ValueKlass::value_mirror as ValueKlass and other 
classes will
   be renamed together in the future.
- I think AccessFlags::set_is_flattenable should be re-examined. 
JVM_ACC_FLATTENABLE
   no longer set in lworld?
- Intrinsification of Class::asPrimaryType will need update (JDK-8225317).
   I have excluded 
MyValue1.class.isAssignableFrom(MyValue1.class.asIndirectType())
   test case in compiler/valhalla/valuetypes/TestIntrinsifics.java. I'd 
need the compiler
   expert to help investigating it while I think it might be related to 
JDK-8225317.  Hence
   I capture that failing case in JDK-8225317.
- I took out the unnecessary asPrimaryType call in the tests since 
V.class now returns
   the primary mirror.  I left several asPrimaryType calls in 
TestIntrinsics as they look
   like those calls are intended.

Mandy

On 5/15/19 11:38 AM, Roger Riggs wrote:
> Please review Mandy's additions and changes to reflection and 
> java.lang.invoke APIs
> for inline and nullable types.
> The changes go a bit deep because of the support for the Java APIs 
> provided by the VM.
>
> This initial prototype reflects discussions about terminology and 
> orthogonality
> of concepts for inline vs nullable as described in the comments of 
> 8223351.
>
> Issue:
>   https://bugs.openjdk.java.net/browse/JDK-8223351
>
> Webrev:
>    http://cr.openjdk.java.net/~rriggs/webrev-lworld-dev-8223351/
>
> Thanks for any comments and suggestions, Roger
>




More information about the valhalla-dev mailing list