Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 604dca8

Browse files
arbrengitsjustkevin
authored andcommitted
Revert "[fuchsia] Switch from core-jit to core snapshots. (#30744)" (#31065)
This reverts commit a193f08.
1 parent bf58727 commit 604dca8

File tree

10 files changed

+95
-37
lines changed

10 files changed

+95
-37
lines changed

shell/platform/fuchsia/dart_runner/BUILD.gn

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,21 @@ template("jit_runner_package") {
223223
rebase_path("$target_gen_dir/kernel/vm_data${product_suffix}.bin")
224224
dest = "vm_snapshot_data.bin"
225225
},
226+
{
227+
path = rebase_path(
228+
"$target_gen_dir/kernel/vm_instructions${product_suffix}.bin")
229+
dest = "vm_snapshot_instructions.bin"
230+
},
226231
{
227232
path = rebase_path(
228233
"$target_gen_dir/kernel/isolate_data${product_suffix}.bin")
229234
dest = "isolate_core_snapshot_data.bin"
230235
},
236+
{
237+
path = rebase_path(
238+
"$target_gen_dir/kernel/isolate_instructions${product_suffix}.bin")
239+
dest = "isolate_core_snapshot_instructions.bin"
240+
},
231241
]
232242

233243
if (!invoker.product) {

shell/platform/fuchsia/dart_runner/dart_component_controller.cc

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,14 @@ bool DartComponentController::SetupFromKernel() {
206206
isolate_snapshot_data_)) {
207207
return false;
208208
}
209+
if (!dart_utils::MappedResource::LoadFromNamespace(
210+
nullptr, "/pkg/data/isolate_core_snapshot_instructions.bin",
211+
isolate_snapshot_instructions_, true /* executable */)) {
212+
return false;
213+
}
209214

210-
// The core snapshot does not separate instructions from data.
211215
if (!CreateIsolate(isolate_snapshot_data_.address(),
212-
nullptr /* isolate_snapshot_instructions */)) {
216+
isolate_snapshot_instructions_.address())) {
213217
return false;
214218
}
215219

@@ -273,16 +277,16 @@ bool DartComponentController::SetupFromAppSnapshot() {
273277
return false;
274278
}
275279
} else {
276-
// TODO(fxb/91200): This code path was broken for over a year and is
277-
// probably not used.
278280
if (!dart_utils::MappedResource::LoadFromNamespace(
279281
namespace_, data_path_ + "/isolate_snapshot_data.bin",
280282
isolate_snapshot_data_)) {
281283
return false;
282284
}
283-
isolate_data = isolate_snapshot_data_.address();
284-
// We don't separate instructions from data in 'core' snapshots.
285-
isolate_instructions = nullptr;
285+
if (!dart_utils::MappedResource::LoadFromNamespace(
286+
namespace_, data_path_ + "/isolate_snapshot_instructions.bin",
287+
isolate_snapshot_instructions_, true /* executable */)) {
288+
return false;
289+
}
286290
}
287291
return CreateIsolate(isolate_data, isolate_instructions);
288292
#endif // defined(AOT_RUNTIME)

shell/platform/fuchsia/dart_runner/dart_component_controller_v2.cc

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ bool DartComponentControllerV2::CreateAndBindNamespace() {
214214

215215
bool DartComponentControllerV2::SetUpFromKernel() {
216216
dart_utils::MappedResource manifest;
217-
218217
if (!dart_utils::MappedResource::LoadFromNamespace(
219218
namespace_, data_path_ + "/app.dilplist", manifest)) {
220219
return false;
@@ -225,10 +224,14 @@ bool DartComponentControllerV2::SetUpFromKernel() {
225224
isolate_snapshot_data_)) {
226225
return false;
227226
}
227+
if (!dart_utils::MappedResource::LoadFromNamespace(
228+
nullptr, "/pkg/data/isolate_core_snapshot_instructions.bin",
229+
isolate_snapshot_instructions_, true /* executable */)) {
230+
return false;
231+
}
228232

229-
// The core snapshot does not separate instructions from data.
230233
if (!CreateIsolate(isolate_snapshot_data_.address(),
231-
nullptr /* isolate_snapshot_instructions */)) {
234+
isolate_snapshot_instructions_.address())) {
232235
return false;
233236
}
234237

@@ -293,16 +296,16 @@ bool DartComponentControllerV2::SetUpFromAppSnapshot() {
293296
return false;
294297
}
295298
} else {
296-
// TODO(fxb/91200): This code path was broken for over a year and is
297-
// probably not used.
298299
if (!dart_utils::MappedResource::LoadFromNamespace(
299300
namespace_, data_path_ + "/isolate_snapshot_data.bin",
300301
isolate_snapshot_data_)) {
301302
return false;
302303
}
303-
isolate_data = isolate_snapshot_data_.address();
304-
// We don't separate instructions from data in 'core' snapshots.
305-
isolate_instructions = nullptr;
304+
if (!dart_utils::MappedResource::LoadFromNamespace(
305+
namespace_, data_path_ + "/isolate_snapshot_instructions.bin",
306+
isolate_snapshot_instructions_, true /* executable */)) {
307+
return false;
308+
}
306309
}
307310
return CreateIsolate(isolate_data, isolate_instructions);
308311
#endif // defined(AOT_RUNTIME)

