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 "platform/thread.h" | 10 #include "platform/thread.h" |
(...skipping 12 matching lines...) Expand all Loading... | |
23 class Debugger; | 23 class Debugger; |
24 class HandleScope; | 24 class HandleScope; |
25 class HandleVisitor; | 25 class HandleVisitor; |
26 class Heap; | 26 class Heap; |
27 class ICData; | 27 class ICData; |
28 class LongJump; | 28 class LongJump; |
29 class MessageHandler; | 29 class MessageHandler; |
30 class Mutex; | 30 class Mutex; |
31 class ObjectPointerVisitor; | 31 class ObjectPointerVisitor; |
32 class ObjectStore; | 32 class ObjectStore; |
33 class RawInstance; | |
33 class RawArray; | 34 class RawArray; |
34 class RawContext; | 35 class RawContext; |
35 class RawDouble; | 36 class RawDouble; |
36 class RawMint; | 37 class RawMint; |
37 class RawInteger; | 38 class RawInteger; |
38 class RawError; | 39 class RawError; |
39 class Simulator; | 40 class Simulator; |
40 class StackResource; | 41 class StackResource; |
41 class StackZone; | 42 class StackZone; |
42 class StubCode; | 43 class StubCode; |
44 class RawFloat32x4; | |
45 class RawUint32x4; | |
43 | 46 |
44 | 47 |
45 // Used by the deoptimization infrastructure to defer allocation of Double | 48 // Used by the deoptimization infrastructure to defer allocation of unboxed |
46 // objects until frame is fully rewritten and GC is safe. | 49 // objects until frame is fully rewritten and GC is safe. |
47 // See callers of Isolate::DeferDoubleMaterialization. | 50 // See callers of Isolate::DeferObjectMaterialization. |
48 class DeferredDouble { | 51 class DeferredObject { |
49 public: | 52 public: |
50 DeferredDouble(double value, RawDouble** slot, DeferredDouble* next) | 53 DeferredObject(RawInstance** slot, DeferredObject* next) |
51 : value_(value), slot_(slot), next_(next) { } | 54 : slot_(slot), next_(next) { } |
55 virtual ~DeferredObject() { } | |
52 | 56 |
53 double value() const { return value_; } | 57 RawInstance** slot() const { return slot_; } |
54 RawDouble** slot() const { return slot_; } | 58 DeferredObject* next() const { return next_; } |
55 DeferredDouble* next() const { return next_; } | 59 |
60 virtual void materialize() = 0; | |
srdjan
2013/03/19 20:48:45
s/materialize/Materialize/
Cutch
2013/03/19 21:48:33
Done.
| |
56 | 61 |
57 private: | 62 private: |
63 RawInstance** const slot_; | |
64 DeferredObject* const next_; | |
65 | |
66 DISALLOW_COPY_AND_ASSIGN(DeferredObject); | |
67 }; | |
68 | |
69 | |
70 class DeferredDouble : public DeferredObject { | |
71 public: | |
72 DeferredDouble(double value, RawInstance** slot, DeferredObject* next) | |
73 : DeferredObject(slot, next), value_(value) { } | |
74 virtual void materialize(); | |
75 double value() const { return value_; } | |
76 private: | |
58 const double value_; | 77 const double value_; |
59 RawDouble** const slot_; | |
60 DeferredDouble* const next_; | |
61 | 78 |
62 DISALLOW_COPY_AND_ASSIGN(DeferredDouble); | 79 DISALLOW_COPY_AND_ASSIGN(DeferredDouble); |
63 }; | 80 }; |
64 | 81 |
65 | 82 |
66 class DeferredMint { | 83 class DeferredMint : public DeferredObject { |
67 public: | 84 public: |
68 DeferredMint(int64_t value, RawMint** slot, DeferredMint* next) | 85 DeferredMint(int64_t value, RawInstance** slot, DeferredObject* next) |
69 : value_(value), slot_(slot), next_(next) { } | 86 : DeferredObject(slot, next), value_(value) { } |
87 | |
88 virtual void materialize(); | |
70 | 89 |
71 int64_t value() const { return value_; } | 90 int64_t value() const { return value_; } |
72 RawMint** slot() const { return slot_; } | |
73 DeferredMint* next() const { return next_; } | |
74 | 91 |
75 private: | 92 private: |
76 const int64_t value_; | 93 const int64_t value_; |
77 RawMint** const slot_; | |
78 DeferredMint* const next_; | |
79 | 94 |
80 DISALLOW_COPY_AND_ASSIGN(DeferredMint); | 95 DISALLOW_COPY_AND_ASSIGN(DeferredMint); |
81 }; | 96 }; |
82 | 97 |
83 | 98 |
99 class DeferredFloat32x4 : public DeferredObject { | |
100 public: | |
101 DeferredFloat32x4(simd128_value_t value, RawInstance** slot, | |
102 DeferredObject* next) | |
103 : DeferredObject(slot, next), value_(value) { } | |
104 | |
105 virtual void materialize(); | |
106 | |
107 simd128_value_t value() const { return value_; } | |
108 | |
109 private: | |
110 const simd128_value_t value_; | |
111 | |
112 DISALLOW_COPY_AND_ASSIGN(DeferredFloat32x4); | |
113 }; | |
114 | |
115 | |
116 class DeferredUint32x4 : public DeferredObject { | |
117 public: | |
118 DeferredUint32x4(simd128_value_t value, RawInstance** slot, | |
119 DeferredObject* next) | |
120 : DeferredObject(slot, next), value_(value) { } | |
121 | |
122 virtual void materialize(); | |
123 | |
124 simd128_value_t value() const { return value_; } | |
125 | |
126 private: | |
127 const simd128_value_t value_; | |
128 | |
129 DISALLOW_COPY_AND_ASSIGN(DeferredUint32x4); | |
130 }; | |
131 | |
132 | |
84 class Isolate : public BaseIsolate { | 133 class Isolate : public BaseIsolate { |
85 public: | 134 public: |
86 ~Isolate(); | 135 ~Isolate(); |
87 | 136 |
88 static inline Isolate* Current() { | 137 static inline Isolate* Current() { |
89 return reinterpret_cast<Isolate*>(Thread::GetThreadLocal(isolate_key)); | 138 return reinterpret_cast<Isolate*>(Thread::GetThreadLocal(isolate_key)); |
90 } | 139 } |
91 | 140 |
92 static void SetCurrent(Isolate* isolate); | 141 static void SetCurrent(Isolate* isolate); |
93 | 142 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
301 return file_close_callback_; | 350 return file_close_callback_; |
302 } | 351 } |
303 | 352 |
304 intptr_t* deopt_cpu_registers_copy() const { | 353 intptr_t* deopt_cpu_registers_copy() const { |
305 return deopt_cpu_registers_copy_; | 354 return deopt_cpu_registers_copy_; |
306 } | 355 } |
307 void set_deopt_cpu_registers_copy(intptr_t* value) { | 356 void set_deopt_cpu_registers_copy(intptr_t* value) { |
308 ASSERT((value == NULL) || (deopt_cpu_registers_copy_ == NULL)); | 357 ASSERT((value == NULL) || (deopt_cpu_registers_copy_ == NULL)); |
309 deopt_cpu_registers_copy_ = value; | 358 deopt_cpu_registers_copy_ = value; |
310 } | 359 } |
311 double* deopt_fpu_registers_copy() const { | 360 fpu_register_t* deopt_fpu_registers_copy() const { |
312 return deopt_fpu_registers_copy_; | 361 return deopt_fpu_registers_copy_; |
313 } | 362 } |
314 void set_deopt_fpu_registers_copy(double* value) { | 363 void set_deopt_fpu_registers_copy(fpu_register_t* value) { |
315 ASSERT((value == NULL) || (deopt_fpu_registers_copy_ == NULL)); | 364 ASSERT((value == NULL) || (deopt_fpu_registers_copy_ == NULL)); |
316 deopt_fpu_registers_copy_ = value; | 365 deopt_fpu_registers_copy_ = value; |
317 } | 366 } |
318 intptr_t* deopt_frame_copy() const { return deopt_frame_copy_; } | 367 intptr_t* deopt_frame_copy() const { return deopt_frame_copy_; } |
319 void SetDeoptFrameCopy(intptr_t* value, intptr_t size) { | 368 void SetDeoptFrameCopy(intptr_t* value, intptr_t size) { |
320 ASSERT((value == NULL) || (size > 0)); | 369 ASSERT((value == NULL) || (size > 0)); |
321 ASSERT((value == NULL) || (deopt_frame_copy_ == NULL)); | 370 ASSERT((value == NULL) || (deopt_frame_copy_ == NULL)); |
322 deopt_frame_copy_ = value; | 371 deopt_frame_copy_ = value; |
323 deopt_frame_copy_size_ = size; | 372 deopt_frame_copy_size_ = size; |
324 } | 373 } |
325 intptr_t deopt_frame_copy_size() const { return deopt_frame_copy_size_; } | 374 intptr_t deopt_frame_copy_size() const { return deopt_frame_copy_size_; } |
326 | 375 |
327 void DeferDoubleMaterialization(double value, RawDouble** slot) { | 376 void DeferDoubleMaterialization(double value, RawDouble** slot) { |
328 deferred_doubles_ = new DeferredDouble(value, slot, deferred_doubles_); | 377 deferred_objects_ = new DeferredDouble( |
378 value, | |
379 reinterpret_cast<RawInstance**>(slot), | |
380 deferred_objects_); | |
329 } | 381 } |
330 | 382 |
331 void DeferMintMaterialization(int64_t value, RawMint** slot) { | 383 void DeferMintMaterialization(int64_t value, RawMint** slot) { |
332 deferred_mints_ = new DeferredMint(value, slot, deferred_mints_); | 384 deferred_objects_ = new DeferredMint(value, |
385 reinterpret_cast<RawInstance**>(slot), | |
386 deferred_objects_); | |
333 } | 387 } |
334 | 388 |
335 DeferredDouble* DetachDeferredDoubles() { | 389 void DeferFloat32x4Materialization(simd128_value_t value, |
336 DeferredDouble* list = deferred_doubles_; | 390 RawFloat32x4** slot) { |
337 deferred_doubles_ = NULL; | 391 deferred_objects_ = new DeferredFloat32x4( |
392 value, | |
393 reinterpret_cast<RawInstance**>(slot), | |
394 deferred_objects_); | |
395 } | |
396 | |
397 void DeferUint32x4Materialization(simd128_value_t value, | |
398 RawUint32x4** slot) { | |
399 deferred_objects_ = new DeferredUint32x4( | |
400 value, | |
401 reinterpret_cast<RawInstance**>(slot), | |
402 deferred_objects_); | |
403 } | |
404 | |
405 DeferredObject* DetachDeferredObjects() { | |
406 DeferredObject* list = deferred_objects_; | |
407 deferred_objects_ = NULL; | |
338 return list; | 408 return list; |
339 } | 409 } |
340 | 410 |
341 DeferredMint* DetachDeferredMints() { | |
342 DeferredMint* list = deferred_mints_; | |
343 deferred_mints_ = NULL; | |
344 return list; | |
345 } | |
346 | |
347 static char* GetStatus(const char* request); | 411 static char* GetStatus(const char* request); |
348 | 412 |
349 private: | 413 private: |
350 Isolate(); | 414 Isolate(); |
351 | 415 |
352 void BuildName(const char* name_prefix); | 416 void BuildName(const char* name_prefix); |
353 void PrintInvokedFunctions(); | 417 void PrintInvokedFunctions(); |
354 | 418 |
355 static ThreadLocalKey isolate_key; | 419 static ThreadLocalKey isolate_key; |
356 StoreBufferBlock store_buffer_block_; | 420 StoreBufferBlock store_buffer_block_; |
(...skipping 21 matching lines...) Expand all Loading... | |
378 Mutex* mutex_; // protects stack_limit_ and saved_stack_limit_. | 442 Mutex* mutex_; // protects stack_limit_ and saved_stack_limit_. |
379 uword stack_limit_; | 443 uword stack_limit_; |
380 uword saved_stack_limit_; | 444 uword saved_stack_limit_; |
381 MessageHandler* message_handler_; | 445 MessageHandler* message_handler_; |
382 uword spawn_data_; | 446 uword spawn_data_; |
383 GcPrologueCallbacks gc_prologue_callbacks_; | 447 GcPrologueCallbacks gc_prologue_callbacks_; |
384 GcEpilogueCallbacks gc_epilogue_callbacks_; | 448 GcEpilogueCallbacks gc_epilogue_callbacks_; |
385 | 449 |
386 // Deoptimization support. | 450 // Deoptimization support. |
387 intptr_t* deopt_cpu_registers_copy_; | 451 intptr_t* deopt_cpu_registers_copy_; |
388 double* deopt_fpu_registers_copy_; | 452 fpu_register_t* deopt_fpu_registers_copy_; |
389 intptr_t* deopt_frame_copy_; | 453 intptr_t* deopt_frame_copy_; |
390 intptr_t deopt_frame_copy_size_; | 454 intptr_t deopt_frame_copy_size_; |
391 DeferredDouble* deferred_doubles_; | 455 DeferredObject* deferred_objects_; |
392 DeferredMint* deferred_mints_; | |
393 | 456 |
394 static Dart_IsolateCreateCallback create_callback_; | 457 static Dart_IsolateCreateCallback create_callback_; |
395 static Dart_IsolateInterruptCallback interrupt_callback_; | 458 static Dart_IsolateInterruptCallback interrupt_callback_; |
396 static Dart_IsolateUnhandledExceptionCallback unhandled_exception_callback_; | 459 static Dart_IsolateUnhandledExceptionCallback unhandled_exception_callback_; |
397 static Dart_IsolateShutdownCallback shutdown_callback_; | 460 static Dart_IsolateShutdownCallback shutdown_callback_; |
398 static Dart_FileOpenCallback file_open_callback_; | 461 static Dart_FileOpenCallback file_open_callback_; |
399 static Dart_FileWriteCallback file_write_callback_; | 462 static Dart_FileWriteCallback file_write_callback_; |
400 static Dart_FileCloseCallback file_close_callback_; | 463 static Dart_FileCloseCallback file_close_callback_; |
401 | 464 |
402 DISALLOW_COPY_AND_ASSIGN(Isolate); | 465 DISALLOW_COPY_AND_ASSIGN(Isolate); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
462 Isolate* new_isolate_; | 525 Isolate* new_isolate_; |
463 Isolate* saved_isolate_; | 526 Isolate* saved_isolate_; |
464 uword saved_stack_limit_; | 527 uword saved_stack_limit_; |
465 | 528 |
466 DISALLOW_COPY_AND_ASSIGN(SwitchIsolateScope); | 529 DISALLOW_COPY_AND_ASSIGN(SwitchIsolateScope); |
467 }; | 530 }; |
468 | 531 |
469 } // namespace dart | 532 } // namespace dart |
470 | 533 |
471 #endif // VM_ISOLATE_H_ | 534 #endif // VM_ISOLATE_H_ |
OLD | NEW |