[foreign-jextract] RFR: 8277830: jextract generated code should not depend on Java layouts
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Mon Nov 29 14:15:49 UTC 2021
On Mon, 29 Nov 2021 14:09:29 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> This patch tweaks jextract generation, so that a new constant class is emitted, namely `Constant$root`, which contains the definition of all basic C primitive types. These are declared with the correct alignment constraints, depending on platforms.
>
> Every other layout created by jextract will depend on these shared layouts constants, so that jextract code doesn't depend on alignment choices in `ValueLayout` constants.
>
> In the future, we should probably generalize this approach, so that e.g. layouts are emitted only once, and then referred to afterwards - not just for primitive types, but also for everything else (struct, typedef, etc.). This would minimize the amount of layouts we store in the constant classes.
I've tested this on some samples I have on Linux - would probably be wise to also test on Windows/Mac.
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/620
More information about the panama-dev
mailing list