shell/platform/fuchsia/dart_runner/dart_runner.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,13 @@ DartRunner::DartRunner(sys::ComponentContext* context) : context_(context) {
200200
nullptr, "/pkg/data/vm_snapshot_data.bin", vm_snapshot_data_)) {
201201
FX_LOG(FATAL, LOG_TAG, "Failed to load vm snapshot data");
202202
}
203+
if (!dart_utils::MappedResource::LoadFromNamespace(
204+
nullptr, "/pkg/data/vm_snapshot_instructions.bin",
205+
vm_snapshot_instructions_, true /* executable */)) {
206+
FX_LOG(FATAL, LOG_TAG, "Failed to load vm snapshot instructions");
207+
}
203208
params.vm_snapshot_data = vm_snapshot_data_.address();
209+
params.vm_snapshot_instructions = vm_snapshot_instructions_.address();
204210
#endif
205211
params.create_group = IsolateGroupCreateCallback;
206212
params.shutdown_isolate = IsolateShutdownCallback;

shell/platform/fuchsia/dart_runner/kernel/BUILD.gn

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,17 @@ template("create_kernel_core_snapshot") {
4040
inputs = [ platform_dill ]
4141

4242
vm_snapshot_data = "$target_gen_dir/vm_data${product_suffix}.bin"
43+
vm_snapshot_instructions =
44+
"$target_gen_dir/vm_instructions${product_suffix}.bin"
4345
isolate_snapshot_data = "$target_gen_dir/isolate_data${product_suffix}.bin"
46+
isolate_snapshot_instructions =
47+
"$target_gen_dir/isolate_instructions${product_suffix}.bin"
4448
snapshot_profile = "$target_gen_dir/snapshot_profile${product_suffix}.json"
4549
outputs = [
4650
vm_snapshot_data,
51+
vm_snapshot_instructions,
4752
isolate_snapshot_data,
53+
isolate_snapshot_instructions,
4854
snapshot_profile,
4955
]
5056

@@ -59,10 +65,14 @@ template("create_kernel_core_snapshot") {
5965
"--lazy_async_stacks",
6066
"--enable_mirrors=false",
6167
"--deterministic",
62-
"--snapshot_kind=core",
68+
"--snapshot_kind=core-jit",
6369
"--vm_snapshot_data=" + rebase_path(vm_snapshot_data, root_build_dir),
70+
"--vm_snapshot_instructions=" +
71+
rebase_path(vm_snapshot_instructions, root_build_dir),
6472
"--isolate_snapshot_data=" +
6573
rebase_path(isolate_snapshot_data, root_build_dir),
74+
"--isolate_snapshot_instructions=" +
75+
rebase_path(isolate_snapshot_instructions, root_build_dir),
6676
"--write_v8_snapshot_profile_to=" +
6777
rebase_path(snapshot_profile, root_build_dir),
6878
]

shell/platform/fuchsia/dart_runner/service_isolate.cc

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ Dart_Isolate CreateServiceIsolate(
9696
"/pkg/data/vmservice_isolate_snapshot_data.bin";
9797
const char* snapshot_instructions_path =
9898
"/pkg/data/vmservice_isolate_snapshot_instructions.bin";
99+
#else
100+
// The VM service is embedded in the core snapshot.
101+
const char* snapshot_data_path = "/pkg/data/isolate_core_snapshot_data.bin";
102+
const char* snapshot_instructions_path =
103+
"/pkg/data/isolate_core_snapshot_instructions.bin";
104+
#endif
99105

100106
if (!dart_utils::MappedResource::LoadFromNamespace(
101107
nullptr, snapshot_data_path, mapped_isolate_snapshot_data)) {
@@ -113,21 +119,8 @@ Dart_Isolate CreateServiceIsolate(
113119

114120
vmservice_data = mapped_isolate_snapshot_data.address();
115121
vmservice_instructions = mapped_isolate_snapshot_instructions.address();
122+
#if defined(AOT_RUNTIME)
116123
}
117-
#else
118-
// The VM service is embedded in the core snapshot.
119-
// 'core' snapshot_kinds do not separate instructions from data, so we don't
120-
// load an instructions file.
121-
const char* snapshot_data_path = "/pkg/data/isolate_core_snapshot_data.bin";
122-
if (!dart_utils::MappedResource::LoadFromNamespace(
123-
nullptr, snapshot_data_path, mapped_isolate_snapshot_data)) {
124-
*error = strdup("Failed to load snapshot for service isolate");
125-
FX_LOG(ERROR, LOG_TAG, *error);
126-
return nullptr;
127-
}
128-
129-
vmservice_data = mapped_isolate_snapshot_data.address();
130-
vmservice_instructions = nullptr;
131124
#endif
132125

133126
bool is_null_safe =

shell/platform/fuchsia/flutter/BUILD.gn

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,11 +346,21 @@ template("jit_runner") {
346346
"$snapshot_gen_dir/vm_isolate_snapshot${product_suffix}.bin")
347347
dest = "vm_snapshot_data.bin"
348348
},
349+
{
350+
path = rebase_path(
351+
"$snapshot_gen_dir/vm_snapshot_instructions${product_suffix}.bin")
352+
dest = "vm_snapshot_instructions.bin"
353+
},
349354
{
350355
path = rebase_path(
351356
"$snapshot_gen_dir/isolate_snapshot${product_suffix}.bin")
352357
dest = "isolate_core_snapshot_data.bin"
353358
},
359+
{
360+
path = rebase_path(
361+
"$snapshot_gen_dir/isolate_snapshot_instructions${product_suffix}.bin")
362+
dest = "isolate_core_snapshot_instructions.bin"
363+
},
354364
]
355365

356366
_vulkan_icds = []

shell/platform/fuchsia/flutter/component_v1.cc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,13 +348,19 @@ ComponentV1::ComponentV1(
348348
return MakeFileMapping("/pkg/data/vm_snapshot_data.bin",
349349
false /* executable */);
350350
};
351+
settings_.vm_snapshot_instr = []() {
352+
return MakeFileMapping("/pkg/data/vm_snapshot_instructions.bin",
353+
true /* executable */);
354+
};
355+
351356
settings_.isolate_snapshot_data = []() {
352357
return MakeFileMapping("/pkg/data/isolate_core_snapshot_data.bin",
353358
false /* executable */);
354359
};
355-
356-
// 'core' snapshots do not separate instructions from data, so we
357-
// don't set isolate_snapshot_instr here.
360+
settings_.isolate_snapshot_instr = [] {
361+
return MakeFileMapping("/pkg/data/isolate_core_snapshot_instructions.bin",
362+
true /* executable */);
363+
};
358364
}
359365

