RFR: 8254022: [lworld] [type-restrictions] Initial support for RestrictedField

Frederic Parain fparain at openjdk.java.net
Tue Oct 6 18:31:19 UTC 2020


On Tue, 6 Oct 2020 15:39:03 GMT, David Simms <dsimms at openjdk.org> wrote:

>> [Second attempt, trying to do it on the right branch this time]
>> 
>> Please review these changes adding an initial support for RestrictedField.
>> 
>> The patch includes:
>>  - recognizing and processing the new attribute during class file parsing
>>  - creating new meta-data to store both the erased type and the restricted type
>>  - fixing all intermediate method dealing with field types (FieldInfo, FieldStream, etc)
>>  - fixing field resolution to take into the two possible signatures of the fields
>>  - adding checkcast against the restricted type in the interpreter implementation of putfield
>> 
>> The patch doesn't include:
>>  - propagating new meta-data to CI
>>  - adding new type checks in JIT generated code
>> 
>> The main take away of this first patch is that the VM mostly cares about the sharp type (from the
>> RestrictedField attribute), and the only place where it needs knowledge of the erased type is for
>> field resolution. This is why the implementation of the RestrictedField in the VM is inverted compared
>> to the content of the class file: the traditional FieldInfo is filled with the sharp type from the RestrictedField
>> attribute, while the original erased type is moved to a new variable section of InstanceKlass.
>> 
>> Note: the patch includes a serious clean up of the FieldInfo data structure. It used to store the allocation
>> type of the field, but this information is not used anymore after the replacement of the old field layout
>> code by the field layout builder. Removing the allocation type from the data structure simplifies it a lot.
>> 
>> Thank you,
>> 
>> Fred
>
> It looks good. Thanks for explanation on the fieldInfo clean up (described in PR body).

David,

Thank you for the review.

Fred

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

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



More information about the valhalla-dev mailing list