[Git][ghc/ghc][wip/ghc-debug] Remove unsave function (#18405)

Sven Tennie gitlab at gitlab.haskell.org
Wed Aug 26 15:31:58 UTC 2020



Sven Tennie pushed to branch wip/ghc-debug at Glasgow Haskell Compiler / GHC


Commits:
335cd211 by Sven Tennie at 2020-08-26T17:31:44+02:00
Remove unsave function (#18405)

heap_view_closurePtrsAsWords is currently only used by ghc-debug, so
it can be defined there.

- - - - -


2 changed files:

- includes/rts/storage/Heap.h
- rts/Heap.c


Changes:

=====================================
includes/rts/storage/Heap.h
=====================================
@@ -11,9 +11,10 @@
 #include "rts/storage/Closures.h"
 
 StgMutArrPtrs *heap_view_closurePtrs(Capability *cap, StgClosure *closure);
-StgArrBytes *heap_view_closurePtrsAsWords(Capability *cap, StgClosure *closure);
 
 void heap_view_closure_ptrs_in_pap_payload(StgClosure *ptrs[], StgWord *nptrs
                         , StgClosure *fun, StgClosure **payload, StgWord size);
 
 StgWord heap_view_closureSize(StgClosure *closure);
+
+StgWord collect_pointers(StgClosure *closure, StgWord size, StgClosure *ptrs[]);


=====================================
rts/Heap.c
=====================================
@@ -80,7 +80,7 @@ void heap_view_closure_ptrs_in_pap_payload(StgClosure *ptrs[], StgWord *nptrs
  * Collect the pointers of a closure into the given array. size should be
  * heap_view_closureSize(closure). Returns the number of pointers collected.
  */
-static StgWord collect_pointers(StgClosure *closure, StgWord size, StgClosure *ptrs[size]) {
+StgWord collect_pointers(StgClosure *closure, StgWord size, StgClosure *ptrs[size]) {
     StgClosure **end;
     const StgInfoTable *info = get_itbl(closure);
     StgWord nptrs = 0;
@@ -246,37 +246,6 @@ static StgWord collect_pointers(StgClosure *closure, StgWord size, StgClosure *p
     return nptrs;
 }
 
-StgArrBytes *heap_view_closurePtrsAsWords(Capability *cap, StgClosure *closure) {
-    if(!rts_isPaused()){
-        errorBelch("Warning: "
-            "The RTS must be paused (see rts_pause()) to inspect it's heap!");
-
-        return NULL;
-    }
-
-    ASSERT(LOOKS_LIKE_CLOSURE_PTR(closure));
-
-    StgWord size = heap_view_closureSize(closure);
-
-    // First collect all pointers here, with the comfortable memory bound
-    // of the whole closure. Afterwards we know how many pointers are in
-    // the closure and then we can allocate space on the heap and copy them
-    // there
-    StgClosure *ptrs[size];
-    StgWord nptrs = collect_pointers(closure, size, ptrs);
-    StgArrBytes *arr =
-        (StgArrBytes *)allocate(cap, sizeofW(StgArrBytes) + nptrs);
-    TICK_ALLOC_PRIM(sizeofW(StgArrBytes), nptrs, 0);
-    SET_HDR(arr, &stg_ARR_WORDS_info, cap->r.rCCCS);
-    arr->bytes = sizeof(StgWord) * nptrs;
-
-    for (StgWord i = 0; i<nptrs; i++) {
-        arr->payload[i] = (StgWord)ptrs[i];
-    }
-
-    return arr;
-}
-
 StgMutArrPtrs *heap_view_closurePtrs(Capability *cap, StgClosure *closure) {
     ASSERT(LOOKS_LIKE_CLOSURE_PTR(closure));
 



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/335cd21124f7c3ace718b16ab046b20a077ad44f
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/20200826/990c5a2d/attachment-0001.html>


More information about the ghc-commits mailing list