[foreign-memaccess+abi] RFR: Deduplicate layouts and simplify value layout implementations
Maurizio Cimadamore
mcimadamore at openjdk.org
Wed Feb 15 12:27:12 UTC 2023
On Wed, 15 Feb 2023 09:08:55 GMT, Per Minborg <pminborg at openjdk.org> wrote:
> This PR proposes adding deduplication of the immutable value layout where one provides a value that is equal to the one already at hand. For example, `JAVA_INT.withBitAlignment(32)` will return the same object. There is no general caching mechanism that guarantees a layout will never repeat.
>
> Another part of this PR relates to simplifying value layouts so they only have a single constructor. This will reduce size slightly. Related to this is the replacement of certain magic numbers which are now represented by constants.
Looks good. I'd suggest to split the part which uses constants for the sizes (which seems like a great idea) from the deduplication logic, which makes the code a bit more convoluted (perhaps some validation with jextract might be better, to see if deduplication of layouts bears any fruit).
-------------
PR: https://git.openjdk.org/panama-foreign/pull/795
More information about the panama-dev
mailing list