A few considerations (mostly) on jextract
Markus Knetschke
markus.knetschke at gmail.com
Fri May 28 15:26:12 UTC 2021
> But your idea of attaching more stringy type info in the function (for
> other tools) is good, I believe, and one which I believe we can get to
> by adding layout attributes to the function descriptor (instead of using
> Java annotations):
>
> FunctionDescriptor.of(
> C_POINTER.withAttribute(C_TYPE, "fuse*")
> C_POINTER.withAttribute(C_TYPE,
> "fuse_args*").withAttribute(JAVA_TYPE, fuse_args.class)
> ...
> )
>
> That way the function descriptor will be fully inspectable - although
> not statically so - which might or might not be enough.
This would be great for the start, sadly it would be quite hard to parse with
an annotation processor (which is a feature I this is very underused).
I would really prefer a way useable from an annotation processor.
> >
> >
> > I've now also found the time to port my tests to the new preview
> > (after a lot of meetings about
> > how much code needs a rewrite because of JEP411) and I love a lot of
> > the changes.
> > Two questions:
> > What is now the recommended way to get a MemorySegment from
> > MemoryAddress parameters of
> > upcalls which lifetime is mostly restricted to the call after the
> > removal of asSegmentRestricted(long)?
> The method is still there - just the Restricted suffix has gone :-)
At least in the current preview
FuseFileInfo(MemoryAddress addr) {
this.seg = addr.asSegment(org.fuse.fuse_file_info.sizeof());
}
doesn't compile and I can't see a asSegment method with only a size
parameter in
https://download.java.net/java/early_access/panama/docs/api/jdk.incubator.foreign/jdk/incubator/foreign/MemoryAddress.html
https://github.com/openjdk/panama-foreign/blob/foreign-jextract/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryAddress.java
Best regards,
Markus Knetschke
More information about the panama-dev
mailing list