[vm] Clean up bool return value for EnterIsolate methods.
Effectively these methods always succeed, so return value checking just can be source of confusion. TEST=ci Change-Id: I0a93f130b03c0f66be733c939a1d795d704291d1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423963 Commit-Queue: Alexander Aprelev <aam@google.com> Reviewed-by: Slava Egorov <vegorov@google.com>
This commit is contained in:
committed by
Commit Queue
parent
e81bc24cfb
commit
1a6755cbf4
@@ -1025,9 +1025,8 @@ class SpawnIsolateTask : public ThreadPool::Task {
|
||||
} else if (state_->isolate_group() != nullptr) {
|
||||
ASSERT(IsolateGroup::Current() == nullptr);
|
||||
const bool kBypassSafepoint = false;
|
||||
const bool result = Thread::EnterIsolateGroupAsHelper(
|
||||
state_->isolate_group(), Thread::kSpawnTask, kBypassSafepoint);
|
||||
ASSERT(result);
|
||||
Thread::EnterIsolateGroupAsHelper(state_->isolate_group(),
|
||||
Thread::kSpawnTask, kBypassSafepoint);
|
||||
state_ = nullptr;
|
||||
Thread::ExitIsolateGroupAsHelper(kBypassSafepoint);
|
||||
} else {
|
||||
|
||||
@@ -1094,9 +1094,8 @@ BackgroundCompiler::~BackgroundCompiler() {
|
||||
}
|
||||
|
||||
void BackgroundCompiler::Run() {
|
||||
bool result = Thread::EnterIsolateGroupAsHelper(
|
||||
isolate_group_, Thread::kCompilerTask, /*bypass_safepoint=*/false);
|
||||
ASSERT(result);
|
||||
Thread::EnterIsolateGroupAsHelper(isolate_group_, Thread::kCompilerTask,
|
||||
/*bypass_safepoint=*/false);
|
||||
{
|
||||
Thread* thread = Thread::Current();
|
||||
StackZone stack_zone(thread);
|
||||
|
||||
@@ -1044,9 +1044,8 @@ class ConcurrentMarkTask : public ThreadPool::Task {
|
||||
}
|
||||
|
||||
virtual void Run() {
|
||||
bool result = Thread::EnterIsolateGroupAsHelper(
|
||||
isolate_group_, Thread::kMarkerTask, /*bypass_safepoint=*/true);
|
||||
ASSERT(result);
|
||||
Thread::EnterIsolateGroupAsHelper(isolate_group_, Thread::kMarkerTask,
|
||||
/*bypass_safepoint=*/true);
|
||||
{
|
||||
TIMELINE_FUNCTION_GC_DURATION(Thread::Current(), "ConcurrentMark");
|
||||
int64_t start = OS::GetCurrentMonotonicMicros();
|
||||
|
||||
@@ -437,9 +437,8 @@ void SafepointTask::Run() {
|
||||
return;
|
||||
}
|
||||
|
||||
bool result = Thread::EnterIsolateGroupAsHelper(isolate_group_, kind_,
|
||||
/*bypass_safepoint=*/true);
|
||||
ASSERT(result);
|
||||
Thread::EnterIsolateGroupAsHelper(isolate_group_, kind_,
|
||||
/*bypass_safepoint=*/true);
|
||||
|
||||
RunEnteredIsolateGroup();
|
||||
|
||||
|
||||
@@ -176,9 +176,7 @@ class ConcurrentSweeperTask : public ThreadPool::Task {
|
||||
}
|
||||
|
||||
virtual void Run() {
|
||||
bool result = Thread::EnterIsolateGroupAsNonMutator(isolate_group_,
|
||||
Thread::kSweeperTask);
|
||||
ASSERT(result);
|
||||
Thread::EnterIsolateGroupAsNonMutator(isolate_group_, Thread::kSweeperTask);
|
||||
PageSpace* old_space = isolate_group_->heap()->old_space();
|
||||
{
|
||||
Thread* thread = Thread::Current();
|
||||
|
||||
@@ -1804,9 +1804,8 @@ class EnterIsolateGroupScope {
|
||||
explicit EnterIsolateGroupScope(IsolateGroup* isolate_group)
|
||||
: isolate_group_(isolate_group) {
|
||||
ASSERT(IsolateGroup::Current() == nullptr);
|
||||
const bool result = Thread::EnterIsolateGroupAsHelper(
|
||||
isolate_group_, Thread::kUnknownTask, /*bypass_safepoint=*/false);
|
||||
ASSERT(result);
|
||||
Thread::EnterIsolateGroupAsHelper(isolate_group_, Thread::kUnknownTask,
|
||||
/*bypass_safepoint=*/false);
|
||||
}
|
||||
|
||||
~EnterIsolateGroupScope() {
|
||||
|
||||
+13
-19
@@ -482,22 +482,19 @@ void Thread::ExitIsolate(bool isolate_shutdown) {
|
||||
}
|
||||
}
|
||||
|
||||
bool Thread::EnterIsolateGroupAsHelper(IsolateGroup* isolate_group,
|
||||
void Thread::EnterIsolateGroupAsHelper(IsolateGroup* isolate_group,
|
||||
TaskKind kind,
|
||||
bool bypass_safepoint) {
|
||||
Thread* thread = AddActiveThread(isolate_group, /*isolate=*/nullptr,
|
||||
/*is_dart_mutator=*/false, bypass_safepoint);
|
||||
if (thread != nullptr) {
|
||||
thread->SetupState(kind);
|
||||
// Even if [bypass_safepoint] is true, a thread may need mutator state (e.g.
|
||||
// parallel scavenger threads write to the [Thread]s storebuffer)
|
||||
thread->SetupMutatorState(kind);
|
||||
ResumeThreadInternal(thread);
|
||||
RELEASE_ASSERT(thread != nullptr);
|
||||
thread->SetupState(kind);
|
||||
// Even if [bypass_safepoint] is true, a thread may need mutator state (e.g.
|
||||
// parallel scavenger threads write to the [Thread]s storebuffer)
|
||||
thread->SetupMutatorState(kind);
|
||||
ResumeThreadInternal(thread);
|
||||
|
||||
thread->AssertNonDartMutatorInvariants();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
thread->AssertNonDartMutatorInvariants();
|
||||
}
|
||||
|
||||
void Thread::ExitIsolateGroupAsHelper(bool bypass_safepoint) {
|
||||
@@ -513,19 +510,16 @@ void Thread::ExitIsolateGroupAsHelper(bool bypass_safepoint) {
|
||||
bypass_safepoint);
|
||||
}
|
||||
|
||||
bool Thread::EnterIsolateGroupAsNonMutator(IsolateGroup* isolate_group,
|
||||
void Thread::EnterIsolateGroupAsNonMutator(IsolateGroup* isolate_group,
|
||||
TaskKind kind) {
|
||||
Thread* thread =
|
||||
AddActiveThread(isolate_group, /*isolate=*/nullptr,
|
||||
/*is_dart_mutator=*/false, /*bypass_safepoint=*/true);
|
||||
if (thread != nullptr) {
|
||||
thread->SetupState(kind);
|
||||
ResumeThreadInternal(thread);
|
||||
ASSERT(thread != nullptr);
|
||||
thread->SetupState(kind);
|
||||
ResumeThreadInternal(thread);
|
||||
|
||||
thread->AssertNonMutatorInvariants();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
thread->AssertNonMutatorInvariants();
|
||||
}
|
||||
|
||||
void Thread::ExitIsolateGroupAsNonMutator() {
|
||||
|
||||
+2
-2
@@ -387,12 +387,12 @@ class Thread : public ThreadState {
|
||||
// Makes the current thread exit its isolate.
|
||||
static void ExitIsolate(bool isolate_shutdown = false);
|
||||
|
||||
static bool EnterIsolateGroupAsHelper(IsolateGroup* isolate_group,
|
||||
static void EnterIsolateGroupAsHelper(IsolateGroup* isolate_group,
|
||||
TaskKind kind,
|
||||
bool bypass_safepoint);
|
||||
static void ExitIsolateGroupAsHelper(bool bypass_safepoint);
|
||||
|
||||
static bool EnterIsolateGroupAsNonMutator(IsolateGroup* isolate_group,
|
||||
static void EnterIsolateGroupAsNonMutator(IsolateGroup* isolate_group,
|
||||
TaskKind kind);
|
||||
static void ExitIsolateGroupAsNonMutator();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user