[Git][ghc/ghc][wip/romes/fix-pm-faststring] fix: Save FastStrings in the PMC
Rodrigo Mesquita pushed to branch wip/romes/fix-pm-faststring at Glasgow Haskell Compiler / GHC Commits: eb82bf03 by Rodrigo Mesquita at 2026-06-17T16:11:25+01:00 fix: Save FastStrings in the PMC There is no point in adding the unique to the occurrence FastString we create, since it is part of the Id anyway. Adding it to the FastString, meant each FastString was unique unnecessarily! In a separate branch, running the compiler on test `InstanceMatching` observed 30000 `FastString`s created by this code path. Plus, `fsLit "pm"` follows the existing pattern in `mkPmId`. - - - - - 1 changed file: - compiler/GHC/HsToCore/Pmc/Solver.hs Changes: ===================================== compiler/GHC/HsToCore/Pmc/Solver.hs ===================================== @@ -640,11 +640,11 @@ tyOracle ty_st@(TySt n inert) cts -- return the new inert set and increment the sequence number n ; return (TySt (n+1) <$> mb_new_inert) } --- | Allocates a fresh 'EvVar' name for 'PredTy's. +-- | Allocates a fresh 'EvVar' name for 'PredTy's nameTyCt :: PredType -> DsM EvVar nameTyCt pred_ty = do unique <- getUniqueM - let occname = mkVarOccFS (fsLit ("pm_"++show unique)) + let occname = mkVarOccFS $ fsLit "pm" return (mkUserLocalOrCoVar occname unique ManyTy pred_ty noSrcSpan) ----------------------------- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/eb82bf03703f4e074849034c82599972... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/eb82bf03703f4e074849034c82599972... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Rodrigo Mesquita (@alt-romes)