summaryrefslogtreecommitdiffstats
path: root/runtime/gc/accounting
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2014-06-04 15:25:28 -0700
committerAndreas Gampe <agampe@google.com>2014-06-04 15:45:46 -0700
commit262a0a36ee5f553880365fecf0be1a188526ca69 (patch)
tree3a33a75a5b1bc555707f288778dcb948af0337e2 /runtime/gc/accounting
parent903e390ffd46955628d1161ccfa8de9177d42d22 (diff)
downloadart-262a0a36ee5f553880365fecf0be1a188526ca69.tar.gz
art-262a0a36ee5f553880365fecf0be1a188526ca69.tar.bz2
art-262a0a36ee5f553880365fecf0be1a188526ca69.zip
ART: Heap-allocate buffer in space_bitmap when on 64b arch
The stack frame size will be above our limit if we stack-allocate a buffer. Bug: 15278350 Change-Id: Ie1a31370538410d47c177f0a6e51879a1fc0752c
Diffstat (limited to 'runtime/gc/accounting')
-rw-r--r--runtime/gc/accounting/space_bitmap.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/runtime/gc/accounting/space_bitmap.cc b/runtime/gc/accounting/space_bitmap.cc
index 8e817e5bc5..3cb8d94a31 100644
--- a/runtime/gc/accounting/space_bitmap.cc
+++ b/runtime/gc/accounting/space_bitmap.cc
@@ -127,9 +127,17 @@ void SpaceBitmap<kAlignment>::SweepWalk(const SpaceBitmap<kAlignment>& live_bitm
}
// TODO: rewrite the callbacks to accept a std::vector<mirror::Object*> rather than a mirror::Object**?
- const size_t buffer_size = kWordSize * kBitsPerWord;
+ constexpr size_t buffer_size = kWordSize * kBitsPerWord;
+#ifdef __LP64__
+ // Heap-allocate for smaller stack frame.
+ std::unique_ptr<mirror::Object*[]> pointer_buf_ptr(new mirror::Object*[buffer_size]);
+ mirror::Object** pointer_buf = pointer_buf_ptr.get();
+#else
+ // Stack-allocate buffer as it's small enough.
mirror::Object* pointer_buf[buffer_size];
+#endif
mirror::Object** pb = &pointer_buf[0];
+
size_t start = OffsetToIndex(sweep_begin - live_bitmap.heap_begin_);
size_t end = OffsetToIndex(sweep_end - live_bitmap.heap_begin_ - 1);
CHECK_LT(end, live_bitmap.Size() / kWordSize);