Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(673)

Side by Side Diff: runtime/vm/isolate.cc

Issue 1769183003: Fix sticky error propagation from thread to isolate (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Allow only mutator thread to propagate sticky error Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/isolate.h" 5 #include "vm/isolate.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/text_buffer.h" 10 #include "platform/text_buffer.h"
(...skipping 2574 matching lines...) Expand 10 before | Expand all | Expand 10 after
2585 bool is_mutator, 2585 bool is_mutator,
2586 bool bypass_safepoint) { 2586 bool bypass_safepoint) {
2587 // Disassociate the 'Thread' structure and unschedule the thread 2587 // Disassociate the 'Thread' structure and unschedule the thread
2588 // from this isolate. 2588 // from this isolate.
2589 // We are disassociating the thread from an isolate and it would 2589 // We are disassociating the thread from an isolate and it would
2590 // not be possible to correctly track no_safepoint_scope_depth for the 2590 // not be possible to correctly track no_safepoint_scope_depth for the
2591 // thread in the constructor/destructor of MonitorLocker, 2591 // thread in the constructor/destructor of MonitorLocker,
2592 // so we create a MonitorLocker object which does not do any 2592 // so we create a MonitorLocker object which does not do any
2593 // no_safepoint_scope_depth increments/decrements. 2593 // no_safepoint_scope_depth increments/decrements.
2594 MonitorLocker ml(threads_lock(), false); 2594 MonitorLocker ml(threads_lock(), false);
2595 if (is_mutator) {
2596 thread->isolate()->object_store()->SetStickyErrorFromThread(thread);
2597 }
siva 2016/03/09 07:07:51 Could you add a comment here
2595 if (!bypass_safepoint) { 2598 if (!bypass_safepoint) {
2596 // Ensure that the thread reports itself as being at a safepoint. 2599 // Ensure that the thread reports itself as being at a safepoint.
2597 thread->EnterSafepoint(); 2600 thread->EnterSafepoint();
2598 } 2601 }
2599 OSThread* os_thread = thread->os_thread(); 2602 OSThread* os_thread = thread->os_thread();
2600 ASSERT(os_thread != NULL); 2603 ASSERT(os_thread != NULL);
2601 os_thread->DisableThreadInterrupts(); 2604 os_thread->DisableThreadInterrupts();
2602 os_thread->set_thread(NULL); 2605 os_thread->set_thread(NULL);
2603 OSThread::SetCurrent(os_thread); 2606 OSThread::SetCurrent(os_thread);
2604 if (is_mutator) { 2607 if (is_mutator) {
2605 mutator_thread_ = NULL; 2608 mutator_thread_ = NULL;
2606 } 2609 }
2607 thread->isolate_ = NULL; 2610 thread->isolate_ = NULL;
2608 thread->heap_ = NULL; 2611 thread->heap_ = NULL;
2609 thread->set_os_thread(NULL); 2612 thread->set_os_thread(NULL);
2610 thread->set_execution_state(Thread::kThreadInVM); 2613 thread->set_execution_state(Thread::kThreadInVM);
2611 thread->set_safepoint_state(0); 2614 thread->set_safepoint_state(0);
2612 thread->clear_pending_functions(); 2615 thread->clear_pending_functions();
2616 thread->clear_sticky_error();
2613 ASSERT(thread->no_safepoint_scope_depth() == 0); 2617 ASSERT(thread->no_safepoint_scope_depth() == 0);
2614 // Return thread structure. 2618 // Return thread structure.
2615 thread_registry()->ReturnThreadLocked(is_mutator, thread); 2619 thread_registry()->ReturnThreadLocked(is_mutator, thread);
2616 } 2620 }
2617 2621
2618 2622
2619 static RawInstance* DeserializeObject(Thread* thread, 2623 static RawInstance* DeserializeObject(Thread* thread,
2620 uint8_t* obj_data, 2624 uint8_t* obj_data,
2621 intptr_t obj_len) { 2625 intptr_t obj_len) {
2622 if (obj_data == NULL) { 2626 if (obj_data == NULL) {
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
2839 void IsolateSpawnState::DecrementSpawnCount() { 2843 void IsolateSpawnState::DecrementSpawnCount() {
2840 ASSERT(spawn_count_monitor_ != NULL); 2844 ASSERT(spawn_count_monitor_ != NULL);
2841 ASSERT(spawn_count_ != NULL); 2845 ASSERT(spawn_count_ != NULL);
2842 MonitorLocker ml(spawn_count_monitor_); 2846 MonitorLocker ml(spawn_count_monitor_);
2843 ASSERT(*spawn_count_ > 0); 2847 ASSERT(*spawn_count_ > 0);
2844 *spawn_count_ = *spawn_count_ - 1; 2848 *spawn_count_ = *spawn_count_ - 1;
2845 ml.Notify(); 2849 ml.Notify();
2846 } 2850 }
2847 2851
2848 } // namespace dart 2852 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698