[Git][ghc/ghc][wip/buggymcbugfix/arrayOf-static] fiddling in RTS (segfaults)

Vilem-Benjamin Liepelt gitlab at gitlab.haskell.org
Mon Aug 24 07:16:16 UTC 2020



Vilem-Benjamin Liepelt pushed to branch wip/buggymcbugfix/arrayOf-static at Glasgow Haskell Compiler / GHC


Commits:
f24cd69e by buggymcbugfix at 2020-08-24T09:03:00+02:00
fiddling in RTS (segfaults)

- - - - -


3 changed files:

- compiler/GHC/StgToCmm/Heap.hs
- rts/sm/Evac.c
- rts/sm/Scav.c


Changes:

=====================================
compiler/GHC/StgToCmm/Heap.hs
=====================================
@@ -197,7 +197,7 @@ mkStaticClosureFields dflags info_tbl ccs caf_refs payload
     is_caf = isThunkRep (cit_rep info_tbl)
 
     padding
-        | is_caf && null payload = [mkIntCLit platform 0]
+        | is_caf && null payload = [mkIntCLit platform 0] -- TODO empty array case?
         | otherwise = []
 
     static_link_field
@@ -205,7 +205,11 @@ mkStaticClosureFields dflags info_tbl ccs caf_refs payload
         = [mkIntCLit platform 0]
         | staticClosureNeedsLink (mayHaveCafRefs caf_refs) info_tbl
         = [static_link_value]
-        | otherwise
+        | SmallArrayPtrsRep 0 <- cit_rep info_tbl
+        = [mkIntCLit platform 3]
+        | SmallArrayPtrsRep _ <- cit_rep info_tbl
+        = [mkIntCLit platform 0]
+        | otherwise -- CONSTR_0_1, CONSTR_0_2, CONSTR_NOCAF cases in rts/sm/Evac.c
         = []
 
     saved_info_field


=====================================
rts/sm/Evac.c
=====================================
@@ -627,10 +627,17 @@ loop:
       case CONSTR_0_2:
       case CONSTR_NOCAF:
           /* no need to put these on the static linked list, they don't need
-           * to be scavenged.
+           * to be scavenged. See static_link_field in GHC.StgToCmm.Heap
            */
           return;
 
+      case SMALL_MUT_ARR_PTRS_CLEAN: // todo: do we even need to evac this case?
+      case SMALL_MUT_ARR_PTRS_FROZEN_CLEAN: // todo: do we even need to evac this case?
+      case SMALL_MUT_ARR_PTRS_DIRTY:
+      case SMALL_MUT_ARR_PTRS_FROZEN_DIRTY:
+          evacuate_static_object(STATIC_LINK(info,(StgSmallMutArrPtrs*)q), q);
+          return;
+
       default:
           barf("evacuate(static): strange closure type %d", (int)(info->type));
       }


=====================================
rts/sm/Scav.c
=====================================
@@ -1791,6 +1791,20 @@ scavenge_static(void)
         }
         break;
       }
+    case SMALL_MUT_ARR_PTRS_CLEAN:
+    case SMALL_MUT_ARR_PTRS_FROZEN_CLEAN:
+    case SMALL_MUT_ARR_PTRS_DIRTY:
+    case SMALL_MUT_ARR_PTRS_FROZEN_DIRTY:
+    {
+        StgPtr q, next;
+        StgSmallMutArrPtrs* arr = (StgSmallMutArrPtrs*)p;
+        next = (P_)arr->payload + arr->ptrs;
+        // evacuate the pointers
+        for (q = (P_)arr->payload; q < next; q++) { // todo: does the payload come last, even when profiling?
+            evacuate((StgClosure **)q);
+        }
+        break;
+    }
 
     default:
       barf("scavenge_static: strange closure %d", (int)(info->type));



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f24cd69ee27ec66331b06a016fba674b8e5f0d42
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/20200824/450c301c/attachment-0001.html>


More information about the ghc-commits mailing list