| OLD | NEW |
| 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/base_isolate.h" | 11 #include "vm/base_isolate.h" |
| 11 #include "vm/class_table.h" | 12 #include "vm/class_table.h" |
| 12 #include "vm/counters.h" | 13 #include "vm/counters.h" |
| 13 #include "vm/handles.h" | 14 #include "vm/handles.h" |
| 14 #include "vm/megamorphic_cache_table.h" | 15 #include "vm/megamorphic_cache_table.h" |
| 15 #include "vm/metrics.h" | 16 #include "vm/metrics.h" |
| 16 #include "vm/random.h" | 17 #include "vm/random.h" |
| 17 #include "vm/tags.h" | 18 #include "vm/tags.h" |
| 18 #include "vm/thread.h" | 19 #include "vm/thread.h" |
| 19 #include "vm/os_thread.h" | 20 #include "vm/os_thread.h" |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 | 266 |
| 266 void InitializeStackLimit(); | 267 void InitializeStackLimit(); |
| 267 void SetStackLimit(uword value); | 268 void SetStackLimit(uword value); |
| 268 void SetStackLimitFromStackBase(uword stack_base); | 269 void SetStackLimitFromStackBase(uword stack_base); |
| 269 void ClearStackLimit(); | 270 void ClearStackLimit(); |
| 270 | 271 |
| 271 // Returns the current C++ stack pointer. Equivalent taking the address of a | 272 // Returns the current C++ stack pointer. Equivalent taking the address of a |
| 272 // stack allocated local, but plays well with AddressSanitizer. | 273 // stack allocated local, but plays well with AddressSanitizer. |
| 273 static uword GetCurrentStackPointer(); | 274 static uword GetCurrentStackPointer(); |
| 274 | 275 |
| 276 // Returns true if any of the interrupts specified by 'interrupt_bits' are |
| 277 // currently scheduled for this isolate, but leaves them unchanged. |
| 278 // |
| 279 // NOTE: The read uses relaxed memory ordering, i.e., it is atomic and |
| 280 // an interrupt is guaranteed to be observed eventually, but any further |
| 281 // order guarantees must be ensured by other synchronization. See the |
| 282 // tests in isolate_test.cc for example usage. |
| 283 bool HasInterruptsScheduled(uword interrupt_bits) { |
| 284 ASSERT(interrupt_bits == (interrupt_bits & kInterruptsMask)); |
| 285 uword limit = AtomicOperations::LoadRelaxed(&stack_limit_); |
| 286 return (limit != saved_stack_limit_) && |
| 287 (((limit & kInterruptsMask) & interrupt_bits) != 0); |
| 288 } |
| 289 |
| 290 // Access to the current stack limit for generated code. This may be |
| 291 // overwritten with a special value to trigger interrupts. |
| 275 uword stack_limit_address() const { | 292 uword stack_limit_address() const { |
| 276 return reinterpret_cast<uword>(&stack_limit_); | 293 return reinterpret_cast<uword>(&stack_limit_); |
| 277 } | 294 } |
| 278 | |
| 279 // The current stack limit. This may be overwritten with a special | |
| 280 // value to trigger interrupts. | |
| 281 uword stack_limit() const { return stack_limit_; } | |
| 282 static intptr_t stack_limit_offset() { | 295 static intptr_t stack_limit_offset() { |
| 283 return OFFSET_OF(Isolate, stack_limit_); | 296 return OFFSET_OF(Isolate, stack_limit_); |
| 284 } | 297 } |
| 285 | 298 |
| 286 // The true stack limit for this isolate. | 299 // The true stack limit for this isolate. |
| 287 uword saved_stack_limit() const { return saved_stack_limit_; } | 300 uword saved_stack_limit() const { return saved_stack_limit_; } |
| 288 | 301 |
| 289 uword stack_base() const { return stack_base_; } | 302 uword stack_base() const { return stack_base_; } |
| 290 | 303 |
| 291 // Stack overflow flags | 304 // Stack overflow flags |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1083 uint8_t* serialized_message_; | 1096 uint8_t* serialized_message_; |
| 1084 intptr_t serialized_message_len_; | 1097 intptr_t serialized_message_len_; |
| 1085 Isolate::Flags isolate_flags_; | 1098 Isolate::Flags isolate_flags_; |
| 1086 bool paused_; | 1099 bool paused_; |
| 1087 bool errors_are_fatal_; | 1100 bool errors_are_fatal_; |
| 1088 }; | 1101 }; |
| 1089 | 1102 |
| 1090 } // namespace dart | 1103 } // namespace dart |
| 1091 | 1104 |
| 1092 #endif // VM_ISOLATE_H_ | 1105 #endif // VM_ISOLATE_H_ |
| OLD | NEW |