| 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/os_thread.h" | 9 #include "vm/os_thread.h" |
| 10 #include "vm/store_buffer.h" | 10 #include "vm/store_buffer.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 // Makes the current thread enter 'isolate'. | 77 // Makes the current thread enter 'isolate'. |
| 78 static void EnterIsolate(Isolate* isolate); | 78 static void EnterIsolate(Isolate* isolate); |
| 79 // Makes the current thread exit its isolate. | 79 // Makes the current thread exit its isolate. |
| 80 static void ExitIsolate(); | 80 static void ExitIsolate(); |
| 81 | 81 |
| 82 // A VM thread other than the main mutator thread can enter an isolate as a | 82 // A VM thread other than the main mutator thread can enter an isolate as a |
| 83 // "helper" to gain limited concurrent access to the isolate. One example is | 83 // "helper" to gain limited concurrent access to the isolate. One example is |
| 84 // SweeperTask (which uses the class table, which is copy-on-write). | 84 // SweeperTask (which uses the class table, which is copy-on-write). |
| 85 // TODO(koda): Properly synchronize heap access to expand allowed operations. | 85 // TODO(koda): Properly synchronize heap access to expand allowed operations. |
| 86 static void EnterIsolateAsHelper(Isolate* isolate); | 86 static void EnterIsolateAsHelper(Isolate* isolate, |
| 87 static void ExitIsolateAsHelper(); | 87 bool bypass_safepoint = false); |
| 88 static void ExitIsolateAsHelper(bool bypass_safepoint = false); |
| 88 | 89 |
| 89 // Called when the current thread transitions from mutator to collector. | 90 // Called when the current thread transitions from mutator to collector. |
| 90 // Empties the store buffer block into the isolate. | 91 // Empties the store buffer block into the isolate. |
| 91 // TODO(koda): Always run GC in separate thread. | 92 // TODO(koda): Always run GC in separate thread. |
| 92 static void PrepareForGC(); | 93 static void PrepareForGC(); |
| 93 | 94 |
| 94 #if defined(TARGET_OS_WINDOWS) | 95 #if defined(TARGET_OS_WINDOWS) |
| 95 // Clears the state of the current thread and frees the allocation. | 96 // Clears the state of the current thread and frees the allocation. |
| 96 static void CleanUp(); | 97 static void CleanUp(); |
| 97 #endif | 98 #endif |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 void set_zone(Zone* zone) { | 281 void set_zone(Zone* zone) { |
| 281 state_.zone = zone; | 282 state_.zone = zone; |
| 282 } | 283 } |
| 283 | 284 |
| 284 void set_top_exit_frame_info(uword top_exit_frame_info) { | 285 void set_top_exit_frame_info(uword top_exit_frame_info) { |
| 285 state_.top_exit_frame_info = top_exit_frame_info; | 286 state_.top_exit_frame_info = top_exit_frame_info; |
| 286 } | 287 } |
| 287 | 288 |
| 288 static void SetCurrent(Thread* current); | 289 static void SetCurrent(Thread* current); |
| 289 | 290 |
| 290 void Schedule(Isolate* isolate); | 291 void Schedule(Isolate* isolate, bool bypass_safepoint = false); |
| 291 void Unschedule(); | 292 void Unschedule(bool bypass_safepoint = false); |
| 292 | 293 |
| 293 friend class ApiZone; | 294 friend class ApiZone; |
| 294 friend class Isolate; | 295 friend class Isolate; |
| 295 friend class StackZone; | 296 friend class StackZone; |
| 296 friend class ThreadRegistry; | 297 friend class ThreadRegistry; |
| 297 DISALLOW_COPY_AND_ASSIGN(Thread); | 298 DISALLOW_COPY_AND_ASSIGN(Thread); |
| 298 }; | 299 }; |
| 299 | 300 |
| 300 } // namespace dart | 301 } // namespace dart |
| 301 | 302 |
| 302 #endif // VM_THREAD_H_ | 303 #endif // VM_THREAD_H_ |
| OLD | NEW |