[foreign-jextract] RFR: 8253725: Jextract fails to extract big monolithic headers
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Mon Sep 28 14:21:35 UTC 2020
This patch adds support for splitting the symbols in the main header class into multiple classes; the header class is
then rewrited to extend all these additional classes, so that all symbols would be exposed to users in the classic way.
I've toyed with some ways to split on a by-header basis, but found that in certain cases we would generate near-empty
classes - and that would still not prevent issues from occurring in the corner case a single very big header file
contained so many symbols.
I've reorganized the code a bit - I noted that we were generating several nested classes, but in some cases (structs)
we were using a builder, in other cases (functional interfaces, typedef) we weren't. Now we use builders for classes,
and I've added an intermediate nested builder abstraction which does the right thing for all nested cases.
I've also converted the source constant generator to be a JavaSourceBuilder too - since it too is a class, after all,
with a classBegin/End and build methods.
Finally, I moved the string builder/indentation logic out to a different class (StringSourceBuilder); since some
builders want to have their own string buffer, while others (the nested ones) don't.
The organization of the builder code is still far from optimal, but I think that, moving forward, this consolidation
should make it easier to make changes.
-------------
Commit messages:
- Fix indentation in functional interfaces
- Revert compilation policy
- Switch to byfile compilation policy
- Fix cyclic inheritance
- Fix splittimng logic (again)
- Fix issues with splitting
- Try to improve memory usage
- reset decl count
- Revert to simpler header file splitting
- More cleanup - added orthogonal StringSourceBuilder
- ... and 10 more: https://git.openjdk.java.net/panama-foreign/compare/c14a58a9...f36d7651
Changes: https://git.openjdk.java.net/panama-foreign/pull/357/files
Webrev: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=357&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8253725
Stats: 1416 lines in 15 files changed: 619 ins; 412 del; 385 mod
Patch: https://git.openjdk.java.net/panama-foreign/pull/357.diff
Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/357/head:pull/357
PR: https://git.openjdk.java.net/panama-foreign/pull/357
More information about the panama-dev
mailing list