diff options
| author | Sven Tennie <sven.tennie@gmail.com> | 2023-04-23 10:08:26 +0000 |
|---|---|---|
| committer | Sven Tennie <sven.tennie@gmail.com> | 2023-05-05 19:59:53 +0000 |
| commit | 6ea11206254d534b0a6c9650b328fe68452a938a (patch) | |
| tree | 015844a110f746a26d913dfe930f3667d1ed171e | |
| parent | 50d236177528d9f887822a876fc3964293c33e26 (diff) | |
| download | haskell-6ea11206254d534b0a6c9650b328fe68452a938a.tar.gz | |
Formatting and one comment
| -rw-r--r-- | libraries/ghc-heap/GHC/Exts/Stack/Decode.hs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libraries/ghc-heap/GHC/Exts/Stack/Decode.hs b/libraries/ghc-heap/GHC/Exts/Stack/Decode.hs index 4f2d079453..3a550b1d16 100644 --- a/libraries/ghc-heap/GHC/Exts/Stack/Decode.hs +++ b/libraries/ghc-heap/GHC/Exts/Stack/Decode.hs @@ -213,6 +213,9 @@ advanceStackFrameLocation ((StackSnapshot stackSnapshot#), index) = getClosure :: StackSnapshot# -> WordOffset -> IO Closure getClosure stackSnapshot# index = + -- Beware! We have to put ptr into a Box immediately. Otherwise, the garbage + -- collector might move the referenced closure, without updating our reference + -- (pointer) to it. ( IO $ \s -> case getStackClosure# stackSnapshot# @@ -236,7 +239,7 @@ data Pointerness = Pointer | NonPointer decodeLargeBitmap :: LargeBitmapGetter -> StackSnapshot# -> WordOffset -> WordOffset -> IO [Closure] decodeLargeBitmap getterFun# stackSnapshot# index relativePayloadOffset = do let largeBitmap = case getterFun# stackSnapshot# (wordOffsetToWord# index) of - (# wordsAddr#, size# #) -> LargeBitmap (W# size#) (Ptr wordsAddr#) + (# wordsAddr#, size# #) -> LargeBitmap (W# size#) (Ptr wordsAddr#) bitmapWords <- largeBitmapToList largeBitmap decodeBitmaps stackSnapshot# @@ -286,12 +289,11 @@ decodeBitmaps stack# index ps = decodeSmallBitmap :: SmallBitmapGetter -> StackSnapshot# -> WordOffset -> WordOffset -> IO [Closure] decodeSmallBitmap getterFun# stackSnapshot# index relativePayloadOffset = let (bitmap, size) = case getterFun# stackSnapshot# (wordOffsetToWord# index) of - (# b#, s# #) -> (W# b#, W# s#) - in - decodeBitmaps - stackSnapshot# - (index + relativePayloadOffset) - (bitmapWordPointerness size bitmap) + (# b#, s# #) -> (W# b#, W# s#) + in decodeBitmaps + stackSnapshot# + (index + relativePayloadOffset) + (bitmapWordPointerness size bitmap) unpackStackFrame :: StackFrameLocation -> IO StackFrame unpackStackFrame (StackSnapshot stackSnapshot#, index) = do |
