[foreign-jextract] RFR: 8247678: StdLibTest fails to create an empty VaList on Windows
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Tue Jun 16 15:53:42 UTC 2020
On Tue, 16 Jun 2020 15:04:48 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
> Hi,
>
> This patch addresses a test failure in StdLibTest, caused by trying to allocate an empty VaList in the Windows
> implementation.
> (After some discussion with Maurizio) this is fixed by special casing empty va lists in the implementation.
> VaList.Builder.build() now returns a special empty va list constant when the VaList is empty. There's also an added
> VaList.empty() method, to directly create an empty VaList. To implement this I removed the getSegment methods in the
> VaList implementation classes, and instead rely on VaList::address for unboxing a VaList. This works better with the
> spacial case empty VaList. Along with that I moved some of the shared code for handling VaList in the linkers to
> SharedUtils. I added tests for the empty() API to verify that the returned VaList is non-closeable, and also updated
> StdLibTest to close the VaLists it creates (it wasn't doing this yet). Thanks,
> Jorn
Looks good - only a minor issue with confinement which needs to be worked around with a restricted segment, I believe.
src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/abi/x64/sysv/SysVVaList.java line 132:
> 131: MemorySegment ms = MemorySegment.allocateNative(LAYOUT);
> 132: cleaner.register(SysVVaList.class, ms::close);
> 133: MemoryAddress base = ms.baseAddress();
This will fail because of confinement
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/208
More information about the panama-dev
mailing list