mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Plumbing for a core snapshot with code (currently empty). (flutter/engine#3749)
This commit is contained in:
parent
375a44693a
commit
aa1c5cb32f
@ -75,8 +75,12 @@ template("flutter_app") {
|
||||
get_label_info(flutter_core_snapshot_label, "target_gen_dir")
|
||||
flutter_core_snapshot_vm_data =
|
||||
"$flutter_core_snapshot_gen_dir/vm_isolate_snapshot.bin"
|
||||
flutter_core_snapshot_vm_instructions =
|
||||
"$flutter_core_snapshot_gen_dir/vm_snapshot_instructions.bin"
|
||||
flutter_core_snapshot_isolate_data =
|
||||
"$flutter_core_snapshot_gen_dir/isolate_snapshot.bin"
|
||||
flutter_core_snapshot_isolate_instructions =
|
||||
"$flutter_core_snapshot_gen_dir/isolate_snapshot_instructions.bin"
|
||||
|
||||
dot_packages = "$target_gen_dir/$dart_package_name.packages"
|
||||
bundle_path = "$target_gen_dir/$bundle_name"
|
||||
@ -93,6 +97,10 @@ template("flutter_app") {
|
||||
|
||||
inputs = [
|
||||
main_dart,
|
||||
flutter_core_snapshot_vm_data,
|
||||
flutter_core_snapshot_vm_instructions,
|
||||
flutter_core_snapshot_isolate_data,
|
||||
flutter_core_snapshot_isolate_instructions,
|
||||
]
|
||||
|
||||
outputs = [
|
||||
@ -110,8 +118,12 @@ template("flutter_app") {
|
||||
rebase_path(gen_snapshot),
|
||||
"--vm-snapshot-data",
|
||||
rebase_path(flutter_core_snapshot_vm_data),
|
||||
"--vm-snapshot-instructions",
|
||||
rebase_path(flutter_core_snapshot_vm_instructions),
|
||||
"--isolate-snapshot-data",
|
||||
rebase_path(flutter_core_snapshot_isolate_data),
|
||||
"--isolate-snapshot-instructions",
|
||||
rebase_path(flutter_core_snapshot_isolate_instructions),
|
||||
"--main-dart",
|
||||
rebase_path(main_dart),
|
||||
"--packages",
|
||||
|
||||
@ -16,8 +16,12 @@ def main():
|
||||
help='The Flutter snapshotter')
|
||||
parser.add_argument('--vm-snapshot-data', type=str, required=True,
|
||||
help='Path to vm_isolate_snapshot.bin')
|
||||
parser.add_argument('--vm-snapshot-instructions', type=str, required=True,
|
||||
help='Path to vm_isolate_snapshot.bin')
|
||||
parser.add_argument('--isolate-snapshot-data', type=str, required=True,
|
||||
help='Path to isolate_snapshot.bin')
|
||||
parser.add_argument('--isolate-snapshot-instructions', type=str, required=True,
|
||||
help='Path to isolate_snapshot.bin')
|
||||
parser.add_argument('--main-dart', type=str, required=True,
|
||||
help='The main.dart file to use')
|
||||
parser.add_argument('--packages', type=str, required=True,
|
||||
@ -35,11 +39,13 @@ def main():
|
||||
args.snapshotter_path,
|
||||
'--snapshot_kind=script',
|
||||
'--vm_snapshot_data=%s' % args.vm_snapshot_data,
|
||||
'--vm_snapshot_instructions=%s' % args.vm_snapshot_instructions,
|
||||
'--isolate_snapshot_data=%s' % args.isolate_snapshot_data,
|
||||
'--isolate_snapshot_instructions=%s' % args.isolate_snapshot_instructions,
|
||||
'--packages=%s' % args.packages,
|
||||
'--script_snapshot=%s' % args.snapshot,
|
||||
'--dependencies=%s' % args.depfile,
|
||||
args.main_dart,
|
||||
args.main_dart
|
||||
]
|
||||
|
||||
result = subprocess.call(cmd, cwd=args.root_build_dir)
|
||||
|
||||
@ -38,11 +38,16 @@ action("generate_snapshot_bin") {
|
||||
snapshot_dart,
|
||||
] + dart_ui_files
|
||||
|
||||
vm_isolate_snapshot = "$target_gen_dir/vm_isolate_snapshot.bin"
|
||||
isolate_snapshot = "$target_gen_dir/isolate_snapshot.bin"
|
||||
vm_snapshot_data = "$target_gen_dir/vm_isolate_snapshot.bin"
|
||||
vm_snapshot_instructions = "$target_gen_dir/vm_snapshot_instructions.bin"
|
||||
isolate_snapshot_data = "$target_gen_dir/isolate_snapshot.bin"
|
||||
isolate_snapshot_instructions =
|
||||
"$target_gen_dir/isolate_snapshot_instructions.bin"
|
||||
outputs = [
|
||||
vm_isolate_snapshot,
|
||||
isolate_snapshot,
|
||||
vm_snapshot_data,
|
||||
vm_snapshot_instructions,
|
||||
isolate_snapshot_data,
|
||||
isolate_snapshot_instructions,
|
||||
]
|
||||
|
||||
rebased_dart_ui_path = rebase_path(dart_ui_path)
|
||||
@ -62,9 +67,13 @@ action("generate_snapshot_bin") {
|
||||
"--snapshot_kind",
|
||||
"core",
|
||||
"--vm_output_bin",
|
||||
rebase_path(vm_isolate_snapshot, root_build_dir),
|
||||
rebase_path(vm_snapshot_data, root_build_dir),
|
||||
"--vm_instructions_output_bin",
|
||||
rebase_path(vm_snapshot_instructions, root_build_dir),
|
||||
"--isolate_output_bin",
|
||||
rebase_path(isolate_snapshot, root_build_dir),
|
||||
rebase_path(isolate_snapshot_data, root_build_dir),
|
||||
"--isolate_instructions_output_bin",
|
||||
rebase_path(isolate_snapshot_instructions, root_build_dir),
|
||||
"--url_mapping=dart:ui,$rebased_dart_ui_path",
|
||||
]
|
||||
|
||||
@ -79,40 +88,93 @@ action("generate_snapshot_bin") {
|
||||
}
|
||||
}
|
||||
|
||||
action("generate_snapshot_file") {
|
||||
# Generates an assembly file defining a given symbol with the bytes from a
|
||||
# binary file. Places the symbol in a text section if 'executable' is true,
|
||||
# otherwise places the symbol in a read-only data section.
|
||||
template("bin_to_assembly") {
|
||||
assert(defined(invoker.deps), "Must define deps")
|
||||
assert(defined(invoker.input), "Must define input binary file")
|
||||
assert(defined(invoker.output), "Must define output assembly file")
|
||||
assert(defined(invoker.symbol), "Must define symbol name")
|
||||
assert(defined(invoker.executable), "Must define boolean executable")
|
||||
|
||||
action(target_name) {
|
||||
deps = invoker.deps
|
||||
script = "//dart/runtime/tools/bin_to_assembly.py"
|
||||
args = [
|
||||
"--input",
|
||||
rebase_path(invoker.input),
|
||||
"--output",
|
||||
rebase_path(invoker.output),
|
||||
"--symbol_name",
|
||||
invoker.symbol,
|
||||
"--target_os",
|
||||
current_os,
|
||||
]
|
||||
if (invoker.executable) {
|
||||
args += [ "--executable" ]
|
||||
}
|
||||
inputs = [
|
||||
script,
|
||||
invoker.input,
|
||||
]
|
||||
outputs = [
|
||||
invoker.output,
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
bin_to_assembly("vm_snapshot_data_assembly") {
|
||||
deps = [
|
||||
":generate_snapshot_bin",
|
||||
]
|
||||
inputs = [
|
||||
"//dart/runtime/tools/create_snapshot_file.py",
|
||||
"snapshot.c.tmpl",
|
||||
"$target_gen_dir/vm_isolate_snapshot.bin",
|
||||
"$target_gen_dir/isolate_snapshot.bin",
|
||||
]
|
||||
output = "$target_gen_dir/snapshot.c"
|
||||
outputs = [
|
||||
output,
|
||||
]
|
||||
input = "$target_gen_dir/vm_isolate_snapshot.bin"
|
||||
output = "$target_gen_dir/vm_snapshot_data.S"
|
||||
symbol = "kDartVmSnapshotData"
|
||||
executable = false
|
||||
}
|
||||
|
||||
script = "//dart/runtime/tools/create_snapshot_file.py"
|
||||
args = [
|
||||
"--vm_input_bin",
|
||||
rebase_path("$target_gen_dir/vm_isolate_snapshot.bin"),
|
||||
"--input_bin",
|
||||
rebase_path("$target_gen_dir/isolate_snapshot.bin"),
|
||||
"--input_cc",
|
||||
rebase_path("snapshot.c.tmpl"),
|
||||
"--output",
|
||||
rebase_path(output),
|
||||
bin_to_assembly("vm_snapshot_instructions_assembly") {
|
||||
deps = [
|
||||
":generate_snapshot_bin",
|
||||
]
|
||||
input = "$target_gen_dir/vm_snapshot_instructions.bin"
|
||||
output = "$target_gen_dir/vm_snapshot_instructions.S"
|
||||
symbol = "kDartVmSnapshotInstructions"
|
||||
executable = true
|
||||
}
|
||||
|
||||
bin_to_assembly("isolate_snapshot_data_assembly") {
|
||||
deps = [
|
||||
":generate_snapshot_bin",
|
||||
]
|
||||
input = "$target_gen_dir/isolate_snapshot.bin"
|
||||
output = "$target_gen_dir/isolate_snapshot_data.S"
|
||||
symbol = "kDartIsolateCoreSnapshotData"
|
||||
executable = false
|
||||
}
|
||||
|
||||
bin_to_assembly("isolate_snapshot_instructions_assembly") {
|
||||
deps = [
|
||||
":generate_snapshot_bin",
|
||||
]
|
||||
input = "$target_gen_dir/isolate_snapshot_instructions.bin"
|
||||
output = "$target_gen_dir/isolate_snapshot_instructions.S"
|
||||
symbol = "kDartIsolateCoreSnapshotInstructions"
|
||||
executable = true
|
||||
}
|
||||
|
||||
source_set("snapshot") {
|
||||
sources = [
|
||||
"$target_gen_dir/snapshot.c",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":generate_snapshot_file",
|
||||
":isolate_snapshot_data_assembly",
|
||||
":isolate_snapshot_instructions_assembly",
|
||||
":vm_snapshot_data_assembly",
|
||||
":vm_snapshot_instructions_assembly",
|
||||
]
|
||||
sources = [
|
||||
"$target_gen_dir/isolate_snapshot_data.S",
|
||||
"$target_gen_dir/isolate_snapshot_instructions.S",
|
||||
"$target_gen_dir/vm_snapshot_data.S",
|
||||
"$target_gen_dir/vm_snapshot_instructions.S",
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
// The string on the next line will be filled in with the contents of the
|
||||
// generated snapshot binary file for the vm isolate.
|
||||
// This string forms the content of the dart vm isolate snapshot which
|
||||
// is loaded into the vm isolate.
|
||||
const uint8_t kDartVmSnapshotData_[]
|
||||
__attribute__((aligned(8))) = { %s };
|
||||
const uint8_t* kDartVmSnapshotData
|
||||
__attribute__((visibility("default"), used)) = kDartVmSnapshotData_;
|
||||
const uint8_t* kDartVmSnapshotInstructions
|
||||
__attribute__((visibility("default"), used)) = NULL;
|
||||
|
||||
// The string on the next line will be filled in with the contents of the
|
||||
// generated snapshot binary file for a regular dart isolate.
|
||||
// This string forms the content of a regular dart isolate snapshot which
|
||||
// is loaded into an isolate when it is created.
|
||||
const uint8_t kDartIsolateCoreSnapshotData_[]
|
||||
__attribute__((aligned(8))) = { %s };
|
||||
const uint8_t* kDartIsolateCoreSnapshotData
|
||||
__attribute__((visibility("default"), used)) = kDartIsolateCoreSnapshotData_;
|
||||
const uint8_t* kDartIsolateCoreSnapshotInstructions
|
||||
__attribute__((visibility("default"), used)) = NULL;
|
||||
@ -7,8 +7,8 @@
|
||||
#include <stdint.h>
|
||||
|
||||
extern "C" {
|
||||
extern const uint8_t* kDartVmSnapshotData;
|
||||
extern const uint8_t* kDartVmSnapshotInstructions;
|
||||
extern const uint8_t* kDartIsolateCoreSnapshotData;
|
||||
extern const uint8_t* kDartIsolateCoreSnapshotInstructions;
|
||||
extern const uint8_t kDartVmSnapshotData[];
|
||||
extern const uint8_t kDartVmSnapshotInstructions[];
|
||||
extern const uint8_t kDartIsolateCoreSnapshotData[];
|
||||
extern const uint8_t kDartIsolateCoreSnapshotInstructions[];
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user