[Git][ghc/ghc][wip/buggymcbugfix/arrayOf-static] rts

Vilem-Benjamin Liepelt gitlab at gitlab.haskell.org
Mon Aug 24 14:05:04 UTC 2020



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


Commits:
6f57a31e by buggymcbugfix at 2020-08-24T16:04:50+02:00
rts

- - - - -


2 changed files:

- includes/rts/storage/ClosureMacros.h
- rts/sm/Evac.c


Changes:

=====================================
includes/rts/storage/ClosureMacros.h
=====================================
@@ -159,27 +159,35 @@ INLINE_HEADER StgHalfWord GET_TAG(const StgClosure *con)
 
 /* These are hard-coded. */
 #define THUNK_STATIC_LINK(p) (&(p)->payload[1])
-#define IND_STATIC_LINK(p)   (&(p)->payload[1])
+#define IND_STATIC_LINK(p) (&(p)->payload[1])
+#define SMALL_MUT_ARR_STATIC_LINK(p) (&((StgSmallMutArrPtrs*)p)->payload[((StgSmallMutArrPtrs*)p)->ptrs])
+#define CONSTR_AND_FUN_STATIC_LINK(info,p) (&(p)->payload[info->layout.payload.ptrs + info->layout.payload.nptrs])
 
 INLINE_HEADER StgClosure **
 STATIC_LINK(const StgInfoTable *info, StgClosure *p)
 {
     switch (info->type) {
+    case FUN_STATIC:
+    case CONSTR:
+    case CONSTR_1_0:
+    case CONSTR_2_0:
+    case CONSTR_1_1:
+        return CONSTR_AND_FUN_STATIC_LINK(info,p);
+
     case THUNK_STATIC:
         return THUNK_STATIC_LINK(p);
 
     case IND_STATIC:
         return IND_STATIC_LINK(p);
 
-    case SMALL_MUT_ARR_PTRS_CLEAN:
-    case SMALL_MUT_ARR_PTRS_FROZEN_CLEAN:
+    // case SMALL_MUT_ARR_PTRS_CLEAN: // TODO: do we really need this case?
+    // case SMALL_MUT_ARR_PTRS_FROZEN_CLEAN: // TODO: do we really need this case?
     case SMALL_MUT_ARR_PTRS_DIRTY:
     case SMALL_MUT_ARR_PTRS_FROZEN_DIRTY:
-        return (StgSmallMutArrPtrs*)p->payload[(StgSmallMutArrPtrs*)p->size];
+        return SMALL_MUT_ARR_STATIC_LINK(p);
 
     default:
-        return &p->payload[info->layout.payload.ptrs +
-                           info->layout.payload.nptrs];
+        barf("STATIC_LINK: strange closure type %d", (int)(info->type));
     }
 }
 


=====================================
rts/sm/Evac.c
=====================================
@@ -604,7 +604,7 @@ loop:
 
       case FUN_STATIC:
           if (info->srt != 0 || info->layout.payload.ptrs != 0) {
-              evacuate_static_object(STATIC_LINK(info,(StgClosure *)q), q);
+              evacuate_static_object(CONSTR_AND_FUN_STATIC_LINK(info,(StgClosure *)q), q);
           }
           return;
 
@@ -620,7 +620,7 @@ loop:
       case CONSTR_1_0:
       case CONSTR_2_0:
       case CONSTR_1_1:
-          evacuate_static_object(STATIC_LINK(info,(StgClosure *)q), q);
+          evacuate_static_object(CONSTR_AND_FUN_STATIC_LINK(info,(StgClosure *)q), q);
           return;
 
       case CONSTR_0_1:
@@ -635,7 +635,7 @@ loop:
       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);
+          evacuate_static_object(SMALL_MUT_ARR_STATIC_LINK((StgSmallMutArrPtrs*)q), q);
           return;
 
       default:



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6f57a31e4928d6942cc179488b3bb4a6824409b8
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/5cba2206/attachment-0001.html>


More information about the ghc-commits mailing list