some thoughts on panama/jextract

Michael Zucchi notzed at gmail.com
Mon Jan 6 06:57:14 UTC 2020


Hi Maurizio,

On 3/1/20 8:31 am, Maurizio Cimadamore wrote:
> Hi Michael,
> thanks for the feedback. The jextract story has moved quite a bit from 
> the prototype you have played with. There is a document I wrote few 
> weeks ago which summarizes the main beefs with the status quo:
>
> http://cr.openjdk.java.net/~mcimadamore/panama/jextract_distilled.html
>
Ahah, as usual it's hard to keep track of these things when you drop 
into a project.  I've been aware of panama for a while but that's about 
it until I looked at it in detail last week.  I only went by what I 
found on the openjdk page and hit the source-code before I read very far.

Well for C libclang is constrained by the ABI for the platform but I was 
thinking of other things like pointer sizes or exposed platform pieces 
(or even compile options).  Although a well designed api will abstract 
the latter they don't all do it.  I use jmods already so that works for 
the binary part, it's the source-part i was worried about because as 
soon as something isn't auto-generated, it's manual work and i'm lazy.

But thanks for the detailed response, i'll keep an eye out on developments.

For now ... well I got caught up over the weekend experimenting with the 
non-jextract parts and ended up writing my own jextract-like tool.  It 
uses a gcc plugin to get the metadata and perl to turn that into class 
files in various relatively flexible ways.  It's not 100% complete but 
it's enough to link to libavformat and read video frames.  I think the 
biggest commonly-used bit missing is enums (it currently converts them 
to int or long, and the symbolic names don't make it to java) but it 
does most of the rest.  bitfields were a pain!

If anyone is interested I published it together with a crappy example 
and and put up a very poor home page: 
https://www.zedzone.space/software/panamaz.html

It's definitely amd64, probably linux and perhaps gcc 9.2 only.

It turned into a lot more work than I intended so i'm a bit over it for 
the moment thus how much i keep poking at it is up in the air. At least 
it was an engaging puzzle for a couple of days and the gcc plugin could 
be handy.

Cheers,
  Michael



More information about the panama-dev mailing list