Right now some of the call sites assets that ResolvedFieldEntry corresponds to the correct fieldDescriptor, and that these fields are in fact flattened. It was suggested that this would be more robust if this was folded into the construction of the FlatFieldPayload construction.
I moved these asserts up the construction hierarchy so that we also verify the unsafe flat field access. Because these can access nested flat values, some extra utility was added to find nested flat fields from an offset. After this change the `FlatFieldPayload` check that the `fieldDescriptor*` constructor and the `ResolvedFieldEntry*` is a valid non-nested flat field in the containing object. And the `FlatValuePayload::construct_from_parts` verifies that there is an field at that offset of of the correct InlineKlass. (Either a direct field or array element, or a nested flat field inside an flat field or array element) _Also the unsafe access logging was missing a ResourceMark, and changed it so it does not assert on bad offset, as I moved the assertions into the FlatValuePayload construction._ Testing: * Running tier 1 - 4 with `--enable-preview` * Running all Valhalla tests ------------- Commit messages: - 8378519: [lworld] Fold fieldDescriptor / ResolvedFieldEntry checks into the FlatFieldPayload constructor Changes: https://git.openjdk.org/valhalla/pull/2186/files Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=2186&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8378519 Stats: 403 lines in 9 files changed: 333 ins; 56 del; 14 mod Patch: https://git.openjdk.org/valhalla/pull/2186.diff Fetch: git fetch https://git.openjdk.org/valhalla.git pull/2186/head:pull/2186 PR: https://git.openjdk.org/valhalla/pull/2186
