[vm] Identify the vm isolate etc by construction not by name.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/54855
Change-Id: I31699c4343822e99a8fa275ba00dcdfa51cdd06b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351220
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
This commit is contained in:
Ryan Macnak 2024-02-13 23:32:01 +00:00 committed by Commit Queue
parent 0ae2ac1277
commit 48cbd9b322
14 changed files with 91 additions and 101 deletions

View file

@ -129,6 +129,7 @@ static Dart_Isolate CreateAndSetupServiceIsolate(const char* script_uri,
RELEASE_ASSERT(kernel_buffer != nullptr);
flags->load_vmservice_library = true;
flags->is_service_isolate = true;
isolate_group_data->SetKernelBufferUnowned(
const_cast<uint8_t*>(kernel_buffer), kernel_buffer_size);
isolate = Dart_CreateIsolateGroupFromKernel(

View file

@ -580,7 +580,7 @@ DART_EXPORT const char* Dart_VersionString(void);
* for each part.
*/
#define DART_FLAGS_CURRENT_VERSION (0x0000000c)
#define DART_FLAGS_CURRENT_VERSION (0x0000000d)
typedef struct {
int32_t version;
@ -592,6 +592,8 @@ typedef struct {
bool copy_parent_code;
bool null_safety;
bool is_system_isolate;
bool is_service_isolate;
bool is_kernel_isolate;
bool snapshot_is_dontneed_safe;
bool branch_coverage;
} Dart_IsolateFlags;

View file

@ -95,7 +95,7 @@ DEFINE_NATIVE_ENTRY(Developer_registerExtension, 0, 2) {
// service isolate. This can happen, for example, because the
// service isolate uses dart:io. If we decide that we want to start
// supporting this in the future, it will take some work.
if (!ServiceIsolate::IsServiceIsolateDescendant(isolate)) {
if (!isolate->is_service_isolate()) {
isolate->RegisterServiceExtensionHandler(name, handler);
}
return Object::null();

View file

@ -0,0 +1,18 @@
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// https://github.com/dart-lang/sdk/issues/54855
// The VM should not confuse these for the actual VM isolate, etc.
import "dart:isolate";
child(_) {
new RawReceivePort(); // Keep alive.
}
main() {
Isolate.spawn(child, null, debugName: "vm-isolate");
Isolate.spawn(child, null, debugName: "vm-service");
Isolate.spawn(child, null, debugName: "kernel-service");
}

View file

@ -376,7 +376,8 @@ char* Dart::DartInit(const Dart_InitializeParams* params) {
params->vm_snapshot_instructions, nullptr, -1, api_flags));
// ObjectStore should be created later, after null objects are initialized.
auto group = new IsolateGroup(std::move(source), /*embedder_data=*/nullptr,
/*object_store=*/nullptr, api_flags);
/*object_store=*/nullptr, api_flags,
/*is_vm_isolate*/ true);
group->CreateHeap(/*is_vm_isolate=*/true,
/*is_service_or_kernel_isolate=*/false);
IsolateGroup::RegisterIsolateGroup(group);
@ -1172,11 +1173,6 @@ void Dart::ShutdownIsolate(Thread* T) {
T->isolate()->Shutdown();
}
bool Dart::VmIsolateNameEquals(const char* name) {
ASSERT(name != nullptr);
return (strcmp(name, kVmIsolateName) == 0);
}
int64_t Dart::UptimeMicros() {
return OS::GetCurrentMonotonicMicros() - Dart::start_time_micros_;
}

View file

@ -71,7 +71,6 @@ class Dart : public AllStatic {
return vm_isolate_->group();
}
static ThreadPool* thread_pool() { return thread_pool_; }
static bool VmIsolateNameEquals(const char* name);
static int64_t UptimeMicros();
static int64_t UptimeMillis() {

View file

@ -1311,20 +1311,6 @@ static Dart_Isolate CreateIsolate(IsolateGroup* group,
return static_cast<Dart_Isolate>(nullptr);
}
static bool IsServiceOrKernelIsolateName(const char* name) {
if (ServiceIsolate::NameEquals(name)) {
ASSERT(!ServiceIsolate::Exists());
return true;
}
#if !defined(DART_PRECOMPILED_RUNTIME)
if (KernelIsolate::NameEquals(name)) {
ASSERT(!KernelIsolate::Exists());
return true;
}
#endif // !defined(DART_PRECOMPILED_RUNTIME)
return false;
}
Isolate* CreateWithinExistingIsolateGroup(IsolateGroup* group,
const char* name,
char** error) {
@ -1369,9 +1355,11 @@ Dart_CreateIsolateGroup(const char* script_uri,
std::unique_ptr<IsolateGroupSource> source(
new IsolateGroupSource(script_uri, non_null_name, snapshot_data,
snapshot_instructions, nullptr, -1, *flags));
auto group = new IsolateGroup(std::move(source), isolate_group_data, *flags);
auto group = new IsolateGroup(std::move(source), isolate_group_data, *flags,
/*is_vm_isolate=*/false);
group->CreateHeap(
/*is_vm_isolate=*/false, IsServiceOrKernelIsolateName(non_null_name));
/*is_vm_isolate=*/false,
flags->is_service_isolate || flags->is_kernel_isolate);
IsolateGroup::RegisterIsolateGroup(group);
Dart_Isolate isolate = CreateIsolate(group, /*is_new_group=*/true,
non_null_name, isolate_data, error);
@ -1402,10 +1390,12 @@ Dart_CreateIsolateGroupFromKernel(const char* script_uri,
std::shared_ptr<IsolateGroupSource> source(
new IsolateGroupSource(script_uri, non_null_name, nullptr, nullptr,
kernel_buffer, kernel_buffer_size, *flags));
auto group = new IsolateGroup(source, isolate_group_data, *flags);
auto group = new IsolateGroup(source, isolate_group_data, *flags,
/*is_vm_isolate=*/false);
IsolateGroup::RegisterIsolateGroup(group);
group->CreateHeap(
/*is_vm_isolate=*/false, IsServiceOrKernelIsolateName(non_null_name));
/*is_vm_isolate=*/false,
flags->is_service_isolate || flags->is_kernel_isolate);
Dart_Isolate isolate = CreateIsolate(group, /*is_new_group=*/true,
non_null_name, isolate_data, error);
if (isolate != nullptr) {
@ -6170,7 +6160,7 @@ DART_EXPORT bool Dart_IsKernelIsolate(Dart_Isolate isolate) {
return false;
#else
Isolate* iso = reinterpret_cast<Isolate*>(isolate);
return KernelIsolate::IsKernelIsolate(iso);
return iso->is_kernel_isolate();
#endif
}
@ -6283,7 +6273,7 @@ DART_EXPORT bool Dart_DetectNullSafety(const char* script_uri,
DART_EXPORT bool Dart_IsServiceIsolate(Dart_Isolate isolate) {
Isolate* iso = reinterpret_cast<Isolate*>(isolate);
return ServiceIsolate::IsServiceIsolate(iso);
return iso->is_service_isolate();
}
DART_EXPORT void Dart_RegisterIsolateServiceRequestCallback(

View file

@ -325,11 +325,13 @@ void MutatorThreadPool::NotifyIdle() {
IsolateGroup::IsolateGroup(std::shared_ptr<IsolateGroupSource> source,
void* embedder_data,
ObjectStore* object_store,
Dart_IsolateFlags api_flags)
Dart_IsolateFlags api_flags,
bool is_vm_isolate)
: class_table_(nullptr),
cached_class_table_table_(nullptr),
object_store_(object_store),
class_table_allocator_(),
is_vm_isolate_(is_vm_isolate),
embedder_data_(embedder_data),
thread_pool_(),
isolates_lock_(new SafepointRwLock()),
@ -384,7 +386,6 @@ IsolateGroup::IsolateGroup(std::shared_ptr<IsolateGroupSource> source,
#endif
{
FlagsCopyFrom(api_flags);
const bool is_vm_isolate = Dart::VmIsolateNameEquals(source_->name);
if (!is_vm_isolate) {
thread_pool_.reset(
new MutatorThreadPool(this, FLAG_disable_thread_pool_limit
@ -406,8 +407,13 @@ IsolateGroup::IsolateGroup(std::shared_ptr<IsolateGroupSource> source,
IsolateGroup::IsolateGroup(std::shared_ptr<IsolateGroupSource> source,
void* embedder_data,
Dart_IsolateFlags api_flags)
: IsolateGroup(source, embedder_data, new ObjectStore(), api_flags) {
Dart_IsolateFlags api_flags,
bool is_vm_isolate)
: IsolateGroup(source,
embedder_data,
new ObjectStore(),
api_flags,
is_vm_isolate) {
if (object_store() != nullptr) {
object_store()->InitStubs();
}
@ -477,8 +483,6 @@ void IsolateGroup::CreateHeap(bool is_vm_isolate,
: FLAG_old_gen_heap_size) *
MBInWords);
is_vm_isolate_heap_ = is_vm_isolate;
#define ISOLATE_GROUP_METRIC_CONSTRUCTORS(type, variable, name, unit) \
metric_##variable##_.InitInstance(this, name, nullptr, Metric::unit);
ISOLATE_GROUP_METRIC_LIST(ISOLATE_GROUP_METRIC_CONSTRUCTORS)
@ -503,8 +507,7 @@ void IsolateGroup::Shutdown() {
// pool can trigger idle notification, which can start new GC tasks).
//
// (The vm-isolate doesn't have a thread pool.)
const bool is_vm_isolate = Dart::VmIsolateNameEquals(source()->name);
if (!is_vm_isolate) {
if (!is_vm_isolate_) {
ASSERT(thread_pool_ != nullptr);
thread_pool_->Shutdown();
thread_pool_.reset();
@ -529,7 +532,7 @@ void IsolateGroup::Shutdown() {
// If the creation of the isolate group (or the first isolate within the
// isolate group) failed, we do not invoke the cleanup callback (the
// embedder is responsible for handling the creation error).
if (initial_spawn_successful_ && !is_vm_isolate) {
if (initial_spawn_successful_ && !is_vm_isolate_) {
auto group_shutdown_callback = Isolate::GroupCleanupCallback();
if (group_shutdown_callback != nullptr) {
group_shutdown_callback(embedder_data());
@ -712,7 +715,7 @@ bool IsolateGroup::HasApplicationIsolateGroups() {
bool IsolateGroup::HasOnlyVMIsolateGroup() {
ReadRwLocker wl(ThreadState::Current(), isolate_groups_rwlock_);
for (auto group : *isolate_groups_) {
if (!Dart::VmIsolateNameEquals(group->source()->name)) {
if (!group->is_vm_isolate()) {
return false;
}
}
@ -1537,6 +1540,8 @@ void IsolateGroup::FlagsInitialize(Dart_IsolateFlags* api_flags) {
BOOL_ISOLATE_GROUP_FLAG_LIST(INIT_FROM_FLAG)
#undef INIT_FROM_FLAG
api_flags->copy_parent_code = false;
api_flags->is_service_isolate = false;
api_flags->is_kernel_isolate = false;
}
void IsolateGroup::FlagsCopyTo(Dart_IsolateFlags* api_flags) {
@ -1546,6 +1551,8 @@ void IsolateGroup::FlagsCopyTo(Dart_IsolateFlags* api_flags) {
BOOL_ISOLATE_GROUP_FLAG_LIST(INIT_FROM_FIELD)
#undef INIT_FROM_FIELD
api_flags->copy_parent_code = false;
api_flags->is_service_isolate = false;
api_flags->is_kernel_isolate = false;
}
void IsolateGroup::FlagsCopyFrom(const Dart_IsolateFlags& api_flags) {
@ -1586,6 +1593,8 @@ void Isolate::FlagsInitialize(Dart_IsolateFlags* api_flags) {
BOOL_ISOLATE_FLAG_LIST(INIT_FROM_FLAG)
#undef INIT_FROM_FLAG
api_flags->copy_parent_code = false;
api_flags->is_service_isolate = false;
api_flags->is_kernel_isolate = false;
}
void Isolate::FlagsCopyTo(Dart_IsolateFlags* api_flags) const {
@ -1597,6 +1606,8 @@ void Isolate::FlagsCopyTo(Dart_IsolateFlags* api_flags) const {
BOOL_ISOLATE_FLAG_LIST(INIT_FROM_FIELD)
#undef INIT_FROM_FIELD
api_flags->copy_parent_code = false;
api_flags->is_service_isolate = false;
api_flags->is_kernel_isolate = false;
}
void Isolate::FlagsCopyFrom(const Dart_IsolateFlags& api_flags) {
@ -1760,6 +1771,7 @@ Isolate* Isolate::InitIsolate(const char* name_prefix,
const Dart_IsolateFlags& api_flags,
bool is_vm_isolate) {
Isolate* result = new Isolate(isolate_group, api_flags);
result->set_is_vm_isolate(is_vm_isolate);
result->BuildName(name_prefix);
if (!is_vm_isolate) {
// vm isolate object store is initialized later, after null instance
@ -1817,11 +1829,11 @@ Isolate* Isolate::InitIsolate(const char* name_prefix,
// to vm-isolate objects, e.g. null)
isolate_group->RegisterIsolate(result);
if (ServiceIsolate::NameEquals(name_prefix)) {
if (api_flags.is_service_isolate) {
ASSERT(!ServiceIsolate::Exists());
ServiceIsolate::SetServiceIsolate(result);
#if !defined(DART_PRECOMPILED_RUNTIME)
} else if (KernelIsolate::NameEquals(name_prefix)) {
} else if (api_flags.is_kernel_isolate) {
ASSERT(!KernelIsolate::Exists());
KernelIsolate::SetKernelIsolate(result);
#endif // !defined(DART_PRECOMPILED_RUNTIME)
@ -2537,11 +2549,11 @@ void Isolate::Shutdown() {
void Isolate::LowLevelCleanup(Isolate* isolate) {
#if !defined(DART_PRECOMPILED_RUNTIME)
if (KernelIsolate::IsKernelIsolate(isolate)) {
if (isolate->is_kernel_isolate()) {
KernelIsolate::SetKernelIsolate(nullptr);
}
#endif
if (ServiceIsolate::IsServiceIsolate(isolate)) {
if (isolate->is_service_isolate()) {
ServiceIsolate::SetServiceIsolate(nullptr);
}
@ -2674,7 +2686,7 @@ void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor,
if (debugger() != nullptr) {
debugger()->VisitObjectPointers(visitor);
}
if (ServiceIsolate::IsServiceIsolate(this)) {
if (is_service_isolate()) {
ServiceIsolate::VisitObjectPointers(visitor);
}
#endif // !defined(PRODUCT)
@ -3527,7 +3539,7 @@ bool IsolateGroup::IsSystemIsolateGroup(const IsolateGroup* group) {
bool Isolate::IsVMInternalIsolate(const Isolate* isolate) {
return isolate->is_kernel_isolate() || isolate->is_service_isolate() ||
(Dart::vm_isolate() == isolate);
isolate->is_vm_isolate();
}
void Isolate::KillLocked(LibMsgId msg_id) {

View file

@ -156,7 +156,10 @@ typedef FixedCache<intptr_t, CatchEntryMovesRefPtr, 16> CatchEntryMovesCache;
#define BOOL_ISOLATE_FLAG_LIST_DEFAULT_GETTER(V) \
V(PRODUCT, copy_parent_code, CopyParentCode, copy_parent_code, false) \
V(PRODUCT, is_system_isolate, IsSystemIsolate, is_system_isolate, false)
V(NONPRODUCT, is_system_isolate, IsSystemIsolate, is_system_isolate, false) \
V(NONPRODUCT, is_service_isolate, IsServiceIsolate, is_service_isolate, \
false) \
V(NONPRODUCT, is_kernel_isolate, IsKernelIsolate, is_kernel_isolate, false)
// List of Isolate flags with custom getters named #name().
//
@ -280,10 +283,12 @@ class IsolateGroup : public IntrusiveDListEntry<IsolateGroup> {
IsolateGroup(std::shared_ptr<IsolateGroupSource> source,
void* embedder_data,
ObjectStore* object_store,
Dart_IsolateFlags api_flags);
Dart_IsolateFlags api_flags,
bool is_vm_isolate);
IsolateGroup(std::shared_ptr<IsolateGroupSource> source,
void* embedder_data,
Dart_IsolateFlags api_flags);
Dart_IsolateFlags api_flags,
bool is_vm_isolate);
~IsolateGroup();
void RehashConstants(Become* become);
@ -295,6 +300,7 @@ class IsolateGroup : public IntrusiveDListEntry<IsolateGroup> {
std::shared_ptr<IsolateGroupSource> shareable_source() const {
return source_;
}
bool is_vm_isolate() const { return is_vm_isolate_; }
void* embedder_data() const { return embedder_data_; }
bool initial_spawn_successful() { return initial_spawn_successful_; }
@ -819,7 +825,7 @@ class IsolateGroup : public IntrusiveDListEntry<IsolateGroup> {
const char** obfuscation_map_ = nullptr;
bool is_vm_isolate_heap_ = false;
bool is_vm_isolate_ = false;
void* embedder_data_ = nullptr;
IdleTimeHandler idle_time_handler_;
@ -1363,18 +1369,9 @@ class Isolate : public BaseIsolate, public IntrusiveDListEntry<Isolate> {
void PauseEventHandler();
#endif
bool is_service_isolate() const {
return LoadIsolateFlagsBit<IsServiceIsolateBit>();
}
void set_is_service_isolate(bool value) {
UpdateIsolateFlagsBit<IsServiceIsolateBit>(value);
}
bool is_kernel_isolate() const {
return LoadIsolateFlagsBit<IsKernelIsolateBit>();
}
void set_is_kernel_isolate(bool value) {
UpdateIsolateFlagsBit<IsKernelIsolateBit>(value);
bool is_vm_isolate() const { return LoadIsolateFlagsBit<IsVMIsolateBit>(); }
void set_is_vm_isolate(bool value) {
UpdateIsolateFlagsBit<IsVMIsolateBit>(value);
}
bool is_service_registered() const {
@ -1564,6 +1561,7 @@ class Isolate : public BaseIsolate, public IntrusiveDListEntry<Isolate> {
#define ISOLATE_FLAG_BITS(V) \
V(ErrorsFatal) \
V(IsRunnable) \
V(IsVMIsolate) \
V(IsServiceIsolate) \
V(IsKernelIsolate) \
V(ResumeRequest) \

View file

@ -70,6 +70,7 @@ class RunKernelTask : public ThreadPool::Task {
api_flags.enable_asserts = false;
api_flags.null_safety = true;
api_flags.is_system_isolate = true;
api_flags.is_kernel_isolate = true;
#if !defined(DART_PRECOMPILER)
api_flags.use_field_guards = true;
#endif
@ -106,7 +107,7 @@ class RunKernelTask : public ThreadPool::Task {
}
// isolate_ was set as side effect of create callback.
ASSERT(KernelIsolate::IsKernelIsolate(isolate));
ASSERT(isolate->is_kernel_isolate());
isolate->message_handler()->Run(isolate->group()->thread_pool(), nullptr,
ShutdownIsolate,
@ -127,7 +128,7 @@ class RunKernelTask : public ThreadPool::Task {
HandleScope handle_scope(T);
auto I = T->isolate();
ASSERT(KernelIsolate::IsKernelIsolate(I));
ASSERT(I->is_kernel_isolate());
// Print the error if there is one. This may execute dart code to
// print the exception object, so we need to use a StartIsolateScope.
@ -261,7 +262,7 @@ void KernelIsolate::InitCallback(Isolate* I) {
Thread* T = Thread::Current();
ASSERT(I == T->isolate());
ASSERT(I != nullptr);
if (!NameEquals(I->name())) {
if (!I->is_kernel_isolate()) {
// Not kernel isolate.
return;
}
@ -273,21 +274,11 @@ void KernelIsolate::InitCallback(Isolate* I) {
SetKernelIsolate(I);
}
bool KernelIsolate::IsKernelIsolate(const Isolate* isolate) {
MonitorLocker ml(monitor_);
return isolate == isolate_;
}
bool KernelIsolate::IsRunning() {
MonitorLocker ml(monitor_);
return (kernel_port_ != ILLEGAL_PORT) && (isolate_ != nullptr);
}
bool KernelIsolate::NameEquals(const char* name) {
ASSERT(name != nullptr);
return (strcmp(name, DART_KERNEL_ISOLATE_NAME) == 0);
}
bool KernelIsolate::Exists() {
MonitorLocker ml(monitor_);
return isolate_ != nullptr;
@ -295,9 +286,7 @@ bool KernelIsolate::Exists() {
void KernelIsolate::SetKernelIsolate(Isolate* isolate) {
MonitorLocker ml(monitor_);
if (isolate != nullptr) {
isolate->set_is_kernel_isolate(true);
}
ASSERT(isolate == nullptr || isolate->is_kernel_isolate());
isolate_ = isolate;
ml.NotifyAll();
}

View file

@ -49,10 +49,8 @@ class KernelIsolate : public AllStatic {
static bool Start();
static void Shutdown();
static bool NameEquals(const char* name);
static bool Exists();
static bool IsRunning();
static bool IsKernelIsolate(const Isolate* isolate);
static Dart_Port WaitForKernelPort();
static Dart_Port KernelPort() { return kernel_port_; }
@ -135,7 +133,6 @@ class KernelIsolate : public AllStatic {
public:
static bool IsRunning() { return false; }
static void Shutdown() {}
static bool IsKernelIsolate(const Isolate* isolate) { return false; }
static void NotifyAboutIsolateGroupShutdown(
const IsolateGroup* isolate_group) {}
static bool GetExperimentalFlag(const char* value) { return false; }

View file

@ -5235,8 +5235,7 @@ class SystemServiceIsolateVisitor : public IsolateVisitor {
virtual ~SystemServiceIsolateVisitor() {}
void VisitIsolate(Isolate* isolate) {
if (IsSystemIsolate(isolate) &&
!Dart::VmIsolateNameEquals(isolate->name())) {
if (IsSystemIsolate(isolate) && !isolate->is_vm_isolate()) {
jsarr_->AddValue(isolate);
}
}
@ -5320,7 +5319,7 @@ void Service::PrintJSONForVM(JSONStream* js, bool ref) {
JSONArray jsarr_isolate_groups(&jsobj, "systemIsolateGroups");
IsolateGroup::ForEach([&jsarr_isolate_groups](IsolateGroup* isolate_group) {
// Don't surface the vm-isolate since it's not a "real" isolate.
if (Dart::VmIsolateNameEquals(isolate_group->source()->name)) {
if (isolate_group->is_vm_isolate()) {
return;
}
if (isolate_group->is_system_isolate_group()) {

View file

@ -139,11 +139,6 @@ void ServiceIsolate::SetServerAddress(const char* address) {
server_address_ = Utils::StrDup(address);
}
bool ServiceIsolate::NameEquals(const char* name) {
ASSERT(name != nullptr);
return strcmp(name, kName) == 0;
}
bool ServiceIsolate::Exists() {
MonitorLocker ml(monitor_);
return isolate_ != nullptr;
@ -154,11 +149,6 @@ bool ServiceIsolate::IsRunning() {
return (port_ != ILLEGAL_PORT) && (isolate_ != nullptr);
}
bool ServiceIsolate::IsServiceIsolate(const Isolate* isolate) {
MonitorLocker ml(monitor_);
return isolate != nullptr && isolate == isolate_;
}
bool ServiceIsolate::IsServiceIsolateDescendant(Isolate* isolate) {
MonitorLocker ml(monitor_);
return isolate->origin_id() == origin_;
@ -234,7 +224,7 @@ bool ServiceIsolate::SendIsolateStartupMessage() {
}
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
if (Dart::VmIsolateNameEquals(isolate->name())) {
if (isolate->is_vm_isolate()) {
return false;
}
@ -257,7 +247,7 @@ bool ServiceIsolate::SendIsolateShutdownMessage() {
}
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
if (Dart::VmIsolateNameEquals(isolate->name())) {
if (isolate->is_vm_isolate()) {
return false;
}
@ -306,7 +296,7 @@ void ServiceIsolate::SetServiceIsolate(Isolate* isolate) {
MonitorLocker ml(monitor_);
isolate_ = isolate;
if (isolate_ != nullptr) {
isolate_->set_is_service_isolate(true);
ASSERT(isolate->is_service_isolate());
origin_ = isolate_->origin_id();
}
}
@ -316,7 +306,7 @@ void ServiceIsolate::MaybeMakeServiceIsolate(Isolate* I) {
ASSERT(I == T->isolate());
ASSERT(I != nullptr);
ASSERT(I->name() != nullptr);
if (!ServiceIsolate::NameEquals(I->name())) {
if (!I->is_service_isolate()) {
// Not service isolate.
return;
}
@ -369,6 +359,7 @@ class RunServiceTask : public ThreadPool::Task {
Dart_IsolateFlags api_flags;
Isolate::FlagsInitialize(&api_flags);
api_flags.is_system_isolate = true;
api_flags.is_service_isolate = true;
isolate = reinterpret_cast<Isolate*>(
create_group_callback(ServiceIsolate::kName, ServiceIsolate::kName,
nullptr, nullptr, &api_flags, nullptr, &error));
@ -424,7 +415,7 @@ class RunServiceTask : public ThreadPool::Task {
HandleScope handle_scope(T);
auto I = T->isolate();
ASSERT(ServiceIsolate::IsServiceIsolate(I));
ASSERT(I->is_service_isolate());
// Print the error if there is one. This may execute dart code to
// print the exception object, so we need to use a StartIsolateScope.
@ -606,7 +597,7 @@ void ServiceIsolate::RegisterRunningIsolates(
auto thread = Thread::Current();
auto zone = thread->zone();
ASSERT(ServiceIsolate::IsServiceIsolate(thread->isolate()));
ASSERT(thread->isolate()->is_service_isolate());
// Obtain "_registerIsolate" function to call.
const String& library_url = Symbols::DartVMService();

View file

@ -22,7 +22,6 @@ class ServiceIsolate : public AllStatic {
public:
static const char* kName;
static bool NameEquals(const char* name);
static bool Exists();
static bool IsRunning();
@ -104,7 +103,6 @@ class ServiceIsolate : public AllStatic {
#else
public:
static bool NameEquals(const char* name) { return false; }
static bool Exists() { return false; }
static bool IsRunning() { return false; }
static bool IsServiceIsolate(const Isolate* isolate) { return false; }