[vm/tags] Reset default/current tags as thread is released.
Fixes https://github.com/dart-lang/sdk/issues/61473 TEST=ci Change-Id: I36606a38bf282ff1cae58d6c3184cc3212df29f9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/449070 Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Alexander Aprelev <aam@google.com>
This commit is contained in:
committed by
Commit Queue
parent
285b11070f
commit
1b6700115d
+9
-2
@@ -431,6 +431,8 @@ char* Dart::DartInit(const Dart_InitializeParams* params) {
|
||||
StackZone zone(T);
|
||||
HandleScope handle_scope(T);
|
||||
Object::InitNullAndBool(vm_isolate_->group());
|
||||
// Now that null is initialized properly.
|
||||
group->tag_table_ = GrowableObjectArray::null();
|
||||
vm_isolate_->isolate_group_->set_object_store(new ObjectStore());
|
||||
vm_isolate_->isolate_object_store()->Init();
|
||||
vm_isolate_->finalizers_ = GrowableObjectArray::null();
|
||||
@@ -1037,8 +1039,13 @@ ErrorPtr Dart::InitializeIsolate(Thread* T,
|
||||
I->debugger()->NotifyIsolateCreated();
|
||||
#endif
|
||||
|
||||
const UserTag& default_tag = UserTag::Handle(UserTag::DefaultTag(T));
|
||||
T->set_current_tag(default_tag);
|
||||
if (is_first_isolate_in_group) {
|
||||
// IsolateGroup tag_table was not available when isolate was first
|
||||
// created, but now it is.
|
||||
ASSERT(T->current_tag() == UserTag::null());
|
||||
const UserTag& default_tag = UserTag::Handle(UserTag::DefaultTag(T));
|
||||
T->set_current_tag(default_tag);
|
||||
}
|
||||
|
||||
I->init_loaded_prefixes_set_storage();
|
||||
|
||||
|
||||
@@ -366,6 +366,9 @@ void Thread::AssertEmptyThreadInvariants() {
|
||||
ASSERT(stack_limit_.load() == 0);
|
||||
ASSERT(safepoint_state_ == 0);
|
||||
|
||||
ASSERT(default_tag_ == UserTag::null());
|
||||
ASSERT(current_tag_ == UserTag::null());
|
||||
|
||||
// Avoid running these asserts for `vm-isolate`.
|
||||
if (active_stacktrace_.untag() != 0) {
|
||||
ASSERT(field_table_values_ == nullptr);
|
||||
@@ -434,6 +437,13 @@ void Thread::EnterIsolate(Isolate* isolate) {
|
||||
thread->ExitSafepoint();
|
||||
}
|
||||
|
||||
StackZone zone(thread);
|
||||
HANDLESCOPE(thread);
|
||||
if (group->tag_table() != GrowableObjectArray::null()) {
|
||||
const UserTag& default_tag = UserTag::Handle(UserTag::DefaultTag(thread));
|
||||
thread->set_current_tag(default_tag);
|
||||
}
|
||||
|
||||
ASSERT(!thread->IsAtSafepoint());
|
||||
}
|
||||
|
||||
@@ -764,6 +774,8 @@ void Thread::FreeActiveThread(Thread* thread,
|
||||
thread->stack_limit_.store(0);
|
||||
thread->safepoint_state_ = 0;
|
||||
thread->ResetStateLocked();
|
||||
thread->current_tag_ = UserTag::null();
|
||||
thread->default_tag_ = UserTag::null();
|
||||
|
||||
thread->AssertEmptyThreadInvariants();
|
||||
thread_registry->ReturnThreadLocked(thread);
|
||||
|
||||
Reference in New Issue
Block a user