Skip to content

Commit

Permalink
Singleton BlackHole value
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPenner committed Nov 27, 2024
1 parent 37244aa commit 700c33c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion unison-runtime/src/Unison/Runtime/Stack.hs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,11 @@ data GClosure comb
deriving stock (Show, Functor, Foldable, Traversable)
{- ORMOLU_ENABLE -}

-- Singleton black hole value to avoid allocation.
blackHole :: Closure
blackHole = Closure GBlackHole
{-# NOINLINE blackHole #-}

pattern PAp :: CombIx -> GCombInfo (RComb Val) -> Seg -> Closure
pattern PAp cix comb seg = Closure (GPAp cix comb seg)

Expand All @@ -295,7 +300,9 @@ pattern Captured k a seg = Closure (GCaptured k a seg)

pattern Foreign x = Closure (GForeign x)

pattern BlackHole = Closure GBlackHole
pattern BlackHole <- Closure GBlackHole
where
BlackHole = blackHole

pattern UnboxedTypeTag t <- Closure (GUnboxedTypeTag t)
where
Expand Down

0 comments on commit 700c33c

Please sign in to comment.