Skip to content

compiler: fix cost centre profiling breakage in wasm NCG due to incorrect register mapping

Cheng Shao requested to merge type-dance/ghc:wasm-ncg-fix-prof into master

The wasm NCG used to map CCCS to a wasm global, based on the observation that CCCS is a transient register that's already handled by thread state load/store logic, so it doesn't need to be backed by the rCCCS field in the register table.

Unfortunately, this is wrong, since even when Cmm execution hasn't yielded back to the scheduler, the Cmm code may call enterFunCCS, which does use rCCCS.

This breaks cost centre profiling in a subtle way, resulting in inaccurate stack traces in some test cases. The fix is simple though: just remove the CCCS mapping.

Merge request reports