[Git][ghc/ghc][wip/dcoutts/issue-26717] 2 commits: Fixup: Renumber the tso->why_blocked constants
Duncan Coutts pushed to branch wip/dcoutts/issue-26717 at Glasgow Haskell Compiler / GHC Commits: 9490d849 by Duncan Coutts at 2026-07-21T13:32:27+01:00 Fixup: Renumber the tso->why_blocked constants a function got renamed after the comment was written - - - - - e233ebde by Duncan Coutts at 2026-07-21T13:33:21+01:00 Fixup ghc-heap to follow new encoding of why_blocked codes Spotted by Cheng Shao during code review. TODO: squash into: "Extend the tso->why_blocked encoding to indicate block_info closures" - - - - - 3 changed files: - libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc - libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingEnabled.hsc - rts/include/rts/Constants.h Changes: ===================================== libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingDisabled.hsc ===================================== @@ -63,7 +63,7 @@ parseWhatNext w = case w of _ -> WhatNextUnknownValue w parseWhyBlocked :: Word16 -> WhyBlocked -parseWhyBlocked w = case w of +parseWhyBlocked w = case untagWhyBlocked w of (#const NotBlocked) -> NotBlocked (#const BlockedOnMVar) -> BlockedOnMVar (#const BlockedOnMVarRead) -> BlockedOnMVarRead @@ -78,6 +78,9 @@ parseWhyBlocked w = case w of (#const BlockedOnMsgThrowTo) -> BlockedOnMsgThrowTo (#const ThreadMigrating) -> ThreadMigrating _ -> WhyBlockedUnknownValue w + where + -- See Constants.h encoding for why_blocked + untagWhyBlocked why = why .&. 0x0f parseTsoFlags :: Word32 -> [TsoFlags] parseTsoFlags w | isSet (#const TSO_LOCKED) w = TsoLocked : parseTsoFlags (unset (#const TSO_LOCKED) w) ===================================== libraries/ghc-heap/GHC/Exts/Heap/FFIClosures_ProfilingEnabled.hsc ===================================== @@ -63,7 +63,7 @@ parseWhatNext w = case w of _ -> WhatNextUnknownValue w parseWhyBlocked :: Word16 -> WhyBlocked -parseWhyBlocked w = case w of +parseWhyBlocked w = case untagWhyBlocked w of (#const NotBlocked) -> NotBlocked (#const BlockedOnMVar) -> BlockedOnMVar (#const BlockedOnMVarRead) -> BlockedOnMVarRead @@ -78,6 +78,9 @@ parseWhyBlocked w = case w of (#const BlockedOnMsgThrowTo) -> BlockedOnMsgThrowTo (#const ThreadMigrating) -> ThreadMigrating _ -> WhyBlockedUnknownValue w + where + -- See Constants.h encoding for why_blocked + untagWhyBlocked why = why .&. 0x0f parseTsoFlags :: Word32 -> [TsoFlags] parseTsoFlags w | isSet (#const TSO_LOCKED) w = TsoLocked : parseTsoFlags (unset (#const TSO_LOCKED) w) ===================================== rts/include/rts/Constants.h ===================================== @@ -288,8 +288,9 @@ * which are closures. * * Note: keep these in sync with GHC/Conc/Sync.hs: threadStatus - * Note: keep these in sync with Schedule.c: eventlogStopStatus which + * Note: keep these in sync with Schedule.c: eventlogThreadStatusBlocked which * converts the constants here to the ones used in the eventlog. + * Note: keep the encoding here in sync with parseWhyBlocked in ghc-heap */ #define NotBlocked 0 /* Uses block_info.prev */ #define BlockedOnMVar 1 /* Uses block_info.mvar */ View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/40dc6744d655b9c82d32384f4932884... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/40dc6744d655b9c82d32384f4932884... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
Duncan Coutts (@dcoutts)