Skip to content
Snippets Groups Projects
Commit 0a8c14bd authored by Simon Peyton Jones's avatar Simon Peyton Jones Committed by Marge Bot
Browse files

Fix handling ze_meta_tv_env in GHC.Tc.Utils.Zonk

As #19668 showed, there was an /asymptotic/ slow-down in zonking in
GHC 9.0, exposed in test T9198.  The bug was actually present in earlier
compilers, but by a fluke didn't actually show up in any of our tests;
but adding Quick Look exposed it.

The bug was that in zonkTyVarOcc we
1. read the meta-tyvar-env variable
2. looked up the variable in the env
3. found a 'miss'
4. looked in the variable, found `Indirect ty`
5. zonked `ty`
6. update the env *gotten from step 1* to map the variable
   to its zonked type.

The bug is that we thereby threw away all teh work done in step 4.
In T9198 that made an enormous, indeed asymptotic difference.

The fix is easy: use updTcRef.

I commented in `Note [Sharing when zonking to Type]`

-------------------------
Metric Decrease:
    T9198
-------------------------
parent da92e728
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment