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