[foreign-memaccess+abi] RFR: Deduplicate layouts and simplify value layout implementations [v2]

Per Minborg pminborg at openjdk.org
Thu Feb 16 09:36:46 UTC 2023


On Wed, 15 Feb 2023 16:34:34 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.
>
> Per Minborg has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Rollback changes in constructor
>  - Rollback changes not related to dedup

Here is a run with jextract using the zstd lib:

  | Building jextract |   | Running jextract zstd |   | Runnig zstd
-- | -- | -- | -- | -- | --
created name | 250 |   | 315 |   | 0
saved name | 0 |   | 0 |   | 0
created bit alignment | 13 |   | 13 |   | 7
saved bit alignment | 36 |   | 247 |   | 1
created order | 0 |   | 0 |   | 0
saved order | 0 |   | 0 |   | 1

Again, deduplicating names proves pointless.

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

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


More information about the panama-dev mailing list