Admin message

Due to a large amount of spam we do not allow new users to create repositories, they are "external" users. If you are a new user and want to create a repository, for example for forking GHC, open a new issue on ghc/ghc using the "get-verified" issue template

Non-moving collector is unable to finalize weak pointers
Currently, the non-moving collector is unable to finalize weak pointers under some circumstances due to an interaction between the moving and non-moving collectors' weak pointer marking logic. Specifically, consider a case such as: ``` nursery ┆ non-moving gen. ┆ ┆ ┆ K ┌───┆────► ┌───────┐ │ ┆ │ │ │ ┆ │ │ │ ┆ │ │ W │ ┆ └───────┘ ┌────────────┐ │ ┆ │WEAK │ │ ┆ │ key ├──┘ ┆ │ value ├──────┆──────► ... │ finalizer │──────┆──────► ... └────────────┘ ┆ ┆ ┆ ``` 1. At some point the weak will be promoted into the non-moving generation. 2. At some point later, we will initiate a major collection and `W` will be moved to `oldest_gen->old_weak_ptr_list` (by `initWeakForGC`) 3. We proceed with scavenging and eventually call `traverseWeakPtrList`, which will eventually call `tidyWeakList(oldest_gen)` 4. We find that `isAlive(w->key) == true` as `w->key` is in the non-moving generation and `isAlive` necessarily conservatively considers any objects in the non-moving generation as alive 5. We call `scavengeLiveWeak` on `w`, which will evacuate `&w->key`. As `w->key` is a non-moving object, it is pushed to the update-remembered set (see `Note [Aging under the non-moving collector]`). At this point we are in a situation where `w` cannot be tombstoned by the nonmoving GC as `w->key` is reachable via the update-remembered set.
issue