From c22c59ef8513b4cbbfd25073d1afbf58196b522a Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Mon, 24 Feb 2014 15:16:06 -0800 Subject: Remove started runtime check in RevokeAllThreadLocalAllocationStacks This check occasionally caused some thread local allocation stacks to incorrectly not get revoked when multiple threads were allocating without a started runtime. This showed up in image_test with compaction enabled when we were initializing classes in the compiler driver. Change-Id: I7f28d072feea333c2503e35265ba25c51a6308fe --- oatdump/oatdump.cc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'oatdump') diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc index 0d9b9910b7..330a307df7 100644 --- a/oatdump/oatdump.cc +++ b/oatdump/oatdump.cc @@ -49,6 +49,7 @@ #include "runtime.h" #include "safe_map.h" #include "scoped_thread_state_change.h" +#include "thread_list.h" #include "verifier/dex_gc_map.h" #include "verifier/method_verifier.h" #include "vmap_table.h" @@ -817,12 +818,21 @@ class ImageDumper { const std::vector& spaces = heap->GetContinuousSpaces(); Thread* self = Thread::Current(); { - WriterMutexLock mu(self, *Locks::heap_bitmap_lock_); - heap->FlushAllocStack(); + { + WriterMutexLock mu(self, *Locks::heap_bitmap_lock_); + heap->FlushAllocStack(); + } // Since FlushAllocStack() above resets the (active) allocation // stack. Need to revoke the thread-local allocation stacks that // point into it. - heap->RevokeAllThreadLocalAllocationStacks(self); + { + self->TransitionFromRunnableToSuspended(kNative); + ThreadList* thread_list = Runtime::Current()->GetThreadList(); + thread_list->SuspendAll(); + heap->RevokeAllThreadLocalAllocationStacks(self); + thread_list->ResumeAll(); + self->TransitionFromSuspendedToRunnable(); + } } { std::ostream* saved_os = os_; @@ -1548,7 +1558,6 @@ static int oatdump(int argc, char** argv) { // give it away now and then switch to a more managable ScopedObjectAccess. Thread::Current()->TransitionFromRunnableToSuspended(kNative); ScopedObjectAccess soa(Thread::Current()); - gc::Heap* heap = Runtime::Current()->GetHeap(); gc::space::ImageSpace* image_space = heap->GetImageSpace(); CHECK(image_space != NULL); -- cgit v1.2.3