From nbenalla at openjdk.org Fri May 2 14:30:36 2025 From: nbenalla at openjdk.org (Nizar Benalla) Date: Fri, 2 May 2025 14:30:36 GMT Subject: RFR: 7903933: Move sharable items from different generations to a common file [v7] In-Reply-To: References: Message-ID: > 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: feedback: rename option and consolidate code ------------- Changes: - all: https://git.openjdk.org/jextract/pull/278/files - new: https://git.openjdk.org/jextract/pull/278/files/532ee1a6..5c8802a6 Webrevs: - full: https://webrevs.openjdk.org/?repo=jextract&pr=278&range=06 - incr: https://webrevs.openjdk.org/?repo=jextract&pr=278&range=05-06 Stats: 83 lines in 5 files changed: 44 ins; 16 del; 23 mod Patch: https://git.openjdk.org/jextract/pull/278.diff Fetch: git fetch https://git.openjdk.org/jextract.git pull/278/head:pull/278 PR: https://git.openjdk.org/jextract/pull/278 From nbenalla at openjdk.org Fri May 2 14:33:58 2025 From: nbenalla at openjdk.org (Nizar Benalla) Date: Fri, 2 May 2025 14:33:58 GMT Subject: RFR: 7903933: Move sharable items from different generations to a common file [v6] In-Reply-To: References: Message-ID: On Mon, 28 Apr 2025 15:59:58 GMT, Maurizio Cimadamore wrote: >> 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). Fixed, I consolidated the shared code in some methods. I ran into issues with the java files having the wrong name so I had to change the logic a little. > 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? Fixed in https://github.com/openjdk/jextract/pull/278/commits/5c8802a6abc2fbb65a1bf341be2e7e11c5936c74, I thought only the shared symbols belonged in the separate class. I did not move the library arena to the separate class and instead kept it close to the symbol lookup. ------------- PR Review Comment: https://git.openjdk.org/jextract/pull/278#discussion_r2071703755 PR Review Comment: https://git.openjdk.org/jextract/pull/278#discussion_r2071701834 From mcimadamore at openjdk.org Fri May 2 14:53:01 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Fri, 2 May 2025 14:53:01 GMT Subject: RFR: 7903933: Move sharable items from different generations to a common file [v7] In-Reply-To: References: Message-ID: On Fri, 2 May 2025 14:30:36 GMT, Nizar Benalla 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: > > feedback: rename option and consolidate code Very nice cleanup! Looks good ------------- Marked as reviewed by mcimadamore (Reviewer). PR Review: https://git.openjdk.org/jextract/pull/278#pullrequestreview-2812213858 From nbenalla at openjdk.org Mon May 5 12:47:43 2025 From: nbenalla at openjdk.org (Nizar Benalla) Date: Mon, 5 May 2025 12:47:43 GMT Subject: RFR: 7903933: Move sharable items from different generations to a common file [v8] In-Reply-To: References: Message-ID: <1idqGjuhuaRZB8gBn6dqYuaaeRMCZsRmIOu_COhNbOc=.3381a028-292f-48d6-8fb0-b383ec4be101@github.com> > 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: update test ------------- Changes: - all: https://git.openjdk.org/jextract/pull/278/files - new: https://git.openjdk.org/jextract/pull/278/files/5c8802a6..e3b9ae2a Webrevs: - full: https://webrevs.openjdk.org/?repo=jextract&pr=278&range=07 - incr: https://webrevs.openjdk.org/?repo=jextract&pr=278&range=06-07 Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jextract/pull/278.diff Fetch: git fetch https://git.openjdk.org/jextract.git pull/278/head:pull/278 PR: https://git.openjdk.org/jextract/pull/278 From nbenalla at openjdk.org Mon May 5 12:47:44 2025 From: nbenalla at openjdk.org (Nizar Benalla) Date: Mon, 5 May 2025 12:47:44 GMT Subject: RFR: 7903933: Move sharable items from different generations to a common file [v7] In-Reply-To: References: Message-ID: On Fri, 2 May 2025 14:30:36 GMT, Nizar Benalla 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: > > feedback: rename option and consolidate code I pushed a small test-only update, I was seeing some failures in the CI (that I didn't see locally). This fixes it, ------------- PR Comment: https://git.openjdk.org/jextract/pull/278#issuecomment-2850878301 From mcimadamore at openjdk.org Tue May 6 08:50:32 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Tue, 6 May 2025 08:50:32 GMT Subject: RFR: 7903933: Move sharable items from different generations to a common file [v8] In-Reply-To: <1idqGjuhuaRZB8gBn6dqYuaaeRMCZsRmIOu_COhNbOc=.3381a028-292f-48d6-8fb0-b383ec4be101@github.com> References: <1idqGjuhuaRZB8gBn6dqYuaaeRMCZsRmIOu_COhNbOc=.3381a028-292f-48d6-8fb0-b383ec4be101@github.com> Message-ID: On Mon, 5 May 2025 12:47:43 GMT, Nizar Benalla 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: > > update test Good catch! ------------- Marked as reviewed by mcimadamore (Reviewer). PR Review: https://git.openjdk.org/jextract/pull/278#pullrequestreview-2817415601 From nbenalla at openjdk.org Tue May 6 11:21:30 2025 From: nbenalla at openjdk.org (Nizar Benalla) Date: Tue, 6 May 2025 11:21:30 GMT Subject: RFR: 7903933: Move sharable items from different generations to a common file [v8] In-Reply-To: <1idqGjuhuaRZB8gBn6dqYuaaeRMCZsRmIOu_COhNbOc=.3381a028-292f-48d6-8fb0-b383ec4be101@github.com> References: <1idqGjuhuaRZB8gBn6dqYuaaeRMCZsRmIOu_COhNbOc=.3381a028-292f-48d6-8fb0-b383ec4be101@github.com> Message-ID: <1T2yA5uJJ1gBIjEGYhubOTAzdG0TQ9JFDIQ1FM5F4Ro=.9f247d80-62d9-4f34-a09c-3ee634698897@github.com> On Mon, 5 May 2025 12:47:43 GMT, Nizar Benalla 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: > > update test Thanks for all the rounds of reviews. ------------- PR Comment: https://git.openjdk.org/jextract/pull/278#issuecomment-2854191605 From duke at openjdk.org Tue May 6 11:21:31 2025 From: duke at openjdk.org (duke) Date: Tue, 6 May 2025 11:21:31 GMT Subject: RFR: 7903933: Move sharable items from different generations to a common file [v8] In-Reply-To: <1idqGjuhuaRZB8gBn6dqYuaaeRMCZsRmIOu_COhNbOc=.3381a028-292f-48d6-8fb0-b383ec4be101@github.com> References: <1idqGjuhuaRZB8gBn6dqYuaaeRMCZsRmIOu_COhNbOc=.3381a028-292f-48d6-8fb0-b383ec4be101@github.com> Message-ID: On Mon, 5 May 2025 12:47:43 GMT, Nizar Benalla 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: > > update test @nizarbenalla Your change (at version e3b9ae2a21517e008a06e3e55d42a5957366d4ad) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/jextract/pull/278#issuecomment-2854195422 From jvernee at openjdk.org Tue May 6 17:58:34 2025 From: jvernee at openjdk.org (Jorn Vernee) Date: Tue, 6 May 2025 17:58:34 GMT Subject: RFR: 7903933: Move sharable items from different generations to a common file [v8] In-Reply-To: <1idqGjuhuaRZB8gBn6dqYuaaeRMCZsRmIOu_COhNbOc=.3381a028-292f-48d6-8fb0-b383ec4be101@github.com> References: <1idqGjuhuaRZB8gBn6dqYuaaeRMCZsRmIOu_COhNbOc=.3381a028-292f-48d6-8fb0-b383ec4be101@github.com> Message-ID: On Mon, 5 May 2025 12:47:43 GMT, Nizar Benalla 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: > > update test doc/GUIDE.md line 989: > 987: | `--dump-includes ` | dump included symbols into specified file (see below) | > 988: | `--include-[function,constant,struct,union,typedef,var]` | Include a symbol of the given name and kind in the generated bindings. When one of these options is specified, any symbol that is not matched by any specified filters is omitted from the generated bindings. | > 989: | `--symbols-class-name ` | override the name of the root header class | Suggestion: | `--symbols-class-name ` | override the name of the root header class | src/main/java/org/openjdk/jextract/impl/FunctionalInterfaceBuilder.java line 45: > 43: private FunctionalInterfaceBuilder(SourceFileBuilder builder, String className, ClassSourceBuilder enclosing, > 44: String runtimeHelperName, Type.Function funcType, boolean isNested) { > 45: super(builder, isNested ? "public final static" : "public final", Kind.CLASS, className, null, enclosing, runtimeHelperName); Changes in this file seem unrelated? Leftover from other work? src/main/java/org/openjdk/jextract/impl/HeaderFileBuilder.java line 357: > 355: > 356: static final Arena LIBRARY_ARENA = Arena.ofAuto();"""); > 357: } Suggestion: void emitLibaryArena(){ appendIndentedLines(""" static final Arena LIBRARY_ARENA = Arena.ofAuto();"""); } src/main/java/org/openjdk/jextract/impl/IncludeHelper.java line 91: > 89: public String getSharedSymbolsFile() { > 90: return sharedSymbolsFile; > 91: } Uhm, I think this should just be in `Options`, not in `IncludeHelper`, since it's not related to the `--include` options. src/main/java/org/openjdk/jextract/impl/ToplevelBuilder.java line 46: > 44: public static final String PREV_SUFFIX = "#{PREV_SUFFIX}"; > 45: private static final String SUFFIX = "#{SUFFIX}"; > 46: private static String SHARED; I think this was supposed to be `final`? Suggestion: private final String shared; src/main/resources/org/openjdk/jextract/impl/resources/Messages.properties line 88: > 86: -t, --target-package target package name for the generated classes. If this option\n\ > 87: \ is not specified, then unnamed package is used. \n\ > 88: --symbols-class-name override the name of the root header class \n\ Suggestion: --symbols-class-name override the name of the root header class \n\ test/testng/org/openjdk/jextract/test/toolprovider/TestClassGeneration.java line 195: > 193: public void testFunctionalInterface(String name, MethodType type) { > 194: Class fpClass = loader.loadClass("com.acme." + name); > 195: checkPrivateConstructor(fpClass); Same here, these changes seem unrelated. ------------- PR Review Comment: https://git.openjdk.org/jextract/pull/278#discussion_r2075975278 PR Review Comment: https://git.openjdk.org/jextract/pull/278#discussion_r2075987523 PR Review Comment: https://git.openjdk.org/jextract/pull/278#discussion_r2075966750 PR Review Comment: https://git.openjdk.org/jextract/pull/278#discussion_r2075970980 PR Review Comment: https://git.openjdk.org/jextract/pull/278#discussion_r2075974800 PR Review Comment: https://git.openjdk.org/jextract/pull/278#discussion_r2075982835 PR Review Comment: https://git.openjdk.org/jextract/pull/278#discussion_r2075988326 From nbenalla at openjdk.org Wed May 7 09:20:30 2025 From: nbenalla at openjdk.org (Nizar Benalla) Date: Wed, 7 May 2025 09:20:30 GMT Subject: RFR: 7903933: Move sharable items from different generations to a common file [v8] In-Reply-To: References: <1idqGjuhuaRZB8gBn6dqYuaaeRMCZsRmIOu_COhNbOc=.3381a028-292f-48d6-8fb0-b383ec4be101@github.com> Message-ID: On Tue, 6 May 2025 17:53:33 GMT, Jorn Vernee wrote: >> Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision: >> >> update test > > src/main/java/org/openjdk/jextract/impl/FunctionalInterfaceBuilder.java line 45: > >> 43: private FunctionalInterfaceBuilder(SourceFileBuilder builder, String className, ClassSourceBuilder enclosing, >> 44: String runtimeHelperName, Type.Function funcType, boolean isNested) { >> 45: super(builder, isNested ? "public final static" : "public final", Kind.CLASS, className, null, enclosing, runtimeHelperName); > > Changes in this file seem unrelated? Leftover from other work? This change was to make the utility classes final, it's somewhat unrelated to this patch but it didn't seem to be worth a separate PR. ------------- PR Review Comment: https://git.openjdk.org/jextract/pull/278#discussion_r2077199255 From nbenalla at openjdk.org Wed May 7 10:43:26 2025 From: nbenalla at openjdk.org (Nizar Benalla) Date: Wed, 7 May 2025 10:43:26 GMT Subject: RFR: 7903933: Move sharable items from different generations to a common file [v8] In-Reply-To: References: <1idqGjuhuaRZB8gBn6dqYuaaeRMCZsRmIOu_COhNbOc=.3381a028-292f-48d6-8fb0-b383ec4be101@github.com> Message-ID: On Tue, 6 May 2025 17:54:07 GMT, Jorn Vernee wrote: >> Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision: >> >> update test > > test/testng/org/openjdk/jextract/test/toolprovider/TestClassGeneration.java line 195: > >> 193: public void testFunctionalInterface(String name, MethodType type) { >> 194: Class fpClass = loader.loadClass("com.acme." + name); >> 195: checkPrivateConstructor(fpClass); > > Same here, these changes seem unrelated. This is also related to making the utility classes final with a private constructor. ------------- PR Review Comment: https://git.openjdk.org/jextract/pull/278#discussion_r2077340632 From nbenalla at openjdk.org Thu May 8 12:28:20 2025 From: nbenalla at openjdk.org (Nizar Benalla) Date: Thu, 8 May 2025 12:28:20 GMT Subject: RFR: 7903933: Move sharable items from different generations to a common file [v9] In-Reply-To: References: Message-ID: > 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: feedback from jorn ------------- Changes: - all: https://git.openjdk.org/jextract/pull/278/files - new: https://git.openjdk.org/jextract/pull/278/files/e3b9ae2a..167423e1 Webrevs: - full: https://webrevs.openjdk.org/?repo=jextract&pr=278&range=08 - incr: https://webrevs.openjdk.org/?repo=jextract&pr=278&range=07-08 Stats: 62 lines in 9 files changed: 27 ins; 2 del; 33 mod Patch: https://git.openjdk.org/jextract/pull/278.diff Fetch: git fetch https://git.openjdk.org/jextract.git pull/278/head:pull/278 PR: https://git.openjdk.org/jextract/pull/278 From nbenalla at openjdk.org Thu May 8 12:28:20 2025 From: nbenalla at openjdk.org (Nizar Benalla) Date: Thu, 8 May 2025 12:28:20 GMT Subject: RFR: 7903933: Move sharable items from different generations to a common file [v8] In-Reply-To: References: <1idqGjuhuaRZB8gBn6dqYuaaeRMCZsRmIOu_COhNbOc=.3381a028-292f-48d6-8fb0-b383ec4be101@github.com> Message-ID: On Tue, 6 May 2025 17:44:35 GMT, Jorn Vernee wrote: >> Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision: >> >> update test > > src/main/java/org/openjdk/jextract/impl/ToplevelBuilder.java line 46: > >> 44: public static final String PREV_SUFFIX = "#{PREV_SUFFIX}"; >> 45: private static final String SUFFIX = "#{SUFFIX}"; >> 46: private static String SHARED; > > I think this was supposed to be `final`? > Suggestion: > > private final String shared; Fixed in [167423e](https://github.com/openjdk/jextract/pull/278/commits/167423e1c23f3b3d2bf092c4cfdf6f465c6c54e1). I had to refractor a couple of methods. `generateInternal` now takes `Options options`, that way I don't need to change the signature every time we add a new command-line option. ------------- PR Review Comment: https://git.openjdk.org/jextract/pull/278#discussion_r2079616575 From jvernee at openjdk.org Thu May 8 13:01:09 2025 From: jvernee at openjdk.org (Jorn Vernee) Date: Thu, 8 May 2025 13:01:09 GMT Subject: RFR: 7903933: Move sharable items from different generations to a common file [v9] In-Reply-To: References: Message-ID: On Thu, 8 May 2025 12:28:20 GMT, Nizar Benalla 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: > > feedback from jorn Marked as reviewed by jvernee (Reviewer). src/main/java/org/openjdk/jextract/impl/IncludeHelper.java line 90: > 88: > 89: public String getSharedClassName() { > 90: return sharedClassName; These can now be removed I think? ------------- PR Review: https://git.openjdk.org/jextract/pull/278#pullrequestreview-2825044208 PR Review Comment: https://git.openjdk.org/jextract/pull/278#discussion_r2079666302 From nbenalla at openjdk.org Thu May 8 13:50:19 2025 From: nbenalla at openjdk.org (Nizar Benalla) Date: Thu, 8 May 2025 13:50:19 GMT Subject: RFR: 7903933: Move sharable items from different generations to a common file [v10] In-Reply-To: References: Message-ID: > 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: revert changes to IncludeHelper ------------- Changes: - all: https://git.openjdk.org/jextract/pull/278/files - new: https://git.openjdk.org/jextract/pull/278/files/167423e1..5733943f Webrevs: - full: https://webrevs.openjdk.org/?repo=jextract&pr=278&range=09 - incr: https://webrevs.openjdk.org/?repo=jextract&pr=278&range=08-09 Stats: 7 lines in 1 file changed: 0 ins; 5 del; 2 mod Patch: https://git.openjdk.org/jextract/pull/278.diff Fetch: git fetch https://git.openjdk.org/jextract.git pull/278/head:pull/278 PR: https://git.openjdk.org/jextract/pull/278 From nbenalla at openjdk.org Thu May 8 13:50:19 2025 From: nbenalla at openjdk.org (Nizar Benalla) Date: Thu, 8 May 2025 13:50:19 GMT Subject: RFR: 7903933: Move sharable items from different generations to a common file [v9] In-Reply-To: References: Message-ID: On Thu, 8 May 2025 12:57:26 GMT, Jorn Vernee wrote: >> Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision: >> >> feedback from jorn > > src/main/java/org/openjdk/jextract/impl/IncludeHelper.java line 90: > >> 88: >> 89: public String getSharedClassName() { >> 90: return sharedClassName; > > These can now be removed I think? I missed this, thanks for catching it. ------------- PR Review Comment: https://git.openjdk.org/jextract/pull/278#discussion_r2079747586 From jvernee at openjdk.org Thu May 8 14:36:07 2025 From: jvernee at openjdk.org (Jorn Vernee) Date: Thu, 8 May 2025 14:36:07 GMT Subject: RFR: 7903933: Move sharable items from different generations to a common file [v10] In-Reply-To: References: Message-ID: On Thu, 8 May 2025 13:50:19 GMT, Nizar Benalla 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: > > revert changes to IncludeHelper Marked as reviewed by jvernee (Reviewer). Thanks for the updates. Looks good now! ------------- PR Review: https://git.openjdk.org/jextract/pull/278#pullrequestreview-2825356367 PR Comment: https://git.openjdk.org/jextract/pull/278#issuecomment-2863286585 From nbenalla at openjdk.org Thu May 8 14:59:10 2025 From: nbenalla at openjdk.org (Nizar Benalla) Date: Thu, 8 May 2025 14:59:10 GMT Subject: RFR: 7903933: Move sharable items from different generations to a common file [v10] In-Reply-To: References: Message-ID: On Thu, 8 May 2025 13:50:19 GMT, Nizar Benalla 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: > > revert changes to IncludeHelper Thanks! Glad this work can be integrated into jextract. ------------- PR Comment: https://git.openjdk.org/jextract/pull/278#issuecomment-2863348138 From duke at openjdk.org Thu May 8 14:59:10 2025 From: duke at openjdk.org (duke) Date: Thu, 8 May 2025 14:59:10 GMT Subject: RFR: 7903933: Move sharable items from different generations to a common file [v10] In-Reply-To: References: Message-ID: <2GZOxNw-NlRJmRTCSyTbJ3gq0-GoKmAt3XeqtZsZxmM=.a83ba963-3fb4-4ec8-88cc-e2cd6b9fd068@github.com> On Thu, 8 May 2025 13:50:19 GMT, Nizar Benalla 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: > > revert changes to IncludeHelper @nizarbenalla Your change (at version 5733943f65702d599da7cbbc1699b38740a531c9) is now ready to be sponsored by a Committer. ------------- PR Comment: https://git.openjdk.org/jextract/pull/278#issuecomment-2863354817 From jvernee at openjdk.org Thu May 8 15:15:09 2025 From: jvernee at openjdk.org (Jorn Vernee) Date: Thu, 8 May 2025 15:15:09 GMT Subject: git: openjdk/jextract: 7903933: Move sharable items from different generations to a common file Message-ID: <05c3eb57-c935-46c8-a1e1-48f99c848b2b@openjdk.org> Changeset: ab6b30fd Branch: master Author: Nizar Benalla Committer: Jorn Vernee Date: 2025-05-08 15:12:44 +0000 URL: https://git.openjdk.org/jextract/commit/ab6b30fd189e33a52d366846202f2e9b9b280142 7903933: Move sharable items from different generations to a common file Reviewed-by: mcimadamore, jvernee ! doc/GUIDE.md ! src/main/java/org/openjdk/jextract/JextractTool.java ! src/main/java/org/openjdk/jextract/impl/ClassSourceBuilder.java ! src/main/java/org/openjdk/jextract/impl/FunctionalInterfaceBuilder.java ! src/main/java/org/openjdk/jextract/impl/HeaderFileBuilder.java ! src/main/java/org/openjdk/jextract/impl/Options.java ! src/main/java/org/openjdk/jextract/impl/OutputFactory.java ! src/main/java/org/openjdk/jextract/impl/ToplevelBuilder.java ! src/main/resources/org/openjdk/jextract/impl/resources/Messages.properties + test/jtreg/generator/sharedSymbolsHeader/TestSharedSymbolsHeader.java = test/jtreg/generator/sharedSymbolsHeader/sharedSymbolsHeader.h ! test/testng/org/openjdk/jextract/test/toolprovider/TestClassGeneration.java From nbenalla at openjdk.org Thu May 8 15:18:12 2025 From: nbenalla at openjdk.org (Nizar Benalla) Date: Thu, 8 May 2025 15:18:12 GMT Subject: Integrated: 7903933: Move sharable items from different generations to a common file In-Reply-To: References: Message-ID: On Mon, 3 Feb 2025 18:16:48 GMT, Nizar Benalla 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. This pull request has now been integrated. Changeset: ab6b30fd Author: Nizar Benalla Committer: Jorn Vernee URL: https://git.openjdk.org/jextract/commit/ab6b30fd189e33a52d366846202f2e9b9b280142 Stats: 249 lines in 12 files changed: 166 ins; 11 del; 72 mod 7903933: Move sharable items from different generations to a common file Reviewed-by: mcimadamore, jvernee ------------- PR: https://git.openjdk.org/jextract/pull/278