Skip to content

Commit

Permalink
Fix for issue 27019 (Safepoint assertion failure in Flutter)
Browse files Browse the repository at this point in the history
BUG=27019
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2215523002 .
  • Loading branch information
a-siva committed Aug 4, 2016
1 parent 6075a53 commit 99baa3d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions runtime/vm/isolate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2595,7 +2595,8 @@ Thread* Isolate::ScheduleThread(bool is_mutator, bool bypass_safepoint) {
ASSERT(heap() != NULL);
thread->heap_ = heap();
thread->set_os_thread(os_thread);
ASSERT(thread->execution_state() == Thread::kThreadInVM);
ASSERT(thread->execution_state() == Thread::kThreadInNative);
thread->set_execution_state(Thread::kThreadInVM);
thread->set_safepoint_state(0);
thread->set_vm_tag(VMTag::kVMTagId);
ASSERT(thread->no_safepoint_scope_depth() == 0);
Expand Down Expand Up @@ -2646,8 +2647,8 @@ void Isolate::UnscheduleThread(Thread* thread,
thread->isolate_ = NULL;
thread->heap_ = NULL;
thread->set_os_thread(NULL);
thread->set_execution_state(Thread::kThreadInVM);
thread->set_safepoint_state(0);
thread->set_execution_state(Thread::kThreadInNative);
thread->set_safepoint_state(Thread::SetAtSafepoint(true, 0));
thread->clear_pending_functions();
ASSERT(thread->no_safepoint_scope_depth() == 0);
// Return thread structure.
Expand Down
4 changes: 3 additions & 1 deletion runtime/vm/profiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,9 @@ static uintptr_t __attribute__((noinline)) GetProgramCounter() {

void Profiler::DumpStackTrace(bool native_stack_trace) {
Thread* thread = Thread::Current();
ASSERT(thread != NULL);
if (thread == NULL) {
return;
}
OSThread* os_thread = thread->os_thread();
ASSERT(os_thread != NULL);
Isolate* isolate = thread->isolate();
Expand Down
2 changes: 1 addition & 1 deletion runtime/vm/thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Thread::Thread(Isolate* isolate)
REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS)
REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT)
safepoint_state_(0),
execution_state_(kThreadInVM),
execution_state_(kThreadInNative),
next_(NULL) {
NOT_IN_PRODUCT(
dart_stream_ = Timeline::GetDartStream();
Expand Down

0 comments on commit 99baa3d

Please sign in to comment.