[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 20:02:33 UTC 2023



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


Commits:
95e9aaee by Ben Gamari at 2023-06-01T16:02:27-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++] = bq->link;
+            ptrs[nptrs++] = bq->bh;
+            ptrs[nptrs++] = bq->owner;
+            ptrs[nptrs++] = 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/95e9aaee75b6ba021f5ead29ccbc49b6f3bb3f14

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/95e9aaee75b6ba021f5ead29ccbc49b6f3bb3f14
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/d417ded5/attachment-0001.html>


More information about the ghc-commits mailing list