summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-05-03 20:06:47 -0400
committerBen Gamari <ben@smart-cactus.org>2019-10-22 12:18:39 -0400
commit53a1a27e51f978f520b6084aff2e4b25014b5cf3 (patch)
treeb5d30a97cb9a53e185aaf8746ae508bda76d0a14 /rts
parent19bfe460cd70e4962be83862b86be89d1b7e0f14 (diff)
downloadhaskell-53a1a27e51f978f520b6084aff2e4b25014b5cf3.tar.gz
NonMovingMark: Eliminate redundant check_in_nonmoving_heaps
Diffstat (limited to 'rts')
-rw-r--r--rts/sm/NonMovingMark.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/rts/sm/NonMovingMark.c b/rts/sm/NonMovingMark.c
index 27b2b679b7..eeccd58428 100644
--- a/rts/sm/NonMovingMark.c
+++ b/rts/sm/NonMovingMark.c
@@ -415,11 +415,8 @@ void push_closure (MarkQueue *q,
StgClosure *p,
StgClosure **origin)
{
- // TODO: Push this into callers where they already have the Bdescr
- if (HEAP_ALLOCED_GC(p) && (Bdescr((StgPtr) p)->gen != oldest_gen))
- return;
-
#if defined(DEBUG)
+ ASSERT(!HEAP_ALLOCED_GC(p) || (Bdescr((StgPtr) p)->gen == oldest_gen));
ASSERT(LOOKS_LIKE_CLOSURE_PTR(p));
// Commenting out: too slow
// if (RtsFlags.DebugFlags.sanity) {
@@ -532,15 +529,11 @@ void updateRemembSetPushThunkEager(Capability *cap,
MarkQueue *queue = &cap->upd_rem_set.queue;
push_thunk_srt(queue, &info->i);
- // Don't record the origin of objects living outside of the nonmoving
- // heap; we can't perform the selector optimisation on them anyways.
- bool record_origin = check_in_nonmoving_heap((StgClosure*)thunk);
-
for (StgWord i = 0; i < info->i.layout.payload.ptrs; i++) {
if (check_in_nonmoving_heap(thunk->payload[i])) {
- push_closure(queue,
- thunk->payload[i],
- record_origin ? &thunk->payload[i] : NULL);
+ // Don't bother to push origin; it makes the barrier needlessly
+ // expensive with little benefit.
+ push_closure(queue, thunk->payload[i], NULL);
}
}
break;
@@ -549,7 +542,9 @@ void updateRemembSetPushThunkEager(Capability *cap,
{
MarkQueue *queue = &cap->upd_rem_set.queue;
StgAP *ap = (StgAP *) thunk;
- push_closure(queue, ap->fun, &ap->fun);
+ if (check_in_nonmoving_heap(ap->fun)) {
+ push_closure(queue, ap->fun, NULL);
+ }
mark_PAP_payload(queue, ap->fun, ap->payload, ap->n_args);
break;
}
@@ -570,9 +565,10 @@ void updateRemembSetPushThunk_(StgRegTable *reg, StgThunk *p)
inline void updateRemembSetPushClosure(Capability *cap, StgClosure *p)
{
- if (!check_in_nonmoving_heap(p)) return;
- MarkQueue *queue = &cap->upd_rem_set.queue;
- push_closure(queue, p, NULL);
+ if (check_in_nonmoving_heap(p)) {
+ MarkQueue *queue = &cap->upd_rem_set.queue;
+ push_closure(queue, p, NULL);
+ }
}
void updateRemembSetPushClosure_(StgRegTable *reg, struct StgClosure_ *p)
@@ -669,7 +665,10 @@ void markQueuePushClosure (MarkQueue *q,
StgClosure *p,
StgClosure **origin)
{
- push_closure(q, p, origin);
+ // TODO: Push this into callers where they already have the Bdescr
+ if (check_in_nonmoving_heap(p)) {
+ push_closure(q, p, origin);
+ }
}
/* TODO: Do we really never want to specify the origin here? */