360366
#if defined(DART_PRODUCT)

shell/platform/fuchsia/flutter/component_v2.cc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,13 +412,19 @@ ComponentV2::ComponentV2(
412412
return MakeFileMapping("/pkg/data/vm_snapshot_data.bin",
413413
false /* executable */);
414414
};
415+
settings_.vm_snapshot_instr = []() {
416+
return MakeFileMapping("/pkg/data/vm_snapshot_instructions.bin",
417+
true /* executable */);
418+
};
419+
415420
settings_.isolate_snapshot_data = []() {
416421
return MakeFileMapping("/pkg/data/isolate_core_snapshot_data.bin",
417422
false /* executable */);
418423
};
419-
420-
// 'core' snapshots do not separate instructions from data, so we
421-
// don't set isolate_snapshot_instr here.
424+
settings_.isolate_snapshot_instr = [] {
425+
return MakeFileMapping("/pkg/data/isolate_core_snapshot_instructions.bin",
426+
true /* executable */);
427+
};
422428
}
423429

424430
#if defined(DART_PRODUCT)

shell/platform/fuchsia/flutter/kernel/BUILD.gn

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,17 @@ template("core_snapshot") {
4444
inputs = [ platform_dill ]
4545

4646
vm_snapshot_data = "$target_gen_dir/vm_isolate_snapshot${suffix}.bin"
47+
vm_snapshot_instructions =
48+
"$target_gen_dir/vm_snapshot_instructions${suffix}.bin"
4749
isolate_snapshot_data = "$target_gen_dir/isolate_snapshot${suffix}.bin"
50+
isolate_snapshot_instructions =
51+
"$target_gen_dir/isolate_snapshot_instructions${suffix}.bin"
4852
snapshot_profile = "$target_gen_dir/snapshot_profile${suffix}.json"
4953
outputs = [
5054
vm_snapshot_data,
55+
vm_snapshot_instructions,
5156
isolate_snapshot_data,
57+
isolate_snapshot_instructions,
5258
snapshot_profile,
5359
]
5460

@@ -63,10 +69,14 @@ template("core_snapshot") {
6369
"--lazy_async_stacks",
6470
"--enable_mirrors=false",
6571
"--deterministic",
66-
"--snapshot_kind=core",
72+
"--snapshot_kind=core-jit",
6773
"--vm_snapshot_data=" + rebase_path(vm_snapshot_data, root_build_dir),
74+
"--vm_snapshot_instructions=" +
75+
rebase_path(vm_snapshot_instructions, root_build_dir),
6876
"--isolate_snapshot_data=" +
6977
rebase_path(isolate_snapshot_data, root_build_dir),
78+
"--isolate_snapshot_instructions=" +
79+
rebase_path(isolate_snapshot_instructions, root_build_dir),
7080
"--write_v8_snapshot_profile_to=" +
7181
rebase_path(snapshot_profile, root_build_dir),
7282
]

0 commit comments

Comments
 (0)