Skip to content

Commit

Permalink
[standalone] Fix setting up the kernel isolate's namespace differently.
Browse files Browse the repository at this point in the history
TEST=ci
Bug: #54914
Change-Id: I92b4016df7fcc81b7e2bd94e9124574c419cecfb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352686
Reviewed-by: Siva Annamalai <[email protected]>
Commit-Queue: Ryan Macnak <[email protected]>
  • Loading branch information
rmacnak-google authored and Commit Queue committed Feb 15, 2024
1 parent 6b6f782 commit 6cfb95c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions runtime/bin/main_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -270,9 +271,10 @@ static Dart_Isolate IsolateSetupHelper(Dart_Isolate isolate,
auto isolate_data = reinterpret_cast<IsolateData*>(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)
Expand Down

0 comments on commit 6cfb95c

Please sign in to comment.