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

Athijegannathan Sundararajan sundar at openjdk.java.net
Wed Apr 1 10:28:09 UTC 2020


On Wed, 1 Apr 2020 10:23:33 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Athijegannathan Sundararajan has updated the pull request incrementally with one additional commit since the last
>> revision:
>>   * added static modifier to Cstring.toString method. Added tests for Cstring methods
>>   * added length accepting allocateArray overloadeds and using the same in samples.
>>   * using bulk copy for array copy
>>   * fixed samples to use Cstring method instead of methods from Foreign.
>
> doc/panama_jextract.md line 330:
> 
>> 329:             Cdouble.set(y, 2, 0.0);
>> 330:             Cdouble.set(y, 3, 0.0);
>> 331:             cblas_dgemv(Layout, transa, m, n, alpha, a, lda, x, incx, beta, y, incy);
> 
> We also need an helper that takes a MemorySegment, interprets it as a native double array and turns it into a Java
> double array. e.g. double[] toJavaArray(MemorySegment)
> Not needed here, but could be handy in other cases

Will add bulk (array) getter operation

> doc/panama_jextract.md line 166:
> 
>> 165:             // convert char* ptr from readline as Java String & print it
>> 166:             System.out.println("Hello, " + Cstring.toString(p));
>> 167:         }
> 
> I suggest calling this `toJavaString` to avoid confusion

True. Will rename toString as toJavaString to be clear.

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

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


More information about the panama-dev mailing list