Skip to content

Commit

Permalink
Fix stack debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPenner committed Nov 14, 2024
1 parent e05237e commit d4ea9a2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions unison-runtime/src/Unison/Runtime/Stack.hs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ import Prelude hiding (words)

{- ORMOLU_DISABLE -}
#ifdef STACK_CHECK
import Unison.Debug qualified as Debug
import Data.Text.IO (hPutStrLn)
import UnliftIO (stderr, throwIO)
import GHC.Stack (CallStack, callStack)

type DebugCallStack = (HasCallStack :: Constraint)

Expand Down Expand Up @@ -666,7 +668,7 @@ peekI _stk@(Stack _ _ sp ustk _) = do
peekOffI :: DebugCallStack => Stack -> Off -> IO Int
peekOffI _stk@(Stack _ _ sp ustk _) i = do
#ifdef STACK_CHECK
assertUnboxed _stk 0
assertUnboxed _stk i
#endif
readByteArray ustk (sp - i)
{-# INLINE peekOffI #-}
Expand Down Expand Up @@ -756,7 +758,6 @@ pokeBool stk b =
bpoke :: DebugCallStack => Stack -> BVal -> IO ()
bpoke _stk@(Stack _ _ sp _ bstk) b = do
#ifdef STACK_CHECK
Debug.debugLogM Debug.Interpreter "before assert bumped"
assertBumped _stk 0
#endif
writeArray bstk sp b
Expand Down

0 comments on commit d4ea9a2

Please sign in to comment.