summaryrefslogtreecommitdiff
path: root/rts/sm/NonMovingScav.c
diff options
context:
space:
mode:
Diffstat (limited to 'rts/sm/NonMovingScav.c')
-rw-r--r--rts/sm/NonMovingScav.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/rts/sm/NonMovingScav.c b/rts/sm/NonMovingScav.c
index 9f92563032..8128f0dba3 100644
--- a/rts/sm/NonMovingScav.c
+++ b/rts/sm/NonMovingScav.c
@@ -84,9 +84,18 @@
*/
void
-nonmovingScavengeOne (StgClosure *q)
+nonmovingScavengeOne (StgClosure *q0)
{
+ StgClosure *q = q0;
+
+ // N.B. There may be a gap before the first word of the closure in the case
+ // of an aligned ByteArray# as allocated by allocatePinned().
+ // See Note [Allocating pinned objects into the non-moving heap].
+ while (*(StgPtr*) q == NULL)
+ q = (StgClosure *) ((StgPtr*) q + 1);
+
ASSERT(LOOKS_LIKE_CLOSURE_PTR(q));
+
StgPtr p = (StgPtr)q;
const StgInfoTable *info = get_itbl(q);
const bool saved_eager_promotion = gct->eager_promotion;