[foreign] RFR 8212560 : jextract should generate a static forwarder class

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu Oct 18 00:56:09 UTC 2018


On 17/10/2018 05:37, Sundararajan Athijegannathan wrote:
>
> On option: do we need an explicit option? given that one file extra 
> and that too only when -l is specified. (too many options already? ;) )
>
> On naming: we've derived automatic names elsewhere. I think we could 
> revisit all naming options by another round - perhaps even java 
> convention for header interface name.

While on the plane a good name scheme came to mind - why not call the 
static wrappers with the 'Lib' suffix (a la *nix) ? E.g. given an header:

foo.h

we could generate:

foo.class (raw header)

fooLib.class (static forwarder lib)


>
> On subclassing: Nice suggestion. I made it as AsmCodeFactoryExt class 
> and extended it from AsmCodeFactory. visit methods now return Boolean 
> to tell if the particular tree was handled or not. This is needed so 
> that subclass can avoid the same tree if super class avoided it (for 
> eg. function-like macros, repeated definitions..)
>
> Updated: http://cr.openjdk.java.net/~sundar/8212560/webrev.01/index.html

Looks good!

Maurizio

>
> Thanks,
> -Sundar
>
> On 17/10/18, 3:25 PM, Maurizio Cimadamore wrote:
>> I like it! Few questions/comments:
>>
>> * should it be enabled/disabled with explicit option
>> * should the name of the statics class be customizable
>> * I like the code organization - have you thought of pushing it 
>> further and make StaticForwarderGenerator a _subclass_ of 
>> AsmCodeFactory - each visitor could maybe delegate to 
>> super.visitXyz() first and then do its own bit? Then when you setup 
>> the pipeline, depending on what info is available on the context 
>> (e.g. presence of -l) you can decide whether to use a 'bare' 
>> ASMCodeFactory or the 'embellished' one. That should remove all the 
>> 'if staticFwd != null ...' sections from AsmCodeFactory.
>>
>> Maurizio
>>
>>
>> On 17/10/2018 06:35, Sundararajan Athijegannathan wrote:
>>> Please review.
>>>
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8212560
>>> Webrev: http://cr.openjdk.java.net/~sundar/8212560/webrev.00/index.html
>>>
>>> Thanks,
>>> -Sundar


More information about the panama-dev mailing list