8299561: VaList.empty() doesn't return a list associated with the global scope

Reviewed-by: jvernee
This commit is contained in:
Maurizio Cimadamore 2023-01-05 09:44:16 +00:00
parent a17f505d73
commit 9c4ed16be2
3 changed files with 6 additions and 2 deletions

View File

@ -129,7 +129,7 @@ public non-sealed class LinuxAArch64VaList implements VaList {
}
private static MemorySegment emptyListAddress() {
MemorySegment ms = MemorySegment.allocateNative(LAYOUT, SegmentScope.auto());
MemorySegment ms = MemorySegment.allocateNative(LAYOUT, SegmentScope.global());
VH_stack.set(ms, MemorySegment.NULL);
VH_gr_top.set(ms, MemorySegment.NULL);
VH_vr_top.set(ms, MemorySegment.NULL);

View File

@ -138,7 +138,7 @@ public non-sealed class SysVVaList implements VaList {
}
private static MemorySegment emptyListAddress() {
MemorySegment base = MemorySegment.allocateNative(LAYOUT, SegmentScope.auto());
MemorySegment base = MemorySegment.allocateNative(LAYOUT, SegmentScope.global());
VH_gp_offset.set(base, MAX_GP_OFFSET);
VH_fp_offset.set(base, MAX_FP_OFFSET);
VH_overflow_arg_area.set(base, MemorySegment.NULL);

View File

@ -907,4 +907,8 @@ public class VaListTest extends NativeTestHelper {
assertThrows(NoSuchElementException.class, () -> nextVarg(vaList, next));
}
@Test(dataProvider = "emptyVaLists")
public void testEmptyVaListScope(VaList vaList) {
assertEquals(vaList.segment().scope(), SegmentScope.global());
}
}