summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbuggymcbugfix <4444-buggymcbugfix@users.noreply.gitlab.haskell.org>2020-08-24 16:04:50 +0200
committerVilem Liepelt <17603372+buggymcbugfix@users.noreply.github.com>2021-08-04 22:14:04 +0200
commitee3e5ad47eb1df21b47ea66ed649478af22ed8ad (patch)
treedd5e31707b2a3d449f6d3e7896a3c988f5c57375
parentc3d4363c51c2d75e7b9698318de702500fa9f0d9 (diff)
downloadhaskell-wip/buggymcbugfix/arrayOf-static.tar.gz
-rw-r--r--includes/rts/storage/ClosureMacros.h20
-rw-r--r--rts/sm/Evac.c6
2 files changed, 17 insertions, 9 deletions
diff --git a/includes/rts/storage/ClosureMacros.h b/includes/rts/storage/ClosureMacros.h
index b4844ec420..62b48de3cd 100644
--- a/includes/rts/storage/ClosureMacros.h
+++ b/includes/rts/storage/ClosureMacros.h
@@ -166,27 +166,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));
}
}
diff --git a/rts/sm/Evac.c b/rts/sm/Evac.c
index 69832050bc..a010f00a51 100644
--- a/rts/sm/Evac.c
+++ b/rts/sm/Evac.c
@@ -711,7 +711,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;
@@ -727,7 +727,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:
@@ -742,7 +742,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: