[foreign-memaccess+abi] RFR: 8299911: Refactor struct handling in AArch64 CallArranger

Maurizio Cimadamore mcimadamore at openjdk.org
Wed Jan 11 12:34:40 UTC 2023


On Wed, 11 Jan 2023 04:33:06 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> Refactor struct handling in AArch64 CallArranger.
> 
> Instead of having 6 very similar looking while loops, I've consolidated the storage allocation code for structs into a single helper method (`StorageCalculator::structStorages`). This should make it much easier to see which logic is being used for a particular case.

src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/CallArranger.java line 302:

> 300:                 if (isFieldWise) {
> 301:                     // fields only, no padding
> 302:                     copyLayout = (ValueLayout) layout.memberLayouts().get(i);

Doesn't this contradict the comment? E.g. if we only copy fields, then we should skip padding layouts here (as they can be members of a group layout) ?

src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/CallArranger.java line 306:

> 304:                     // chunk-wise copy
> 305:                     long copySize = Math.min(layout.byteSize() - offset, MAX_COPY_SIZE);
> 306:                     boolean useFloat = false; // never use float for chunk-wise copies

this local seems unnecessary?

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

PR: https://git.openjdk.org/panama-foreign/pull/765


More information about the panama-dev mailing list