RFR: 7903933: Move sharable items from different generations to a common file [v6]
Maurizio Cimadamore
mcimadamore at openjdk.org
Mon Apr 28 16:02:58 UTC 2025
On Fri, 18 Apr 2025 15:35:08 GMT, Nizar Benalla <nbenalla at openjdk.org> wrote:
>> Please review this patch to move the `C_*` layouts and the static utility methods into separate classes: `LayoutUtils.java` and `FFMUtils.java`, respectively.
>>
>> - The names could later be personalized through a JSON configuration.
>> - We can use static imports if the `-t` option is no used and the files are generated into the default package, in that case we use the classname to call the static methods or use the `C_*` constants.
>>
>> Some tests had to be modified slightly, either by adding new static imports or replacing classnames.
>
> Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision:
>
> make utility classes final with a private constructor
src/main/java/org/openjdk/jextract/impl/ToplevelBuilder.java line 67:
> 65: SourceFileBuilder sfb = SourceFileBuilder.newSourceFile(packageName(), SHARED);
> 66: HeaderFileBuilder sharedBuilder = new HeaderFileBuilder(sfb, SHARED, null, SHARED);
> 67: sharedBuilder.appendBlankLine();
There seems to be a lot of overlapping between the code here and the one in `nextHeader` -- especially now that the first header is not really meant to have a lot of special things (the only exception being the symbol lookup logic).
src/main/java/org/openjdk/jextract/impl/ToplevelBuilder.java line 80:
> 78: first.classBegin();
> 79: first.emitDefaultConstructor();
> 80: first.emitRuntimeHelperMethods();
Shouldn't the runtime helper methods end up in the shared class?
-------------
PR Review Comment: https://git.openjdk.org/jextract/pull/278#discussion_r2063996942
PR Review Comment: https://git.openjdk.org/jextract/pull/278#discussion_r2063993553
More information about the jextract-dev
mailing list