summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Feuer <david.feuer@gmail.com>2020-09-17 16:08:23 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-09-19 15:51:44 -0400
commitb26cd86795d86850bfa97aa020d0a46b8ac043da (patch)
tree27d2940d6cbf59a9928b564f37a64ee0de57f521
parent885ecd18e084e4e2b15fbc5de0aa5222f2573387 (diff)
downloadhaskell-b26cd86795d86850bfa97aa020d0a46b8ac043da.tar.gz
Unpack the MVar in Compact
The `MVar` lock in `Compact` was unnecessarily lazy, creating an extra indirection and wasting two words. Make it strict.
-rw-r--r--libraries/ghc-compact/GHC/Compact.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/libraries/ghc-compact/GHC/Compact.hs b/libraries/ghc-compact/GHC/Compact.hs
index c58b751c51..1f985de1ac 100644
--- a/libraries/ghc-compact/GHC/Compact.hs
+++ b/libraries/ghc-compact/GHC/Compact.hs
@@ -136,7 +136,7 @@ import GHC.Types
-- If compaction encounters any of the above, a 'Control.Exception.CompactionFailed'
-- exception will be thrown by the compaction operation.
--
-data Compact a = Compact Compact# a (MVar ())
+data Compact a = Compact Compact# a !(MVar ())
-- we can *read* from a Compact without taking a lock, but only
-- one thread can be writing to the compact at any given time.
-- The MVar here is to enforce mutual exclusion among writers.