[Git][ghc/ghc][wip/ghc-heap-prim] ghc-heap: Support for PRIM and BLOCKING_QUEUE closures

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Thu Jun 1 21:10:38 UTC 2023



Ben Gamari pushed to branch wip/ghc-heap-prim at Glasgow Haskell Compiler / GHC


Commits:
fd585733 by Ben Gamari at 2023-06-01T17:10:33-04:00
ghc-heap: Support for PRIM and BLOCKING_QUEUE closures

- - - - -


2 changed files:

- libraries/ghc-heap/GHC/Exts/Heap.hs
- rts/Heap.c


Changes:

=====================================
libraries/ghc-heap/GHC/Exts/Heap.hs
=====================================
@@ -317,8 +317,9 @@ getClosureDataFromHeapRepPrim getConDesc decodeCCS itbl heapRep pts = do
             _ -> fail $ "Expected at least 3 ptrs to MVAR, found "
                         ++ show (length pts)
 
-        BLOCKING_QUEUE ->
-            pure $ OtherClosure itbl pts rawHeapWords
+        BLOCKING_QUEUE
+          | [_link, bh, _owner, msg] <- pts ->
+            pure $ BlockingQueueClosure itbl _link bh _owner msg
 
         WEAK -> case pts of
             pts0 : pts1 : pts2 : pts3 : rest -> pure $ WeakClosure


=====================================
rts/Heap.c
=====================================
@@ -245,6 +245,25 @@ StgWord collect_pointers(StgClosure *closure, StgClosure *ptrs[]) {
             // See the note in AP_STACK about the stack chunk.
             break;
 
+        case BLOCKING_QUEUE:
+        {
+            StgBlockingQueue *bq = (StgBlockingQueue *) closure;
+            ptrs[nptrs++] = (StgClosure *) bq->link;
+            ptrs[nptrs++] = bq->bh;
+            ptrs[nptrs++] = (StgClosure *) bq->owner;
+            ptrs[nptrs++] = (StgClosure *) bq->queue;
+            break;
+        }
+
+        case PRIM:
+        {
+            StgInfoTable *itbl = get_itbl(closure);
+            for (int i=0; i < itbl->layout.ptrs; i++) {
+                ptrs[nptrs++] = closure->payload[i];
+            }
+            break;
+        }
+
         default:
             fprintf(stderr,"closurePtrs: Cannot handle type %s yet\n",
                            closure_type_names[info->type]);



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fd585733bc7a5b2b70c78db0d75996a65c5a8eeb

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fd585733bc7a5b2b70c78db0d75996a65c5a8eeb
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230601/73e21f5f/attachment-0001.html>


More information about the ghc-commits mailing list