Skip to content

Commit 58c3d35

Browse files
committed
blackhole handling ; fix: GHC RTS implements ThreadId# prim type as strong pointer for Thread State Objects, estgi should do the same
1 parent 0f7f923 commit 58c3d35

File tree

1 file changed

+4
-3
lines changed
  • external-stg-interpreter/lib/Stg/Interpreter/GC

1 file changed

+4
-3
lines changed

external-stg-interpreter/lib/Stg/Interpreter/GC/GCRef.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@ instance VisitGCRef HeapObject where
2626
visitGCRef action = \case
2727
Con{..} -> visitGCRef action hoConArgs
2828
Closure{..} -> visitGCRef action hoCloArgs >> visitGCRef action hoEnv
29-
BlackHole _ o -> pure ()
29+
BlackHole _o _q -> pure () -- HINT: the blackhole wait queue is handled separately
3030
ApStack{..} -> visitGCRef action hoResult >> visitGCRef action hoStack
3131
RaiseException ex -> visitGCRef action ex
3232

3333
instance VisitGCRef StackContinuation where
3434
visitGCRef action = \case
3535
CaseOf _ _ env _ _ _ -> visitGCRef action env
36-
Update addr -> pure () -- action $ HeapPtr addr -- TODO/FIXME: this is not a GC root!
36+
Update{} -> pure () -- HINT: the thunk is under evaluation, its closure is referred from the thread stack
37+
-- the blackhole wait queue is handled separately
3738
Apply args -> visitGCRef action args
3839
Catch handler _ _ -> visitGCRef action handler
3940
CatchRetry stm alt _ _ -> visitGCRef action stm >> visitGCRef action alt
@@ -153,7 +154,7 @@ visitAtom atom action = case atom of
153154
MutableByteArray i -> action $ encodeRef (baId i) NS_MutableByteArray
154155
WeakPointer i -> action $ encodeRef i NS_WeakPointer
155156
StableName i -> action $ encodeRef i NS_StableName
156-
ThreadId i -> pure ()
157+
ThreadId i -> action $ encodeRef i NS_Thread -- NOTE: in GHC the ThreadId# prim type is a strong pointer to TSO (thread state oject)
157158
LiftedUndefined{} -> pure ()
158159
Rubbish{} -> pure ()
159160
Unbinded{} -> pure ()

0 commit comments

Comments
 (0)