Skip to content

Ensure that `error` applications aren't CAFs

While addressing #21141 (closed) we noticed that many exception-throwing functions, including error, are CAFfy. This is problematic as CAFfyness is infectious: a function becomes CAFfy if any of the functions it depends upon is CAFfy. This can lead to a lot of work for the GC.

The plan here is as follows:

  • Merge something like !2968 to ensure that single-entry thunks aren't added to SRTs
  • Teach the code generator to treat top-level thunks with dead-end demand signatures as single-entry
  • Either:
    • Reconsider #15113 to ensure that literal strings do not become CAFs, or
    • Introduce a rewrite rule to rewrite error (unpackCString# lit) to errorCString lit, ensuring that unpackCString# lit doesn't become a CAF
  • Add a test ensuring that a simple application of error (and errorWithoutStackTrace) isn't CAFfy
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information