RFR: 7903146: TypeTranslator is no longer needed [v3]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Wed Apr 6 16:13:47 UTC 2022


On Wed, 6 Apr 2022 16:08:25 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Now that ValueLayout has carrier information attached, we no longer need to perform two separate visit on a function type, one to get a FunctionDescriptor and one to get a MethodType. We can just get a FunctionDescriptor and derive everything from there.
>> 
>> This patch applies several cleanups on OutputFactory, to flatten the code, and remove some spaghetti lambdas. It also drops the FunctionInfo/VarInfo abstraction, since now that we can derive most of the info from layouts, these do not seem to add much value.
>
> Maurizio Cimadamore has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 10 commits:
> 
>  - Merge branch 'master' into drop_type_translator
>  - Update copyright
>  - Drop VarInfo
>  - Drop FunctionINfo
>  - Initial push
>  - Merge branch 'cleanup_treemaker' into drop_type_translator
>  - Address review comments
>  - Drop TypeTranslator
>  - Merge branch 'master' into cleanup_treemaker
>  - Initial push

src/main/java/org/openjdk/jextract/impl/HeaderFileBuilder.java line 283:

> 281:                 buf.append("\")");
> 282:             }
> 283:         } else if (type == boolean.class) {

This is a bug that was revealed by the cleanup: for boolean constants macros, we were using a "boolean" layout - but then we were dropping that information away, and just using byte as a carrier. That's because the Type -> Layout translation was subtly different from the Type -> Class one. Now that we only use a single translation, all these discrepancies are exposed.

-------------

PR: https://git.openjdk.java.net/jextract/pull/14


More information about the jextract-dev mailing list