Integrated: 8267948: [lword] Core reflection and method handles support for L/Q model

Mandy Chung mchung at openjdk.java.net
Mon Jun 7 16:20:40 UTC 2021


On Thu, 3 Jun 2021 03:45:41 GMT, Mandy Chung <mchung at openjdk.org> wrote:

> This PR implements the primary (`ref`) mirror and secondary (`val`) mirror for primitive classes [1].   The following APIs returning `Class` return the primary mirror: 
> 
> `Object::getClass`
> `Class::getClass`
> `Class::forName`
> `java.lang.reflect.Member::getDeclaringClass` (i.e. `Field`, `Method` and `Constructor`)
> 
> `Class::getName` and `Class::getSimpleName` return the same name for the `ref` and `val` mirror of a primitive class.  Therefore, Class.forName(type.getName()) will work if the type is either `ref` or `val` mirror.
> 
> `Class::getTypeName` returns `Foo.ref` if this `Class` is a primitive reference type.  (we will revisit this for reference-favoring primitive class.)
> 
> New proposed APIs: 
> `Class::isPrimitiveClass` returns true for the `ref` and `val` mirror of a primitive class. 
> 
> `Class::isPrimaryType` returns true if this `Class` object represents the primary mirror
> `Class::asPrimaryType` returns the primary type of this class or interface.
> - An alternative I considered is `Class::isReferenceType` and `Class::asReferenceType` but they will have to specify the special case for primitive types which are not (yet) primitive classes.   I want to go with this initial patch to make progress for the prototype.  We will follow up the API discussion next.
> 
> `Class::isValueType` returns true if this `Class` object represents the primary mirror
> `Class::asValueType` returns the primary type of this class or interface.
> 
> Several tests fail when running with -Xcomp which may depend on the second phase JIT support work (JDK-8267932) which depends on this work to make progress.
> 
> [1] https://github.com/openjdk/valhalla-docs/blob/main/site/design-notes/state-of-valhalla/03-vm-model.md

This pull request has now been integrated.

Changeset: d9d96e8c
Author:    Mandy Chung <mchung at openjdk.org>
URL:       https://git.openjdk.java.net/valhalla/commit/d9d96e8c8df1546a9930fba89a081c10b1a52349
Stats:     768 lines in 47 files changed: 431 ins; 137 del; 200 mod

8267948: [lword] Core reflection and method handles support for L/Q model

Reviewed-by: fparain, rriggs

-------------

PR: https://git.openjdk.java.net/valhalla/pull/436


More information about the valhalla-dev mailing list