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

Maurizio Cimadamore mcimadamore at openjdk.java.net
Mon Nov 29 16:13:14 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.

This pull request has now been integrated.

Changeset: 95d344ce
Author:    Maurizio Cimadamore <mcimadamore at openjdk.org>
URL:       https://git.openjdk.java.net/panama-foreign/commit/95d344ceb9bcb20ce8b4d7ed6d957b6eb01d3ffc
Stats:     148 lines in 8 files changed: 90 ins; 37 del; 21 mod

8277830: jextract generated code should not depend on Java layouts

Reviewed-by: sundar, jvernee

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

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


More information about the panama-dev mailing list