RFR: 8177673: [JVMCI] missing checks in HotSpotMemoryAccessProviderImpl can cause VM assertions to fail
Please review this patch to fix a VM-level assertion failure due to missing sanity checks in HotSpotMemoryAccessProviderImpl. The sanity checking has been enhanced to map an object+displacement back to a field before performing a read. If the mapping fails, an IllegalArgumentException is thrown.
I've had to rework this patch after talking to the Truffle team. Truffle doesn't always read in compliance with field layout. For example, Truffle can perform a short read from an int field or a long read from an int array or pair of adjacent int fields. Since we only care about not making the VM crash or halt due to a VM assertion, the checks performed by JVMCI should allow the above kinds of access. As such, I've relaxed the checking to only ensure that a read is within the bounds of an object or array. Only in the case of an object read do we now check that the displacement of the read corresponds to a field (which must be of kind JavaKind.Object).
Please re-review this patch in light of the above.