Skip to content

Commit

Permalink
Fix stackchecks
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPenner committed Nov 12, 2024
1 parent 1355300 commit e05237e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion unison-runtime/src/Unison/Runtime/Stack.hs
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,12 @@ assertBumped :: HasCallStack => Stack -> Off -> IO ()
assertBumped (Stack _ _ sp ustk bstk) i = do
u <- readByteArray ustk (sp - i)
b :: BVal <- readArray bstk (sp - i)
when (u /= unboxedSentinel || b /= boxedSentinel) do
when (u /= unboxedSentinel || not (isBoxedSentinel b)) do
error $ "Expected stack slot to have been bumped, but it was:" <> show (Val u b)
where
isBoxedSentinel :: Closure -> Bool
isBoxedSentinel (Closure GUnboxedSentinel) = True
isBoxedSentinel _ = False

assertUnboxed :: HasCallStack => Stack -> Off -> IO ()
assertUnboxed (Stack _ _ sp ustk bstk) i = do
Expand Down

0 comments on commit e05237e

Please sign in to comment.