Skip to content

Commit 27f70f8

Browse files
authored
test: fix pool size assumption (#34554)
On 32-bit, this object falls into the 12-byte pool, which does not exist on some platforms (such as Win32). Query for which pool this will land into and test the track-allocation result accordingly. Fixes a test added in #34391
1 parent 8820227 commit 27f70f8

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/julia_internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ void gc_sweep_sysimg(void);
150150
static const int jl_gc_sizeclasses[] = {
151151
#ifdef _P64
152152
8,
153-
#elif MAX_ALIGN == 8
154-
// ARM and PowerPC have max alignment of 8,
153+
#elif MAX_ALIGN > 4
154+
// ARM and PowerPC have max alignment larger than pointer,
155155
// make sure allocation of size 8 has that alignment.
156156
4, 8,
157157
#else

test/cmdlineargs.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,16 @@ let exename = `$(Base.julia_cmd()) --startup-file=no`
277277
@test popfirst!(got) == " - function f(x)"
278278
@test popfirst!(got) == " 80 []"
279279
if Sys.WORD_SIZE == 64
280+
# P64 pools with 64 bit tags
280281
@test popfirst!(got) == " 32 Base.invokelatest(g, 0)"
281282
@test popfirst!(got) == " 48 Base.invokelatest(g, x)"
282-
else
283+
elseif 12 == (() -> @allocated ccall(:jl_gc_allocobj, Ptr{Cvoid}, (Csize_t,), 8))()
284+
# See if we have a 12-byte pool with 32 bit tags (MAX_ALIGN = 4)
283285
@test popfirst!(got) == " 24 Base.invokelatest(g, 0)"
284286
@test popfirst!(got) == " 36 Base.invokelatest(g, x)"
287+
else # MAX_ALIGN >= 8
288+
@test popfirst!(got) == " 16 Base.invokelatest(g, 0)"
289+
@test popfirst!(got) == " 48 Base.invokelatest(g, x)"
285290
end
286291
@test popfirst!(got) == " 80 []"
287292
@test popfirst!(got) == " - end"

0 commit comments

Comments
 (0)