Skip to content

Commit

Permalink
test: fix pool size assumption (#34554)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
vtjnash authored Jan 29, 2020
1 parent 8820227 commit 27f70f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ void gc_sweep_sysimg(void);
static const int jl_gc_sizeclasses[] = {
#ifdef _P64
8,
#elif MAX_ALIGN == 8
// ARM and PowerPC have max alignment of 8,
#elif MAX_ALIGN > 4
// ARM and PowerPC have max alignment larger than pointer,
// make sure allocation of size 8 has that alignment.
4, 8,
#else
Expand Down
7 changes: 6 additions & 1 deletion test/cmdlineargs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,16 @@ let exename = `$(Base.julia_cmd()) --startup-file=no`
@test popfirst!(got) == " - function f(x)"
@test popfirst!(got) == " 80 []"
if Sys.WORD_SIZE == 64
# P64 pools with 64 bit tags
@test popfirst!(got) == " 32 Base.invokelatest(g, 0)"
@test popfirst!(got) == " 48 Base.invokelatest(g, x)"
else
elseif 12 == (() -> @allocated ccall(:jl_gc_allocobj, Ptr{Cvoid}, (Csize_t,), 8))()
# See if we have a 12-byte pool with 32 bit tags (MAX_ALIGN = 4)
@test popfirst!(got) == " 24 Base.invokelatest(g, 0)"
@test popfirst!(got) == " 36 Base.invokelatest(g, x)"
else # MAX_ALIGN >= 8
@test popfirst!(got) == " 16 Base.invokelatest(g, 0)"
@test popfirst!(got) == " 48 Base.invokelatest(g, x)"
end
@test popfirst!(got) == " 80 []"
@test popfirst!(got) == " - end"
Expand Down

0 comments on commit 27f70f8

Please sign in to comment.