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

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

Issue 2006793002: VM: Fix race between background compiler and guarded cid update. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: rework how we invalidate background compiled code Created 4 years, 7 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/compiler.cc ('k') | runtime/vm/isolate.cc » ('j') | 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) 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 #ifndef VM_ISOLATE_H_ 5 #ifndef VM_ISOLATE_H_
6 #define VM_ISOLATE_H_ 6 #define VM_ISOLATE_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "vm/atomic.h" 10 #include "vm/atomic.h"
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 553
554 void IncrTopLevelParsingCount() { 554 void IncrTopLevelParsingCount() {
555 AtomicOperations::IncrementBy(&top_level_parsing_count_, 1); 555 AtomicOperations::IncrementBy(&top_level_parsing_count_, 1);
556 } 556 }
557 void DecrTopLevelParsingCount() { 557 void DecrTopLevelParsingCount() {
558 AtomicOperations::DecrementBy(&top_level_parsing_count_, 1); 558 AtomicOperations::DecrementBy(&top_level_parsing_count_, 1);
559 } 559 }
560 560
561 static const intptr_t kInvalidGen = 0; 561 static const intptr_t kInvalidGen = 0;
562 562
563 void IncrFieldInvalidationGen() {
564 AtomicOperations::IncrementBy(&field_invalidation_gen_, 1);
565 if (field_invalidation_gen_ == kInvalidGen) {
566 AtomicOperations::IncrementBy(&field_invalidation_gen_, 1);
567 }
568 }
569 intptr_t field_invalidation_gen() const { return field_invalidation_gen_; }
570
571 void IncrLoadingInvalidationGen() { 563 void IncrLoadingInvalidationGen() {
572 AtomicOperations::IncrementBy(&loading_invalidation_gen_, 1); 564 AtomicOperations::IncrementBy(&loading_invalidation_gen_, 1);
573 if (loading_invalidation_gen_ == kInvalidGen) { 565 if (loading_invalidation_gen_ == kInvalidGen) {
574 AtomicOperations::IncrementBy(&loading_invalidation_gen_, 1); 566 AtomicOperations::IncrementBy(&loading_invalidation_gen_, 1);
575 } 567 }
576 } 568 }
577 intptr_t loading_invalidation_gen() { 569 intptr_t loading_invalidation_gen() {
578 return AtomicOperations::LoadRelaxedIntPtr(&loading_invalidation_gen_); 570 return AtomicOperations::LoadRelaxedIntPtr(&loading_invalidation_gen_);
579 } 571 }
580 572
581 // Used by mutator thread to notify background compiler which fields
582 // triggered code invalidation.
583 void AddDisablingField(const Field& field);
584 // Returns Field::null() if none available in the list. Can be called
585 // only from background compiler and while mutator thread is at safepoint.
586 RawField* GetDisablingField();
587 void ClearDisablingFieldList();
588
589 // Used by background compiler which field became boxed and must trigger 573 // Used by background compiler which field became boxed and must trigger
590 // deoptimization in the mutator thread. 574 // deoptimization in the mutator thread.
591 void AddDeoptimizingBoxedField(const Field& field); 575 void AddDeoptimizingBoxedField(const Field& field);
592 // Returns Field::null() if none available in the list. 576 // Returns Field::null() if none available in the list.
593 RawField* GetDeoptimizingBoxedField(); 577 RawField* GetDeoptimizingBoxedField();
594 578
595 RawObject* InvokePendingServiceExtensionCalls(); 579 RawObject* InvokePendingServiceExtensionCalls();
596 void AppendServiceExtensionCall(const Instance& closure, 580 void AppendServiceExtensionCall(const Instance& closure,
597 const String& method_name, 581 const String& method_name,
598 const Array& parameter_keys, 582 const Array& parameter_keys,
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 782
799 // Isolate list next pointer. 783 // Isolate list next pointer.
800 Isolate* next_; 784 Isolate* next_;
801 785
802 // Used to wake the isolate when it is in the pause event loop. 786 // Used to wake the isolate when it is in the pause event loop.
803 Monitor* pause_loop_monitor_; 787 Monitor* pause_loop_monitor_;
804 788
805 // Invalidation generations; used to track events occuring in parallel 789 // Invalidation generations; used to track events occuring in parallel
806 // to background compilation. The counters may overflow, which is OK 790 // to background compilation. The counters may overflow, which is OK
807 // since we check for equality to detect if an event occured. 791 // since we check for equality to detect if an event occured.
808 intptr_t field_invalidation_gen_;
809 intptr_t loading_invalidation_gen_; 792 intptr_t loading_invalidation_gen_;
810 intptr_t top_level_parsing_count_; 793 intptr_t top_level_parsing_count_;
811 794
812 // Protect access to boxed_field_list_ and disabling_field_list_. 795 // Protect access to boxed_field_list_.
813 Mutex* field_list_mutex_; 796 Mutex* field_list_mutex_;
814 // List of fields that became boxed and that trigger deoptimization. 797 // List of fields that became boxed and that trigger deoptimization.
815 RawGrowableObjectArray* boxed_field_list_; 798 RawGrowableObjectArray* boxed_field_list_;
816 // List of fields that were disabling code while background compiler
817 // was running.
818 RawGrowableObjectArray* disabling_field_list_;
819 799
820 // This guards spawn_count_. An isolate cannot complete shutdown and be 800 // This guards spawn_count_. An isolate cannot complete shutdown and be
821 // destroyed while there are child isolates in the midst of a spawn. 801 // destroyed while there are child isolates in the midst of a spawn.
822 Monitor* spawn_count_monitor_; 802 Monitor* spawn_count_monitor_;
823 intptr_t spawn_count_; 803 intptr_t spawn_count_;
824 804
825 // Has a reload ever been attempted? 805 // Has a reload ever been attempted?
826 bool has_attempted_reload_; 806 bool has_attempted_reload_;
827 intptr_t no_reload_scope_depth_; // we can only reload when this is 0. 807 intptr_t no_reload_scope_depth_; // we can only reload when this is 0.
828 IsolateReloadContext* reload_context_; 808 IsolateReloadContext* reload_context_;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 intptr_t* spawn_count_; 969 intptr_t* spawn_count_;
990 970
991 Dart_IsolateFlags isolate_flags_; 971 Dart_IsolateFlags isolate_flags_;
992 bool paused_; 972 bool paused_;
993 bool errors_are_fatal_; 973 bool errors_are_fatal_;
994 }; 974 };
995 975
996 } // namespace dart 976 } // namespace dart
997 977
998 #endif // VM_ISOLATE_H_ 978 #endif // VM_ISOLATE_H_
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698