From 6cfb95ce7cc95fa805a080f5608f3b9dbabc83af Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Thu, 15 Feb 2024 20:58:28 +0000 Subject: [PATCH] [standalone] Fix setting up the kernel isolate's namespace differently. TEST=ci Bug: https://github.com/dart-lang/sdk/issues/54914 Change-Id: I92b4016df7fcc81b7e2bd94e9124574c419cecfb Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352686 Reviewed-by: Siva Annamalai Commit-Queue: Ryan Macnak --- runtime/bin/main_impl.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/runtime/bin/main_impl.cc b/runtime/bin/main_impl.cc index 3684391931e3..4cd6fa46f200 100644 --- a/runtime/bin/main_impl.cc +++ b/runtime/bin/main_impl.cc @@ -153,6 +153,7 @@ static void OnExitHook(int64_t exit_code) { static Dart_Handle SetupCoreLibraries(Dart_Isolate isolate, IsolateData* isolate_data, bool is_isolate_group_start, + bool is_kernel_isolate, const char** resolved_packages_config) { auto isolate_group_data = isolate_data->isolate_group_data(); const auto packages_file = isolate_data->packages_file(); @@ -193,8 +194,7 @@ static Dart_Handle SetupCoreLibraries(Dart_Isolate isolate, Builtin::SetNativeResolver(Builtin::kCLILibrary); VmService::SetNativeResolver(); - const char* namespc = - Dart_IsKernelIsolate(isolate) ? nullptr : Options::namespc(); + const char* namespc = is_kernel_isolate ? nullptr : Options::namespc(); result = DartUtils::SetupIOLibrary(namespc, script_uri, Options::exit_disabled()); if (Dart_IsError(result)) return result; @@ -218,6 +218,7 @@ static bool OnIsolateInitialize(void** child_callback_data, char** error) { isolate_group_data->RunFromAppSnapshot(); Dart_Handle result = SetupCoreLibraries(isolate, isolate_data, /*group_start=*/false, + /*is_kernel_isolate=*/false, /*resolved_packages_config=*/nullptr); if (Dart_IsError(result)) goto failed; @@ -270,9 +271,10 @@ static Dart_Isolate IsolateSetupHelper(Dart_Isolate isolate, auto isolate_data = reinterpret_cast(Dart_IsolateData(isolate)); const char* resolved_packages_config = nullptr; - result = SetupCoreLibraries(isolate, isolate_data, - /*is_isolate_group_start=*/true, - &resolved_packages_config); + result = + SetupCoreLibraries(isolate, isolate_data, + /*is_isolate_group_start=*/true, + flags->is_kernel_isolate, &resolved_packages_config); CHECK_RESULT(result); #if !defined(DART_PRECOMPILED_RUNTIME)