[foreign-abi] RFR: 8248420: Add a variant of VaList::make which takes a NativeScope [v6]

Jorn Vernee jvernee at openjdk.java.net
Thu Jul 16 18:59:47 UTC 2020


On Thu, 16 Jul 2020 15:10:24 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Jorn Vernee has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Fix whitespace error
>>  - Add extra test for liveness of copied VaList without using scope
>
> This is borderline in terms of requiring its own liveness check:
> 
> @Override
> public MemoryAddress address() {
>      return ptr;
> }
> Of course, in the current impl, since `ptr` is attached to the original segment, attempting to use the address will
> fail (if parent valist has been closed already).

After a suggestion from Maurizio I've re-written the VaListTest to try and test all the implementations on the
different platforms, instead of just the implementation for the current platform.

This results in 4 different versions of each test being run; once for each platform, where the reading of the VaList is
done in Java as well, and then one native implementation. The needed parameters are injected into tests using
DataProviders. For the struct tests this was a little tricky, since we need to inject the platform specific
C_INT/C_LONGLONG/C_FLOAT layouts into the struct layout. This resulted in the current code complexity.

Upcalls are still only tested for the current platform, since the creation of the va_list happens in native code in
that case, and we only have access to 1 platform in that case :)

---

I've also cleaned up the sumStack test, which wasn't actually using a VaList, as well as reduced some copy-pasted code
which was previously used for debugging, but never collapsed back into for-loops afterwards.

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

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


More information about the panama-dev mailing list