diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-03-01 17:14:58 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2021-03-01 17:17:21 -0500 |
commit | e6d09428362d83abd01d7900f0e85cdb9f0d615f (patch) | |
tree | 06f59c57bd502f8a29795d193b61ab05bca47875 | |
parent | f512f9e232329c3c6c5a809d82216cc90a3a3ec7 (diff) | |
download | haskell-wip/T19464.tar.gz |
compiler: Strictness while updating RULE IdInfowip/T19464
Previously `updateRuleIdInfos` was called by a `strictMap` yet didn't
actually perform its work strictly due to it updating a lazy field. This
resulted in `TypeEnv`s being retained unnecessarily.
See #19464.
-rw-r--r-- | compiler/GHC/Iface/UpdateIdInfos.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/GHC/Iface/UpdateIdInfos.hs b/compiler/GHC/Iface/UpdateIdInfos.hs index 0c70b5caeb..7e0be83a5f 100644 --- a/compiler/GHC/Iface/UpdateIdInfos.hs +++ b/compiler/GHC/Iface/UpdateIdInfos.hs @@ -62,9 +62,13 @@ updateModDetailsIdInfos cg_infos mod_details = -- Rules -------------------------------------------------------------------------------- +-- N.B. we do this strictly to avoid building thunks which will later +-- keep TypeEnvs around (see #19464). updateRuleIdInfos :: TypeEnv -> CoreRule -> CoreRule updateRuleIdInfos _ rule@BuiltinRule{} = rule -updateRuleIdInfos type_env Rule{ .. } = Rule { ru_rhs = updateGlobalIds type_env ru_rhs, .. } +updateRuleIdInfos type_env Rule{ .. } = + let !rhs = updateGlobalIds type_env ru_rhs + in Rule { ru_rhs = rhs, .. } -------------------------------------------------------------------------------- -- Instances |