[foreign-jextract] RFR: 8262198: Overhaul bitfield parsing logic [v2]
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Tue Feb 23 18:26:06 UTC 2021
> This parsing stratgey cannot (by definition) fail - so, moving forward there will be no more exceptions coming from this side of the code. Of course, since we no longer have container classification, when bitfield support is added to the backend, things might be a bit tricker; however I realized that, since the layout is well-formed, the backend can always use the layout API to query the offset and size of a given bitfield, and decide on the best strategy to get there (e.g. get the closed 8/16/32/64-bit word and apply some bitmasking). So, perhaps things don't change much in terms of code generation support.
>
> This patch fixes a small bug in Parser, where we where creating the same tree twice (!!). There are some small tweaks to TreeMaker, to work with the new bitfield info coming out from RecordLayoutComputer, but overall nothing too difficult here.
>
> Note that the `BadBitfieldTest`, which was previously asserting a jextract crash, has now turned into a positive test (and I've dropped the exclusion on Windows, since the test should now pass on all platforms).
>
> [1] - https://github.com/rust-lang/rust-bindgen/issues/743
Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
Add assertion on UnionLayoutComputer::finishLayout
-------------
Changes:
- all: https://git.openjdk.java.net/panama-foreign/pull/459/files
- new: https://git.openjdk.java.net/panama-foreign/pull/459/files/e1c2e7fe..400d9f36
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=459&range=01
- incr: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=459&range=00-01
Stats: 2 lines in 1 file changed: 2 ins; 0 del; 0 mod
Patch: https://git.openjdk.java.net/panama-foreign/pull/459.diff
Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/459/head:pull/459
PR: https://git.openjdk.java.net/panama-foreign/pull/459
More information about the panama-dev
mailing list