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 RUNTIME_VM_ISOLATE_H_ | 5 #ifndef RUNTIME_VM_ISOLATE_H_ |
6 #define RUNTIME_VM_ISOLATE_H_ | 6 #define RUNTIME_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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 Thread* mutator_thread() const; | 216 Thread* mutator_thread() const; |
217 | 217 |
218 // Mutator thread is not scheduled if NULL or no heap is attached | 218 // Mutator thread is not scheduled if NULL or no heap is attached |
219 // to it. The latter only occurs when the mutator thread object | 219 // to it. The latter only occurs when the mutator thread object |
220 // is unscheduled by the isolate (or never scheduled). | 220 // is unscheduled by the isolate (or never scheduled). |
221 bool IsMutatorThreadScheduled() { | 221 bool IsMutatorThreadScheduled() { |
222 return mutator_thread_ != NULL && mutator_thread_->heap() != NULL; | 222 return mutator_thread_ != NULL && mutator_thread_->heap() != NULL; |
223 } | 223 } |
224 | 224 |
225 const char* name() const { return name_; } | 225 const char* name() const { return name_; } |
226 | |
227 #if !defined(PRODUCT) | |
228 const char* debugger_name() const { return debugger_name_; } | 226 const char* debugger_name() const { return debugger_name_; } |
229 void set_debugger_name(const char* name); | 227 void set_debugger_name(const char* name); |
| 228 |
230 int64_t UptimeMicros() const; | 229 int64_t UptimeMicros() const; |
231 #endif // !defined(PRODUCT) | |
232 | 230 |
233 Dart_Port main_port() const { return main_port_; } | 231 Dart_Port main_port() const { return main_port_; } |
234 void set_main_port(Dart_Port port) { | 232 void set_main_port(Dart_Port port) { |
235 ASSERT(main_port_ == 0); // Only set main port once. | 233 ASSERT(main_port_ == 0); // Only set main port once. |
236 main_port_ = port; | 234 main_port_ = port; |
237 } | 235 } |
238 Dart_Port origin_id() const { return origin_id_; } | 236 Dart_Port origin_id() const { return origin_id_; } |
239 void set_origin_id(Dart_Port id) { | 237 void set_origin_id(Dart_Port id) { |
240 ASSERT((id == main_port_ && origin_id_ == 0) || (origin_id_ == main_port_)); | 238 ASSERT((id == main_port_ && origin_id_ == 0) || (origin_id_ == main_port_)); |
241 origin_id_ = id; | 239 origin_id_ = id; |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 return shutdown_callback_; | 418 return shutdown_callback_; |
421 } | 419 } |
422 | 420 |
423 static void SetCleanupCallback(Dart_IsolateCleanupCallback cb) { | 421 static void SetCleanupCallback(Dart_IsolateCleanupCallback cb) { |
424 cleanup_callback_ = cb; | 422 cleanup_callback_ = cb; |
425 } | 423 } |
426 static Dart_IsolateCleanupCallback CleanupCallback() { | 424 static Dart_IsolateCleanupCallback CleanupCallback() { |
427 return cleanup_callback_; | 425 return cleanup_callback_; |
428 } | 426 } |
429 | 427 |
430 #if !defined(PRODUCT) | |
431 void set_object_id_ring(ObjectIdRing* ring) { object_id_ring_ = ring; } | 428 void set_object_id_ring(ObjectIdRing* ring) { object_id_ring_ = ring; } |
432 ObjectIdRing* object_id_ring() { return object_id_ring_; } | 429 ObjectIdRing* object_id_ring() { return object_id_ring_; } |
433 #endif // !defined(PRODUCT) | |
434 | 430 |
435 void AddPendingDeopt(uword fp, uword pc); | 431 void AddPendingDeopt(uword fp, uword pc); |
436 uword FindPendingDeopt(uword fp) const; | 432 uword FindPendingDeopt(uword fp) const; |
437 void ClearPendingDeoptsAtOrBelow(uword fp) const; | 433 void ClearPendingDeoptsAtOrBelow(uword fp) const; |
438 MallocGrowableArray<PendingLazyDeopt>* pending_deopts() const { | 434 MallocGrowableArray<PendingLazyDeopt>* pending_deopts() const { |
439 return pending_deopts_; | 435 return pending_deopts_; |
440 } | 436 } |
441 bool IsDeoptimizing() const { return deopt_context_ != NULL; } | 437 bool IsDeoptimizing() const { return deopt_context_ != NULL; } |
442 DeoptContext* deopt_context() const { return deopt_context_; } | 438 DeoptContext* deopt_context() const { return deopt_context_; } |
443 void set_deopt_context(DeoptContext* value) { | 439 void set_deopt_context(DeoptContext* value) { |
(...skipping 18 matching lines...) Expand all Loading... |
462 "enable_background_compiler."); | 458 "enable_background_compiler."); |
463 } | 459 } |
464 } | 460 } |
465 | 461 |
466 void disable_background_compiler() { background_compiler_disabled_depth_++; } | 462 void disable_background_compiler() { background_compiler_disabled_depth_++; } |
467 | 463 |
468 bool is_background_compiler_disabled() const { | 464 bool is_background_compiler_disabled() const { |
469 return background_compiler_disabled_depth_ > 0; | 465 return background_compiler_disabled_depth_ > 0; |
470 } | 466 } |
471 | 467 |
472 #if !defined(PRODUCT) | |
473 void UpdateLastAllocationProfileAccumulatorResetTimestamp() { | 468 void UpdateLastAllocationProfileAccumulatorResetTimestamp() { |
474 last_allocationprofile_accumulator_reset_timestamp_ = | 469 last_allocationprofile_accumulator_reset_timestamp_ = |
475 OS::GetCurrentTimeMillis(); | 470 OS::GetCurrentTimeMillis(); |
476 } | 471 } |
477 | 472 |
478 int64_t last_allocationprofile_accumulator_reset_timestamp() const { | 473 int64_t last_allocationprofile_accumulator_reset_timestamp() const { |
479 return last_allocationprofile_accumulator_reset_timestamp_; | 474 return last_allocationprofile_accumulator_reset_timestamp_; |
480 } | 475 } |
481 | 476 |
482 void UpdateLastAllocationProfileGCTimestamp() { | 477 void UpdateLastAllocationProfileGCTimestamp() { |
483 last_allocationprofile_gc_timestamp_ = OS::GetCurrentTimeMillis(); | 478 last_allocationprofile_gc_timestamp_ = OS::GetCurrentTimeMillis(); |
484 } | 479 } |
485 | 480 |
486 int64_t last_allocationprofile_gc_timestamp() const { | 481 int64_t last_allocationprofile_gc_timestamp() const { |
487 return last_allocationprofile_gc_timestamp_; | 482 return last_allocationprofile_gc_timestamp_; |
488 } | 483 } |
489 #endif // !defined(PRODUCT) | |
490 | 484 |
491 intptr_t BlockClassFinalization() { | 485 intptr_t BlockClassFinalization() { |
492 ASSERT(defer_finalization_count_ >= 0); | 486 ASSERT(defer_finalization_count_ >= 0); |
493 return defer_finalization_count_++; | 487 return defer_finalization_count_++; |
494 } | 488 } |
495 | 489 |
496 intptr_t UnblockClassFinalization() { | 490 intptr_t UnblockClassFinalization() { |
497 ASSERT(defer_finalization_count_ > 0); | 491 ASSERT(defer_finalization_count_ > 0); |
498 return defer_finalization_count_--; | 492 return defer_finalization_count_--; |
499 } | 493 } |
500 | 494 |
501 bool AllowClassFinalization() { | 495 bool AllowClassFinalization() { |
502 ASSERT(defer_finalization_count_ >= 0); | 496 ASSERT(defer_finalization_count_ >= 0); |
503 return defer_finalization_count_ == 0; | 497 return defer_finalization_count_ == 0; |
504 } | 498 } |
505 | 499 |
506 #ifndef PRODUCT | 500 #ifndef PRODUCT |
507 void PrintJSON(JSONStream* stream, bool ref = true); | 501 void PrintJSON(JSONStream* stream, bool ref = true); |
508 #endif | 502 #endif |
509 | 503 |
510 // Mutator thread is used to aggregate compiler stats. | 504 // Mutator thread is used to aggregate compiler stats. |
511 CompilerStats* aggregate_compiler_stats() { | 505 CompilerStats* aggregate_compiler_stats() { |
512 return mutator_thread()->compiler_stats(); | 506 return mutator_thread()->compiler_stats(); |
513 } | 507 } |
514 | 508 |
515 #if !defined(PRODUCT) | |
516 VMTagCounters* vm_tag_counters() { return &vm_tag_counters_; } | 509 VMTagCounters* vm_tag_counters() { return &vm_tag_counters_; } |
517 | 510 |
518 bool IsReloading() const { return reload_context_ != NULL; } | 511 bool IsReloading() const { return reload_context_ != NULL; } |
519 | 512 |
520 IsolateReloadContext* reload_context() { return reload_context_; } | 513 IsolateReloadContext* reload_context() { return reload_context_; } |
521 | 514 |
522 void DeleteReloadContext(); | 515 void DeleteReloadContext(); |
523 | 516 |
524 bool HasAttemptedReload() const { return has_attempted_reload_; } | 517 bool HasAttemptedReload() const { return has_attempted_reload_; } |
525 | 518 |
526 bool CanReload() const; | 519 bool CanReload() const; |
527 | 520 |
528 void set_last_reload_timestamp(int64_t value) { | 521 void set_last_reload_timestamp(int64_t value) { |
529 last_reload_timestamp_ = value; | 522 last_reload_timestamp_ = value; |
530 } | 523 } |
531 int64_t last_reload_timestamp() const { return last_reload_timestamp_; } | 524 int64_t last_reload_timestamp() const { return last_reload_timestamp_; } |
532 #endif // !defined(PRODUCT) | |
533 | 525 |
534 bool IsPaused() const; | 526 bool IsPaused() const; |
535 | 527 |
536 #if !defined(PRODUCT) | |
537 bool should_pause_post_service_request() const { | 528 bool should_pause_post_service_request() const { |
538 return should_pause_post_service_request_; | 529 return should_pause_post_service_request_; |
539 } | 530 } |
540 void set_should_pause_post_service_request( | 531 void set_should_pause_post_service_request( |
541 bool should_pause_post_service_request) { | 532 bool should_pause_post_service_request) { |
542 should_pause_post_service_request_ = should_pause_post_service_request; | 533 should_pause_post_service_request_ = should_pause_post_service_request; |
543 } | 534 } |
544 #endif // !defined(PRODUCT) | |
545 | 535 |
546 RawError* PausePostRequest(); | 536 RawError* PausePostRequest(); |
547 | 537 |
548 uword user_tag() const { return user_tag_; } | 538 uword user_tag() const { return user_tag_; } |
549 static intptr_t user_tag_offset() { return OFFSET_OF(Isolate, user_tag_); } | 539 static intptr_t user_tag_offset() { return OFFSET_OF(Isolate, user_tag_); } |
550 static intptr_t current_tag_offset() { | 540 static intptr_t current_tag_offset() { |
551 return OFFSET_OF(Isolate, current_tag_); | 541 return OFFSET_OF(Isolate, current_tag_); |
552 } | 542 } |
553 static intptr_t default_tag_offset() { | 543 static intptr_t default_tag_offset() { |
554 return OFFSET_OF(Isolate, default_tag_); | 544 return OFFSET_OF(Isolate, default_tag_); |
555 } | 545 } |
556 | 546 |
557 #if !defined(PRODUCT) | |
558 #define ISOLATE_METRIC_ACCESSOR(type, variable, name, unit) \ | 547 #define ISOLATE_METRIC_ACCESSOR(type, variable, name, unit) \ |
559 type* Get##variable##Metric() { return &metric_##variable##_; } | 548 type* Get##variable##Metric() { return &metric_##variable##_; } |
560 ISOLATE_METRIC_LIST(ISOLATE_METRIC_ACCESSOR); | 549 ISOLATE_METRIC_LIST(ISOLATE_METRIC_ACCESSOR); |
561 #undef ISOLATE_METRIC_ACCESSOR | 550 #undef ISOLATE_METRIC_ACCESSOR |
562 #endif // !defined(PRODUCT) | |
563 | 551 |
564 static intptr_t IsolateListLength(); | 552 static intptr_t IsolateListLength(); |
565 | 553 |
566 RawGrowableObjectArray* tag_table() const { return tag_table_; } | 554 RawGrowableObjectArray* tag_table() const { return tag_table_; } |
567 void set_tag_table(const GrowableObjectArray& value); | 555 void set_tag_table(const GrowableObjectArray& value); |
568 | 556 |
569 RawUserTag* current_tag() const { return current_tag_; } | 557 RawUserTag* current_tag() const { return current_tag_; } |
570 void set_current_tag(const UserTag& tag); | 558 void set_current_tag(const UserTag& tag); |
571 | 559 |
572 RawUserTag* default_tag() const { return default_tag_; } | 560 RawUserTag* default_tag() const { return default_tag_; } |
573 void set_default_tag(const UserTag& tag); | 561 void set_default_tag(const UserTag& tag); |
574 | 562 |
575 void set_ic_miss_code(const Code& code); | 563 void set_ic_miss_code(const Code& code); |
576 | 564 |
577 #if !defined(PRODUCT) | |
578 Metric* metrics_list_head() { return metrics_list_head_; } | 565 Metric* metrics_list_head() { return metrics_list_head_; } |
| 566 |
579 void set_metrics_list_head(Metric* metric) { metrics_list_head_ = metric; } | 567 void set_metrics_list_head(Metric* metric) { metrics_list_head_ = metric; } |
580 #endif // !defined(PRODUCT) | |
581 | 568 |
582 RawGrowableObjectArray* deoptimized_code_array() const { | 569 RawGrowableObjectArray* deoptimized_code_array() const { |
583 return deoptimized_code_array_; | 570 return deoptimized_code_array_; |
584 } | 571 } |
585 void set_deoptimized_code_array(const GrowableObjectArray& value); | 572 void set_deoptimized_code_array(const GrowableObjectArray& value); |
586 void TrackDeoptimizedCode(const Code& code); | 573 void TrackDeoptimizedCode(const Code& code); |
587 | 574 |
588 // Also sends a paused at exit event over the service protocol. | 575 // Also sends a paused at exit event over the service protocol. |
589 void SetStickyError(RawError* sticky_error); | 576 void SetStickyError(RawError* sticky_error); |
590 | 577 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 | 669 |
683 static void KillAllIsolates(LibMsgId msg_id); | 670 static void KillAllIsolates(LibMsgId msg_id); |
684 static void KillIfExists(Isolate* isolate, LibMsgId msg_id); | 671 static void KillIfExists(Isolate* isolate, LibMsgId msg_id); |
685 | 672 |
686 static void DisableIsolateCreation(); | 673 static void DisableIsolateCreation(); |
687 static void EnableIsolateCreation(); | 674 static void EnableIsolateCreation(); |
688 static bool IsolateCreationEnabled(); | 675 static bool IsolateCreationEnabled(); |
689 | 676 |
690 void StopBackgroundCompiler(); | 677 void StopBackgroundCompiler(); |
691 | 678 |
692 #if !defined(PRODUCT) | |
693 intptr_t reload_every_n_stack_overflow_checks() const { | 679 intptr_t reload_every_n_stack_overflow_checks() const { |
694 return reload_every_n_stack_overflow_checks_; | 680 return reload_every_n_stack_overflow_checks_; |
695 } | 681 } |
696 #endif // !defined(PRODUCT) | |
697 | 682 |
698 HandlerInfoCache* handler_info_cache() { return &handler_info_cache_; } | 683 HandlerInfoCache* handler_info_cache() { return &handler_info_cache_; } |
699 | 684 |
700 CatchEntryStateCache* catch_entry_state_cache() { | 685 CatchEntryStateCache* catch_entry_state_cache() { |
701 return &catch_entry_state_cache_; | 686 return &catch_entry_state_cache_; |
702 } | 687 } |
703 | 688 |
704 void MaybeIncreaseReloadEveryNStackOverflowChecks(); | 689 void MaybeIncreaseReloadEveryNStackOverflowChecks(); |
705 | 690 |
706 private: | 691 private: |
(...skipping 17 matching lines...) Expand all Loading... |
724 | 709 |
725 void ProfileIdle(); | 710 void ProfileIdle(); |
726 | 711 |
727 // Visit all object pointers. Caller must ensure concurrent sweeper is not | 712 // Visit all object pointers. Caller must ensure concurrent sweeper is not |
728 // running, and the visitor must not allocate. | 713 // running, and the visitor must not allocate. |
729 void VisitObjectPointers(ObjectPointerVisitor* visitor, bool validate_frames); | 714 void VisitObjectPointers(ObjectPointerVisitor* visitor, bool validate_frames); |
730 void VisitStackPointers(ObjectPointerVisitor* visitor, bool validate_frames); | 715 void VisitStackPointers(ObjectPointerVisitor* visitor, bool validate_frames); |
731 | 716 |
732 void set_user_tag(uword tag) { user_tag_ = tag; } | 717 void set_user_tag(uword tag) { user_tag_ = tag; } |
733 | 718 |
734 #if !defined(PRODUCT) | |
735 RawGrowableObjectArray* GetAndClearPendingServiceExtensionCalls(); | 719 RawGrowableObjectArray* GetAndClearPendingServiceExtensionCalls(); |
736 RawGrowableObjectArray* pending_service_extension_calls() const { | 720 RawGrowableObjectArray* pending_service_extension_calls() const { |
737 return pending_service_extension_calls_; | 721 return pending_service_extension_calls_; |
738 } | 722 } |
739 void set_pending_service_extension_calls(const GrowableObjectArray& value); | 723 void set_pending_service_extension_calls(const GrowableObjectArray& value); |
740 RawGrowableObjectArray* registered_service_extension_handlers() const { | 724 RawGrowableObjectArray* registered_service_extension_handlers() const { |
741 return registered_service_extension_handlers_; | 725 return registered_service_extension_handlers_; |
742 } | 726 } |
743 void set_registered_service_extension_handlers( | 727 void set_registered_service_extension_handlers( |
744 const GrowableObjectArray& value); | 728 const GrowableObjectArray& value); |
745 #endif // !defined(PRODUCT) | |
746 | 729 |
747 Monitor* threads_lock() const; | 730 Monitor* threads_lock() const; |
748 Thread* ScheduleThread(bool is_mutator, bool bypass_safepoint = false); | 731 Thread* ScheduleThread(bool is_mutator, bool bypass_safepoint = false); |
749 void UnscheduleThread(Thread* thread, | 732 void UnscheduleThread(Thread* thread, |
750 bool is_mutator, | 733 bool is_mutator, |
751 bool bypass_safepoint = false); | 734 bool bypass_safepoint = false); |
752 | 735 |
753 // DEPRECATED: Use Thread's methods instead. During migration, these default | 736 // DEPRECATED: Use Thread's methods instead. During migration, these default |
754 // to using the mutator thread (which must also be the current thread). | 737 // to using the mutator thread (which must also be the current thread). |
755 Zone* current_zone() const { | 738 Zone* current_zone() const { |
(...skipping 10 matching lines...) Expand all Loading... |
766 StoreBuffer* store_buffer_; | 749 StoreBuffer* store_buffer_; |
767 Heap* heap_; | 750 Heap* heap_; |
768 uword user_tag_; | 751 uword user_tag_; |
769 RawUserTag* current_tag_; | 752 RawUserTag* current_tag_; |
770 RawUserTag* default_tag_; | 753 RawUserTag* default_tag_; |
771 RawCode* ic_miss_code_; | 754 RawCode* ic_miss_code_; |
772 ObjectStore* object_store_; | 755 ObjectStore* object_store_; |
773 ClassTable class_table_; | 756 ClassTable class_table_; |
774 bool single_step_; | 757 bool single_step_; |
775 | 758 |
776 // Try to keep boolean fields together. | 759 ThreadRegistry* thread_registry_; |
777 bool errors_fatal_; | 760 SafepointHandler* safepoint_handler_; |
778 bool is_runnable_; | 761 Dart_MessageNotifyCallback message_notify_callback_; |
779 bool is_service_isolate_; | 762 char* name_; |
780 bool compilation_allowed_; | |
781 bool all_classes_finalized_; | |
782 bool remapping_cids_; | |
783 | |
784 // Fields that aren't needed in a product build go here with boolean flags at | |
785 // the top. | |
786 #if !defined(PRODUCT) | |
787 bool resume_request_; | |
788 bool has_attempted_reload_; // Has a reload ever been attempted? | |
789 // Should we pause in the debug message loop after this request? | |
790 bool should_pause_post_service_request_; | |
791 | |
792 char* debugger_name_; | 763 char* debugger_name_; |
793 int64_t start_time_micros_; | 764 int64_t start_time_micros_; |
794 Debugger* debugger_; | 765 Dart_Port main_port_; |
795 int64_t last_resume_timestamp_; | 766 Dart_Port origin_id_; // Isolates created by spawnFunc have some origin id. |
| 767 uint64_t pause_capability_; |
| 768 uint64_t terminate_capability_; |
| 769 bool errors_fatal_; |
| 770 void* init_callback_data_; |
| 771 Dart_EnvironmentCallback environment_callback_; |
| 772 Dart_LibraryTagHandler library_tag_handler_; |
| 773 ApiState* api_state_; |
| 774 NOT_IN_PRODUCT(Debugger* debugger_); |
| 775 NOT_IN_PRODUCT(bool resume_request_); |
| 776 NOT_IN_PRODUCT(int64_t last_resume_timestamp_); |
| 777 Random random_; |
| 778 Simulator* simulator_; |
| 779 Mutex* mutex_; // Protects compiler stats. |
| 780 Mutex* symbols_mutex_; // Protects concurrent access to the symbol table. |
| 781 Mutex* type_canonicalization_mutex_; // Protects type canonicalization. |
| 782 Mutex* constant_canonicalization_mutex_; // Protects const canonicalization. |
| 783 Mutex* megamorphic_lookup_mutex_; // Protects megamorphic table lookup. |
| 784 MessageHandler* message_handler_; |
| 785 IsolateSpawnState* spawn_state_; |
| 786 bool is_runnable_; |
| 787 Dart_GcPrologueCallback gc_prologue_callback_; |
| 788 Dart_GcEpilogueCallback gc_epilogue_callback_; |
| 789 intptr_t defer_finalization_count_; |
| 790 MallocGrowableArray<PendingLazyDeopt>* pending_deopts_; |
| 791 DeoptContext* deopt_context_; |
| 792 |
| 793 bool is_service_isolate_; |
796 | 794 |
797 // Isolate-specific flags. | 795 // Isolate-specific flags. |
| 796 #if !defined(PRODUCT) |
798 #define DECLARE_FIELD(name, isolate_flag_name, flag_name) bool name##_; | 797 #define DECLARE_FIELD(name, isolate_flag_name, flag_name) bool name##_; |
799 ISOLATE_FLAG_LIST(DECLARE_FIELD) | 798 ISOLATE_FLAG_LIST(DECLARE_FIELD) |
800 #undef DECLARE_FIELD | 799 #undef DECLARE_FIELD |
| 800 #endif // !defined(PRODUCT) |
801 | 801 |
802 // Timestamps of last operation via service. | 802 // Timestamps of last operation via service. |
803 int64_t last_allocationprofile_accumulator_reset_timestamp_; | 803 int64_t last_allocationprofile_accumulator_reset_timestamp_; |
804 int64_t last_allocationprofile_gc_timestamp_; | 804 int64_t last_allocationprofile_gc_timestamp_; |
805 | 805 |
| 806 // Ring buffer of objects assigned an id. |
| 807 ObjectIdRing* object_id_ring_; |
| 808 |
806 VMTagCounters vm_tag_counters_; | 809 VMTagCounters vm_tag_counters_; |
| 810 RawGrowableObjectArray* tag_table_; |
| 811 |
| 812 RawGrowableObjectArray* deoptimized_code_array_; |
| 813 |
| 814 RawError* sticky_error_; |
| 815 |
| 816 // Background compilation. |
| 817 BackgroundCompiler* background_compiler_; |
| 818 intptr_t background_compiler_disabled_depth_; |
807 | 819 |
808 // We use 6 list entries for each pending service extension calls. | 820 // We use 6 list entries for each pending service extension calls. |
809 enum { | 821 enum { |
810 kPendingHandlerIndex = 0, | 822 kPendingHandlerIndex = 0, |
811 kPendingMethodNameIndex, | 823 kPendingMethodNameIndex, |
812 kPendingKeysIndex, | 824 kPendingKeysIndex, |
813 kPendingValuesIndex, | 825 kPendingValuesIndex, |
814 kPendingReplyPortIndex, | 826 kPendingReplyPortIndex, |
815 kPendingIdIndex, | 827 kPendingIdIndex, |
816 kPendingEntrySize | 828 kPendingEntrySize |
817 }; | 829 }; |
818 RawGrowableObjectArray* pending_service_extension_calls_; | 830 RawGrowableObjectArray* pending_service_extension_calls_; |
819 | 831 |
820 // We use 2 list entries for each registered extension handler. | 832 // We use 2 list entries for each registered extension handler. |
821 enum { | 833 enum { |
822 kRegisteredNameIndex = 0, | 834 kRegisteredNameIndex = 0, |
823 kRegisteredHandlerIndex, | 835 kRegisteredHandlerIndex, |
824 kRegisteredEntrySize | 836 kRegisteredEntrySize |
825 }; | 837 }; |
826 RawGrowableObjectArray* registered_service_extension_handlers_; | 838 RawGrowableObjectArray* registered_service_extension_handlers_; |
827 | 839 |
828 Metric* metrics_list_head_; | 840 Metric* metrics_list_head_; |
829 | 841 |
| 842 bool compilation_allowed_; |
| 843 bool all_classes_finalized_; |
| 844 bool remapping_cids_; |
| 845 |
| 846 // Isolate list next pointer. |
| 847 Isolate* next_; |
| 848 |
830 // Used to wake the isolate when it is in the pause event loop. | 849 // Used to wake the isolate when it is in the pause event loop. |
831 Monitor* pause_loop_monitor_; | 850 Monitor* pause_loop_monitor_; |
832 | 851 |
833 #define ISOLATE_METRIC_VARIABLE(type, variable, name, unit) \ | |
834 type metric_##variable##_; | |
835 ISOLATE_METRIC_LIST(ISOLATE_METRIC_VARIABLE); | |
836 #undef ISOLATE_METRIC_VARIABLE | |
837 | |
838 intptr_t no_reload_scope_depth_; // we can only reload when this is 0. | |
839 // Per-isolate copy of FLAG_reload_every. | |
840 intptr_t reload_every_n_stack_overflow_checks_; | |
841 IsolateReloadContext* reload_context_; | |
842 int64_t last_reload_timestamp_; | |
843 // Ring buffer of objects assigned an id. | |
844 ObjectIdRing* object_id_ring_; | |
845 #endif // !defined(PRODUCT) | |
846 | |
847 // All other fields go here. | |
848 ThreadRegistry* thread_registry_; | |
849 SafepointHandler* safepoint_handler_; | |
850 Dart_MessageNotifyCallback message_notify_callback_; | |
851 char* name_; | |
852 Dart_Port main_port_; | |
853 Dart_Port origin_id_; // Isolates created by spawnFunc have some origin id. | |
854 uint64_t pause_capability_; | |
855 uint64_t terminate_capability_; | |
856 void* init_callback_data_; | |
857 Dart_EnvironmentCallback environment_callback_; | |
858 Dart_LibraryTagHandler library_tag_handler_; | |
859 ApiState* api_state_; | |
860 Random random_; | |
861 Simulator* simulator_; | |
862 Mutex* mutex_; // Protects compiler stats. | |
863 Mutex* symbols_mutex_; // Protects concurrent access to the symbol table. | |
864 Mutex* type_canonicalization_mutex_; // Protects type canonicalization. | |
865 Mutex* constant_canonicalization_mutex_; // Protects const canonicalization. | |
866 Mutex* megamorphic_lookup_mutex_; // Protects megamorphic table lookup. | |
867 MessageHandler* message_handler_; | |
868 IsolateSpawnState* spawn_state_; | |
869 Dart_GcPrologueCallback gc_prologue_callback_; | |
870 Dart_GcEpilogueCallback gc_epilogue_callback_; | |
871 intptr_t defer_finalization_count_; | |
872 MallocGrowableArray<PendingLazyDeopt>* pending_deopts_; | |
873 DeoptContext* deopt_context_; | |
874 | |
875 RawGrowableObjectArray* tag_table_; | |
876 | |
877 RawGrowableObjectArray* deoptimized_code_array_; | |
878 | |
879 RawError* sticky_error_; | |
880 | |
881 // Background compilation. | |
882 BackgroundCompiler* background_compiler_; | |
883 intptr_t background_compiler_disabled_depth_; | |
884 | |
885 // Isolate list next pointer. | |
886 Isolate* next_; | |
887 | |
888 // Invalidation generations; used to track events occurring in parallel | 852 // Invalidation generations; used to track events occurring in parallel |
889 // to background compilation. The counters may overflow, which is OK | 853 // to background compilation. The counters may overflow, which is OK |
890 // since we check for equality to detect if an event occured. | 854 // since we check for equality to detect if an event occured. |
891 intptr_t loading_invalidation_gen_; | 855 intptr_t loading_invalidation_gen_; |
892 intptr_t top_level_parsing_count_; | 856 intptr_t top_level_parsing_count_; |
893 | 857 |
894 // Protect access to boxed_field_list_. | 858 // Protect access to boxed_field_list_. |
895 Mutex* field_list_mutex_; | 859 Mutex* field_list_mutex_; |
896 // List of fields that became boxed and that trigger deoptimization. | 860 // List of fields that became boxed and that trigger deoptimization. |
897 RawGrowableObjectArray* boxed_field_list_; | 861 RawGrowableObjectArray* boxed_field_list_; |
898 | 862 |
899 // This guards spawn_count_. An isolate cannot complete shutdown and be | 863 // This guards spawn_count_. An isolate cannot complete shutdown and be |
900 // destroyed while there are child isolates in the midst of a spawn. | 864 // destroyed while there are child isolates in the midst of a spawn. |
901 Monitor* spawn_count_monitor_; | 865 Monitor* spawn_count_monitor_; |
902 intptr_t spawn_count_; | 866 intptr_t spawn_count_; |
903 | 867 |
| 868 #define ISOLATE_METRIC_VARIABLE(type, variable, name, unit) \ |
| 869 type metric_##variable##_; |
| 870 ISOLATE_METRIC_LIST(ISOLATE_METRIC_VARIABLE); |
| 871 #undef ISOLATE_METRIC_VARIABLE |
| 872 |
| 873 // Has a reload ever been attempted? |
| 874 bool has_attempted_reload_; |
| 875 intptr_t no_reload_scope_depth_; // we can only reload when this is 0. |
| 876 // Per-isolate copy of FLAG_reload_every. |
| 877 intptr_t reload_every_n_stack_overflow_checks_; |
| 878 IsolateReloadContext* reload_context_; |
| 879 int64_t last_reload_timestamp_; |
| 880 // Should we pause in the debug message loop after this request? |
| 881 bool should_pause_post_service_request_; |
| 882 |
904 HandlerInfoCache handler_info_cache_; | 883 HandlerInfoCache handler_info_cache_; |
905 CatchEntryStateCache catch_entry_state_cache_; | 884 CatchEntryStateCache catch_entry_state_cache_; |
906 | 885 |
907 static Dart_IsolateCreateCallback create_callback_; | 886 static Dart_IsolateCreateCallback create_callback_; |
908 static Dart_IsolateShutdownCallback shutdown_callback_; | 887 static Dart_IsolateShutdownCallback shutdown_callback_; |
909 static Dart_IsolateCleanupCallback cleanup_callback_; | 888 static Dart_IsolateCleanupCallback cleanup_callback_; |
910 | 889 |
911 #if !defined(PRODUCT) | 890 #if !defined(PRODUCT) |
912 static void WakePauseEventHandler(Dart_Isolate isolate); | 891 static void WakePauseEventHandler(Dart_Isolate isolate); |
913 #endif | 892 #endif |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 intptr_t* spawn_count_; | 1039 intptr_t* spawn_count_; |
1061 | 1040 |
1062 Dart_IsolateFlags isolate_flags_; | 1041 Dart_IsolateFlags isolate_flags_; |
1063 bool paused_; | 1042 bool paused_; |
1064 bool errors_are_fatal_; | 1043 bool errors_are_fatal_; |
1065 }; | 1044 }; |
1066 | 1045 |
1067 } // namespace dart | 1046 } // namespace dart |
1068 | 1047 |
1069 #endif // RUNTIME_VM_ISOLATE_H_ | 1048 #endif // RUNTIME_VM_ISOLATE_H_ |
OLD | NEW |