[foreign-jextract] RFR: 8248710: jextract should not generate Cstring, Cpointer, Cint C-X utility classes [v2]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Fri Jul 3 10:27:43 UTC 2020


On Fri, 3 Jul 2020 06:04:28 GMT, Athijegannathan Sundararajan <sundar at openjdk.org> wrote:

>> Cstring, Cpointer, C-X* classes are not generated anymore. Updated tests, samples for the same. Samples updated for
>> stability issues with foreign-abi crashes as well.
>
> Athijegannathan Sundararajan has updated the pull request incrementally with one additional commit since the last
> revision:
>   get rid of workaround as foreign-abi implementation default has been changed

This static definition in some of the examples:

private static MemoryAddress allocatePointer(MemoryAddress value, NativeScope scope) {
+         var addr = scope.allocate(C_POINTER);
+         var handle = C_POINTER.varHandle(long.class);
+         handle.set(addr, value.toRawLongValue());
+         return addr;
+     }

seems unnecessary, since it can just be replaced by two lines:

var addr = scope.allocate(C_POINTER);
MemoryAccess.setAddress(addr, 0, value);

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

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


More information about the panama-dev mailing list