[foreign-jextract] RFR: 8249536: jextract throw IllegalStateException for bitfields in nested anonymous structs
Jorn Vernee
jvernee at openjdk.java.net
Wed Jul 15 18:12:54 UTC 2020
Hi,
This patch fixes an issue with grouping of bitfields into a container for structs that contain anonymous nested structs
that have bitfields in them. Such as
struct Foo {
struct {
int a : 7;
int b : 25;
};
};
The current code iterates over the member layouts of a struct, and when it finds a bitfield storage unit, it tries to
find matching bitfield Declarations and groups them into a synthetic nested BITFIELDS declaration.
But, the memory layout members also contain bitfields that are found in anonymous nested structs, since they are
flattened into the parent layout. However, for the jextract Declaration tree this is not the case, so the current code
can not find a matching declaration for these bitfield layouts.
The fix is to ignore bitfields that come from nested anonymous structs. They will be handled when processing the nested
anonymous struct instead.
Thanks,
Jorn
-------------
Commit messages:
- Add API test
- ignore bitfields nested in anonymous structs when collecting bitfields
Changes: https://git.openjdk.java.net/panama-foreign/pull/246/files
Webrev: https://webrevs.openjdk.java.net/panama-foreign/246/webrev.00
Issue: https://bugs.openjdk.java.net/browse/JDK-8249536
Stats: 129 lines in 4 files changed: 124 ins; 1 del; 4 mod
Patch: https://git.openjdk.java.net/panama-foreign/pull/246.diff
Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/246/head:pull/246
PR: https://git.openjdk.java.net/panama-foreign/pull/246
More information about the panama-dev
mailing list