Basic questions about Panama
Virendra J. Marathe
virendra.marathe at oracle.com
Wed Mar 14 22:13:28 UTC 2018
Hi Henry,
Thanks for pointing to the right directory. I looked at the simple.h
and recursive.h
examples, and their respective .java files. I have questions.
* First I don't understand how the pieces fit together. i.e. jextract
uses a .h file to
create a jar/class file; so what is the .java in those examples
for? Is it something
the programmer has to write up to mimic the interfaces present in
the class files?
* The annotations seem quite heavy and superfluous. Can a Java
programmer omit
some of them?
* I also don't understand the role of each argument in these annotations
-- e.g. USR,
do we need to write down the line and column numbers? what is
layout? what is @Offset,
and why are all of them a multiple of 8?
* What would the Java code that uses these interfaces look like? If the
programmer wants
to allocate an off-heap object and cast it into an interface, what
would the native as well as
Java side of that interaction look like?
* Lastly, can I talk to someone for clarifications to these basic
doubts? A higher
bandwidth call may be much more useful than email swaps.
Thanks,
Virendra
On 03/14/2018 04:41 PM, Henry Jen wrote:
> Hi Virendra,
>
>> On Mar 14, 2018, at 12:09 PM, Virendra J. Marathe <virendra.marathe at oracle.com> wrote:
>>
>>
>> Hi all,
>>
>> I've started working on a project in Oracle Labs to enable persistent memory access in Java
>> through Panama. I'm new to Panama. I'm using the nicl branch, which I was told contains
>> the jextract tool to create Java classes from .h files (the code is in C). I have a couple
>> questions to get started.
>>
>> 1. Samples: README.nicl says sample programs should be present in the src/demo/share/panama
>> directory. I don't see that directory in either the nicl branch or the default one.
> We are moving demos into test, I’ll update README.nicl. It is now in jdk/test/java/nicl and jdk/test/com/sun/tools/jextract.
>
> A sample to show how jextract generate binding for libclang and run jextract on top of the generated classes can be found at
> http://cr.openjdk.java.net/~henryjen/panama/clang-ffi/
>
> That is a little out-of-date, a new version will come up soon.
>
>> 2. Is there a tool present in Panama to get a .java version of the classes created by
>> jextract? (Perhaps the missing samples will help with this one?)
>>
> Currently we only generate class files, not source files. Generated stub are interfaces and implementation classes are weaved at runtime.
>
> Cheers,
> Henry
>
More information about the panama-dev
mailing list