diff --git a/src/gc-stacks.c b/src/gc-stacks.c index c04e48821e46f..693cb8d0eadf0 100644 --- a/src/gc-stacks.c +++ b/src/gc-stacks.c @@ -76,6 +76,10 @@ static void free_stack(void *stkbuf, size_t bufsz) } #endif +JL_DLLEXPORT uint32_t jl_get_num_stack_mappings(void) +{ + return jl_atomic_load_relaxed(&num_stack_mappings); +} const unsigned pool_sizes[] = { 128 * 1024, diff --git a/test/threads.jl b/test/threads.jl index 8189311739e31..14fe94408a050 100644 --- a/test/threads.jl +++ b/test/threads.jl @@ -327,3 +327,9 @@ end @test_throws ArgumentError @macroexpand(@threads 1) # arg isn't an Expr @test_throws ArgumentError @macroexpand(@threads if true 1 end) # arg doesn't start with for end + +@testset "num_stack_mappings metric" begin + @test @ccall(jl_get_num_stack_mappings()::Cint) >= 1 + # There must be at least two: one for the root test task and one for the async task: + @test fetch(@async(@ccall(jl_get_num_stack_mappings()::Cint))) >= 2 +end