diff options
author | jeffhao <jeffhao@google.com> | 2011-11-04 14:58:55 -0700 |
---|---|---|
committer | jeffhao <jeffhao@google.com> | 2011-11-04 14:58:55 -0700 |
commit | 39da035d99b6e81e8ca8d9b99da16984f2993dd6 (patch) | |
tree | 94e5d27a97a241a179659c0fc79b092d6d39f1c0 /src/card_table.cc | |
parent | cac6cc72c3331257fa6437b36a131e5d551e2f3c (diff) | |
download | art-39da035d99b6e81e8ca8d9b99da16984f2993dd6.zip art-39da035d99b6e81e8ca8d9b99da16984f2993dd6.tar.gz art-39da035d99b6e81e8ca8d9b99da16984f2993dd6.tar.bz2 |
Changed card table to use less cards when heap size is limited.
The card table uses the growth limit of the heap to limit the number of
cards it makes available for use. This gives it less cards to clean up
while the heap is limited.
Change-Id: Ia6520231d4abeda9604993ba28fd7ee7729a1ecb
Diffstat (limited to 'src/card_table.cc')
-rw-r--r-- | src/card_table.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/card_table.cc b/src/card_table.cc index e8eec38..4b57aa1 100644 --- a/src/card_table.cc +++ b/src/card_table.cc @@ -45,9 +45,9 @@ namespace art { * byte is equal to GC_DIRTY_CARD. See CardTable::Init for details. */ -CardTable* CardTable::Create(const byte* heap_base, size_t heap_max_size) { +CardTable* CardTable::Create(const byte* heap_base, size_t heap_max_size, size_t growth_size) { UniquePtr<CardTable> bitmap(new CardTable); - if (!bitmap->Init(heap_base, heap_max_size)) { + if (!bitmap->Init(heap_base, heap_max_size, growth_size)) { return NULL; } else { return bitmap.release(); @@ -58,7 +58,7 @@ CardTable* CardTable::Create(const byte* heap_base, size_t heap_max_size) { * Initializes the card table; must be called before any other * CardTable functions. */ -bool CardTable::Init(const byte* heap_base, size_t heap_max_size) { +bool CardTable::Init(const byte* heap_base, size_t heap_max_size, size_t growth_size) { /* Set up the card table */ size_t length = heap_max_size / GC_CARD_SIZE; /* Allocate an extra 256 bytes to allow fixed low-byte of base */ @@ -68,7 +68,8 @@ bool CardTable::Init(const byte* heap_base, size_t heap_max_size) { return false; } base_ = alloc_base; - length_ = length; + length_ = growth_size / GC_CARD_SIZE; + max_length_ = length; offset_ = 0; /* All zeros is the correct initial value; all clean. */ CHECK_EQ(GC_CARD_CLEAN, 0); |