[foreign-jextract] RFR: 8277830: jextract generated code should not depend on Java layouts

Jorn Vernee jvernee at openjdk.java.net
Mon Nov 29 16:07:21 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.

Marked as reviewed by jvernee (Committer).

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

PR: https://git.openjdk.java.net/panama-foreign/pull/620


More information about the panama-dev mailing list