File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -431,6 +431,8 @@ char* Dart::DartInit(const Dart_InitializeParams* params) {
431431 StackZone zone (T);
432432 HandleScope handle_scope (T);
433433 Object::InitNullAndBool (vm_isolate_->group ());
434+ // Now that null is initialized properly.
435+ group->tag_table_ = GrowableObjectArray::null ();
434436 vm_isolate_->isolate_group_ ->set_object_store (new ObjectStore ());
435437 vm_isolate_->isolate_object_store ()->Init ();
436438 vm_isolate_->finalizers_ = GrowableObjectArray::null ();
@@ -1037,8 +1039,13 @@ ErrorPtr Dart::InitializeIsolate(Thread* T,
10371039 I->debugger ()->NotifyIsolateCreated ();
10381040#endif
10391041
1040- const UserTag& default_tag = UserTag::Handle (UserTag::DefaultTag (T));
1041- T->set_current_tag (default_tag);
1042+ if (is_first_isolate_in_group) {
1043+ // IsolateGroup tag_table was not available when isolate was first
1044+ // created, but now it is.
1045+ ASSERT (T->current_tag () == UserTag::null ());
1046+ const UserTag& default_tag = UserTag::Handle (UserTag::DefaultTag (T));
1047+ T->set_current_tag (default_tag);
1048+ }
10421049
10431050 I->init_loaded_prefixes_set_storage ();
10441051
Original file line number Diff line number Diff line change @@ -366,6 +366,9 @@ void Thread::AssertEmptyThreadInvariants() {
366366 ASSERT (stack_limit_.load () == 0 );
367367 ASSERT (safepoint_state_ == 0 );
368368
369+ ASSERT (default_tag_ == UserTag::null ());
370+ ASSERT (current_tag_ == UserTag::null ());
371+
369372 // Avoid running these asserts for `vm-isolate`.
370373 if (active_stacktrace_.untag () != 0 ) {
371374 ASSERT (field_table_values_ == nullptr );
@@ -434,6 +437,13 @@ void Thread::EnterIsolate(Isolate* isolate) {
434437 thread->ExitSafepoint ();
435438 }
436439
440+ StackZone zone (thread);
441+ HANDLESCOPE (thread);
442+ if (group->tag_table () != GrowableObjectArray::null ()) {
443+ const UserTag& default_tag = UserTag::Handle (UserTag::DefaultTag (thread));
444+ thread->set_current_tag (default_tag);
445+ }
446+
437447 ASSERT (!thread->IsAtSafepoint ());
438448}
439449
@@ -764,6 +774,8 @@ void Thread::FreeActiveThread(Thread* thread,
764774 thread->stack_limit_ .store (0 );
765775 thread->safepoint_state_ = 0 ;
766776 thread->ResetStateLocked ();
777+ thread->current_tag_ = UserTag::null ();
778+ thread->default_tag_ = UserTag::null ();
767779
768780 thread->AssertEmptyThreadInvariants ();
769781 thread_registry->ReturnThreadLocked (thread);
You can’t perform that action at this time.
0 commit comments