[foreign-jextract] RFR: 8241925: jextract should generate simple allocation, access API for C primitive types

Athijegannathan Sundararajan sundar at openjdk.java.net
Wed Apr 1 02:41:28 UTC 2020


On Tue, 31 Mar 2020 15:46:41 GMT, Henry Jen <henryjen at openjdk.org> wrote:

>> added static method helper classes to handle allocation, access ot C primitive types and C strings.
>
> src/jdk.incubator.jextract/share/classes/jdk/incubator/jextract/tool/resources/Cstring.java.template line 30:
> 
>> 29:         byteArrHandle.set(addr, (long)bytes.length, (byte)0);
>> 30:     }
>> 31:
> 
> I wonder, why using VarHandle in a loop instead of just MS::copy? Is there an optimization benefit? AFAIK, byte has no
> issue like endianness conversion like integral type.

Will fix this. Thx

> src/jdk.incubator.jextract/share/classes/jdk/incubator/jextract/tool/resources/Cstring.java.template line 59:
> 
>> 58:
>> 59:     public String toString(MemoryAddress addr) {
>> 60:         StringBuilder buf = new StringBuilder();
> 
> static?

Oops. Will fix this and add a test.

-------------

PR: https://git.openjdk.java.net/panama-foreign/pull/78


More information about the panama-dev mailing list