> `FieldClosure` is used for iterating fields in an object. For Valhalla, it 
> has been enhanced to handle fields that are inside inlined fields. However, 
> the current implementation has two problems:
> 
> [1] It type casts the address of an inlined field into an `oop` pointer. This 
> is unsafe as many operations, such as getting the header of an `oop`, will 
> not work with such an `oop` pointer:
> 
> https://github.com/openjdk/jdk/blob/b1f975efa481bd5e20c1b7d58a87d0866df205e6/src/hotspot/share/runtime/fieldDescriptor.cpp#L216
> 
> [2] The parameter `base_offset` is used in many functions. Its meaning is 
> unclear and inconsistent.
> 
> https://github.com/openjdk/jdk/blob/b1f975efa481bd5e20c1b7d58a87d0866df205e6/src/hotspot/share/runtime/fieldDescriptor.cpp#L159
> 
> https://github.com/openjdk/jdk/blob/b1f975efa481bd5e20c1b7d58a87d0866df205e6/src/hotspot/share/oops/instanceKlass.hpp#L99-L101
> 
> This RFE refactors `FieldClosure` to avoid the above problems. `FieldClosure` 
> now carries information about inlined fields. This information can be used by 
> various field iteration code to simplify their operations. See 
> `FieldClosure::inline_klass()` and `FieldClosure::inline_offset()`.
> 
> As a result, users of `FieldClosure` and `FieldDescriptor()` no longer need 
> to perform obscure arithmetics with `InlineKlass::payload_offset()`.
> 
> This RFE also moves a few common operations into utility functions to avoid 
> code duplication.
> 
> Also:
> - Fixed a bug in `FlatArrayKlass::oop_print_elements_on()` in the handling of 
> nullable elements.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Ioi Lam has updated the pull request incrementally with two additional commits 
since the last revision:

 - @fparain  review comments
 - Changed inline_xxx to flat_xxx

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/32565/files
  - new: https://git.openjdk.org/jdk/pull/32565/files/c6eb13fa..05d285d7

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=32565&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=32565&range=00-01

  Stats: 104 lines in 9 files changed: 9 ins; 22 del; 73 mod
  Patch: https://git.openjdk.org/jdk/pull/32565.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/32565/head:pull/32565

PR: https://git.openjdk.org/jdk/pull/32565

Reply via email to