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

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

Issue 1439483003: - Add an OSThread structure which is the generic TLS structure for all C++ (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address-comments Created 5 years, 1 month 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 #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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 uword stack_limit_address() const { 247 uword stack_limit_address() const {
248 return reinterpret_cast<uword>(&stack_limit_); 248 return reinterpret_cast<uword>(&stack_limit_);
249 } 249 }
250 static intptr_t stack_limit_offset() { 250 static intptr_t stack_limit_offset() {
251 return OFFSET_OF(Isolate, stack_limit_); 251 return OFFSET_OF(Isolate, stack_limit_);
252 } 252 }
253 253
254 // The true stack limit for this isolate. 254 // The true stack limit for this isolate.
255 uword saved_stack_limit() const { return saved_stack_limit_; } 255 uword saved_stack_limit() const { return saved_stack_limit_; }
256 256
257 uword stack_base() const { return stack_base_; }
258
259 // Stack overflow flags 257 // Stack overflow flags
260 enum { 258 enum {
261 kOsrRequest = 0x1, // Current stack overflow caused by OSR request. 259 kOsrRequest = 0x1, // Current stack overflow caused by OSR request.
262 }; 260 };
263 261
264 uword stack_overflow_flags_address() const { 262 uword stack_overflow_flags_address() const {
265 return reinterpret_cast<uword>(&stack_overflow_flags_); 263 return reinterpret_cast<uword>(&stack_overflow_flags_);
266 } 264 }
267 265
268 int32_t IncrementAndGetStackOverflowCount() { 266 int32_t IncrementAndGetStackOverflowCount() {
269 return ++stack_overflow_count_; 267 return ++stack_overflow_count_;
270 } 268 }
271 269
272 // Retrieves and clears the stack overflow flags. These are set by 270 // Retrieves and clears the stack overflow flags. These are set by
273 // the generated code before the slow path runtime routine for a 271 // the generated code before the slow path runtime routine for a
274 // stack overflow is called. 272 // stack overflow is called.
275 uword GetAndClearStackOverflowFlags(); 273 uword GetAndClearStackOverflowFlags();
276 274
277 // Retrieve the stack address bounds for profiler.
278 bool GetProfilerStackBounds(uword* lower, uword* upper) const;
279
280 static uword GetSpecifiedStackSize();
281
282 static const intptr_t kStackSizeBuffer = (4 * KB * kWordSize);
283
284 // Interrupt bits. 275 // Interrupt bits.
285 enum { 276 enum {
286 kVMInterrupt = 0x1, // Internal VM checks: safepoints, store buffers, etc. 277 kVMInterrupt = 0x1, // Internal VM checks: safepoints, store buffers, etc.
287 kMessageInterrupt = 0x2, // An interrupt to process an out of band message. 278 kMessageInterrupt = 0x2, // An interrupt to process an out of band message.
288 279
289 kInterruptsMask = (kVMInterrupt | kMessageInterrupt), 280 kInterruptsMask = (kVMInterrupt | kMessageInterrupt),
290 }; 281 };
291 282
292 void ScheduleInterrupts(uword interrupt_bits); 283 void ScheduleInterrupts(uword interrupt_bits);
293 RawError* HandleInterrupts(); 284 RawError* HandleInterrupts();
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 ApiState* api_state_; 755 ApiState* api_state_;
765 Debugger* debugger_; 756 Debugger* debugger_;
766 bool resume_request_; 757 bool resume_request_;
767 int64_t last_resume_timestamp_; 758 int64_t last_resume_timestamp_;
768 bool has_compiled_code_; // Can check that no compilation occured. 759 bool has_compiled_code_; // Can check that no compilation occured.
769 Flags flags_; 760 Flags flags_;
770 Random random_; 761 Random random_;
771 Simulator* simulator_; 762 Simulator* simulator_;
772 Mutex* mutex_; // protects stack_limit_, saved_stack_limit_, compiler stats. 763 Mutex* mutex_; // protects stack_limit_, saved_stack_limit_, compiler stats.
773 uword saved_stack_limit_; 764 uword saved_stack_limit_;
774 uword stack_base_;
775 uword stack_overflow_flags_; 765 uword stack_overflow_flags_;
776 int32_t stack_overflow_count_; 766 int32_t stack_overflow_count_;
777 MessageHandler* message_handler_; 767 MessageHandler* message_handler_;
778 IsolateSpawnState* spawn_state_; 768 IsolateSpawnState* spawn_state_;
779 bool is_runnable_; 769 bool is_runnable_;
780 Dart_GcPrologueCallback gc_prologue_callback_; 770 Dart_GcPrologueCallback gc_prologue_callback_;
781 Dart_GcEpilogueCallback gc_epilogue_callback_; 771 Dart_GcEpilogueCallback gc_epilogue_callback_;
782 intptr_t defer_finalization_count_; 772 intptr_t defer_finalization_count_;
783 DeoptContext* deopt_context_; 773 DeoptContext* deopt_context_;
784 774
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 : new_isolate_(new_isolate), saved_isolate_(Isolate::Current()) { 891 : new_isolate_(new_isolate), saved_isolate_(Isolate::Current()) {
902 // TODO(koda): Audit users; passing NULL goes against naming of this class. 892 // TODO(koda): Audit users; passing NULL goes against naming of this class.
903 if (new_isolate_ == NULL) { 893 if (new_isolate_ == NULL) {
904 ASSERT(Isolate::Current() == NULL); 894 ASSERT(Isolate::Current() == NULL);
905 // Do nothing. 895 // Do nothing.
906 return; 896 return;
907 } 897 }
908 if (saved_isolate_ != new_isolate_) { 898 if (saved_isolate_ != new_isolate_) {
909 ASSERT(Isolate::Current() == NULL); 899 ASSERT(Isolate::Current() == NULL);
910 // Ensure this is not a nested 'isolate enter' with prior state. 900 // Ensure this is not a nested 'isolate enter' with prior state.
911 ASSERT(new_isolate_->stack_base() == 0); 901 ASSERT(new_isolate_->saved_stack_limit() == 0);
912 Thread::EnterIsolate(new_isolate_); 902 Thread::EnterIsolate(new_isolate_);
913 } 903 }
914 } 904 }
915 905
916 ~StartIsolateScope() { 906 ~StartIsolateScope() {
917 if (new_isolate_ == NULL) { 907 if (new_isolate_ == NULL) {
918 ASSERT(Isolate::Current() == NULL); 908 ASSERT(Isolate::Current() == NULL);
919 // Do nothing. 909 // Do nothing.
920 return; 910 return;
921 } 911 }
922 if (saved_isolate_ != new_isolate_) { 912 if (saved_isolate_ != new_isolate_) {
923 ASSERT(saved_isolate_ == NULL); 913 ASSERT(saved_isolate_ == NULL);
924 // ASSERT that we have bottomed out of all Dart invocations. 914 // ASSERT that we have bottomed out of all Dart invocations.
925 ASSERT(new_isolate_->stack_base() == 0); 915 ASSERT(new_isolate_->saved_stack_limit() == 0);
926 Thread::ExitIsolate(); 916 Thread::ExitIsolate();
927 } 917 }
928 } 918 }
929 919
930 private: 920 private:
931 Isolate* new_isolate_; 921 Isolate* new_isolate_;
932 Isolate* saved_isolate_; 922 Isolate* saved_isolate_;
933 923
934 DISALLOW_COPY_AND_ASSIGN(StartIsolateScope); 924 DISALLOW_COPY_AND_ASSIGN(StartIsolateScope);
935 }; 925 };
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 uint8_t* serialized_message_; 983 uint8_t* serialized_message_;
994 intptr_t serialized_message_len_; 984 intptr_t serialized_message_len_;
995 Isolate::Flags isolate_flags_; 985 Isolate::Flags isolate_flags_;
996 bool paused_; 986 bool paused_;
997 bool errors_are_fatal_; 987 bool errors_are_fatal_;
998 }; 988 };
999 989
1000 } // namespace dart 990 } // namespace dart
1001 991
1002 #endif // VM_ISOLATE_H_ 992 #endif // VM_ISOLATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698