OLD | NEW |
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 #ifndef VM_THREAD_H_ | 5 #ifndef VM_THREAD_H_ |
6 #define VM_THREAD_H_ | 6 #define VM_THREAD_H_ |
7 | 7 |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 #include "vm/handles.h" | 9 #include "vm/handles.h" |
10 #include "vm/os_thread.h" | 10 #include "vm/os_thread.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 state_.no_safepoint_scope_depth -= 1; | 265 state_.no_safepoint_scope_depth -= 1; |
266 #endif | 266 #endif |
267 } | 267 } |
268 | 268 |
269 // Collection of isolate-specific state of a thread that is saved/restored | 269 // Collection of isolate-specific state of a thread that is saved/restored |
270 // on isolate exit/re-entry. | 270 // on isolate exit/re-entry. |
271 struct State { | 271 struct State { |
272 Zone* zone; | 272 Zone* zone; |
273 uword top_exit_frame_info; | 273 uword top_exit_frame_info; |
274 StackResource* top_resource; | 274 StackResource* top_resource; |
275 TimelineEventBlock* timeline_block; | |
276 LongJumpScope* long_jump_base; | 275 LongJumpScope* long_jump_base; |
277 #if defined(DEBUG) | 276 #if defined(DEBUG) |
278 HandleScope* top_handle_scope; | 277 HandleScope* top_handle_scope; |
279 intptr_t no_handle_scope_depth; | 278 intptr_t no_handle_scope_depth; |
280 int32_t no_safepoint_scope_depth; | 279 int32_t no_safepoint_scope_depth; |
281 #endif | 280 #endif |
282 }; | 281 }; |
283 | 282 |
284 #define DEFINE_OFFSET_METHOD(type_name, member_name, expr, default_init_value) \ | 283 #define DEFINE_OFFSET_METHOD(type_name, member_name, expr, default_init_value) \ |
285 static intptr_t member_name##offset() { \ | 284 static intptr_t member_name##offset() { \ |
(...skipping 19 matching lines...) Expand all Loading... |
305 static bool CanLoadFromThread(const Object& object); | 304 static bool CanLoadFromThread(const Object& object); |
306 static intptr_t OffsetFromThread(const Object& object); | 305 static intptr_t OffsetFromThread(const Object& object); |
307 static intptr_t OffsetFromThread(const RuntimeEntry* runtime_entry); | 306 static intptr_t OffsetFromThread(const RuntimeEntry* runtime_entry); |
308 | 307 |
309 Mutex* timeline_block_lock() { | 308 Mutex* timeline_block_lock() { |
310 return &timeline_block_lock_; | 309 return &timeline_block_lock_; |
311 } | 310 } |
312 | 311 |
313 // Only safe to access when holding |timeline_block_lock_|. | 312 // Only safe to access when holding |timeline_block_lock_|. |
314 TimelineEventBlock* timeline_block() const { | 313 TimelineEventBlock* timeline_block() const { |
315 return state_.timeline_block; | 314 return timeline_block_; |
316 } | 315 } |
317 | 316 |
318 // Only safe to access when holding |timeline_block_lock_|. | 317 // Only safe to access when holding |timeline_block_lock_|. |
319 void set_timeline_block(TimelineEventBlock* block) { | 318 void set_timeline_block(TimelineEventBlock* block) { |
320 state_.timeline_block = block; | 319 timeline_block_ = block; |
321 } | 320 } |
322 | 321 |
323 class Log* log() const; | 322 class Log* log() const; |
324 | 323 |
325 static const intptr_t kNoDeoptId = -1; | 324 static const intptr_t kNoDeoptId = -1; |
326 static const intptr_t kDeoptIdStep = 2; | 325 static const intptr_t kDeoptIdStep = 2; |
327 static const intptr_t kDeoptIdBeforeOffset = 0; | 326 static const intptr_t kDeoptIdBeforeOffset = 0; |
328 static const intptr_t kDeoptIdAfterOffset = 1; | 327 static const intptr_t kDeoptIdAfterOffset = 1; |
329 intptr_t deopt_id() const { return deopt_id_; } | 328 intptr_t deopt_id() const { return deopt_id_; } |
330 void set_deopt_id(int value) { | 329 void set_deopt_id(int value) { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 | 411 |
413 static ThreadLocalKey thread_key_; | 412 static ThreadLocalKey thread_key_; |
414 | 413 |
415 const ThreadId id_; | 414 const ThreadId id_; |
416 ThreadInterruptCallback thread_interrupt_callback_; | 415 ThreadInterruptCallback thread_interrupt_callback_; |
417 void* thread_interrupt_data_; | 416 void* thread_interrupt_data_; |
418 Isolate* isolate_; | 417 Isolate* isolate_; |
419 Heap* heap_; | 418 Heap* heap_; |
420 State state_; | 419 State state_; |
421 Mutex timeline_block_lock_; | 420 Mutex timeline_block_lock_; |
| 421 TimelineEventBlock* timeline_block_; |
422 StoreBufferBlock* store_buffer_block_; | 422 StoreBufferBlock* store_buffer_block_; |
423 class Log* log_; | 423 class Log* log_; |
424 intptr_t deopt_id_; // Compilation specific counter. | 424 intptr_t deopt_id_; // Compilation specific counter. |
425 uword vm_tag_; | 425 uword vm_tag_; |
426 #define DECLARE_MEMBERS(type_name, member_name, expr, default_init_value) \ | 426 #define DECLARE_MEMBERS(type_name, member_name, expr, default_init_value) \ |
427 type_name member_name; | 427 type_name member_name; |
428 CACHED_CONSTANTS_LIST(DECLARE_MEMBERS) | 428 CACHED_CONSTANTS_LIST(DECLARE_MEMBERS) |
429 #undef DECLARE_MEMBERS | 429 #undef DECLARE_MEMBERS |
430 | 430 |
431 #define DECLARE_MEMBERS(name) \ | 431 #define DECLARE_MEMBERS(name) \ |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 }; | 524 }; |
525 | 525 |
526 #if defined(TARGET_OS_WINDOWS) | 526 #if defined(TARGET_OS_WINDOWS) |
527 // Clears the state of the current thread and frees the allocation. | 527 // Clears the state of the current thread and frees the allocation. |
528 void WindowsThreadCleanUp(); | 528 void WindowsThreadCleanUp(); |
529 #endif | 529 #endif |
530 | 530 |
531 } // namespace dart | 531 } // namespace dart |
532 | 532 |
533 #endif // VM_THREAD_H_ | 533 #endif // VM_THREAD_H_ |
OLD | NEW |