summaryrefslogtreecommitdiffstats
path: root/vm/alloc/MarkSweep.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'vm/alloc/MarkSweep.cpp')
-rw-r--r--vm/alloc/MarkSweep.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/vm/alloc/MarkSweep.cpp b/vm/alloc/MarkSweep.cpp
index eb739e552..2781a7cfa 100644
--- a/vm/alloc/MarkSweep.cpp
+++ b/vm/alloc/MarkSweep.cpp
@@ -558,8 +558,9 @@ static void scanGrayObjects(GcMarkContext *ctx)
const u1 *base, *limit, *ptr, *dirty;
base = &h->cardTableBase[0];
- limit = dvmCardFromAddr((u1 *)dvmHeapSourceGetLimit());
- assert(limit <= &h->cardTableBase[h->cardTableLength]);
+ // The limit is the card one after the last accessible card.
+ limit = dvmCardFromAddr((u1 *)dvmHeapSourceGetLimit() - GC_CARD_SIZE) + 1;
+ assert(limit <= &base[h->cardTableOffset + h->cardTableLength]);
ptr = base;
for (;;) {