Skip to content

Commit a0ab7fe

Browse files
committed
Restore a couple ORMOLU_DISABLE
These two are still necessary, but overlooked because CI wasn’t actually running Ormolu.
1 parent 1aca986 commit a0ab7fe

File tree

1 file changed

+27
-19
lines changed
  • unison-runtime/src/Unison/Runtime

1 file changed

+27
-19
lines changed

unison-runtime/src/Unison/Runtime/Stack.hs

+27-19
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ unboxedTypeTagFromInt = \case
285285
3 -> NatTag
286286
_ -> error "intToUnboxedTypeTag: invalid tag"
287287

288+
{- ORMOLU_DISABLE -}
289+
{- because ormolu-0.7.2.0 can’t handle CPP used within a declaration. -}
288290
data GClosure comb
289291
= GPAp
290292
!CombIx
@@ -306,6 +308,7 @@ data GClosure comb
306308
| GUnboxedSentinel
307309
#endif
308310
deriving stock (Show, Functor, Foldable, Traversable)
311+
{- ORMOLU_ENABLE -}
309312

310313
-- Singleton black hole value to avoid allocation.
311314
blackHole :: Closure
@@ -802,69 +805,72 @@ alloc = do
802805
pure $ Stack {ap = -1, fp = -1, sp = -1, ustk, bstk}
803806
{-# INLINE alloc #-}
804807

805-
peek :: DebugCallStack => Stack -> IO Val
808+
{- ORMOLU_DISABLE -}
809+
{- because ormolu-0.7.2.0 can’t handle CPP used within declarations. -}
810+
811+
peek :: (DebugCallStack) => Stack -> IO Val
806812
peek stk@(Stack _ _ sp ustk _) = do
807813
-- Can't use upeek here because in stack-check mode it will assert that the stack slot is unboxed.
808814
u <- readByteArray ustk sp
809815
b <- bpeek stk
810816
pure (Val u b)
811817
{-# INLINE peek #-}
812818

813-
peekI :: DebugCallStack => Stack -> IO Int
819+
peekI :: (DebugCallStack) => Stack -> IO Int
814820
peekI _stk@(Stack _ _ sp ustk _) = do
815821
#ifdef STACK_CHECK
816822
assertUnboxed _stk 0
817823
#endif
818824
readByteArray ustk sp
819825
{-# INLINE peekI #-}
820826

821-
peekOffI :: DebugCallStack => Stack -> Off -> IO Int
827+
peekOffI :: (DebugCallStack) => Stack -> Off -> IO Int
822828
peekOffI _stk@(Stack _ _ sp ustk _) i = do
823829
#ifdef STACK_CHECK
824830
assertUnboxed _stk i
825831
#endif
826832
readByteArray ustk (sp - i)
827833
{-# INLINE peekOffI #-}
828834

829-
bpeek :: DebugCallStack => Stack -> IO BVal
835+
bpeek :: (DebugCallStack) => Stack -> IO BVal
830836
bpeek (Stack _ _ sp _ bstk) = readArray bstk sp
831837
{-# INLINE bpeek #-}
832838

833-
upeek :: DebugCallStack => Stack -> IO UVal
839+
upeek :: (DebugCallStack) => Stack -> IO UVal
834840
upeek _stk@(Stack _ _ sp ustk _) = do
835841
#ifdef STACK_CHECK
836842
assertUnboxed _stk 0
837843
#endif
838844
readByteArray ustk sp
839845
{-# INLINE upeek #-}
840846

841-
peekOff :: DebugCallStack => Stack -> Off -> IO Val
847+
peekOff :: (DebugCallStack) => Stack -> Off -> IO Val
842848
peekOff stk@(Stack _ _ sp ustk _) i = do
843849
-- Can't use upeekOff here because in stack-check mode it will assert that the stack slot is unboxed.
844850
u <- readByteArray ustk (sp - i)
845851
b <- bpeekOff stk i
846852
pure $ Val u b
847853
{-# INLINE peekOff #-}
848854

849-
bpeekOff :: DebugCallStack => Stack -> Off -> IO BVal
855+
bpeekOff :: (DebugCallStack) => Stack -> Off -> IO BVal
850856
bpeekOff (Stack _ _ sp _ bstk) i = readArray bstk (sp - i)
851857
{-# INLINE bpeekOff #-}
852858

853-
upeekOff :: DebugCallStack => Stack -> Off -> IO UVal
859+
upeekOff :: (DebugCallStack) => Stack -> Off -> IO UVal
854860
upeekOff _stk@(Stack _ _ sp ustk _) i = do
855861
#ifdef STACK_CHECK
856862
assertUnboxed _stk i
857863
#endif
858864
readByteArray ustk (sp - i)
859865
{-# INLINE upeekOff #-}
860866

861-
upokeT :: DebugCallStack => Stack -> UVal -> BVal -> IO ()
867+
upokeT :: (DebugCallStack) => Stack -> UVal -> BVal -> IO ()
862868
upokeT !stk@(Stack _ _ sp ustk _) !u !t = do
863869
bpoke stk t
864870
writeByteArray ustk sp u
865871
{-# INLINE upokeT #-}
866872

867-
poke :: DebugCallStack => Stack -> Val -> IO ()
873+
poke :: (DebugCallStack) => Stack -> Val -> IO ()
868874
poke _stk@(Stack _ _ sp ustk bstk) (Val u b) = do
869875
#ifdef STACK_CHECK
870876
assertBumped _stk 0
@@ -876,57 +882,57 @@ poke _stk@(Stack _ _ sp ustk bstk) (Val u b) = do
876882
-- | Sometimes we get back an int from a foreign call which we want to use as a Nat.
877883
-- If we know it's positive and smaller than 2^63 then we can safely store the Int directly as a Nat without
878884
-- checks.
879-
unsafePokeIasN :: DebugCallStack => Stack -> Int -> IO ()
885+
unsafePokeIasN :: (DebugCallStack) => Stack -> Int -> IO ()
880886
unsafePokeIasN stk n = do
881887
upokeT stk n natTypeTag
882888
{-# INLINE unsafePokeIasN #-}
883889

884890
-- | Store an unboxed tag to later match on.
885891
-- Often used to indicate the constructor of a data type that's been unpacked onto the stack,
886892
-- or some tag we're about to branch on.
887-
pokeTag :: DebugCallStack => Stack -> Int -> IO ()
893+
pokeTag :: (DebugCallStack) => Stack -> Int -> IO ()
888894
pokeTag =
889895
-- For now we just use ints, but maybe should have a separate type for tags so we can detect if we're leaking them.
890896
pokeI
891897
{-# INLINE pokeTag #-}
892898

893-
peekTag :: DebugCallStack => Stack -> IO Int
899+
peekTag :: (DebugCallStack) => Stack -> IO Int
894900
peekTag = peekI
895901
{-# INLINE peekTag #-}
896902

897-
peekTagOff :: DebugCallStack => Stack -> Off -> IO Int
903+
peekTagOff :: (DebugCallStack) => Stack -> Off -> IO Int
898904
peekTagOff = peekOffI
899905
{-# INLINE peekTagOff #-}
900906

901-
pokeBool :: DebugCallStack => Stack -> Bool -> IO ()
907+
pokeBool :: (DebugCallStack) => Stack -> Bool -> IO ()
902908
pokeBool stk b =
903909
poke stk $ if b then trueVal else falseVal
904910
{-# INLINE pokeBool #-}
905911

906912
-- | Store a boxed value.
907913
-- We don't bother nulling out the unboxed stack,
908914
-- it's extra work and there's nothing to garbage collect.
909-
bpoke :: DebugCallStack => Stack -> BVal -> IO ()
915+
bpoke :: (DebugCallStack) => Stack -> BVal -> IO ()
910916
bpoke _stk@(Stack _ _ sp _ bstk) b = do
911917
#ifdef STACK_CHECK
912918
assertBumped _stk 0
913919
#endif
914920
writeArray bstk sp b
915921
{-# INLINE bpoke #-}
916922

917-
pokeOff :: DebugCallStack => Stack -> Off -> Val -> IO ()
923+
pokeOff :: (DebugCallStack) => Stack -> Off -> Val -> IO ()
918924
pokeOff stk i (Val u t) = do
919925
bpokeOff stk i t
920926
writeByteArray (ustk stk) (sp stk - i) u
921927
{-# INLINE pokeOff #-}
922928

923-
upokeOffT :: DebugCallStack => Stack -> Off -> UVal -> BVal -> IO ()
929+
upokeOffT :: (DebugCallStack) => Stack -> Off -> UVal -> BVal -> IO ()
924930
upokeOffT stk i u t = do
925931
bpokeOff stk i t
926932
writeByteArray (ustk stk) (sp stk - i) u
927933
{-# INLINE upokeOffT #-}
928934

929-
bpokeOff :: DebugCallStack => Stack -> Off -> BVal -> IO ()
935+
bpokeOff :: (DebugCallStack) => Stack -> Off -> BVal -> IO ()
930936
bpokeOff _stk@(Stack _ _ sp _ bstk) i b = do
931937
#ifdef STACK_CHECK
932938
assertBumped _stk i
@@ -1171,6 +1177,8 @@ peekOffC _stk@(Stack _ _ sp ustk _) i = do
11711177
Char.chr <$> readByteArray ustk (sp - i)
11721178
{-# INLINE peekOffC #-}
11731179

1180+
{- ORMOLU_ENABLE -}
1181+
11741182
pokeN :: Stack -> Word64 -> IO ()
11751183
pokeN stk@(Stack _ _ sp ustk _) n = do
11761184
bpoke stk natTypeTag

0 commit comments

Comments
 (0)