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

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

Issue 2363823002: Fix for issue 27380 - VM stuck in deadlock with background finalization and background compiler thr… (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « runtime/vm/pages.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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/thread.h" 5 #include "vm/thread.h"
6 6
7 #include "vm/compiler_stats.h" 7 #include "vm/compiler_stats.h"
8 #include "vm/dart_api_state.h" 8 #include "vm/dart_api_state.h"
9 #include "vm/growable_array.h" 9 #include "vm/growable_array.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 store_buffer_block_ = isolate()->store_buffer()->PopNonFullBlock(); 546 store_buffer_block_ = isolate()->store_buffer()->PopNonFullBlock();
547 } 547 }
548 548
549 549
550 bool Thread::IsMutatorThread() const { 550 bool Thread::IsMutatorThread() const {
551 return ((isolate_ != NULL) && (isolate_->mutator_thread() == this)); 551 return ((isolate_ != NULL) && (isolate_->mutator_thread() == this));
552 } 552 }
553 553
554 554
555 bool Thread::CanCollectGarbage() const { 555 bool Thread::CanCollectGarbage() const {
556 // We have non mutator threads grow the heap instead of triggering 556 // We grow the heap instead of triggering a garbage collection when a
557 // a garbage collection when they are at a safepoint (e.g: background 557 // thread is at a safepoint in the following situations :
558 // compiler thread finalizing and installing code at a safepoint). 558 // - background compiler thread finalizing and installing code
559 return (IsMutatorThread() || IsAtSafepoint()); 559 // - disassembly of the generated code is done after compilation
560 // So essentially we state that garbage collection is possible only
561 // when we are not at a safepoint.
562 return !IsAtSafepoint();
560 } 563 }
561 564
562 565
563 bool Thread::IsExecutingDartCode() const { 566 bool Thread::IsExecutingDartCode() const {
564 return (top_exit_frame_info() == 0) && 567 return (top_exit_frame_info() == 0) &&
565 (vm_tag() == VMTag::kDartTagId); 568 (vm_tag() == VMTag::kDartTagId);
566 } 569 }
567 570
568 571
569 bool Thread::HasExitedDartCode() const { 572 bool Thread::HasExitedDartCode() const {
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 758
756 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { 759 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() {
757 if (thread() != NULL) { 760 if (thread() != NULL) {
758 OSThread* os_thread = thread()->os_thread(); 761 OSThread* os_thread = thread()->os_thread();
759 ASSERT(os_thread != NULL); 762 ASSERT(os_thread != NULL);
760 os_thread->EnableThreadInterrupts(); 763 os_thread->EnableThreadInterrupts();
761 } 764 }
762 } 765 }
763 766
764 } // namespace dart 767 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/pages.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698