summaryrefslogtreecommitdiffstats
path: root/vm/alloc/MarkSweep.cpp
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2013-08-08 11:43:30 -0700
committerMathieu Chartier <mathieuc@google.com>2013-08-08 13:54:34 -0700
commit38c8baa0ece45abc2a2a53fe3d53dda84d28dd4c (patch)
tree0c292f952eb87885d56444724784304f0bab8775 /vm/alloc/MarkSweep.cpp
parentcec783df5a51233dab94f2fa4506f677d45132e8 (diff)
downloadandroid_dalvik-38c8baa0ece45abc2a2a53fe3d53dda84d28dd4c.tar.gz
android_dalvik-38c8baa0ece45abc2a2a53fe3d53dda84d28dd4c.tar.bz2
android_dalvik-38c8baa0ece45abc2a2a53fe3d53dda84d28dd4c.zip
Fix broken card table asserts.
We had an off by one error due to getting the card for the heap source limit. This is not a valid card when the heap is at maximum size, but doesn't need to be since we do less than comparison on it. Fixed another error where we didn't take into account the biased begin in an assert. Did a bit of refactoring by removing useless if statement. Fixes 061-out-of-memory, 080-oom-throw. Bug: https://code.google.com/p/android/issues/detail?id=42868 (cherry picked from commit ee903e174872edd0ecc6f1940c7412892cd49123) Change-Id: If677c93e46fe1ee5729eec1820b1bd9682b4f924
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 (;;) {