Skip to content

[ghc-9.0] Ensure that wired-in exception closures aren't GC'd

Ben Gamari requested to merge wip/T21141-9.0 into ghc-9.0

As described in Note [Wired-in exceptions are not CAFfy], a small set of
built-in exception closures get special treatment in the code generator,
being declared as non-CAFfy despite potentially containing CAF
references. The original intent of this treatment for the RTS to then
add StablePtrs for each of the closures, ensuring that they are not
GC'd. However, this logic was not applied consistently and eventually
removed entirely in 951c1fb0. This lead to #21141 (closed).

Here we fix this bug by reintroducing the StablePtrs and document the
status quo.

Closes #21141 (closed).

This is a backport of a simplified version of !7690 (closed)

Edited by Ben Gamari

Merge request reports