mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:19:48 +00:00
[vm] Remove shared snapshot and reused instructions features.
Shared snapshots have been disused by Fuchsia deduping. Reused instruction has been disused by Flutter code push. Change-Id: Ia4cb570935c233a9365d521ca04a477c5550ef83 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122421 Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com>
This commit is contained in:
parent
db8370e361
commit
6a65ea9cad
|
@ -113,10 +113,6 @@ static const char* kSnapshotKindNames[] = {
|
|||
V(vm_snapshot_instructions, vm_snapshot_instructions_filename) \
|
||||
V(isolate_snapshot_data, isolate_snapshot_data_filename) \
|
||||
V(isolate_snapshot_instructions, isolate_snapshot_instructions_filename) \
|
||||
V(shared_data, shared_data_filename) \
|
||||
V(shared_instructions, shared_instructions_filename) \
|
||||
V(shared_blobs, shared_blobs_filename) \
|
||||
V(reused_instructions, reused_instructions_filename) \
|
||||
V(blobs_container_filename, blobs_container_filename) \
|
||||
V(assembly, assembly_filename) \
|
||||
V(elf, elf_filename) \
|
||||
|
@ -276,14 +272,12 @@ static int ParseArguments(int argc,
|
|||
case kAppJIT: {
|
||||
if ((load_vm_snapshot_data_filename == NULL) ||
|
||||
(isolate_snapshot_data_filename == NULL) ||
|
||||
((isolate_snapshot_instructions_filename == NULL) &&
|
||||
(reused_instructions_filename == NULL))) {
|
||||
(isolate_snapshot_instructions_filename == NULL)) {
|
||||
Syslog::PrintErr(
|
||||
"Building an app JIT snapshot requires specifying input files for "
|
||||
"--load_vm_snapshot_data and --load_vm_snapshot_instructions, an "
|
||||
" output file for --isolate_snapshot_data, and either an output "
|
||||
"file for --isolate_snapshot_instructions or an input file for "
|
||||
"--reused_instructions.\n\n");
|
||||
" output file for --isolate_snapshot_data, and an output "
|
||||
"file for --isolate_snapshot_instructions.\n\n");
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
@ -571,15 +565,7 @@ static void CreateAndWriteAppSnapshot() {
|
|||
static void CreateAndWriteAppJITSnapshot() {
|
||||
ASSERT(snapshot_kind == kAppJIT);
|
||||
ASSERT(isolate_snapshot_data_filename != NULL);
|
||||
ASSERT((isolate_snapshot_instructions_filename != NULL) ||
|
||||
(reused_instructions_filename != NULL));
|
||||
|
||||
const uint8_t* reused_instructions = NULL;
|
||||
std::unique_ptr<MappedMemory> mapped_reused_instructions;
|
||||
if (reused_instructions_filename != NULL) {
|
||||
mapped_reused_instructions = MapFile(reused_instructions_filename,
|
||||
File::kReadOnly, &reused_instructions);
|
||||
}
|
||||
ASSERT(isolate_snapshot_instructions_filename != NULL);
|
||||
|
||||
Dart_Handle result;
|
||||
uint8_t* isolate_snapshot_data_buffer = NULL;
|
||||
|
@ -590,16 +576,14 @@ static void CreateAndWriteAppJITSnapshot() {
|
|||
result = Dart_CreateAppJITSnapshotAsBlobs(
|
||||
&isolate_snapshot_data_buffer, &isolate_snapshot_data_size,
|
||||
&isolate_snapshot_instructions_buffer,
|
||||
&isolate_snapshot_instructions_size, reused_instructions);
|
||||
&isolate_snapshot_instructions_size);
|
||||
CHECK_RESULT(result);
|
||||
|
||||
WriteFile(isolate_snapshot_data_filename, isolate_snapshot_data_buffer,
|
||||
isolate_snapshot_data_size);
|
||||
if (reused_instructions_filename == NULL) {
|
||||
WriteFile(isolate_snapshot_instructions_filename,
|
||||
isolate_snapshot_instructions_buffer,
|
||||
isolate_snapshot_instructions_size);
|
||||
}
|
||||
WriteFile(isolate_snapshot_instructions_filename,
|
||||
isolate_snapshot_instructions_buffer,
|
||||
isolate_snapshot_instructions_size);
|
||||
}
|
||||
|
||||
static void StreamingWriteCallback(void* callback_data,
|
||||
|
@ -647,35 +631,6 @@ static void CreateAndWritePrecompiledSnapshot() {
|
|||
"loader from //runtime/bin:elf_loader if necessary. See "
|
||||
"http://dartbug.com/38764 for more details.\n");
|
||||
|
||||
const uint8_t* shared_data = NULL;
|
||||
const uint8_t* shared_instructions = NULL;
|
||||
std::unique_ptr<MappedMemory> mapped_shared_data;
|
||||
std::unique_ptr<MappedMemory> mapped_shared_instructions;
|
||||
if (shared_blobs_filename != NULL) {
|
||||
AppSnapshot* shared_blobs = NULL;
|
||||
Syslog::PrintErr("Shared blobs in gen_snapshot are for testing only.\n");
|
||||
shared_blobs = Snapshot::TryReadAppSnapshot(shared_blobs_filename);
|
||||
if (shared_blobs == NULL) {
|
||||
Syslog::PrintErr("Failed to load: %s\n", shared_blobs_filename);
|
||||
Dart_ExitScope();
|
||||
Dart_ShutdownIsolate();
|
||||
exit(kErrorExitCode);
|
||||
}
|
||||
const uint8_t* ignored;
|
||||
shared_blobs->SetBuffers(&ignored, &ignored, &shared_data,
|
||||
&shared_instructions);
|
||||
} else {
|
||||
if (shared_data_filename != NULL) {
|
||||
mapped_shared_data =
|
||||
MapFile(shared_data_filename, File::kReadOnly, &shared_data);
|
||||
}
|
||||
if (shared_instructions_filename != NULL) {
|
||||
mapped_shared_instructions =
|
||||
MapFile(shared_instructions_filename, File::kReadOnly,
|
||||
&shared_instructions);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t* vm_snapshot_data_buffer = NULL;
|
||||
intptr_t vm_snapshot_data_size = 0;
|
||||
uint8_t* vm_snapshot_instructions_buffer = NULL;
|
||||
|
@ -689,7 +644,7 @@ static void CreateAndWritePrecompiledSnapshot() {
|
|||
&vm_snapshot_instructions_buffer, &vm_snapshot_instructions_size,
|
||||
&isolate_snapshot_data_buffer, &isolate_snapshot_data_size,
|
||||
&isolate_snapshot_instructions_buffer,
|
||||
&isolate_snapshot_instructions_size, shared_data, shared_instructions);
|
||||
&isolate_snapshot_instructions_size);
|
||||
CHECK_RESULT(result);
|
||||
|
||||
if (blobs_container_filename != NULL) {
|
||||
|
@ -757,7 +712,7 @@ static int CreateIsolateAndSnapshot(const CommandLineOptions& inputs) {
|
|||
loading_kernel_failed = (isolate == nullptr);
|
||||
} else {
|
||||
isolate = Dart_CreateIsolateGroup(NULL, NULL, isolate_snapshot_data,
|
||||
isolate_snapshot_instructions, NULL, NULL,
|
||||
isolate_snapshot_instructions,
|
||||
&isolate_flags, isolate_group_data.get(),
|
||||
/*isolate_data=*/nullptr, &error);
|
||||
}
|
||||
|
|
|
@ -75,8 +75,6 @@ static bool vm_run_app_snapshot = false;
|
|||
static char* app_script_uri = NULL;
|
||||
static const uint8_t* app_isolate_snapshot_data = NULL;
|
||||
static const uint8_t* app_isolate_snapshot_instructions = NULL;
|
||||
static const uint8_t* app_isolate_shared_data = NULL;
|
||||
static const uint8_t* app_isolate_shared_instructions = NULL;
|
||||
static bool kernel_isolate_is_running = false;
|
||||
|
||||
static Dart_Isolate main_isolate = NULL;
|
||||
|
@ -487,8 +485,7 @@ static Dart_Isolate CreateAndSetupKernelIsolate(const char* script_uri,
|
|||
isolate_data = new IsolateData(isolate_group_data);
|
||||
isolate = Dart_CreateIsolateGroup(
|
||||
DART_KERNEL_ISOLATE_NAME, DART_KERNEL_ISOLATE_NAME,
|
||||
isolate_snapshot_data, isolate_snapshot_instructions,
|
||||
app_isolate_shared_data, app_isolate_shared_instructions, flags,
|
||||
isolate_snapshot_data, isolate_snapshot_instructions, flags,
|
||||
isolate_group_data, isolate_data, error);
|
||||
}
|
||||
if (isolate == NULL) {
|
||||
|
@ -548,8 +545,7 @@ static Dart_Isolate CreateAndSetupServiceIsolate(const char* script_uri,
|
|||
app_isolate_snapshot_instructions;
|
||||
isolate = Dart_CreateIsolateGroup(
|
||||
script_uri, DART_VM_SERVICE_ISOLATE_NAME, isolate_snapshot_data,
|
||||
isolate_snapshot_instructions, app_isolate_shared_data,
|
||||
app_isolate_shared_instructions, flags, isolate_group_data,
|
||||
isolate_snapshot_instructions, flags, isolate_group_data,
|
||||
/*isolate_data=*/nullptr, error);
|
||||
#else
|
||||
// JIT: Service isolate uses the core libraries snapshot.
|
||||
|
@ -562,8 +558,7 @@ static Dart_Isolate CreateAndSetupServiceIsolate(const char* script_uri,
|
|||
core_isolate_snapshot_instructions;
|
||||
isolate = Dart_CreateIsolateGroup(
|
||||
script_uri, DART_VM_SERVICE_ISOLATE_NAME, isolate_snapshot_data,
|
||||
isolate_snapshot_instructions, app_isolate_shared_data,
|
||||
app_isolate_shared_instructions, flags, isolate_group_data,
|
||||
isolate_snapshot_instructions, flags, isolate_group_data,
|
||||
/*isolate_data=*/nullptr, error);
|
||||
#endif // !defined(DART_PRECOMPILED_RUNTIME)
|
||||
if (isolate == NULL) {
|
||||
|
@ -700,17 +695,15 @@ static Dart_Isolate CreateIsolateGroupAndSetupHelper(
|
|||
flags, isolate_group_data, isolate_data, error);
|
||||
} else {
|
||||
auto isolate_data = new IsolateData(isolate_group_data);
|
||||
isolate = Dart_CreateIsolateGroup(
|
||||
script_uri, name, isolate_snapshot_data, isolate_snapshot_instructions,
|
||||
app_isolate_shared_data, app_isolate_shared_instructions, flags,
|
||||
isolate_group_data, isolate_data, error);
|
||||
isolate = Dart_CreateIsolateGroup(script_uri, name, isolate_snapshot_data,
|
||||
isolate_snapshot_instructions, flags,
|
||||
isolate_group_data, isolate_data, error);
|
||||
}
|
||||
#else
|
||||
auto isolate_data = new IsolateData(isolate_group_data);
|
||||
isolate = Dart_CreateIsolateGroup(
|
||||
script_uri, name, isolate_snapshot_data, isolate_snapshot_instructions,
|
||||
app_isolate_shared_data, app_isolate_shared_instructions, flags,
|
||||
isolate_group_data, isolate_data, error);
|
||||
isolate = Dart_CreateIsolateGroup(script_uri, name, isolate_snapshot_data,
|
||||
isolate_snapshot_instructions, flags,
|
||||
isolate_group_data, isolate_data, error);
|
||||
#endif // !defined(DART_PRECOMPILED_RUNTIME)
|
||||
|
||||
Dart_Isolate created_isolate = NULL;
|
||||
|
@ -1123,21 +1116,6 @@ void main(int argc, char** argv) {
|
|||
|
||||
Loader::InitOnce();
|
||||
|
||||
AppSnapshot* shared_blobs = NULL;
|
||||
if (Options::shared_blobs_filename() != NULL) {
|
||||
Syslog::PrintErr(
|
||||
"Shared blobs in the standalone VM are for testing only.\n");
|
||||
shared_blobs =
|
||||
Snapshot::TryReadAppSnapshot(Options::shared_blobs_filename());
|
||||
if (shared_blobs == NULL) {
|
||||
Syslog::PrintErr("Failed to load: %s\n",
|
||||
Options::shared_blobs_filename());
|
||||
Platform::Exit(kErrorExitCode);
|
||||
}
|
||||
const uint8_t* ignored;
|
||||
shared_blobs->SetBuffers(&ignored, &ignored, &app_isolate_shared_data,
|
||||
&app_isolate_shared_instructions);
|
||||
}
|
||||
if (app_snapshot == nullptr) {
|
||||
app_snapshot = Snapshot::TryReadAppSnapshot(script_name);
|
||||
}
|
||||
|
@ -1245,7 +1223,6 @@ void main(int argc, char** argv) {
|
|||
EventHandler::Stop();
|
||||
|
||||
delete app_snapshot;
|
||||
delete shared_blobs;
|
||||
free(app_script_uri);
|
||||
|
||||
// Free copied argument strings if converted.
|
||||
|
|
|
@ -207,8 +207,7 @@ static Dart_Isolate CreateIsolateAndSetup(const char* script_uri,
|
|||
app_snapshot, app_snapshot != nullptr);
|
||||
isolate = Dart_CreateIsolateGroup(
|
||||
DART_KERNEL_ISOLATE_NAME, DART_KERNEL_ISOLATE_NAME,
|
||||
isolate_snapshot_data, isolate_snapshot_instructions,
|
||||
/*shared_data=*/nullptr, /*shared_instructions=*/nullptr, flags,
|
||||
isolate_snapshot_data, isolate_snapshot_instructions, flags,
|
||||
isolate_group_data, /*isolate_data=*/nullptr, error);
|
||||
if (*error != nullptr) {
|
||||
OS::PrintErr("Error creating isolate group: %s\n", *error);
|
||||
|
|
|
@ -476,7 +476,7 @@ void Snapshot::GenerateAppJIT(const char* snapshot_filename) {
|
|||
intptr_t isolate_instructions_size = 0;
|
||||
Dart_Handle result = Dart_CreateAppJITSnapshotAsBlobs(
|
||||
&isolate_data_buffer, &isolate_data_size, &isolate_instructions_buffer,
|
||||
&isolate_instructions_size, NULL);
|
||||
&isolate_instructions_size);
|
||||
if (Dart_IsError(result)) {
|
||||
ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result));
|
||||
}
|
||||
|
@ -486,9 +486,7 @@ void Snapshot::GenerateAppJIT(const char* snapshot_filename) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void Snapshot::GenerateAppAOTAsBlobs(const char* snapshot_filename,
|
||||
const uint8_t* shared_data,
|
||||
const uint8_t* shared_instructions) {
|
||||
void Snapshot::GenerateAppAOTAsBlobs(const char* snapshot_filename) {
|
||||
uint8_t* vm_data_buffer = NULL;
|
||||
intptr_t vm_data_size = 0;
|
||||
uint8_t* vm_instructions_buffer = NULL;
|
||||
|
@ -500,8 +498,7 @@ void Snapshot::GenerateAppAOTAsBlobs(const char* snapshot_filename,
|
|||
Dart_Handle result = Dart_CreateAppAOTSnapshotAsBlobs(
|
||||
&vm_data_buffer, &vm_data_size, &vm_instructions_buffer,
|
||||
&vm_instructions_size, &isolate_data_buffer, &isolate_data_size,
|
||||
&isolate_instructions_buffer, &isolate_instructions_size, shared_data,
|
||||
shared_instructions);
|
||||
&isolate_instructions_buffer, &isolate_instructions_size);
|
||||
if (Dart_IsError(result)) {
|
||||
ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result));
|
||||
}
|
||||
|
|
|
@ -32,9 +32,7 @@ class Snapshot {
|
|||
const char* script_name,
|
||||
const char* package_config);
|
||||
static void GenerateAppJIT(const char* snapshot_filename);
|
||||
static void GenerateAppAOTAsBlobs(const char* snapshot_filename,
|
||||
const uint8_t* shared_data,
|
||||
const uint8_t* shared_instructions);
|
||||
static void GenerateAppAOTAsBlobs(const char* snapshot_filename);
|
||||
static void GenerateAppAOTAsAssembly(const char* snapshot_filename);
|
||||
|
||||
static AppSnapshot* TryReadAppendedAppSnapshotElf(const char* container_path);
|
||||
|
|
|
@ -908,8 +908,6 @@ Dart_CreateIsolateGroup(const char* script_uri,
|
|||
const char* name,
|
||||
const uint8_t* isolate_snapshot_data,
|
||||
const uint8_t* isolate_snapshot_instructions,
|
||||
const uint8_t* shared_data,
|
||||
const uint8_t* shared_instructions,
|
||||
Dart_IsolateFlags* flags,
|
||||
void* isolate_group_data,
|
||||
void* isolate_data,
|
||||
|
@ -3446,9 +3444,7 @@ Dart_CreateAppAOTSnapshotAsBlobs(uint8_t** vm_snapshot_data_buffer,
|
|||
uint8_t** isolate_snapshot_data_buffer,
|
||||
intptr_t* isolate_snapshot_data_size,
|
||||
uint8_t** isolate_snapshot_instructions_buffer,
|
||||
intptr_t* isolate_snapshot_instructions_size,
|
||||
const uint8_t* shared_data,
|
||||
const uint8_t* shared_instructions);
|
||||
intptr_t* isolate_snapshot_instructions_size);
|
||||
|
||||
/**
|
||||
* Sorts the class-ids in depth first traversal order of the inheritance
|
||||
|
@ -3484,8 +3480,7 @@ DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle
|
|||
Dart_CreateAppJITSnapshotAsBlobs(uint8_t** isolate_snapshot_data_buffer,
|
||||
intptr_t* isolate_snapshot_data_size,
|
||||
uint8_t** isolate_snapshot_instructions_buffer,
|
||||
intptr_t* isolate_snapshot_instructions_size,
|
||||
const uint8_t* reused_instructions);
|
||||
intptr_t* isolate_snapshot_instructions_size);
|
||||
|
||||
/**
|
||||
* Like Dart_CreateAppJITSnapshotAsBlobs, but also creates a new VM snapshot.
|
||||
|
|
|
@ -1,92 +0,0 @@
|
|||
// Copyright (c) 2019, 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.
|
||||
|
||||
import "dart:async";
|
||||
import "dart:io";
|
||||
|
||||
import "package:path/path.dart" as p;
|
||||
|
||||
import "snapshot_test_helper.dart";
|
||||
|
||||
int fib(int n) {
|
||||
if (n <= 1) return 1;
|
||||
return fib(n - 1) + fib(n - 2);
|
||||
}
|
||||
|
||||
Future<void> main(List<String> args) async {
|
||||
if (args.contains("--child")) {
|
||||
print(fib(35));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Platform.script.toString().endsWith(".dart")) {
|
||||
print("This test must run from source");
|
||||
return;
|
||||
}
|
||||
|
||||
await withTempDir((String tmp) async {
|
||||
final String coreVMDataPath = p.join(tmp, "core_vm_snapshot_data.bin");
|
||||
final String coreIsoDataPath =
|
||||
p.join(tmp, "core_isolate_snapshot_data.bin");
|
||||
final String baselineIsoDataPath =
|
||||
p.join(tmp, "baseline_isolate_snapshot_data.bin");
|
||||
final String baselineIsoInstrPath =
|
||||
p.join(tmp, "baseline_isolate_snapshot_instructions.bin");
|
||||
final String patchIsoDataPath =
|
||||
p.join(tmp, "patch_isolate_snapshot_data.bin");
|
||||
final String patchIsoInstrPath =
|
||||
p.join(tmp, "patch_isolate_snapshot_instr.bin");
|
||||
final String kernelPath = p.join(tmp, "app.dill");
|
||||
final String tracePath = p.join(tmp, "compilation_trace.txt");
|
||||
|
||||
// We don't support snapshot with code on IA32.
|
||||
final String appSnapshotKind =
|
||||
Platform.version.contains("ia32") ? "app" : "app-jit";
|
||||
|
||||
final result1 = await runGenKernel("generate kernel", [
|
||||
Platform.script.toFilePath(),
|
||||
"--output",
|
||||
kernelPath,
|
||||
]);
|
||||
expectOutput("", result1);
|
||||
|
||||
final result2 = await runDart("generate compilation trace", [
|
||||
"--save_compilation_trace=$tracePath",
|
||||
kernelPath,
|
||||
"--child",
|
||||
]);
|
||||
expectOutput("14930352", result2);
|
||||
|
||||
final result3 = await runGenSnapshot("generate core snapshot", [
|
||||
"--snapshot_kind=core",
|
||||
"--vm_snapshot_data=${coreVMDataPath}",
|
||||
"--isolate_snapshot_data=${coreIsoDataPath}",
|
||||
platformDill,
|
||||
]);
|
||||
expectOutput("", result3);
|
||||
|
||||
final result4 = await runGenSnapshot("generate baseline app snapshot", [
|
||||
"--snapshot_kind=${appSnapshotKind}",
|
||||
"--load_vm_snapshot_data=${coreVMDataPath}",
|
||||
"--load_isolate_snapshot_data=${coreIsoDataPath}",
|
||||
"--isolate_snapshot_data=${baselineIsoDataPath}",
|
||||
"--isolate_snapshot_instructions=${baselineIsoInstrPath}",
|
||||
"--load_compilation_trace=$tracePath",
|
||||
kernelPath,
|
||||
]);
|
||||
expectOutput("", result4);
|
||||
|
||||
final result5 = await runGenSnapshot("generate patch app snapshot", [
|
||||
"--snapshot_kind=${appSnapshotKind}",
|
||||
"--load_vm_snapshot_data=${coreVMDataPath}",
|
||||
"--load_isolate_snapshot_data=${coreIsoDataPath}",
|
||||
"--isolate_snapshot_data=${patchIsoDataPath}",
|
||||
"--isolate_snapshot_instructions=${patchIsoInstrPath}",
|
||||
"--reused_instructions=${baselineIsoInstrPath}",
|
||||
"--load_compilation_trace=$tracePath",
|
||||
kernelPath,
|
||||
]);
|
||||
expectOutput("", result5);
|
||||
});
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
// Copyright (c) 2019, 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.
|
||||
|
||||
import "dart:async";
|
||||
import "dart:io";
|
||||
|
||||
import "package:path/path.dart" as p;
|
||||
|
||||
import "snapshot_test_helper.dart";
|
||||
|
||||
int fib(int n) {
|
||||
if (n <= 1) return 1;
|
||||
return fib(n - 1) + fib(n - 2);
|
||||
}
|
||||
|
||||
Future<void> main(List<String> args) async {
|
||||
if (args.contains("--child")) {
|
||||
print(fib(35));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Platform.script.toString().endsWith(".dart")) {
|
||||
print("This test must run from source");
|
||||
return;
|
||||
}
|
||||
|
||||
await withTempDir((String tmp) async {
|
||||
final String coreVMDataPath = p.join(tmp, "core_vm_snapshot_data.bin");
|
||||
final String coreIsoDataPath =
|
||||
p.join(tmp, "core_isolate_snapshot_data.bin");
|
||||
final String baselineIsoDataPath =
|
||||
p.join(tmp, "baseline_isolate_snapshot_data.bin");
|
||||
final String baselineIsoInstrPath =
|
||||
p.join(tmp, "baseline_isolate_snapshot_instructions.bin");
|
||||
final String patchIsoDataPath =
|
||||
p.join(tmp, "patch_isolate_snapshot_data.bin");
|
||||
final String patchIsoInstrPath =
|
||||
p.join(tmp, "patch_isolate_snapshot_instr.bin");
|
||||
final String kernelPath = p.join(tmp, "app.dill");
|
||||
final String tracePath = p.join(tmp, "compilation_trace.txt");
|
||||
|
||||
// We don't support snapshot with code on IA32.
|
||||
final String appSnapshotKind =
|
||||
Platform.version.contains("ia32") ? "app" : "app-jit";
|
||||
|
||||
final result1 = await runGenKernel("generate kernel", [
|
||||
Platform.script.toFilePath(),
|
||||
"--output",
|
||||
kernelPath,
|
||||
]);
|
||||
expectOutput("", result1);
|
||||
|
||||
final result2 = await runDart("generate compilation trace", [
|
||||
"--save_compilation_trace=$tracePath",
|
||||
kernelPath,
|
||||
"--child",
|
||||
]);
|
||||
expectOutput("14930352", result2);
|
||||
|
||||
final result3 = await runGenSnapshot("generate core snapshot", [
|
||||
"--snapshot_kind=core",
|
||||
"--vm_snapshot_data=${coreVMDataPath}",
|
||||
"--isolate_snapshot_data=${coreIsoDataPath}",
|
||||
platformDill,
|
||||
]);
|
||||
expectOutput("", result3);
|
||||
|
||||
final result4 = await runGenSnapshot("generate baseline app snapshot", [
|
||||
"--snapshot_kind=${appSnapshotKind}",
|
||||
"--load_vm_snapshot_data=${coreVMDataPath}",
|
||||
"--load_isolate_snapshot_data=${coreIsoDataPath}",
|
||||
"--isolate_snapshot_data=${baselineIsoDataPath}",
|
||||
"--isolate_snapshot_instructions=${baselineIsoInstrPath}",
|
||||
"--load_compilation_trace=$tracePath",
|
||||
kernelPath,
|
||||
]);
|
||||
expectOutput("", result4);
|
||||
|
||||
final result5 = await runGenSnapshot("generate patch app snapshot", [
|
||||
"--snapshot_kind=${appSnapshotKind}",
|
||||
"--load_vm_snapshot_data=${coreVMDataPath}",
|
||||
"--load_isolate_snapshot_data=${coreIsoDataPath}",
|
||||
"--isolate_snapshot_data=${patchIsoDataPath}",
|
||||
"--isolate_snapshot_instructions=${patchIsoInstrPath}",
|
||||
"--shared_data=${baselineIsoDataPath}",
|
||||
"--shared_instructions=${baselineIsoInstrPath}",
|
||||
"--load_compilation_trace=$tracePath",
|
||||
kernelPath,
|
||||
]);
|
||||
expectOutput("", result5);
|
||||
});
|
||||
}
|
|
@ -1922,30 +1922,13 @@ class RODataSerializationCluster : public SerializationCluster {
|
|||
Object::FinalizeReadOnlyObject(object);
|
||||
}
|
||||
|
||||
uint32_t ignored;
|
||||
if (s->GetSharedDataOffset(object, &ignored)) {
|
||||
shared_objects_.Add(object);
|
||||
} else {
|
||||
objects_.Add(object);
|
||||
}
|
||||
objects_.Add(object);
|
||||
}
|
||||
|
||||
void WriteAlloc(Serializer* s) {
|
||||
s->WriteCid(cid_);
|
||||
intptr_t count = shared_objects_.length();
|
||||
s->WriteUnsigned(count);
|
||||
for (intptr_t i = 0; i < count; i++) {
|
||||
RawObject* object = shared_objects_[i];
|
||||
s->AssignRef(object);
|
||||
AutoTraceObject(object);
|
||||
uint32_t offset;
|
||||
if (!s->GetSharedDataOffset(object, &offset)) {
|
||||
UNREACHABLE();
|
||||
}
|
||||
s->WriteUnsigned(offset);
|
||||
}
|
||||
|
||||
count = objects_.length();
|
||||
intptr_t count = objects_.length();
|
||||
s->WriteUnsigned(count);
|
||||
uint32_t running_offset = 0;
|
||||
for (intptr_t i = 0; i < count; i++) {
|
||||
|
@ -1975,7 +1958,6 @@ class RODataSerializationCluster : public SerializationCluster {
|
|||
private:
|
||||
const intptr_t cid_;
|
||||
GrowableArray<RawObject*> objects_;
|
||||
GrowableArray<RawObject*> shared_objects_;
|
||||
};
|
||||
#endif // !DART_PRECOMPILED_RUNTIME
|
||||
|
||||
|
@ -1986,12 +1968,6 @@ class RODataDeserializationCluster : public DeserializationCluster {
|
|||
|
||||
void ReadAlloc(Deserializer* d) {
|
||||
intptr_t count = d->ReadUnsigned();
|
||||
for (intptr_t i = 0; i < count; i++) {
|
||||
uint32_t offset = d->ReadUnsigned();
|
||||
d->AssignRef(d->GetSharedObjectAt(offset));
|
||||
}
|
||||
|
||||
count = d->ReadUnsigned();
|
||||
uint32_t running_offset = 0;
|
||||
for (intptr_t i = 0; i < count; i++) {
|
||||
running_offset += d->ReadUnsigned() << kObjectAlignmentLog2;
|
||||
|
@ -4564,7 +4540,7 @@ void Serializer::WriteInstructions(RawInstructions* instr, RawCode* code) {
|
|||
// Code should have been removed by DropCodeWithoutReusableInstructions.
|
||||
UnexpectedObject(code, "Expected instructions to reuse");
|
||||
}
|
||||
Write<int32_t>(offset);
|
||||
Write<uint32_t>(offset);
|
||||
|
||||
// If offset < 0, it's pointing to a shared instruction. We don't profile
|
||||
// references to shared text/data (since they don't consume any space). Of
|
||||
|
@ -4601,11 +4577,6 @@ void Serializer::TraceDataOffset(uint32_t offset) {
|
|||
}
|
||||
}
|
||||
|
||||
bool Serializer::GetSharedDataOffset(RawObject* object,
|
||||
uint32_t* offset) const {
|
||||
return image_writer_->GetSharedDataOffsetFor(object, offset);
|
||||
}
|
||||
|
||||
uint32_t Serializer::GetDataOffset(RawObject* object) const {
|
||||
return image_writer_->GetDataOffsetFor(object);
|
||||
}
|
||||
|
@ -5026,8 +4997,6 @@ Deserializer::Deserializer(Thread* thread,
|
|||
intptr_t size,
|
||||
const uint8_t* data_buffer,
|
||||
const uint8_t* instructions_buffer,
|
||||
const uint8_t* shared_data_buffer,
|
||||
const uint8_t* shared_instructions_buffer,
|
||||
intptr_t offset)
|
||||
: ThreadStackResource(thread),
|
||||
heap_(thread->isolate()->heap()),
|
||||
|
@ -5041,9 +5010,7 @@ Deserializer::Deserializer(Thread* thread,
|
|||
if (Snapshot::IncludesCode(kind)) {
|
||||
ASSERT(instructions_buffer != NULL);
|
||||
ASSERT(data_buffer != NULL);
|
||||
image_reader_ =
|
||||
new (zone_) ImageReader(data_buffer, instructions_buffer,
|
||||
shared_data_buffer, shared_instructions_buffer);
|
||||
image_reader_ = new (zone_) ImageReader(data_buffer, instructions_buffer);
|
||||
}
|
||||
stream_.SetPosition(offset);
|
||||
}
|
||||
|
@ -5294,7 +5261,7 @@ RawApiError* FullSnapshotReader::ConvertToApiError(char* message) {
|
|||
}
|
||||
|
||||
RawInstructions* Deserializer::ReadInstructions() {
|
||||
int32_t offset = Read<int32_t>();
|
||||
uint32_t offset = Read<uint32_t>();
|
||||
return image_reader_->GetInstructionsAt(offset);
|
||||
}
|
||||
|
||||
|
@ -5302,10 +5269,6 @@ RawObject* Deserializer::GetObjectAt(uint32_t offset) const {
|
|||
return image_reader_->GetObjectAt(offset);
|
||||
}
|
||||
|
||||
RawObject* Deserializer::GetSharedObjectAt(uint32_t offset) const {
|
||||
return image_reader_->GetSharedObjectAt(offset);
|
||||
}
|
||||
|
||||
void Deserializer::Prepare() {
|
||||
num_base_objects_ = ReadUnsigned();
|
||||
num_objects_ = ReadUnsigned();
|
||||
|
@ -5660,8 +5623,6 @@ void FullSnapshotWriter::WriteFullSnapshot() {
|
|||
|
||||
FullSnapshotReader::FullSnapshotReader(const Snapshot* snapshot,
|
||||
const uint8_t* instructions_buffer,
|
||||
const uint8_t* shared_data,
|
||||
const uint8_t* shared_instructions,
|
||||
Thread* thread)
|
||||
: kind_(snapshot->kind()),
|
||||
thread_(thread),
|
||||
|
@ -5670,13 +5631,6 @@ FullSnapshotReader::FullSnapshotReader(const Snapshot* snapshot,
|
|||
data_image_(snapshot->DataImage()),
|
||||
instructions_image_(instructions_buffer) {
|
||||
thread->isolate()->set_compilation_allowed(kind_ != Snapshot::kFullAOT);
|
||||
|
||||
if (shared_data == NULL) {
|
||||
shared_data_image_ = NULL;
|
||||
} else {
|
||||
shared_data_image_ = Snapshot::SetupFromBuffer(shared_data)->DataImage();
|
||||
}
|
||||
shared_instructions_image_ = shared_instructions;
|
||||
}
|
||||
|
||||
char* SnapshotHeaderReader::InitializeGlobalVMFlagsFromSnapshot(
|
||||
|
@ -5737,7 +5691,7 @@ RawApiError* FullSnapshotReader::ReadVMSnapshot() {
|
|||
}
|
||||
|
||||
Deserializer deserializer(thread_, kind_, buffer_, size_, data_image_,
|
||||
instructions_image_, NULL, NULL, offset);
|
||||
instructions_image_, offset);
|
||||
RawApiError* api_error = deserializer.VerifyImageAlignment();
|
||||
if (api_error != ApiError::null()) {
|
||||
return api_error;
|
||||
|
@ -5767,8 +5721,7 @@ RawApiError* FullSnapshotReader::ReadIsolateSnapshot() {
|
|||
}
|
||||
|
||||
Deserializer deserializer(thread_, kind_, buffer_, size_, data_image_,
|
||||
instructions_image_, shared_data_image_,
|
||||
shared_instructions_image_, offset);
|
||||
instructions_image_, offset);
|
||||
RawApiError* api_error = deserializer.VerifyImageAlignment();
|
||||
if (api_error != ApiError::null()) {
|
||||
return api_error;
|
||||
|
@ -5781,14 +5734,6 @@ RawApiError* FullSnapshotReader::ReadIsolateSnapshot() {
|
|||
ASSERT(instructions_image_ != NULL);
|
||||
thread_->isolate()->SetupImagePage(instructions_image_,
|
||||
/* is_executable */ true);
|
||||
if (shared_data_image_ != NULL) {
|
||||
thread_->isolate()->SetupImagePage(shared_data_image_,
|
||||
/* is_executable */ false);
|
||||
}
|
||||
if (shared_instructions_image_ != NULL) {
|
||||
thread_->isolate()->SetupImagePage(shared_instructions_image_,
|
||||
/* is_executable */ true);
|
||||
}
|
||||
}
|
||||
|
||||
auto object_store = thread_->isolate()->object_store();
|
||||
|
|
|
@ -349,7 +349,6 @@ class Serializer : public ThreadStackResource {
|
|||
}
|
||||
|
||||
void WriteInstructions(RawInstructions* instr, RawCode* code);
|
||||
bool GetSharedDataOffset(RawObject* object, uint32_t* offset) const;
|
||||
uint32_t GetDataOffset(RawObject* object) const;
|
||||
void TraceDataOffset(uint32_t offset);
|
||||
intptr_t GetDataSize() const;
|
||||
|
@ -467,8 +466,6 @@ class Deserializer : public ThreadStackResource {
|
|||
intptr_t size,
|
||||
const uint8_t* data_buffer,
|
||||
const uint8_t* instructions_buffer,
|
||||
const uint8_t* shared_data_buffer,
|
||||
const uint8_t* shared_instructions_buffer,
|
||||
intptr_t offset = 0);
|
||||
~Deserializer();
|
||||
|
||||
|
@ -548,7 +545,6 @@ class Deserializer : public ThreadStackResource {
|
|||
|
||||
RawInstructions* ReadInstructions();
|
||||
RawObject* GetObjectAt(uint32_t offset) const;
|
||||
RawObject* GetSharedObjectAt(uint32_t offset) const;
|
||||
|
||||
void SkipHeader() { stream_.SetPosition(Snapshot::kHeaderSize); }
|
||||
|
||||
|
@ -653,8 +649,6 @@ class FullSnapshotReader {
|
|||
public:
|
||||
FullSnapshotReader(const Snapshot* snapshot,
|
||||
const uint8_t* instructions_buffer,
|
||||
const uint8_t* shared_data,
|
||||
const uint8_t* shared_instructions,
|
||||
Thread* thread);
|
||||
~FullSnapshotReader() {}
|
||||
|
||||
|
@ -670,8 +664,6 @@ class FullSnapshotReader {
|
|||
intptr_t size_;
|
||||
const uint8_t* data_image_;
|
||||
const uint8_t* instructions_image_;
|
||||
const uint8_t* shared_data_image_;
|
||||
const uint8_t* shared_instructions_image_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(FullSnapshotReader);
|
||||
};
|
||||
|
|
|
@ -249,9 +249,8 @@ char* Dart::Init(const uint8_t* vm_isolate_snapshot,
|
|||
// We make a fake [IsolateGroupSource] here, since the "vm-isolate" is not
|
||||
// really an isolate itself - it acts more as a container for VM-global
|
||||
// objects.
|
||||
std::unique_ptr<IsolateGroupSource> source(
|
||||
new IsolateGroupSource(nullptr, "vm-isolate", nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, -1, api_flags));
|
||||
std::unique_ptr<IsolateGroupSource> source(new IsolateGroupSource(
|
||||
nullptr, "vm-isolate", nullptr, nullptr, nullptr, -1, api_flags));
|
||||
auto group = new IsolateGroup(std::move(source), /*embedder_data=*/nullptr);
|
||||
IsolateGroup::RegisterIsolateGroup(group);
|
||||
vm_isolate_ =
|
||||
|
@ -308,7 +307,7 @@ char* Dart::Init(const uint8_t* vm_isolate_snapshot,
|
|||
} else {
|
||||
return strdup("Invalid vm isolate snapshot seen");
|
||||
}
|
||||
FullSnapshotReader reader(snapshot, instructions_snapshot, NULL, NULL, T);
|
||||
FullSnapshotReader reader(snapshot, instructions_snapshot, T);
|
||||
const Error& error = Error::Handle(reader.ReadVMSnapshot());
|
||||
if (!error.IsNull()) {
|
||||
// Must copy before leaving the zone.
|
||||
|
@ -649,8 +648,6 @@ static bool IsSnapshotCompatible(Snapshot::Kind vm_kind,
|
|||
|
||||
RawError* Dart::InitializeIsolate(const uint8_t* snapshot_data,
|
||||
const uint8_t* snapshot_instructions,
|
||||
const uint8_t* shared_data,
|
||||
const uint8_t* shared_instructions,
|
||||
const uint8_t* kernel_buffer,
|
||||
intptr_t kernel_buffer_size,
|
||||
void* isolate_data) {
|
||||
|
@ -695,8 +692,7 @@ RawError* Dart::InitializeIsolate(const uint8_t* snapshot_data,
|
|||
if (FLAG_trace_isolates) {
|
||||
OS::PrintErr("Size of isolate snapshot = %" Pd "\n", snapshot->length());
|
||||
}
|
||||
FullSnapshotReader reader(snapshot, snapshot_instructions, shared_data,
|
||||
shared_instructions, T);
|
||||
FullSnapshotReader reader(snapshot, snapshot_instructions, T);
|
||||
const Error& error = Error::Handle(reader.ReadIsolateSnapshot());
|
||||
if (!error.IsNull()) {
|
||||
return error.raw();
|
||||
|
|
|
@ -57,8 +57,6 @@ class Dart : public AllStatic {
|
|||
// from_kernel. Otherwise, initialize from sources.
|
||||
static RawError* InitializeIsolate(const uint8_t* snapshot_data,
|
||||
const uint8_t* snapshot_instructions,
|
||||
const uint8_t* shared_data,
|
||||
const uint8_t* shared_instructions,
|
||||
const uint8_t* kernel_buffer,
|
||||
intptr_t kernel_buffer_size,
|
||||
void* data);
|
||||
|
|
|
@ -1114,12 +1114,11 @@ static Dart_Isolate CreateIsolate(IsolateGroup* group,
|
|||
// bootstrap library files which call out to a tag handler that may create
|
||||
// Api Handles when an error is encountered.
|
||||
T->EnterApiScope();
|
||||
const Error& error_obj =
|
||||
Error::Handle(Z, Dart::InitializeIsolate(
|
||||
source->snapshot_data,
|
||||
source->snapshot_instructions, source->shared_data,
|
||||
source->shared_instructions, source->kernel_buffer,
|
||||
source->kernel_buffer_size, isolate_data));
|
||||
const Error& error_obj = Error::Handle(
|
||||
Z, Dart::InitializeIsolate(source->snapshot_data,
|
||||
source->snapshot_instructions,
|
||||
source->kernel_buffer,
|
||||
source->kernel_buffer_size, isolate_data));
|
||||
if (error_obj.IsNull()) {
|
||||
#if defined(DART_NO_SNAPSHOT) && !defined(PRODUCT)
|
||||
if (FLAG_check_function_fingerprints && source->kernel_buffer == NULL) {
|
||||
|
@ -1217,8 +1216,6 @@ Dart_CreateIsolateGroup(const char* script_uri,
|
|||
const char* name,
|
||||
const uint8_t* snapshot_data,
|
||||
const uint8_t* snapshot_instructions,
|
||||
const uint8_t* shared_data,
|
||||
const uint8_t* shared_instructions,
|
||||
Dart_IsolateFlags* flags,
|
||||
void* isolate_group_data,
|
||||
void* isolate_data,
|
||||
|
@ -1232,9 +1229,9 @@ Dart_CreateIsolateGroup(const char* script_uri,
|
|||
}
|
||||
|
||||
const char* non_null_name = name == nullptr ? "isolate" : name;
|
||||
std::unique_ptr<IsolateGroupSource> source(new IsolateGroupSource(
|
||||
script_uri, non_null_name, snapshot_data, snapshot_instructions,
|
||||
shared_data, shared_instructions, nullptr, -1, *flags));
|
||||
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);
|
||||
IsolateGroup::RegisterIsolateGroup(group);
|
||||
Dart_Isolate isolate =
|
||||
|
@ -1263,9 +1260,9 @@ Dart_CreateIsolateGroupFromKernel(const char* script_uri,
|
|||
}
|
||||
|
||||
const char* non_null_name = name == nullptr ? "isolate" : name;
|
||||
std::unique_ptr<IsolateGroupSource> source(new IsolateGroupSource(
|
||||
script_uri, non_null_name, nullptr, nullptr, nullptr, nullptr,
|
||||
kernel_buffer, kernel_buffer_size, *flags));
|
||||
std::unique_ptr<IsolateGroupSource> source(
|
||||
new IsolateGroupSource(script_uri, non_null_name, nullptr, nullptr,
|
||||
kernel_buffer, kernel_buffer_size, *flags));
|
||||
auto group = new IsolateGroup(std::move(source), isolate_group_data);
|
||||
IsolateGroup::RegisterIsolateGroup(group);
|
||||
Dart_Isolate isolate =
|
||||
|
@ -6138,7 +6135,7 @@ Dart_CreateAppAOTSnapshotAsAssembly(Dart_StreamingWriteCallback callback,
|
|||
CHECK_NULL(callback);
|
||||
|
||||
TIMELINE_DURATION(T, Isolate, "WriteAppAOTSnapshot");
|
||||
AssemblyImageWriter image_writer(T, callback, callback_data, NULL, NULL);
|
||||
AssemblyImageWriter image_writer(T, callback, callback_data);
|
||||
uint8_t* vm_snapshot_data_buffer = NULL;
|
||||
uint8_t* isolate_snapshot_data_buffer = NULL;
|
||||
FullSnapshotWriter writer(Snapshot::kFullAOT, &vm_snapshot_data_buffer,
|
||||
|
@ -6170,8 +6167,7 @@ Dart_CreateVMAOTSnapshotAsAssembly(Dart_StreamingWriteCallback callback,
|
|||
CHECK_NULL(callback);
|
||||
|
||||
TIMELINE_DURATION(T, Isolate, "WriteVMAOTSnapshot");
|
||||
AssemblyImageWriter image_writer(T, callback, callback_data, nullptr,
|
||||
nullptr);
|
||||
AssemblyImageWriter image_writer(T, callback, callback_data);
|
||||
uint8_t* vm_snapshot_data_buffer = nullptr;
|
||||
FullSnapshotWriter writer(Snapshot::kFullAOT, &vm_snapshot_data_buffer,
|
||||
nullptr, ApiReallocate, &image_writer, nullptr);
|
||||
|
@ -6214,11 +6210,10 @@ Dart_CreateAppAOTSnapshotAsElf(Dart_StreamingWriteCallback callback,
|
|||
|
||||
BlobImageWriter vm_image_writer(T, &vm_snapshot_instructions_buffer,
|
||||
ApiReallocate, /* initial_size= */ 2 * MB,
|
||||
nullptr, nullptr, nullptr, elf, dwarf);
|
||||
BlobImageWriter isolate_image_writer(
|
||||
T, &isolate_snapshot_instructions_buffer, ApiReallocate,
|
||||
/* initial_size= */ 2 * MB, /* shared_data_image= */ nullptr,
|
||||
/* shared_instructions_image= */ nullptr, nullptr, elf, dwarf);
|
||||
elf, dwarf);
|
||||
BlobImageWriter isolate_image_writer(T, &isolate_snapshot_instructions_buffer,
|
||||
ApiReallocate,
|
||||
/* initial_size= */ 2 * MB, elf, dwarf);
|
||||
FullSnapshotWriter writer(Snapshot::kFullAOT, &vm_snapshot_data_buffer,
|
||||
&isolate_snapshot_data_buffer, ApiReallocate,
|
||||
&vm_image_writer, &isolate_image_writer);
|
||||
|
@ -6247,9 +6242,7 @@ Dart_CreateAppAOTSnapshotAsBlobs(uint8_t** vm_snapshot_data_buffer,
|
|||
uint8_t** isolate_snapshot_data_buffer,
|
||||
intptr_t* isolate_snapshot_data_size,
|
||||
uint8_t** isolate_snapshot_instructions_buffer,
|
||||
intptr_t* isolate_snapshot_instructions_size,
|
||||
const uint8_t* shared_data,
|
||||
const uint8_t* shared_instructions) {
|
||||
intptr_t* isolate_snapshot_instructions_size) {
|
||||
#if defined(TARGET_ARCH_IA32)
|
||||
return Api::NewError("AOT compilation is not supported on IA32.");
|
||||
#elif defined(TARGET_ARCH_DBC)
|
||||
|
@ -6275,22 +6268,12 @@ Dart_CreateAppAOTSnapshotAsBlobs(uint8_t** vm_snapshot_data_buffer,
|
|||
CHECK_NULL(isolate_snapshot_instructions_buffer);
|
||||
CHECK_NULL(isolate_snapshot_instructions_size);
|
||||
|
||||
const void* shared_data_image = NULL;
|
||||
if (shared_data != NULL) {
|
||||
shared_data_image = Snapshot::SetupFromBuffer(shared_data)->DataImage();
|
||||
}
|
||||
const void* shared_instructions_image = shared_instructions;
|
||||
|
||||
TIMELINE_DURATION(T, Isolate, "WriteAppAOTSnapshot");
|
||||
BlobImageWriter vm_image_writer(T, vm_snapshot_instructions_buffer,
|
||||
ApiReallocate, 2 * MB /* initial_size */,
|
||||
/*shared_objects=*/nullptr,
|
||||
/*shared_instructions=*/nullptr,
|
||||
/*reused_objects=*/nullptr);
|
||||
BlobImageWriter isolate_image_writer(
|
||||
T, isolate_snapshot_instructions_buffer, ApiReallocate,
|
||||
2 * MB /* initial_size */, shared_data_image, shared_instructions_image,
|
||||
/* reuse_instructions= */ nullptr);
|
||||
ApiReallocate, 2 * MB /* initial_size */);
|
||||
BlobImageWriter isolate_image_writer(T, isolate_snapshot_instructions_buffer,
|
||||
ApiReallocate,
|
||||
2 * MB /* initial_size */);
|
||||
FullSnapshotWriter writer(Snapshot::kFullAOT, vm_snapshot_data_buffer,
|
||||
isolate_snapshot_data_buffer, ApiReallocate,
|
||||
&vm_image_writer, &isolate_image_writer);
|
||||
|
@ -6390,15 +6373,10 @@ DART_EXPORT Dart_Handle Dart_CreateCoreJITSnapshotAsBlobs(
|
|||
|
||||
TIMELINE_DURATION(T, Isolate, "WriteCoreJITSnapshot");
|
||||
BlobImageWriter vm_image_writer(T, vm_snapshot_instructions_buffer,
|
||||
ApiReallocate, 2 * MB /* initial_size */,
|
||||
/*shared_objects=*/nullptr,
|
||||
/*shared_instructions=*/nullptr,
|
||||
/*reused_objects=*/nullptr);
|
||||
ApiReallocate, 2 * MB /* initial_size */);
|
||||
BlobImageWriter isolate_image_writer(T, isolate_snapshot_instructions_buffer,
|
||||
ApiReallocate, 2 * MB /* initial_size */,
|
||||
/*shared_objects=*/nullptr,
|
||||
/*shared_instructions=*/nullptr,
|
||||
/*reused_objects=*/nullptr);
|
||||
ApiReallocate,
|
||||
2 * MB /* initial_size */);
|
||||
FullSnapshotWriter writer(Snapshot::kFullJIT, vm_snapshot_data_buffer,
|
||||
isolate_snapshot_data_buffer, ApiReallocate,
|
||||
&vm_image_writer, &isolate_image_writer);
|
||||
|
@ -6418,8 +6396,7 @@ DART_EXPORT Dart_Handle
|
|||
Dart_CreateAppJITSnapshotAsBlobs(uint8_t** isolate_snapshot_data_buffer,
|
||||
intptr_t* isolate_snapshot_data_size,
|
||||
uint8_t** isolate_snapshot_instructions_buffer,
|
||||
intptr_t* isolate_snapshot_instructions_size,
|
||||
const uint8_t* reused_instructions) {
|
||||
intptr_t* isolate_snapshot_instructions_size) {
|
||||
#if defined(TARGET_ARCH_IA32)
|
||||
return Api::NewError("Snapshots with code are not supported on IA32.");
|
||||
#elif defined(DART_PRECOMPILED_RUNTIME)
|
||||
|
@ -6440,9 +6417,6 @@ Dart_CreateAppJITSnapshotAsBlobs(uint8_t** isolate_snapshot_data_buffer,
|
|||
BackgroundCompiler::Stop(I);
|
||||
DropRegExpMatchCode(Z);
|
||||
|
||||
if (reused_instructions != nullptr) {
|
||||
DropCodeWithoutReusableInstructions(reused_instructions);
|
||||
}
|
||||
ProgramVisitor::Dedup();
|
||||
Symbols::Compact();
|
||||
|
||||
|
@ -6454,10 +6428,8 @@ Dart_CreateAppJITSnapshotAsBlobs(uint8_t** isolate_snapshot_data_buffer,
|
|||
|
||||
TIMELINE_DURATION(T, Isolate, "WriteAppJITSnapshot");
|
||||
BlobImageWriter isolate_image_writer(T, isolate_snapshot_instructions_buffer,
|
||||
ApiReallocate, 2 * MB /* initial_size */,
|
||||
/*shared_objects=*/nullptr,
|
||||
/*shared_instructions=*/nullptr,
|
||||
reused_instructions);
|
||||
ApiReallocate,
|
||||
2 * MB /* initial_size */);
|
||||
FullSnapshotWriter writer(Snapshot::kFullJIT, NULL,
|
||||
isolate_snapshot_data_buffer, ApiReallocate, NULL,
|
||||
&isolate_image_writer);
|
||||
|
@ -6467,10 +6439,6 @@ Dart_CreateAppJITSnapshotAsBlobs(uint8_t** isolate_snapshot_data_buffer,
|
|||
*isolate_snapshot_instructions_size =
|
||||
isolate_image_writer.InstructionsBlobSize();
|
||||
|
||||
if (reused_instructions != nullptr) {
|
||||
*isolate_snapshot_instructions_buffer = NULL;
|
||||
}
|
||||
|
||||
return Api::Success();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -35,11 +35,6 @@ DEFINE_FLAG(charp,
|
|||
"Print sizes of all instruction objects to the given file");
|
||||
#endif
|
||||
|
||||
DEFINE_FLAG(bool,
|
||||
trace_reused_instructions,
|
||||
false,
|
||||
"Print code that lacks reusable instructions");
|
||||
|
||||
intptr_t ObjectOffsetTrait::Hashcode(Key key) {
|
||||
RawObject* obj = key;
|
||||
ASSERT(!obj->IsSmi());
|
||||
|
@ -82,19 +77,13 @@ bool ObjectOffsetTrait::IsKeyEqual(Pair pair, Key key) {
|
|||
}
|
||||
|
||||
#if !defined(DART_PRECOMPILED_RUNTIME)
|
||||
ImageWriter::ImageWriter(Heap* heap,
|
||||
const void* shared_objects,
|
||||
const void* shared_instructions,
|
||||
const void* reused_instructions)
|
||||
ImageWriter::ImageWriter(Heap* heap)
|
||||
: heap_(heap),
|
||||
next_data_offset_(0),
|
||||
next_text_offset_(0),
|
||||
objects_(),
|
||||
instructions_() {
|
||||
ResetOffsets();
|
||||
SetupShared(&shared_objects_, shared_objects);
|
||||
SetupShared(&shared_instructions_, shared_instructions);
|
||||
SetupShared(&reuse_instructions_, reused_instructions);
|
||||
}
|
||||
|
||||
void ImageWriter::PrepareForSerialization(
|
||||
|
@ -130,25 +119,6 @@ void ImageWriter::PrepareForSerialization(
|
|||
}
|
||||
}
|
||||
|
||||
void ImageWriter::SetupShared(ObjectOffsetMap* map, const void* shared_image) {
|
||||
if (shared_image == NULL) {
|
||||
return;
|
||||
}
|
||||
Image image(shared_image);
|
||||
uword obj_addr = reinterpret_cast<uword>(image.object_start());
|
||||
uword end_addr = obj_addr + image.object_size();
|
||||
while (obj_addr < end_addr) {
|
||||
int32_t offset = obj_addr - reinterpret_cast<uword>(shared_image);
|
||||
RawObject* raw_obj = RawObject::FromAddr(obj_addr);
|
||||
ObjectOffsetPair pair;
|
||||
pair.object = raw_obj;
|
||||
pair.offset = offset;
|
||||
map->Insert(pair);
|
||||
obj_addr += SizeInSnapshot(raw_obj);
|
||||
}
|
||||
ASSERT(obj_addr == end_addr);
|
||||
}
|
||||
|
||||
int32_t ImageWriter::GetTextOffsetFor(RawInstructions* instructions,
|
||||
RawCode* code) {
|
||||
intptr_t offset = heap_->GetObjectId(instructions);
|
||||
|
@ -156,25 +126,6 @@ int32_t ImageWriter::GetTextOffsetFor(RawInstructions* instructions,
|
|||
return offset;
|
||||
}
|
||||
|
||||
if (!reuse_instructions_.IsEmpty()) {
|
||||
ObjectOffsetPair* pair = reuse_instructions_.Lookup(instructions);
|
||||
if (pair == NULL) {
|
||||
// Code should have been removed by DropCodeWithoutReusableInstructions.
|
||||
return 0;
|
||||
}
|
||||
ASSERT(pair->offset != 0);
|
||||
return pair->offset;
|
||||
}
|
||||
|
||||
ObjectOffsetPair* pair = shared_instructions_.Lookup(instructions);
|
||||
if (pair != NULL) {
|
||||
// Negative offsets tell the reader the offset is w/r/t the shared
|
||||
// instructions image instead of the app-specific instructions image.
|
||||
// Compare ImageReader::GetInstructionsAt.
|
||||
ASSERT(pair->offset != 0);
|
||||
return -pair->offset;
|
||||
}
|
||||
|
||||
offset = next_text_offset_;
|
||||
heap_->SetObjectId(instructions, offset);
|
||||
next_text_offset_ += SizeInSnapshot(instructions);
|
||||
|
@ -265,16 +216,6 @@ intptr_t ImageWriter::SizeInSnapshot(RawObject* raw_object) {
|
|||
}
|
||||
#endif // defined(IS_SIMARM_X64)
|
||||
|
||||
bool ImageWriter::GetSharedDataOffsetFor(RawObject* raw_object,
|
||||
uint32_t* offset) {
|
||||
ObjectOffsetPair* pair = shared_objects_.Lookup(raw_object);
|
||||
if (pair == NULL) {
|
||||
return false;
|
||||
}
|
||||
*offset = pair->offset;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t ImageWriter::GetDataOffsetFor(RawObject* raw_object) {
|
||||
intptr_t snap_size = SizeInSnapshot(raw_object);
|
||||
intptr_t offset = next_data_offset_;
|
||||
|
@ -500,10 +441,8 @@ void ImageWriter::WriteROData(WriteStream* stream) {
|
|||
|
||||
AssemblyImageWriter::AssemblyImageWriter(Thread* thread,
|
||||
Dart_StreamingWriteCallback callback,
|
||||
void* callback_data,
|
||||
const void* shared_objects,
|
||||
const void* shared_instructions)
|
||||
: ImageWriter(thread->heap(), shared_objects, shared_instructions, nullptr),
|
||||
void* callback_data)
|
||||
: ImageWriter(thread->heap()),
|
||||
assembly_stream_(512 * KB, callback, callback_data),
|
||||
dwarf_(nullptr) {
|
||||
#if defined(DART_PRECOMPILER)
|
||||
|
@ -894,15 +833,9 @@ BlobImageWriter::BlobImageWriter(Thread* thread,
|
|||
uint8_t** instructions_blob_buffer,
|
||||
ReAlloc alloc,
|
||||
intptr_t initial_size,
|
||||
const void* shared_objects,
|
||||
const void* shared_instructions,
|
||||
const void* reused_instructions,
|
||||
Elf* elf,
|
||||
Dwarf* dwarf)
|
||||
: ImageWriter(thread->heap(),
|
||||
shared_objects,
|
||||
shared_instructions,
|
||||
reused_instructions),
|
||||
: ImageWriter(thread->heap()),
|
||||
instructions_blob_stream_(instructions_blob_buffer, alloc, initial_size),
|
||||
elf_(elf),
|
||||
dwarf_(dwarf) {
|
||||
|
@ -1105,22 +1038,15 @@ void BlobImageWriter::WriteText(WriteStream* clustered_stream, bool vm) {
|
|||
#endif // !defined(DART_PRECOMPILED_RUNTIME)
|
||||
|
||||
ImageReader::ImageReader(const uint8_t* data_image,
|
||||
const uint8_t* instructions_image,
|
||||
const uint8_t* shared_data_image,
|
||||
const uint8_t* shared_instructions_image)
|
||||
: data_image_(data_image),
|
||||
instructions_image_(instructions_image),
|
||||
shared_data_image_(shared_data_image),
|
||||
shared_instructions_image_(shared_instructions_image) {
|
||||
const uint8_t* instructions_image)
|
||||
: data_image_(data_image), instructions_image_(instructions_image) {
|
||||
ASSERT(data_image != NULL);
|
||||
ASSERT(instructions_image != NULL);
|
||||
}
|
||||
|
||||
RawApiError* ImageReader::VerifyAlignment() const {
|
||||
if (!Utils::IsAligned(data_image_, kObjectAlignment) ||
|
||||
!Utils::IsAligned(shared_data_image_, kObjectAlignment) ||
|
||||
!Utils::IsAligned(instructions_image_, kMaxObjectAlignment) ||
|
||||
!Utils::IsAligned(shared_instructions_image_, kMaxObjectAlignment)) {
|
||||
!Utils::IsAligned(instructions_image_, kMaxObjectAlignment)) {
|
||||
return ApiError::New(
|
||||
String::Handle(String::New("Snapshot is misaligned", Heap::kOld)),
|
||||
Heap::kOld);
|
||||
|
@ -1128,17 +1054,11 @@ RawApiError* ImageReader::VerifyAlignment() const {
|
|||
return ApiError::null();
|
||||
}
|
||||
|
||||
RawInstructions* ImageReader::GetInstructionsAt(int32_t offset) const {
|
||||
RawInstructions* ImageReader::GetInstructionsAt(uint32_t offset) const {
|
||||
ASSERT(Utils::IsAligned(offset, kObjectAlignment));
|
||||
|
||||
RawObject* result;
|
||||
if (offset < 0) {
|
||||
result = RawObject::FromAddr(
|
||||
reinterpret_cast<uword>(shared_instructions_image_) - offset);
|
||||
} else {
|
||||
result = RawObject::FromAddr(reinterpret_cast<uword>(instructions_image_) +
|
||||
offset);
|
||||
}
|
||||
RawObject* result = RawObject::FromAddr(
|
||||
reinterpret_cast<uword>(instructions_image_) + offset);
|
||||
ASSERT(result->IsInstructions());
|
||||
ASSERT(result->IsMarked());
|
||||
|
||||
|
@ -1155,116 +1075,4 @@ RawObject* ImageReader::GetObjectAt(uint32_t offset) const {
|
|||
return result;
|
||||
}
|
||||
|
||||
RawObject* ImageReader::GetSharedObjectAt(uint32_t offset) const {
|
||||
ASSERT(Utils::IsAligned(offset, kObjectAlignment));
|
||||
|
||||
RawObject* result =
|
||||
RawObject::FromAddr(reinterpret_cast<uword>(shared_data_image_) + offset);
|
||||
ASSERT(result->IsMarked());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#if !defined(DART_PRECOMPILED_RUNTIME)
|
||||
void DropCodeWithoutReusableInstructions(const void* reused_instructions) {
|
||||
class DropCodeVisitor : public FunctionVisitor, public ClassVisitor {
|
||||
public:
|
||||
explicit DropCodeVisitor(const void* reused_instructions)
|
||||
: code_(Code::Handle()),
|
||||
instructions_(Instructions::Handle()),
|
||||
pool_(ObjectPool::Handle()),
|
||||
table_(Array::Handle()),
|
||||
entry_(Object::Handle()) {
|
||||
ImageWriter::SetupShared(&reused_instructions_, reused_instructions);
|
||||
if (FLAG_trace_reused_instructions) {
|
||||
OS::PrintErr("%" Pd " reusable instructions\n",
|
||||
reused_instructions_.Size());
|
||||
}
|
||||
}
|
||||
|
||||
void Visit(const Class& cls) {
|
||||
code_ = cls.allocation_stub();
|
||||
if (!code_.IsNull()) {
|
||||
if (!CanKeep(code_)) {
|
||||
if (FLAG_trace_reused_instructions) {
|
||||
OS::PrintErr("No reusable instructions for %s\n", cls.ToCString());
|
||||
}
|
||||
cls.DisableAllocationStub();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Visit(const Function& func) {
|
||||
if (func.HasCode()) {
|
||||
code_ = func.CurrentCode();
|
||||
if (!CanKeep(code_)) {
|
||||
if (FLAG_trace_reused_instructions) {
|
||||
OS::PrintErr("No reusable instructions for %s\n", func.ToCString());
|
||||
}
|
||||
func.ClearCode();
|
||||
func.ClearICDataArray();
|
||||
return;
|
||||
}
|
||||
}
|
||||
code_ = func.unoptimized_code();
|
||||
if (!code_.IsNull() && !CanKeep(code_)) {
|
||||
if (FLAG_trace_reused_instructions) {
|
||||
OS::PrintErr("No reusable instructions for %s\n", func.ToCString());
|
||||
}
|
||||
func.ClearCode();
|
||||
func.ClearICDataArray();
|
||||
}
|
||||
}
|
||||
|
||||
bool CanKeep(const Code& code) {
|
||||
if (!IsAvailable(code)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
pool_ = code.object_pool();
|
||||
for (intptr_t i = 0; i < pool_.Length(); i++) {
|
||||
if (pool_.TypeAt(i) == ObjectPool::EntryType::kTaggedObject) {
|
||||
entry_ = pool_.ObjectAt(i);
|
||||
if (entry_.IsCode() && !IsAvailable(Code::Cast(entry_))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
table_ = code.static_calls_target_table();
|
||||
if (!table_.IsNull()) {
|
||||
StaticCallsTable static_calls(table_);
|
||||
for (auto& view : static_calls) {
|
||||
entry_ = view.Get<Code::kSCallTableCodeTarget>();
|
||||
if (entry_.IsCode() && !IsAvailable(Code::Cast(entry_))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
bool IsAvailable(const Code& code) {
|
||||
ObjectOffsetPair* pair = reused_instructions_.Lookup(code.instructions());
|
||||
return pair != NULL;
|
||||
}
|
||||
|
||||
ObjectOffsetMap reused_instructions_;
|
||||
Code& code_;
|
||||
Instructions& instructions_;
|
||||
ObjectPool& pool_;
|
||||
Array& table_;
|
||||
Object& entry_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(DropCodeVisitor);
|
||||
};
|
||||
|
||||
DropCodeVisitor visitor(reused_instructions);
|
||||
ProgramVisitor::VisitClasses(&visitor);
|
||||
ProgramVisitor::VisitFunctions(&visitor);
|
||||
}
|
||||
#endif // !defined(DART_PRECOMPILED_RUNTIME)
|
||||
|
||||
} // namespace dart
|
||||
|
|
|
@ -64,22 +64,16 @@ class Image : ValueObject {
|
|||
|
||||
class ImageReader : public ZoneAllocated {
|
||||
public:
|
||||
ImageReader(const uint8_t* data_image,
|
||||
const uint8_t* instructions_image,
|
||||
const uint8_t* shared_data_image,
|
||||
const uint8_t* shared_instructions_image);
|
||||
ImageReader(const uint8_t* data_image, const uint8_t* instructions_image);
|
||||
|
||||
RawApiError* VerifyAlignment() const;
|
||||
|
||||
RawInstructions* GetInstructionsAt(int32_t offset) const;
|
||||
RawInstructions* GetInstructionsAt(uint32_t offset) const;
|
||||
RawObject* GetObjectAt(uint32_t offset) const;
|
||||
RawObject* GetSharedObjectAt(uint32_t offset) const;
|
||||
|
||||
private:
|
||||
const uint8_t* data_image_;
|
||||
const uint8_t* instructions_image_;
|
||||
const uint8_t* shared_data_image_;
|
||||
const uint8_t* shared_instructions_image_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ImageReader);
|
||||
};
|
||||
|
@ -152,13 +146,9 @@ struct ImageWriterCommand {
|
|||
|
||||
class ImageWriter : public ValueObject {
|
||||
public:
|
||||
ImageWriter(Heap* heap,
|
||||
const void* shared_objects,
|
||||
const void* shared_instructions,
|
||||
const void* reused_instructions);
|
||||
explicit ImageWriter(Heap* heap);
|
||||
virtual ~ImageWriter() {}
|
||||
|
||||
static void SetupShared(ObjectOffsetMap* map, const void* shared_image);
|
||||
void ResetOffsets() {
|
||||
next_data_offset_ = Image::kHeaderSize;
|
||||
next_text_offset_ = Image::kHeaderSize;
|
||||
|
@ -171,7 +161,6 @@ class ImageWriter : public ValueObject {
|
|||
void PrepareForSerialization(GrowableArray<ImageWriterCommand>* commands);
|
||||
|
||||
int32_t GetTextOffsetFor(RawInstructions* instructions, RawCode* code);
|
||||
bool GetSharedDataOffsetFor(RawObject* raw_object, uint32_t* offset);
|
||||
uint32_t GetDataOffsetFor(RawObject* raw_object);
|
||||
|
||||
void Write(WriteStream* clustered_stream, bool vm);
|
||||
|
@ -244,9 +233,6 @@ class ImageWriter : public ValueObject {
|
|||
intptr_t next_text_offset_;
|
||||
GrowableArray<ObjectData> objects_;
|
||||
GrowableArray<InstructionsData> instructions_;
|
||||
ObjectOffsetMap shared_objects_;
|
||||
ObjectOffsetMap shared_instructions_;
|
||||
ObjectOffsetMap reuse_instructions_;
|
||||
|
||||
V8SnapshotProfileWriter::IdSpace offset_space_ =
|
||||
V8SnapshotProfileWriter::kSnapshot;
|
||||
|
@ -309,9 +295,7 @@ class AssemblyImageWriter : public ImageWriter {
|
|||
public:
|
||||
AssemblyImageWriter(Thread* thread,
|
||||
Dart_StreamingWriteCallback callback,
|
||||
void* callback_data,
|
||||
const void* shared_objects,
|
||||
const void* shared_instructions);
|
||||
void* callback_data);
|
||||
void Finalize();
|
||||
|
||||
virtual void WriteText(WriteStream* clustered_stream, bool vm);
|
||||
|
@ -348,9 +332,6 @@ class BlobImageWriter : public ImageWriter {
|
|||
uint8_t** instructions_blob_buffer,
|
||||
ReAlloc alloc,
|
||||
intptr_t initial_size,
|
||||
const void* shared_objects,
|
||||
const void* shared_instructions,
|
||||
const void* reused_instructions,
|
||||
Elf* elf = nullptr,
|
||||
Dwarf* dwarf = nullptr);
|
||||
|
||||
|
@ -370,8 +351,6 @@ class BlobImageWriter : public ImageWriter {
|
|||
DISALLOW_COPY_AND_ASSIGN(BlobImageWriter);
|
||||
};
|
||||
|
||||
void DropCodeWithoutReusableInstructions(const void* reused_instructions);
|
||||
|
||||
} // namespace dart
|
||||
|
||||
#endif // RUNTIME_VM_IMAGE_SNAPSHOT_H_
|
||||
|
|
|
@ -184,8 +184,6 @@ class IsolateGroupSource {
|
|||
const char* name,
|
||||
const uint8_t* snapshot_data,
|
||||
const uint8_t* snapshot_instructions,
|
||||
const uint8_t* shared_data,
|
||||
const uint8_t* shared_instructions,
|
||||
const uint8_t* kernel_buffer,
|
||||
intptr_t kernel_buffer_size,
|
||||
Dart_IsolateFlags flags)
|
||||
|
@ -193,8 +191,6 @@ class IsolateGroupSource {
|
|||
name(strdup(name)),
|
||||
snapshot_data(snapshot_data),
|
||||
snapshot_instructions(snapshot_instructions),
|
||||
shared_data(shared_data),
|
||||
shared_instructions(shared_instructions),
|
||||
kernel_buffer(kernel_buffer),
|
||||
kernel_buffer_size(kernel_buffer_size),
|
||||
flags(flags),
|
||||
|
@ -208,8 +204,6 @@ class IsolateGroupSource {
|
|||
char* name;
|
||||
const uint8_t* snapshot_data;
|
||||
const uint8_t* snapshot_instructions;
|
||||
const uint8_t* shared_data;
|
||||
const uint8_t* shared_instructions;
|
||||
const uint8_t* kernel_buffer;
|
||||
const intptr_t kernel_buffer_size;
|
||||
Dart_IsolateFlags flags;
|
||||
|
|
|
@ -114,9 +114,9 @@ Dart_Isolate TestCase::CreateIsolate(const uint8_t* data_buffer,
|
|||
Isolate::FlagsInitialize(&api_flags);
|
||||
Dart_Isolate isolate = NULL;
|
||||
if (len == 0) {
|
||||
isolate = Dart_CreateIsolateGroup(name, NULL, data_buffer, instr_buffer,
|
||||
NULL, NULL, &api_flags, group_data,
|
||||
isolate_data, &err);
|
||||
isolate =
|
||||
Dart_CreateIsolateGroup(name, NULL, data_buffer, instr_buffer,
|
||||
&api_flags, group_data, isolate_data, &err);
|
||||
} else {
|
||||
isolate = Dart_CreateIsolateGroupFromKernel(name, NULL, data_buffer, len,
|
||||
&api_flags, group_data,
|
||||
|
|
|
@ -1,95 +0,0 @@
|
|||
// Copyright (c) 2018, 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.
|
||||
|
||||
import "dart:io";
|
||||
|
||||
void main(List<String> args) {
|
||||
if (args.contains("--child")) {
|
||||
print("Hello, sharing world!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Platform.executable.endsWith("dart_precompiled_runtime")) {
|
||||
return; // Running in JIT or Windows: AOT binaries not available.
|
||||
}
|
||||
|
||||
if (Platform.isAndroid) {
|
||||
return; // SDK tree and dart_bootstrap not available on the test device.
|
||||
}
|
||||
|
||||
var buildDir =
|
||||
Platform.executable.substring(0, Platform.executable.lastIndexOf('/'));
|
||||
var tempDir = Directory.systemTemp.createTempSync("app-shared");
|
||||
var snapshot1Path = tempDir.uri.resolve("hello1.snapshot").toFilePath();
|
||||
var snapshot2Path = tempDir.uri.resolve("hello2.snapshot").toFilePath();
|
||||
var scriptPath = new Directory(buildDir)
|
||||
.uri
|
||||
.resolve("../../tests/standalone_2/app_snapshot_share_test.dart")
|
||||
.toFilePath();
|
||||
final scriptPathDill = tempDir.uri.resolve('app.dill').toFilePath();
|
||||
|
||||
try {
|
||||
args = <String>[
|
||||
'--aot',
|
||||
'--platform=$buildDir/vm_platform_strong.dill',
|
||||
'-o',
|
||||
scriptPathDill,
|
||||
scriptPath,
|
||||
];
|
||||
runSync("pkg/vm/tool/gen_kernel${Platform.isWindows ? '.bat' : ''}", args);
|
||||
|
||||
args = <String>[
|
||||
"--deterministic",
|
||||
"--snapshot-kind=app-aot-blobs",
|
||||
"--blobs_container_filename=$snapshot1Path",
|
||||
scriptPathDill,
|
||||
];
|
||||
runSync("$buildDir/gen_snapshot", args);
|
||||
|
||||
args = <String>[
|
||||
"--deterministic",
|
||||
"--snapshot-kind=app-aot-blobs",
|
||||
"--blobs_container_filename=$snapshot2Path",
|
||||
"--shared-blobs=$snapshot1Path",
|
||||
scriptPathDill,
|
||||
];
|
||||
runSync("$buildDir/gen_snapshot", args);
|
||||
|
||||
var sizeWithoutSharing = new File(snapshot1Path).statSync().size;
|
||||
var deltaWhenSharing = new File(snapshot2Path).statSync().size;
|
||||
print("sizeWithoutSharing: ${sizeWithoutSharing.toString().padLeft(8)}");
|
||||
print("deltaWhenSharing: ${deltaWhenSharing.toString().padLeft(8)}");
|
||||
if (deltaWhenSharing >= sizeWithoutSharing) {
|
||||
throw "Sharing did not shrink size";
|
||||
}
|
||||
|
||||
args = <String>[
|
||||
"--shared-blobs=$snapshot1Path",
|
||||
snapshot2Path,
|
||||
"--child",
|
||||
];
|
||||
final result = runSync("$buildDir/dart_precompiled_runtime", args);
|
||||
if (!result.stdout.contains("Hello, sharing world!")) {
|
||||
throw "Missing output";
|
||||
}
|
||||
} finally {
|
||||
tempDir.deleteSync(recursive: true);
|
||||
}
|
||||
}
|
||||
|
||||
ProcessResult runSync(String executable, List<String> args) {
|
||||
print("+ $executable ${args.join(' ')}");
|
||||
|
||||
final result = Process.runSync(executable, args);
|
||||
print("Exit code: ${result.exitCode}");
|
||||
print("stdout:");
|
||||
print(result.stdout);
|
||||
print("stderr:");
|
||||
print(result.stderr);
|
||||
|
||||
if (result.exitCode != 0) {
|
||||
throw "Bad exit code";
|
||||
}
|
||||
return result;
|
||||
}
|
|
@ -0,0 +1,613 @@
|
|||
diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc
|
||||
index 2db8ae2c7cd5..dcbe05f66691 100644
|
||||
--- a/runtime/dart_isolate.cc
|
||||
+++ b/runtime/dart_isolate.cc
|
||||
@@ -32,7 +32,6 @@ namespace flutter {
|
||||
std::weak_ptr<DartIsolate> DartIsolate::CreateRootIsolate(
|
||||
const Settings& settings,
|
||||
fml::RefPtr<const DartSnapshot> isolate_snapshot,
|
||||
- fml::RefPtr<const DartSnapshot> shared_snapshot,
|
||||
TaskRunners task_runners,
|
||||
std::unique_ptr<Window> window,
|
||||
fml::WeakPtr<IOManager> io_manager,
|
||||
@@ -58,7 +57,6 @@ std::weak_ptr<DartIsolate> DartIsolate::CreateRootIsolate(
|
||||
std::shared_ptr<DartIsolate>(new DartIsolate(
|
||||
settings, // settings
|
||||
std::move(isolate_snapshot), // isolate snapshot
|
||||
- std::move(shared_snapshot), // shared snapshot
|
||||
task_runners, // task runners
|
||||
std::move(io_manager), // IO manager
|
||||
std::move(image_decoder), // Image Decoder
|
||||
@@ -102,7 +100,6 @@ std::weak_ptr<DartIsolate> DartIsolate::CreateRootIsolate(
|
||||
|
||||
DartIsolate::DartIsolate(const Settings& settings,
|
||||
fml::RefPtr<const DartSnapshot> isolate_snapshot,
|
||||
- fml::RefPtr<const DartSnapshot> shared_snapshot,
|
||||
TaskRunners task_runners,
|
||||
fml::WeakPtr<IOManager> io_manager,
|
||||
fml::WeakPtr<ImageDecoder> image_decoder,
|
||||
@@ -123,7 +120,6 @@ DartIsolate::DartIsolate(const Settings& settings,
|
||||
DartVMRef::GetIsolateNameServer()),
|
||||
settings_(settings),
|
||||
isolate_snapshot_(std::move(isolate_snapshot)),
|
||||
- shared_snapshot_(std::move(shared_snapshot)),
|
||||
child_isolate_preparer_(std::move(child_isolate_preparer)),
|
||||
isolate_create_callback_(isolate_create_callback),
|
||||
isolate_shutdown_callback_(isolate_shutdown_callback) {
|
||||
@@ -592,7 +588,6 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate(
|
||||
DartIsolate::CreateRootIsolate(
|
||||
vm_data->GetSettings(), // settings
|
||||
vm_data->GetIsolateSnapshot(), // isolate snapshot
|
||||
- vm_data->GetSharedSnapshot(), // shared snapshot
|
||||
null_task_runners, // task runners
|
||||
nullptr, // window
|
||||
{}, // IO Manager
|
||||
@@ -705,7 +700,6 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair(
|
||||
std::shared_ptr<DartIsolate>(new DartIsolate(
|
||||
(*raw_embedder_isolate)->GetSettings(), // settings
|
||||
(*raw_embedder_isolate)->GetIsolateSnapshot(), // isolate_snapshot
|
||||
- (*raw_embedder_isolate)->GetSharedSnapshot(), // shared_snapshot
|
||||
null_task_runners, // task_runners
|
||||
fml::WeakPtr<IOManager>{}, // io_manager
|
||||
fml::WeakPtr<ImageDecoder>{}, // io_manager
|
||||
@@ -724,9 +718,7 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair(
|
||||
advisory_script_uri, //
|
||||
advisory_script_entrypoint, //
|
||||
(*embedder_isolate)->GetIsolateSnapshot()->GetDataMapping(),
|
||||
- (*embedder_isolate)->GetIsolateSnapshot()->GetInstructionsMapping(),
|
||||
- (*embedder_isolate)->GetSharedSnapshot()->GetDataMapping(),
|
||||
- (*embedder_isolate)->GetSharedSnapshot()->GetInstructionsMapping(), flags,
|
||||
+ (*embedder_isolate)->GetIsolateSnapshot()->GetInstructionsMapping(), flags,
|
||||
embedder_isolate.get(), // isolate_group_data
|
||||
embedder_isolate.get(), // isolate_group
|
||||
error);
|
||||
@@ -791,10 +783,6 @@ fml::RefPtr<const DartSnapshot> DartIsolate::GetIsolateSnapshot() const {
|
||||
return isolate_snapshot_;
|
||||
}
|
||||
|
||||
-fml::RefPtr<const DartSnapshot> DartIsolate::GetSharedSnapshot() const {
|
||||
- return shared_snapshot_;
|
||||
-}
|
||||
-
|
||||
std::weak_ptr<DartIsolate> DartIsolate::GetWeakIsolatePtr() {
|
||||
return std::static_pointer_cast<DartIsolate>(shared_from_this());
|
||||
}
|
||||
diff --git a/runtime/dart_isolate.h b/runtime/dart_isolate.h
|
||||
index e7ab9b30243c..2abaa11fe011 100644
|
||||
--- a/runtime/dart_isolate.h
|
||||
+++ b/runtime/dart_isolate.h
|
||||
@@ -143,10 +143,6 @@ class DartIsolate : public UIDartState {
|
||||
/// usually obtained from the
|
||||
/// DartVMData associated with the
|
||||
/// running Dart VM instance.
|
||||
- /// @param[in] shared_snapshot The shared snapshot. This is
|
||||
- /// usually obtained from the
|
||||
- /// DartVMData associated with the
|
||||
- /// running Dart VM instance.
|
||||
/// @param[in] task_runners The task runners used by the
|
||||
/// isolate. Via UI bindings, the
|
||||
/// isolate will use the IO task
|
||||
@@ -192,7 +188,6 @@ class DartIsolate : public UIDartState {
|
||||
static std::weak_ptr<DartIsolate> CreateRootIsolate(
|
||||
const Settings& settings,
|
||||
fml::RefPtr<const DartSnapshot> isolate_snapshot,
|
||||
- fml::RefPtr<const DartSnapshot> shared_snapshot,
|
||||
TaskRunners task_runners,
|
||||
std::unique_ptr<Window> window,
|
||||
fml::WeakPtr<IOManager> io_manager,
|
||||
@@ -385,14 +380,6 @@ class DartIsolate : public UIDartState {
|
||||
///
|
||||
fml::RefPtr<const DartSnapshot> GetIsolateSnapshot() const;
|
||||
|
||||
- //----------------------------------------------------------------------------
|
||||
- /// @brief Get the shared snapshot used to launch this isolate. This is
|
||||
- /// referenced by any child isolates launched by the root isolate.
|
||||
- ///
|
||||
- /// @return The shared snapshot.
|
||||
- ///
|
||||
- fml::RefPtr<const DartSnapshot> GetSharedSnapshot() const;
|
||||
-
|
||||
//----------------------------------------------------------------------------
|
||||
/// @brief A weak pointer to the Dart isolate instance. This instance may
|
||||
/// only be used on the task runner that created the root isolate.
|
||||
@@ -428,7 +415,6 @@ class DartIsolate : public UIDartState {
|
||||
Phase phase_ = Phase::Unknown;
|
||||
const Settings settings_;
|
||||
const fml::RefPtr<const DartSnapshot> isolate_snapshot_;
|
||||
- const fml::RefPtr<const DartSnapshot> shared_snapshot_;
|
||||
std::vector<std::shared_ptr<const fml::Mapping>> kernel_buffers_;
|
||||
std::vector<std::unique_ptr<AutoFireClosure>> shutdown_callbacks_;
|
||||
ChildIsolatePreparer child_isolate_preparer_ = nullptr;
|
||||
@@ -438,7 +424,6 @@ class DartIsolate : public UIDartState {
|
||||
|
||||
DartIsolate(const Settings& settings,
|
||||
fml::RefPtr<const DartSnapshot> isolate_snapshot,
|
||||
- fml::RefPtr<const DartSnapshot> shared_snapshot,
|
||||
TaskRunners task_runners,
|
||||
fml::WeakPtr<IOManager> io_manager,
|
||||
fml::WeakPtr<ImageDecoder> image_decoder,
|
||||
diff --git a/runtime/dart_isolate_unittests.cc b/runtime/dart_isolate_unittests.cc
|
||||
index 83a140737324..4d860f82d781 100644
|
||||
--- a/runtime/dart_isolate_unittests.cc
|
||||
+++ b/runtime/dart_isolate_unittests.cc
|
||||
@@ -38,7 +38,6 @@ TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) {
|
||||
auto weak_isolate = DartIsolate::CreateRootIsolate(
|
||||
vm_data->GetSettings(), // settings
|
||||
vm_data->GetIsolateSnapshot(), // isolate snapshot
|
||||
- vm_data->GetSharedSnapshot(), // shared snapshot
|
||||
std::move(task_runners), // task runners
|
||||
nullptr, // window
|
||||
{}, // io manager
|
||||
@@ -71,7 +70,6 @@ TEST_F(DartIsolateTest, IsolateShutdownCallbackIsInIsolateScope) {
|
||||
auto weak_isolate = DartIsolate::CreateRootIsolate(
|
||||
vm_data->GetSettings(), // settings
|
||||
vm_data->GetIsolateSnapshot(), // isolate snapshot
|
||||
- vm_data->GetSharedSnapshot(), // shared snapshot
|
||||
std::move(task_runners), // task runners
|
||||
nullptr, // window
|
||||
{}, // io manager
|
||||
@@ -181,7 +179,6 @@ static void RunDartCodeInIsolate(DartVMRef& vm_ref,
|
||||
auto weak_isolate = DartIsolate::CreateRootIsolate(
|
||||
vm_data->GetSettings(), // settings
|
||||
vm_data->GetIsolateSnapshot(), // isolate snapshot
|
||||
- vm_data->GetSharedSnapshot(), // shared snapshot
|
||||
std::move(task_runners), // task runners
|
||||
nullptr, // window
|
||||
{}, // io manager
|
||||
diff --git a/runtime/dart_lifecycle_unittests.cc b/runtime/dart_lifecycle_unittests.cc
|
||||
index 7a607b7be26f..7a35c96167e5 100644
|
||||
--- a/runtime/dart_lifecycle_unittests.cc
|
||||
+++ b/runtime/dart_lifecycle_unittests.cc
|
||||
@@ -53,7 +53,6 @@ static std::shared_ptr<DartIsolate> CreateAndRunRootIsolate(
|
||||
auto isolate_weak = DartIsolate::CreateRootIsolate(
|
||||
vm.GetSettings(), // settings
|
||||
vm.GetIsolateSnapshot(), // isolate_snapshot
|
||||
- vm.GetSharedSnapshot(), // shared_snapshot
|
||||
runners, // task_runners
|
||||
{}, // window
|
||||
{}, // io_manager
|
||||
diff --git a/runtime/dart_snapshot.cc b/runtime/dart_snapshot.cc
|
||||
index acebcd3493d8..a5df79bb136c 100644
|
||||
--- a/runtime/dart_snapshot.cc
|
||||
+++ b/runtime/dart_snapshot.cc
|
||||
@@ -181,10 +181,6 @@ fml::RefPtr<DartSnapshot> DartSnapshot::IsolateSnapshotFromSettings(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
-fml::RefPtr<DartSnapshot> DartSnapshot::Empty() {
|
||||
- return fml::MakeRefCounted<DartSnapshot>(nullptr, nullptr);
|
||||
-}
|
||||
-
|
||||
DartSnapshot::DartSnapshot(std::shared_ptr<const fml::Mapping> data,
|
||||
std::shared_ptr<const fml::Mapping> instructions)
|
||||
: data_(std::move(data)), instructions_(std::move(instructions)) {}
|
||||
diff --git a/runtime/dart_snapshot.h b/runtime/dart_snapshot.h
|
||||
index 162710ff2a6a..97038aac4aee 100644
|
||||
--- a/runtime/dart_snapshot.h
|
||||
+++ b/runtime/dart_snapshot.h
|
||||
@@ -102,17 +102,6 @@ class DartSnapshot : public fml::RefCountedThreadSafe<DartSnapshot> {
|
||||
static fml::RefPtr<DartSnapshot> IsolateSnapshotFromSettings(
|
||||
const Settings& settings);
|
||||
|
||||
- //----------------------------------------------------------------------------
|
||||
- /// @brief An empty an invalid snapshot. This is used as a placeholder
|
||||
- /// for certain optional snapshots.
|
||||
- ///
|
||||
- /// @bug Now that shared snapshots are no longer required, consider
|
||||
- /// removing this constructor.
|
||||
- ///
|
||||
- /// @return An invalid empty snapshot.
|
||||
- ///
|
||||
- static fml::RefPtr<DartSnapshot> Empty();
|
||||
-
|
||||
//----------------------------------------------------------------------------
|
||||
/// @brief Determines if this snapshot contains a heap component. Since
|
||||
/// the instructions component is optional, the method does not
|
||||
diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc
|
||||
index 37f8e690f737..0c18ba8da702 100644
|
||||
--- a/runtime/dart_vm.cc
|
||||
+++ b/runtime/dart_vm.cc
|
||||
@@ -232,12 +232,10 @@ std::shared_ptr<DartVM> DartVM::Create(
|
||||
Settings settings,
|
||||
fml::RefPtr<DartSnapshot> vm_snapshot,
|
||||
fml::RefPtr<DartSnapshot> isolate_snapshot,
|
||||
- fml::RefPtr<DartSnapshot> shared_snapshot,
|
||||
std::shared_ptr<IsolateNameServer> isolate_name_server) {
|
||||
auto vm_data = DartVMData::Create(settings, //
|
||||
std::move(vm_snapshot), //
|
||||
- std::move(isolate_snapshot), //
|
||||
- std::move(shared_snapshot) //
|
||||
+ std::move(isolate_snapshot) //
|
||||
);
|
||||
|
||||
if (!vm_data) {
|
||||
diff --git a/runtime/dart_vm.h b/runtime/dart_vm.h
|
||||
index 40b8dc4a242e..ac84fe77020d 100644
|
||||
--- a/runtime/dart_vm.h
|
||||
+++ b/runtime/dart_vm.h
|
||||
@@ -162,7 +162,6 @@ class DartVM {
|
||||
Settings settings,
|
||||
fml::RefPtr<DartSnapshot> vm_snapshot,
|
||||
fml::RefPtr<DartSnapshot> isolate_snapshot,
|
||||
- fml::RefPtr<DartSnapshot> shared_snapshot,
|
||||
std::shared_ptr<IsolateNameServer> isolate_name_server);
|
||||
|
||||
DartVM(std::shared_ptr<const DartVMData> data,
|
||||
diff --git a/runtime/dart_vm_data.cc b/runtime/dart_vm_data.cc
|
||||
index e14c998daa74..b93d9ba9ad03 100644
|
||||
--- a/runtime/dart_vm_data.cc
|
||||
+++ b/runtime/dart_vm_data.cc
|
||||
@@ -9,8 +9,7 @@ namespace flutter {
|
||||
std::shared_ptr<const DartVMData> DartVMData::Create(
|
||||
Settings settings,
|
||||
fml::RefPtr<DartSnapshot> vm_snapshot,
|
||||
- fml::RefPtr<DartSnapshot> isolate_snapshot,
|
||||
- fml::RefPtr<DartSnapshot> shared_snapshot) {
|
||||
+ fml::RefPtr<DartSnapshot> isolate_snapshot) {
|
||||
if (!vm_snapshot || !vm_snapshot->IsValid()) {
|
||||
// Caller did not provide a valid VM snapshot. Attempt to infer one
|
||||
// from the settings.
|
||||
@@ -33,30 +32,19 @@ std::shared_ptr<const DartVMData> DartVMData::Create(
|
||||
}
|
||||
}
|
||||
|
||||
- if (!shared_snapshot || !shared_snapshot->IsValid()) {
|
||||
- shared_snapshot = DartSnapshot::Empty();
|
||||
- if (!shared_snapshot) {
|
||||
- FML_LOG(ERROR) << "Shared snapshot invalid.";
|
||||
- return {};
|
||||
- }
|
||||
- }
|
||||
-
|
||||
return std::shared_ptr<const DartVMData>(new DartVMData(
|
||||
std::move(settings), //
|
||||
std::move(vm_snapshot), //
|
||||
- std::move(isolate_snapshot), //
|
||||
- std::move(shared_snapshot) //
|
||||
+ std::move(isolate_snapshot) //
|
||||
));
|
||||
}
|
||||
|
||||
DartVMData::DartVMData(Settings settings,
|
||||
fml::RefPtr<const DartSnapshot> vm_snapshot,
|
||||
- fml::RefPtr<const DartSnapshot> isolate_snapshot,
|
||||
- fml::RefPtr<const DartSnapshot> shared_snapshot)
|
||||
+ fml::RefPtr<const DartSnapshot> isolate_snapshot)
|
||||
: settings_(settings),
|
||||
vm_snapshot_(vm_snapshot),
|
||||
- isolate_snapshot_(isolate_snapshot),
|
||||
- shared_snapshot_(shared_snapshot) {}
|
||||
+ isolate_snapshot_(isolate_snapshot) {}
|
||||
|
||||
DartVMData::~DartVMData() = default;
|
||||
|
||||
@@ -72,8 +60,4 @@ fml::RefPtr<const DartSnapshot> DartVMData::GetIsolateSnapshot() const {
|
||||
return isolate_snapshot_;
|
||||
}
|
||||
|
||||
-fml::RefPtr<const DartSnapshot> DartVMData::GetSharedSnapshot() const {
|
||||
- return shared_snapshot_;
|
||||
-}
|
||||
-
|
||||
} // namespace flutter
|
||||
diff --git a/runtime/dart_vm_data.h b/runtime/dart_vm_data.h
|
||||
index 95c4565e2ef7..0f054bf55f3d 100644
|
||||
--- a/runtime/dart_vm_data.h
|
||||
+++ b/runtime/dart_vm_data.h
|
||||
@@ -15,8 +15,7 @@ class DartVMData {
|
||||
static std::shared_ptr<const DartVMData> Create(
|
||||
Settings settings,
|
||||
fml::RefPtr<DartSnapshot> vm_snapshot,
|
||||
- fml::RefPtr<DartSnapshot> isolate_snapshot,
|
||||
- fml::RefPtr<DartSnapshot> shared_snapshot);
|
||||
+ fml::RefPtr<DartSnapshot> isolate_snapshot);
|
||||
|
||||
~DartVMData();
|
||||
|
||||
@@ -26,18 +25,14 @@ class DartVMData {
|
||||
|
||||
fml::RefPtr<const DartSnapshot> GetIsolateSnapshot() const;
|
||||
|
||||
- fml::RefPtr<const DartSnapshot> GetSharedSnapshot() const;
|
||||
-
|
||||
private:
|
||||
const Settings settings_;
|
||||
const fml::RefPtr<const DartSnapshot> vm_snapshot_;
|
||||
const fml::RefPtr<const DartSnapshot> isolate_snapshot_;
|
||||
- const fml::RefPtr<const DartSnapshot> shared_snapshot_;
|
||||
|
||||
DartVMData(Settings settings,
|
||||
fml::RefPtr<const DartSnapshot> vm_snapshot,
|
||||
- fml::RefPtr<const DartSnapshot> isolate_snapshot,
|
||||
- fml::RefPtr<const DartSnapshot> shared_snapshot);
|
||||
+ fml::RefPtr<const DartSnapshot> isolate_snapshot);
|
||||
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(DartVMData);
|
||||
};
|
||||
diff --git a/runtime/dart_vm_lifecycle.cc b/runtime/dart_vm_lifecycle.cc
|
||||
index 717a0546a280..41a3da606abb 100644
|
||||
--- a/runtime/dart_vm_lifecycle.cc
|
||||
+++ b/runtime/dart_vm_lifecycle.cc
|
||||
@@ -43,8 +43,7 @@ DartVMRef::~DartVMRef() {
|
||||
|
||||
DartVMRef DartVMRef::Create(Settings settings,
|
||||
fml::RefPtr<DartSnapshot> vm_snapshot,
|
||||
- fml::RefPtr<DartSnapshot> isolate_snapshot,
|
||||
- fml::RefPtr<DartSnapshot> shared_snapshot) {
|
||||
+ fml::RefPtr<DartSnapshot> isolate_snapshot) {
|
||||
std::scoped_lock lifecycle_lock(gVMMutex);
|
||||
|
||||
if (!settings.leak_vm) {
|
||||
@@ -78,7 +77,6 @@ DartVMRef DartVMRef::Create(Settings settings,
|
||||
auto vm = DartVM::Create(std::move(settings), //
|
||||
std::move(vm_snapshot), //
|
||||
std::move(isolate_snapshot), //
|
||||
- std::move(shared_snapshot), //
|
||||
isolate_name_server //
|
||||
);
|
||||
|
||||
diff --git a/runtime/dart_vm_lifecycle.h b/runtime/dart_vm_lifecycle.h
|
||||
index 5ce6cf7a5777..d89b6d7cb43d 100644
|
||||
--- a/runtime/dart_vm_lifecycle.h
|
||||
+++ b/runtime/dart_vm_lifecycle.h
|
||||
@@ -29,8 +29,7 @@ class DartVMRef {
|
||||
FML_WARN_UNUSED_RESULT
|
||||
static DartVMRef Create(Settings settings,
|
||||
fml::RefPtr<DartSnapshot> vm_snapshot = nullptr,
|
||||
- fml::RefPtr<DartSnapshot> isolate_snapshot = nullptr,
|
||||
- fml::RefPtr<DartSnapshot> shared_snapshot = nullptr);
|
||||
+ fml::RefPtr<DartSnapshot> isolate_snapshot = nullptr);
|
||||
|
||||
DartVMRef(DartVMRef&&);
|
||||
|
||||
diff --git a/runtime/runtime_controller.cc b/runtime/runtime_controller.cc
|
||||
index 61415ec4124c..a63843fedf66 100644
|
||||
--- a/runtime/runtime_controller.cc
|
||||
+++ b/runtime/runtime_controller.cc
|
||||
@@ -18,7 +18,6 @@ RuntimeController::RuntimeController(
|
||||
RuntimeDelegate& p_client,
|
||||
DartVM* p_vm,
|
||||
fml::RefPtr<const DartSnapshot> p_isolate_snapshot,
|
||||
- fml::RefPtr<const DartSnapshot> p_shared_snapshot,
|
||||
TaskRunners p_task_runners,
|
||||
fml::WeakPtr<IOManager> p_io_manager,
|
||||
fml::WeakPtr<ImageDecoder> p_image_decoder,
|
||||
@@ -31,7 +30,6 @@ RuntimeController::RuntimeController(
|
||||
: RuntimeController(p_client,
|
||||
p_vm,
|
||||
std::move(p_isolate_snapshot),
|
||||
- std::move(p_shared_snapshot),
|
||||
std::move(p_task_runners),
|
||||
std::move(p_io_manager),
|
||||
std::move(p_image_decoder),
|
||||
@@ -47,7 +45,6 @@ RuntimeController::RuntimeController(
|
||||
RuntimeDelegate& p_client,
|
||||
DartVM* p_vm,
|
||||
fml::RefPtr<const DartSnapshot> p_isolate_snapshot,
|
||||
- fml::RefPtr<const DartSnapshot> p_shared_snapshot,
|
||||
TaskRunners p_task_runners,
|
||||
fml::WeakPtr<IOManager> p_io_manager,
|
||||
fml::WeakPtr<ImageDecoder> p_image_decoder,
|
||||
@@ -61,7 +58,6 @@ RuntimeController::RuntimeController(
|
||||
: client_(p_client),
|
||||
vm_(p_vm),
|
||||
isolate_snapshot_(std::move(p_isolate_snapshot)),
|
||||
- shared_snapshot_(std::move(p_shared_snapshot)),
|
||||
task_runners_(p_task_runners),
|
||||
io_manager_(p_io_manager),
|
||||
image_decoder_(p_image_decoder),
|
||||
@@ -78,7 +74,6 @@ RuntimeController::RuntimeController(
|
||||
auto strong_root_isolate =
|
||||
DartIsolate::CreateRootIsolate(vm_->GetVMData()->GetSettings(), //
|
||||
isolate_snapshot_, //
|
||||
- shared_snapshot_, //
|
||||
task_runners_, //
|
||||
std::make_unique<Window>(this), //
|
||||
io_manager_, //
|
||||
@@ -139,7 +134,6 @@ std::unique_ptr<RuntimeController> RuntimeController::Clone() const {
|
||||
client_, //
|
||||
vm_, //
|
||||
isolate_snapshot_, //
|
||||
- shared_snapshot_, //
|
||||
task_runners_, //
|
||||
io_manager_, //
|
||||
image_decoder_, //
|
||||
diff --git a/runtime/runtime_controller.h b/runtime/runtime_controller.h
|
||||
index 665f0e17dbb5..98a87f6f5d09 100644
|
||||
--- a/runtime/runtime_controller.h
|
||||
+++ b/runtime/runtime_controller.h
|
||||
@@ -32,7 +32,6 @@ class RuntimeController final : public WindowClient {
|
||||
RuntimeDelegate& client,
|
||||
DartVM* vm,
|
||||
fml::RefPtr<const DartSnapshot> isolate_snapshot,
|
||||
- fml::RefPtr<const DartSnapshot> shared_snapshot,
|
||||
TaskRunners task_runners,
|
||||
fml::WeakPtr<IOManager> io_manager,
|
||||
fml::WeakPtr<ImageDecoder> iamge_decoder,
|
||||
@@ -128,7 +127,6 @@ class RuntimeController final : public WindowClient {
|
||||
RuntimeDelegate& client_;
|
||||
DartVM* const vm_;
|
||||
fml::RefPtr<const DartSnapshot> isolate_snapshot_;
|
||||
- fml::RefPtr<const DartSnapshot> shared_snapshot_;
|
||||
TaskRunners task_runners_;
|
||||
fml::WeakPtr<IOManager> io_manager_;
|
||||
fml::WeakPtr<ImageDecoder> image_decoder_;
|
||||
@@ -146,7 +144,6 @@ class RuntimeController final : public WindowClient {
|
||||
RuntimeDelegate& client,
|
||||
DartVM* vm,
|
||||
fml::RefPtr<const DartSnapshot> isolate_snapshot,
|
||||
- fml::RefPtr<const DartSnapshot> shared_snapshot,
|
||||
TaskRunners task_runners,
|
||||
fml::WeakPtr<IOManager> io_manager,
|
||||
fml::WeakPtr<ImageDecoder> image_decoder,
|
||||
diff --git a/shell/common/engine.cc b/shell/common/engine.cc
|
||||
index fd424a369eeb..7ad3a432a52c 100644
|
||||
--- a/shell/common/engine.cc
|
||||
+++ b/shell/common/engine.cc
|
||||
@@ -39,7 +39,6 @@ Engine::Engine(Delegate& delegate,
|
||||
const PointerDataDispatcherMaker& dispatcher_maker,
|
||||
DartVM& vm,
|
||||
fml::RefPtr<const DartSnapshot> isolate_snapshot,
|
||||
- fml::RefPtr<const DartSnapshot> shared_snapshot,
|
||||
TaskRunners task_runners,
|
||||
Settings settings,
|
||||
std::unique_ptr<Animator> animator,
|
||||
@@ -61,7 +60,6 @@ Engine::Engine(Delegate& delegate,
|
||||
*this, // runtime delegate
|
||||
&vm, // VM
|
||||
std::move(isolate_snapshot), // isolate snapshot
|
||||
- std::move(shared_snapshot), // shared snapshot
|
||||
task_runners_, // task runners
|
||||
std::move(io_manager), // io manager
|
||||
image_decoder_.GetWeakPtr(), // image decoder
|
||||
diff --git a/shell/common/engine.h b/shell/common/engine.h
|
||||
index 2e4fd41964bb..dde92dbc6d26 100644
|
||||
--- a/shell/common/engine.h
|
||||
+++ b/shell/common/engine.h
|
||||
@@ -249,8 +249,6 @@ class Engine final : public RuntimeDelegate, PointerDataDispatcher::Delegate {
|
||||
/// created when the engine is created. This
|
||||
/// requires access to the isolate snapshot
|
||||
/// upfront.
|
||||
- /// @param[in] shared_snapshot The portion of the isolate snapshot shared
|
||||
- /// among multiple isolates.
|
||||
// TODO(chinmaygarde): This is probably redundant now that the IO manager is
|
||||
// it's own object.
|
||||
/// @param[in] task_runners The task runners used by the shell that
|
||||
@@ -276,7 +274,6 @@ class Engine final : public RuntimeDelegate, PointerDataDispatcher::Delegate {
|
||||
const PointerDataDispatcherMaker& dispatcher_maker,
|
||||
DartVM& vm,
|
||||
fml::RefPtr<const DartSnapshot> isolate_snapshot,
|
||||
- fml::RefPtr<const DartSnapshot> shared_snapshot,
|
||||
TaskRunners task_runners,
|
||||
Settings settings,
|
||||
std::unique_ptr<Animator> animator,
|
||||
diff --git a/shell/common/shell.cc b/shell/common/shell.cc
|
||||
index bf185a6b3661..fbc2457d56bd 100644
|
||||
--- a/shell/common/shell.cc
|
||||
+++ b/shell/common/shell.cc
|
||||
@@ -45,7 +45,6 @@ std::unique_ptr<Shell> Shell::CreateShellOnPlatformThread(
|
||||
TaskRunners task_runners,
|
||||
Settings settings,
|
||||
fml::RefPtr<const DartSnapshot> isolate_snapshot,
|
||||
- fml::RefPtr<const DartSnapshot> shared_snapshot,
|
||||
Shell::CreateCallback<PlatformView> on_create_platform_view,
|
||||
Shell::CreateCallback<Rasterizer> on_create_rasterizer) {
|
||||
if (!task_runners.IsValid()) {
|
||||
@@ -124,7 +123,6 @@ std::unique_ptr<Shell> Shell::CreateShellOnPlatformThread(
|
||||
shell = shell.get(), //
|
||||
&dispatcher_maker, //
|
||||
isolate_snapshot = std::move(isolate_snapshot), //
|
||||
- shared_snapshot = std::move(shared_snapshot), //
|
||||
vsync_waiter = std::move(vsync_waiter), //
|
||||
&weak_io_manager_future //
|
||||
]() mutable {
|
||||
@@ -141,7 +139,6 @@ std::unique_ptr<Shell> Shell::CreateShellOnPlatformThread(
|
||||
dispatcher_maker, //
|
||||
*shell->GetDartVM(), //
|
||||
std::move(isolate_snapshot), //
|
||||
- std::move(shared_snapshot), //
|
||||
task_runners, //
|
||||
shell->GetSettings(), //
|
||||
std::move(animator), //
|
||||
@@ -227,7 +224,6 @@ std::unique_ptr<Shell> Shell::Create(
|
||||
return Shell::Create(std::move(task_runners), //
|
||||
std::move(settings), //
|
||||
vm_data->GetIsolateSnapshot(), // isolate snapshot
|
||||
- DartSnapshot::Empty(), // shared snapshot
|
||||
std::move(on_create_platform_view), //
|
||||
std::move(on_create_rasterizer), //
|
||||
std::move(vm) //
|
||||
@@ -238,7 +234,6 @@ std::unique_ptr<Shell> Shell::Create(
|
||||
TaskRunners task_runners,
|
||||
Settings settings,
|
||||
fml::RefPtr<const DartSnapshot> isolate_snapshot,
|
||||
- fml::RefPtr<const DartSnapshot> shared_snapshot,
|
||||
Shell::CreateCallback<PlatformView> on_create_platform_view,
|
||||
Shell::CreateCallback<Rasterizer> on_create_rasterizer,
|
||||
DartVMRef vm) {
|
||||
@@ -262,7 +257,6 @@ std::unique_ptr<Shell> Shell::Create(
|
||||
task_runners = std::move(task_runners), //
|
||||
settings, //
|
||||
isolate_snapshot = std::move(isolate_snapshot), //
|
||||
- shared_snapshot = std::move(shared_snapshot), //
|
||||
on_create_platform_view, //
|
||||
on_create_rasterizer //
|
||||
]() mutable {
|
||||
@@ -270,7 +264,6 @@ std::unique_ptr<Shell> Shell::Create(
|
||||
std::move(task_runners), //
|
||||
settings, //
|
||||
std::move(isolate_snapshot), //
|
||||
- std::move(shared_snapshot), //
|
||||
on_create_platform_view, //
|
||||
on_create_rasterizer //
|
||||
);
|
||||
diff --git a/shell/common/shell.h b/shell/common/shell.h
|
||||
index e4ee6960389a..cc3ed8fdc448 100644
|
||||
--- a/shell/common/shell.h
|
||||
+++ b/shell/common/shell.h
|
||||
@@ -139,9 +139,6 @@ class Shell final : public PlatformView::Delegate,
|
||||
/// @param[in] isolate_snapshot A custom isolate snapshot. Takes
|
||||
/// precedence over any snapshots
|
||||
/// specified in the settings.
|
||||
- /// @param[in] shared_snapshot A custom shared snapshot. Takes
|
||||
- /// precedence over any snapshots
|
||||
- /// specified in the settings.
|
||||
/// @param[in] on_create_platform_view The callback that must return a
|
||||
/// platform view. This will be called on
|
||||
/// the platform task runner before this
|
||||
@@ -164,7 +161,6 @@ class Shell final : public PlatformView::Delegate,
|
||||
TaskRunners task_runners,
|
||||
Settings settings,
|
||||
fml::RefPtr<const DartSnapshot> isolate_snapshot,
|
||||
- fml::RefPtr<const DartSnapshot> shared_snapshot,
|
||||
CreateCallback<PlatformView> on_create_platform_view,
|
||||
CreateCallback<Rasterizer> on_create_rasterizer,
|
||||
DartVMRef vm);
|
||||
@@ -375,7 +371,6 @@ class Shell final : public PlatformView::Delegate,
|
||||
TaskRunners task_runners,
|
||||
Settings settings,
|
||||
fml::RefPtr<const DartSnapshot> isolate_snapshot,
|
||||
- fml::RefPtr<const DartSnapshot> shared_snapshot,
|
||||
Shell::CreateCallback<PlatformView> on_create_platform_view,
|
||||
Shell::CreateCallback<Rasterizer> on_create_rasterizer);
|
||||
|
||||
diff --git a/shell/platform/fuchsia/dart_runner/dart_component_controller.cc b/shell/platform/fuchsia/dart_runner/dart_component_controller.cc
|
||||
index 37cef7bce6f7..e5bd774fc4e3 100644
|
||||
--- a/shell/platform/fuchsia/dart_runner/dart_component_controller.cc
|
||||
+++ b/shell/platform/fuchsia/dart_runner/dart_component_controller.cc
|
||||
@@ -314,8 +314,7 @@ bool DartComponentController::CreateIsolate(
|
||||
|
||||
isolate_ = Dart_CreateIsolateGroup(
|
||||
url_.c_str(), label_.c_str(), isolate_snapshot_data,
|
||||
- isolate_snapshot_instructions, nullptr /* shared_snapshot_data */,
|
||||
- nullptr /* shared_snapshot_instructions */, nullptr /* flags */, state,
|
||||
+ isolate_snapshot_instructions, nullptr /* flags */, state,
|
||||
state, &error);
|
||||
if (!isolate_) {
|
||||
FX_LOGF(ERROR, LOG_TAG, "Dart_CreateIsolateGroup failed: %s", error);
|
||||
diff --git a/shell/platform/fuchsia/dart_runner/service_isolate.cc b/shell/platform/fuchsia/dart_runner/service_isolate.cc
|
||||
index d22c4df286b6..40719ab81c94 100644
|
||||
--- a/shell/platform/fuchsia/dart_runner/service_isolate.cc
|
||||
+++ b/shell/platform/fuchsia/dart_runner/service_isolate.cc
|
||||
@@ -107,8 +107,7 @@ Dart_Isolate CreateServiceIsolate(const char* uri,
|
||||
Dart_Isolate isolate = Dart_CreateIsolateGroup(
|
||||
uri, DART_VM_SERVICE_ISOLATE_NAME, mapped_isolate_snapshot_data.address(),
|
||||
mapped_isolate_snapshot_instructions.address(),
|
||||
- nullptr /* shared_snapshot_data */,
|
||||
- nullptr /* shared_snapshot_instructions */, nullptr /* flags */, state,
|
||||
+ nullptr /* flags */, state,
|
||||
state, error);
|
||||
if (!isolate) {
|
||||
FX_LOGF(ERROR, LOG_TAG, "Dart_CreateIsolateGroup failed: %s", *error);
|
||||
diff --git a/shell/platform/fuchsia/flutter/engine.cc b/shell/platform/fuchsia/flutter/engine.cc
|
||||
index 75dbf497b8d8..d002049996df 100644
|
||||
--- a/shell/platform/fuchsia/flutter/engine.cc
|
||||
+++ b/shell/platform/fuchsia/flutter/engine.cc
|
||||
@@ -227,7 +227,6 @@ Engine::Engine(Delegate& delegate,
|
||||
task_runners, // host task runners
|
||||
settings_, // shell launch settings
|
||||
std::move(isolate_snapshot), // isolate snapshot
|
||||
- flutter::DartSnapshot::Empty(), // shared snapshot
|
||||
on_create_platform_view, // platform view create callback
|
||||
on_create_rasterizer, // rasterizer create callback
|
||||
std::move(vm) // vm reference
|
Loading…
Reference in a new issue