jextract woes

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu Jan 30 11:28:39 UTC 2020


On 30/01/2020 05:07, Michael Zucchi wrote:
> I guess from jorn's email you're talking about creating a an 
> implementation of an interface through which the calls operate.
>
> I think that's frankly beyond the scope of what should be required to 
> use panama.

All I was trying to say is that there is a way, at the classfile level, 
to make this idiom of your quite fast - as you can effectively build a 
polymorphic cache using the MethodHandle and invokedynamic support - so 
that, as long as the platformID remains constant, the VM will keep 
treating the native method handle as a constant too.

But all this is quite advanced.

>
>> Or maybe it's overkill, and if your context is 'simple' enough, you 
>> can just use a map<Context, MethodHandle> :-)
>>
>
> If jextract can't do the functional equivalent of the above i'll just 
> have to use the code I have already.

I think implementing stuff like this is better done on your side - at 
least for now. If we added support for this use cases it would have to 
be something quite general and reusable, and it's not clear (yet, at 
least - I'd have to think more) to me how something like that would work 
in a way that is general enough to be ok with all libraries using this 
idiom.

But thanks for bringing this up - I think it's an interesting use case!

Maurizio



More information about the panama-dev mailing list