Write barrier for stack updates?

Ömer Sinan Ağacan omeragacan at gmail.com
Tue Jul 17 19:45:19 UTC 2018


Hi Simon,

I'm a bit confused about stack updates in generated code and write barriers.
Because stacks are mutable (we push new stuff or maybe even update existing
frames?) it seems to me that we need one these two, similar to other mutable
objects:

- Always keep all stacks in mut_lists
- Add write barriers before updates

However looking at some of the primops like catch# and the code generator that
generates code that pushes update frames I can't see any write barriers and the
GC doesn't always add stacks to mut_lists (unlike e.g. MUT_ARR_PTRS). I also
thought maybe we add a stack to a mut_list when we switch to the TSO that owns
it or we park the TSO, but I don't see anything relevant in Schedule.c or
ThreadPaused.c. So I'm lost. Could you say a few words about how we deal with
mutated stacks in the GC, so that if an old stack points to a young object we
don't collect the young object in a minor GC?

Thanks,

Ömer


More information about the ghc-devs mailing list