diff options
author | Sven Tennie <sven.tennie@gmail.com> | 2023-04-09 08:59:38 +0000 |
---|---|---|
committer | Sven Tennie <sven.tennie@gmail.com> | 2023-05-05 19:59:53 +0000 |
commit | 9306ac1f1d452ea5be9a9b18319cd85edfa91908 (patch) | |
tree | 40c505bfe347918cd883e99c35936a0314f1ade5 | |
parent | 1590209b826554192562e9ce3973f61774ffc18c (diff) | |
download | haskell-9306ac1f1d452ea5be9a9b18319cd85edfa91908.tar.gz |
getWord: One offset is enough
-rw-r--r-- | libraries/ghc-heap/GHC/Exts/Stack/Decode.hs | 15 | ||||
-rw-r--r-- | libraries/ghc-heap/cbits/Stack.cmm | 6 |
2 files changed, 10 insertions, 11 deletions
diff --git a/libraries/ghc-heap/GHC/Exts/Stack/Decode.hs b/libraries/ghc-heap/GHC/Exts/Stack/Decode.hs index 74290abae2..3d06efaac8 100644 --- a/libraries/ghc-heap/GHC/Exts/Stack/Decode.hs +++ b/libraries/ghc-heap/GHC/Exts/Stack/Decode.hs @@ -116,14 +116,13 @@ getUnderflowFrameNextChunk stackSnapshot# index = IO $ \s -> case getUnderflowFrameNextChunk# stackSnapshot# (wordOffsetToWord# index) s of (# s1, stack# #) -> (# s1, StackSnapshot stack# #) -foreign import prim "getWordzh" getWord# :: StackSnapshot# -> Word# -> Word# -> State# RealWorld -> (# State# RealWorld, Word# #) +foreign import prim "getWordzh" getWord# :: StackSnapshot# -> Word# -> State# RealWorld -> (# State# RealWorld, Word# #) -getWord :: StackSnapshot# -> WordOffset -> WordOffset -> IO Word -getWord stackSnapshot# index relativeOffset = IO $ \s -> +getWord :: StackSnapshot# -> WordOffset -> IO Word +getWord stackSnapshot# index = IO $ \s -> case getWord# stackSnapshot# (wordOffsetToWord# index) - (wordOffsetToWord# relativeOffset) s of (# s1, w# #) -> (# s1, W# w# #) @@ -246,7 +245,7 @@ decodeBitmaps stackSnapshot# index relativePayloadOffset bitmapWords size = where toBitmapPayload :: StackFrameIter -> IO Closure toBitmapPayload (SfiPrimitive stack# i) = do - w <- getWord stack# i 0 + w <- getWord stack# i pure $ UnknownTypeWordSizedPrimitive w toBitmapPayload (SfiClosure stack# i) = getClosure stack# i @@ -332,7 +331,7 @@ unpackStackFrame ((StackSnapshot stackSnapshot#), index) = do } RET_FUN -> do retFunType' <- getRetFunType stackSnapshot# index - retFunSize' <- getWord stackSnapshot# index offsetStgRetFunFrameSize + retFunSize' <- getWord stackSnapshot# (index + offsetStgRetFunFrameSize) retFunFun' <- getClosure stackSnapshot# (index + offsetStgRetFunFrameFun) retFunPayload' <- if retFunType' == ARG_GEN_BIG @@ -354,7 +353,7 @@ unpackStackFrame ((StackSnapshot stackSnapshot#), index) = do updatee = updatee' } CATCH_FRAME -> do - exceptions_blocked' <- getWord stackSnapshot# index offsetStgCatchFrameExceptionsBlocked + exceptions_blocked' <- getWord stackSnapshot# (index + offsetStgCatchFrameExceptionsBlocked) handler' <- getClosure stackSnapshot# (index + offsetStgCatchFrameHandler) pure $ CatchFrame @@ -381,7 +380,7 @@ unpackStackFrame ((StackSnapshot stackSnapshot#), index) = do result = result' } CATCH_RETRY_FRAME -> do - running_alt_code' <- getWord stackSnapshot# index offsetStgCatchRetryFrameRunningAltCode + running_alt_code' <- getWord stackSnapshot# (index + offsetStgCatchRetryFrameRunningAltCode) first_code' <- getClosure stackSnapshot# (index + offsetStgCatchRetryFrameRunningFirstCode) alt_code' <- getClosure stackSnapshot# (index + offsetStgCatchRetryFrameAltCode) pure $ diff --git a/libraries/ghc-heap/cbits/Stack.cmm b/libraries/ghc-heap/cbits/Stack.cmm index 08223c8e00..88ae7d656e 100644 --- a/libraries/ghc-heap/cbits/Stack.cmm +++ b/libraries/ghc-heap/cbits/Stack.cmm @@ -114,10 +114,10 @@ getRetFunLargeBitmapzh(P_ stack, W_ offsetWords) { return (stgArrBytes, size); } -// getWordzh(StgStack* stack, StgWord offsetWords, StgWord offsetBytes) -getWordzh(P_ stack, W_ offsetWords, W_ offsetBytes) { +// getWordzh(StgStack* stack, StgWord offsetWords) +getWordzh(P_ stack, W_ offsetWords) { P_ wordAddr; - wordAddr = (StgStack_sp(stack) + WDS(offsetWords) + WDS(offsetBytes)); + wordAddr = (StgStack_sp(stack) + WDS(offsetWords)); return (W_[wordAddr]); } |