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

Frederic Parain fparain at openjdk.java.net
Mon Oct 5 15:04:04 UTC 2020


[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

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

Commit messages:
 - Initial support for restricted fields
 - Beginning befofe switching signatures
 - Refine checks to inline-typed fields
 - Basic framework to add checkcast to putfield

Changes: https://git.openjdk.java.net/valhalla/pull/210/files
 Webrev: https://webrevs.openjdk.java.net/?repo=valhalla&pr=210&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8254022
  Stats: 393 lines in 18 files changed: 244 ins; 98 del; 51 mod
  Patch: https://git.openjdk.java.net/valhalla/pull/210.diff
  Fetch: git fetch https://git.openjdk.java.net/valhalla pull/210/head:pull/210

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



More information about the valhalla-dev mailing list