[VM] Remove 'corelib' and 'dart-io' sources generation into C++ arrays
- Remove all code that generates the corelib and dart:io library sources into C++ arrays and link them into dart_bootstrap - Remove the executable dart_bootstrap and all uses of it - Remove bootstrap_nolib.cc and builtin_nocore.cc - Remove the Dart 1 code in core lib bootstrap path Change-Id: Ifd33496204285a08b42fe09e39428e7a92b416b6 Reviewed-on: https://dart-review.googlesource.com/c/77241 Commit-Queue: Siva Annamalai <asiva@google.com> Reviewed-by: Zach Anderson <zra@google.com>
This commit is contained in:
committed by
commit-bot@chromium.org
parent
abe93563c4
commit
30aa464f77
@@ -42,7 +42,6 @@ group("runtime") {
|
||||
}
|
||||
deps = [
|
||||
"runtime/bin:dart",
|
||||
"runtime/bin:dart_bootstrap($host_toolchain)",
|
||||
"runtime/bin:process_test",
|
||||
"runtime/bin:run_vm_tests",
|
||||
"runtime/bin:sample_extension",
|
||||
@@ -64,7 +63,6 @@ group("runtime_kernel") {
|
||||
|
||||
group("runtime_precompiled") {
|
||||
deps = [
|
||||
"runtime/bin:dart_bootstrap($host_toolchain)",
|
||||
"runtime/bin:dart_precompiled_runtime",
|
||||
"runtime/bin:process_test",
|
||||
]
|
||||
|
||||
+41
-132
@@ -16,11 +16,10 @@ if (_is_fuchsia) {
|
||||
# Dart's build.
|
||||
#
|
||||
# - prebuilt_dart_action()
|
||||
# Runs Dart scripts using the downloaded prebuilt Dart SDK if there is one,
|
||||
# and a built dart_bootstrap otherwise. This is the preferred method of
|
||||
# running Dart code during the build as it is much faster than using
|
||||
# dart_action() in debug and cross builds. However, prebuilt_dart_action()
|
||||
# should *not* be used to generate snapshots.
|
||||
# Runs Dart scripts using the downloaded prebuilt Dart SDK. This is the
|
||||
# preferred method of running Dart code during the build as it is much
|
||||
# faster than using dart_action() in debug and cross builds.
|
||||
# However, prebuilt_dart_action() should *not* be used to generate snapshots.
|
||||
#
|
||||
# - dart_action()
|
||||
# Runs Dart scripts using the binary built for runtime/bin:dart using the
|
||||
@@ -29,9 +28,6 @@ if (_is_fuchsia) {
|
||||
# an App-JIT snapshot. This will be slow in Debug builds, and very slow in
|
||||
# cross builds.
|
||||
#
|
||||
# - dart_bootstrap_action()
|
||||
# Ditto, but uses runtime/bin:dart_bootstrap.
|
||||
#
|
||||
# - gen_snapshot_action()
|
||||
# Runs the binary built for runtime/bin:gen_snapshot using the host
|
||||
# toolchain. It should only be used when an artifact agreeing exactly
|
||||
@@ -102,91 +98,58 @@ template("_compiled_action") {
|
||||
template("_prebuilt_tool_action") {
|
||||
assert(defined(invoker.binary),
|
||||
"The path to where the prebuilt binary lives must be defined")
|
||||
assert(defined(invoker.target),
|
||||
"The target to use if the prebuilt doesn't exist must be defined")
|
||||
assert(_is_fuchsia || prebuilt_dart_exe_works,
|
||||
"A pre built dart executable needs to be present")
|
||||
|
||||
vm_args = []
|
||||
if (defined(invoker.vm_args)) {
|
||||
vm_args += invoker.vm_args
|
||||
}
|
||||
|
||||
if (_is_fuchsia || prebuilt_dart_exe_works) {
|
||||
not_needed(invoker, [ "target" ])
|
||||
action(target_name) {
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
"depfile",
|
||||
"deps",
|
||||
"outputs",
|
||||
"testonly",
|
||||
"visibility",
|
||||
])
|
||||
script = "$_dart_root/build/gn_run_binary.py"
|
||||
not_needed(invoker, [ "target" ])
|
||||
action(target_name) {
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
"depfile",
|
||||
"deps",
|
||||
"outputs",
|
||||
"testonly",
|
||||
"visibility",
|
||||
])
|
||||
script = "$_dart_root/build/gn_run_binary.py"
|
||||
|
||||
inputs = []
|
||||
if (defined(invoker.inputs)) {
|
||||
inputs += invoker.inputs
|
||||
}
|
||||
|
||||
if (defined(invoker.script)) {
|
||||
inputs += [ invoker.script ]
|
||||
}
|
||||
if (defined(invoker.packages)) {
|
||||
inputs += [ invoker.packages ]
|
||||
}
|
||||
|
||||
args = [
|
||||
"compiled_action",
|
||||
rebase_path(invoker.binary),
|
||||
] + vm_args
|
||||
if (defined(invoker.packages)) {
|
||||
args += [ "--packages=" + rebase_path(invoker.packages) ]
|
||||
}
|
||||
if (defined(invoker.dfe)) {
|
||||
args += [ "--dfe=" + rebase_path(invoker.dfe) ]
|
||||
}
|
||||
if (defined(invoker.script)) {
|
||||
args += [ rebase_path(invoker.script) ]
|
||||
}
|
||||
args += invoker.args
|
||||
inputs = []
|
||||
if (defined(invoker.inputs)) {
|
||||
inputs += invoker.inputs
|
||||
}
|
||||
} else {
|
||||
not_needed(invoker, [ "binary" ])
|
||||
_compiled_action(target_name) {
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
"depfile",
|
||||
"deps",
|
||||
"inputs",
|
||||
"outputs",
|
||||
"testonly",
|
||||
"visibility",
|
||||
])
|
||||
|
||||
if (defined(invoker.script)) {
|
||||
inputs += [ invoker.script ]
|
||||
}
|
||||
if (defined(invoker.packages)) {
|
||||
inputs += [ invoker.packages ]
|
||||
}
|
||||
|
||||
tool = invoker.target
|
||||
args = vm_args
|
||||
if (defined(invoker.packages)) {
|
||||
args += [ "--packages=" + rebase_path(invoker.packages) ]
|
||||
}
|
||||
if (defined(invoker.script)) {
|
||||
args += [ rebase_path(invoker.script) ]
|
||||
}
|
||||
args += invoker.args
|
||||
if (defined(invoker.script)) {
|
||||
inputs += [ invoker.script ]
|
||||
}
|
||||
if (defined(invoker.packages)) {
|
||||
inputs += [ invoker.packages ]
|
||||
}
|
||||
|
||||
args = [
|
||||
"compiled_action",
|
||||
rebase_path(invoker.binary),
|
||||
] + vm_args
|
||||
if (defined(invoker.packages)) {
|
||||
args += [ "--packages=" + rebase_path(invoker.packages) ]
|
||||
}
|
||||
if (defined(invoker.dfe)) {
|
||||
args += [ "--dfe=" + rebase_path(invoker.dfe) ]
|
||||
}
|
||||
if (defined(invoker.script)) {
|
||||
args += [ rebase_path(invoker.script) ]
|
||||
}
|
||||
args += invoker.args
|
||||
}
|
||||
}
|
||||
|
||||
# A template for running Dart scripts during the build using the prebuilt Dart
|
||||
# SDK. This should *not* be used for generating snapshots. It uses the dart
|
||||
# binary from the prebuilt Dart SDK if one is available, and dart_bootstrap
|
||||
# otherwise.
|
||||
# binary from the prebuilt Dart SDK.
|
||||
#
|
||||
# Parameters:
|
||||
# script:
|
||||
@@ -224,7 +187,6 @@ template("prebuilt_dart_action") {
|
||||
binary = "$_dart_root/tools/sdks/dart-sdk/bin/dart$executable_suffix"
|
||||
dfe = "$_dart_root/tools/sdks/dart-sdk/bin/snapshots/kernel-service.dart.snapshot"
|
||||
}
|
||||
target = "$_dart_root/runtime/bin:dart_bootstrap"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,7 +195,6 @@ if (_is_fuchsia) {
|
||||
_prebuilt_tool_action(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
binary = prebuilt_gen_snapshot
|
||||
target = "error"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -252,7 +213,6 @@ template("prebuilt_dart2js_action") {
|
||||
extension = ".bat"
|
||||
}
|
||||
binary = "$_dart_root/tools/sdks/dart-sdk/bin/dart2js${extension}"
|
||||
target = "error"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,57 +335,6 @@ template("dart_action") {
|
||||
}
|
||||
}
|
||||
|
||||
# This template runs the dart_bootstrap produced by the in-progress build.
|
||||
#
|
||||
# Parameters:
|
||||
# script:
|
||||
# The un-rebased path to the Dart script.
|
||||
#
|
||||
# vm_args (optional):
|
||||
# Arguments to pass to the Dart VM.
|
||||
#
|
||||
# args (optional):
|
||||
# The arguments to pass to the Dart script.
|
||||
#
|
||||
# packages (optional):
|
||||
# The un-rebased path to the .packages file.
|
||||
#
|
||||
# Forwarded to action() with the usual meaning:
|
||||
# depfile
|
||||
# deps
|
||||
# inputs
|
||||
# outputs
|
||||
# testonly
|
||||
# visibility
|
||||
template("dart_bootstrap_action") {
|
||||
assert(defined(invoker.script), "script must be defined for $target_name")
|
||||
if (!_is_fuchsia || !use_prebuilt_dart_sdk) {
|
||||
_built_tool_action(target_name) {
|
||||
tool = "$_dart_root/runtime/bin:dart_bootstrap"
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
"args",
|
||||
"depfile",
|
||||
"deps",
|
||||
"inputs",
|
||||
"outputs",
|
||||
"packages",
|
||||
"script",
|
||||
"testonly",
|
||||
"tool",
|
||||
"visibility",
|
||||
"vm_args",
|
||||
])
|
||||
}
|
||||
} else {
|
||||
# We already have a prebuilt dart at the right version, so there is no
|
||||
# reason to use dart_bootstrap.
|
||||
prebuilt_dart_action(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# This template runs the gen_snapshot produced by the in-progress build.
|
||||
#
|
||||
# Parameters:
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
# Parse incoming arguments and extract the value of --packages option if any
|
||||
# was passed. Split options (--xyz) and non-options into two separate arrays.
|
||||
# All options will be passed to dart_bootstrap, while --packages will be
|
||||
# All options will be passed to gen_snapshot, while --packages will be
|
||||
# passed to Fasta.
|
||||
|
||||
set -e
|
||||
@@ -57,10 +57,11 @@ SOURCE_FILE="${ARGV[0]}"
|
||||
SNAPSHOT_FILE="${ARGV[1]}"
|
||||
|
||||
if [ $BUILD_ELF -eq 1 ]; then
|
||||
DART_BOOTSTRAP_OUT="${SNAPSHOT_FILE}.S"
|
||||
GEN_SNAPSHOT_OPTION="--snapshot-kind=app-aot-assembly"
|
||||
GEN_SNAPSHOT_FILENAME="--assembly=${SNAPSHOT_FILE}.S"
|
||||
else
|
||||
OPTIONS=("--use-blobs" "${OPTIONS[@]}")
|
||||
DART_BOOTSTRAP_OUT="${SNAPSHOT_FILE}"
|
||||
GEN_SNAPSHOT_OPTION="--snapshot-kind=app-aot-blobs"
|
||||
GEN_SNAPSHOT_FILENAME="--blobs_container_filename=${SNAPSHOT_FILE}"
|
||||
fi
|
||||
|
||||
function follow_links() {
|
||||
@@ -100,11 +101,9 @@ BIN_DIR="$OUT_DIR/$DART_CONFIGURATION"
|
||||
"$SOURCE_FILE"
|
||||
|
||||
# Step 2: Generate snapshot from the Kernel binary.
|
||||
"$BIN_DIR"/dart_bootstrap \
|
||||
--strong \
|
||||
--reify-generic-functions \
|
||||
--snapshot-kind=app-aot \
|
||||
--snapshot="$DART_BOOTSTRAP_OUT" \
|
||||
"$BIN_DIR"/gen_snapshot \
|
||||
"$GEN_SNAPSHOT_OPTION" \
|
||||
"$GEN_SNAPSHOT_FILENAME" \
|
||||
"${OPTIONS[@]}" \
|
||||
"$SNAPSHOT_FILE.dill"
|
||||
|
||||
|
||||
+12
-281
@@ -46,186 +46,6 @@ action("gen_resources_cc") {
|
||||
] + rebase_path(sources, root_build_dir)
|
||||
}
|
||||
|
||||
template("gen_library_src_path") {
|
||||
assert(defined(invoker.sources), "Need sources in $target_name")
|
||||
assert(defined(invoker.output), "Need output in $target_name")
|
||||
action(target_name) {
|
||||
visibility = [ ":*" ] # Only targets in this file can see this.
|
||||
script = "../tools/gen_library_src_paths.py"
|
||||
inputs = [
|
||||
"../tools/gen_library_src_paths.py",
|
||||
"builtin_in.cc",
|
||||
] + invoker.sources
|
||||
outputs = [
|
||||
invoker.output,
|
||||
]
|
||||
name = invoker.name
|
||||
kind = invoker.kind
|
||||
library_name = "dart:${name}"
|
||||
if (defined(invoker.library_name)) {
|
||||
library_name = invoker.library_name
|
||||
}
|
||||
args = [
|
||||
"--output",
|
||||
rebase_path(invoker.output, root_build_dir),
|
||||
"--input_cc",
|
||||
rebase_path("builtin_in.cc", root_build_dir),
|
||||
"--include",
|
||||
"bin/builtin.h",
|
||||
"--var_name",
|
||||
"dart::bin::Builtin::${name}_${kind}_paths_",
|
||||
"--library_name",
|
||||
library_name,
|
||||
] + rebase_path(invoker.sources, root_build_dir)
|
||||
}
|
||||
}
|
||||
|
||||
gen_library_src_path("generate_builtin_cc_file") {
|
||||
name = "_builtin"
|
||||
kind = "source"
|
||||
sources = builtin_sources
|
||||
output = "$target_gen_dir/builtin_gen.cc"
|
||||
}
|
||||
|
||||
rebased_io_sdk_sources = rebase_path(io_sdk_sources, ".", "../../sdk/lib/io")
|
||||
|
||||
gen_library_src_path("generate_io_cc_file") {
|
||||
name = "io"
|
||||
kind = "source"
|
||||
sources = [ "../../sdk/lib/io/io.dart" ] + rebased_io_sdk_sources
|
||||
output = "$target_gen_dir/io_gen.cc"
|
||||
}
|
||||
|
||||
gen_library_src_path("generate_io_patch_cc_file") {
|
||||
name = "io"
|
||||
kind = "patch"
|
||||
sources = io_runtime_sources
|
||||
output = "$target_gen_dir/io_patch_gen.cc"
|
||||
}
|
||||
|
||||
rebased_http_sdk_sources =
|
||||
rebase_path(http_sdk_sources, ".", "../../sdk/lib/_http")
|
||||
|
||||
gen_library_src_path("generate_http_cc_file") {
|
||||
name = "_http"
|
||||
kind = "source"
|
||||
sources = [ "../../sdk/lib/_http/http.dart" ] + rebased_http_sdk_sources
|
||||
output = "$target_gen_dir/http_gen.cc"
|
||||
}
|
||||
|
||||
rebased_cli_sdk_sources = rebase_path(cli_sdk_sources, ".", "../../sdk/lib/cli")
|
||||
|
||||
gen_library_src_path("generate_cli_cc_file") {
|
||||
name = "cli"
|
||||
kind = "source"
|
||||
sources = [ "../../sdk/lib/cli/cli.dart" ] + rebased_cli_sdk_sources
|
||||
output = "$target_gen_dir/cli_gen.cc"
|
||||
}
|
||||
|
||||
gen_library_src_path("generate_cli_patch_cc_file") {
|
||||
name = "cli"
|
||||
kind = "patch"
|
||||
sources = cli_runtime_sources
|
||||
output = "$target_gen_dir/cli_patch_gen.cc"
|
||||
}
|
||||
|
||||
gen_library_src_path("generate_html_cc_file") {
|
||||
name = "html"
|
||||
kind = "source"
|
||||
sources = [
|
||||
"../../sdk/lib/html/dart2js/html_dart2js.dart",
|
||||
]
|
||||
output = "$target_gen_dir/html_gen.cc"
|
||||
}
|
||||
|
||||
gen_library_src_path("generate_html_common_cc_file") {
|
||||
name = "html_common"
|
||||
kind = "source"
|
||||
sources = [
|
||||
"../../sdk/lib/html/html_common/conversions.dart",
|
||||
"../../sdk/lib/html/html_common/conversions_dart2js.dart",
|
||||
"../../sdk/lib/html/html_common/css_class_set.dart",
|
||||
"../../sdk/lib/html/html_common/device.dart",
|
||||
"../../sdk/lib/html/html_common/filtered_element_list.dart",
|
||||
"../../sdk/lib/html/html_common/html_common.dart",
|
||||
"../../sdk/lib/html/html_common/lists.dart",
|
||||
]
|
||||
output = "$target_gen_dir/html_common_gen.cc"
|
||||
}
|
||||
|
||||
gen_library_src_path("generate_js_cc_file") {
|
||||
name = "js"
|
||||
kind = "source"
|
||||
sources = [
|
||||
"../../sdk/lib/js/dart2js/js_dart2js.dart",
|
||||
]
|
||||
output = "$target_gen_dir/js_gen.cc"
|
||||
}
|
||||
|
||||
gen_library_src_path("generate_js_util_cc_file") {
|
||||
name = "js_util"
|
||||
kind = "source"
|
||||
sources = [
|
||||
"../../sdk/lib/js_util/dart2js/js_util_dart2js.dart",
|
||||
]
|
||||
output = "$target_gen_dir/js_util_gen.cc"
|
||||
}
|
||||
|
||||
gen_library_src_path("generate_indexed_db_cc_file") {
|
||||
name = "indexed_db"
|
||||
kind = "source"
|
||||
sources = [
|
||||
"../../sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart",
|
||||
]
|
||||
output = "$target_gen_dir/indexed_db_gen.cc"
|
||||
}
|
||||
|
||||
gen_library_src_path("generate_web_gl_cc_file") {
|
||||
name = "web_gl"
|
||||
kind = "source"
|
||||
sources = [
|
||||
"../../sdk/lib/web_gl/dart2js/web_gl_dart2js.dart",
|
||||
]
|
||||
output = "$target_gen_dir/web_gl_gen.cc"
|
||||
}
|
||||
|
||||
gen_library_src_path("generate_metadata_cc_file") {
|
||||
name = "metadata"
|
||||
library_name = "metadata.dart"
|
||||
kind = "source"
|
||||
sources = [
|
||||
"../../sdk/lib/html/html_common/metadata.dart",
|
||||
]
|
||||
output = "$target_gen_dir/metadata_gen.cc"
|
||||
}
|
||||
|
||||
gen_library_src_path("generate_web_sql_cc_file") {
|
||||
name = "web_sql"
|
||||
kind = "source"
|
||||
sources = [
|
||||
"../../sdk/lib/web_sql/dart2js/web_sql_dart2js.dart",
|
||||
]
|
||||
output = "$target_gen_dir/web_sql_gen.cc"
|
||||
}
|
||||
|
||||
gen_library_src_path("generate_svg_cc_file") {
|
||||
name = "svg"
|
||||
kind = "source"
|
||||
sources = [
|
||||
"../../sdk/lib/svg/dart2js/svg_dart2js.dart",
|
||||
]
|
||||
output = "$target_gen_dir/svg_gen.cc"
|
||||
}
|
||||
|
||||
gen_library_src_path("generate_web_audio_cc_file") {
|
||||
name = "web_audio"
|
||||
kind = "source"
|
||||
sources = [
|
||||
"../../sdk/lib/web_audio/dart2js/web_audio_dart2js.dart",
|
||||
]
|
||||
output = "$target_gen_dir/web_audio_gen.cc"
|
||||
}
|
||||
|
||||
config("libdart_builtin_config") {
|
||||
if (!is_win) {
|
||||
libs = [ "dl" ]
|
||||
@@ -252,24 +72,7 @@ template("build_libdart_builtin") {
|
||||
configs -= [ "//build/config:symbol_visibility_hidden" ]
|
||||
}
|
||||
public_configs = [ ":libdart_builtin_config" ]
|
||||
deps = [
|
||||
":generate_builtin_cc_file",
|
||||
":generate_cli_cc_file",
|
||||
":generate_cli_patch_cc_file",
|
||||
":generate_html_cc_file",
|
||||
":generate_html_common_cc_file",
|
||||
":generate_http_cc_file",
|
||||
":generate_indexed_db_cc_file",
|
||||
":generate_io_cc_file",
|
||||
":generate_io_patch_cc_file",
|
||||
":generate_js_cc_file",
|
||||
":generate_js_util_cc_file",
|
||||
":generate_metadata_cc_file",
|
||||
":generate_svg_cc_file",
|
||||
":generate_web_audio_cc_file",
|
||||
":generate_web_gl_cc_file",
|
||||
":generate_web_sql_cc_file",
|
||||
]
|
||||
deps = []
|
||||
if (is_fuchsia) {
|
||||
public_deps = [
|
||||
"//zircon/public/lib/fdio",
|
||||
@@ -336,32 +139,22 @@ template("build_gen_snapshot") {
|
||||
if (is_fuchsia) {
|
||||
configs -= [ "//build/config:symbol_visibility_hidden" ]
|
||||
}
|
||||
deps = [
|
||||
":gen_resources_cc",
|
||||
":generate_builtin_cc_file",
|
||||
":generate_http_cc_file",
|
||||
":generate_io_cc_file",
|
||||
":generate_io_patch_cc_file",
|
||||
":generate_cli_cc_file",
|
||||
":generate_cli_patch_cc_file",
|
||||
] + extra_deps
|
||||
deps = [ ":gen_resources_cc" ] + extra_deps
|
||||
|
||||
sources = [
|
||||
# Include generated source files.
|
||||
"$target_gen_dir/builtin_gen.cc",
|
||||
"$target_gen_dir/cli_gen.cc",
|
||||
"$target_gen_dir/cli_patch_gen.cc",
|
||||
"$target_gen_dir/http_gen.cc",
|
||||
"$target_gen_dir/io_gen.cc",
|
||||
"$target_gen_dir/io_patch_gen.cc",
|
||||
"$target_gen_dir/resources_gen.cc",
|
||||
"address_sanitizer.cc",
|
||||
"builtin.cc",
|
||||
"builtin.h",
|
||||
"error_exit.cc",
|
||||
"error_exit.h",
|
||||
"gzip.cc",
|
||||
"gzip.h",
|
||||
"loader.cc",
|
||||
"loader.h",
|
||||
"snapshot_utils.cc",
|
||||
"snapshot_utils.h",
|
||||
|
||||
# Very limited native resolver provided.
|
||||
"builtin_common.cc",
|
||||
@@ -624,7 +417,7 @@ template("dart_io") {
|
||||
dart_io("dart_io_api") {
|
||||
extra_configs = [ "..:dart_maybe_product_config" ]
|
||||
extra_sources = [
|
||||
"builtin_nolib.cc",
|
||||
"builtin.cc",
|
||||
"dart_io_api_impl.cc",
|
||||
"../include/bin/dart_io_api.h",
|
||||
]
|
||||
@@ -633,7 +426,7 @@ dart_io("dart_io_api") {
|
||||
dart_io("dart_io_api_product") {
|
||||
extra_configs = [ "..:dart_product_config" ]
|
||||
extra_sources = [
|
||||
"builtin_nolib.cc",
|
||||
"builtin.cc",
|
||||
"dart_io_api_impl.cc",
|
||||
"../include/bin/dart_io_api.h",
|
||||
]
|
||||
@@ -968,7 +761,7 @@ dart_executable("dart") {
|
||||
extra_deps += [ "../observatory:standalone_observatory_archive" ]
|
||||
}
|
||||
extra_sources = [
|
||||
"builtin_nolib.cc",
|
||||
"builtin.cc",
|
||||
"dfe.cc",
|
||||
"dfe.h",
|
||||
"loader.cc",
|
||||
@@ -992,7 +785,7 @@ dart_executable("dart_precompiled_runtime") {
|
||||
extra_deps += [ "../observatory:standalone_observatory_archive" ]
|
||||
}
|
||||
extra_sources = [
|
||||
"builtin_nolib.cc",
|
||||
"builtin.cc",
|
||||
"snapshot_empty.cc",
|
||||
"loader.cc",
|
||||
"loader.h",
|
||||
@@ -1011,7 +804,7 @@ dart_executable("dart_precompiled_runtime_for_linking") {
|
||||
extra_deps += [ "../observatory:standalone_observatory_archive" ]
|
||||
}
|
||||
extra_sources = [
|
||||
"builtin_nolib.cc",
|
||||
"builtin.cc",
|
||||
"snapshot_empty.cc",
|
||||
"loader.cc",
|
||||
"loader.h",
|
||||
@@ -1025,68 +818,6 @@ dart_executable("dart_precompiled_runtime_for_linking") {
|
||||
target_type = "static_library"
|
||||
}
|
||||
|
||||
dart_executable("dart_bootstrap") {
|
||||
extra_configs = [
|
||||
"..:dart_precompiler_config",
|
||||
"..:dart_nosnapshot_config",
|
||||
]
|
||||
extra_deps = [
|
||||
":gen_resources_cc",
|
||||
":generate_builtin_cc_file",
|
||||
":generate_html_cc_file",
|
||||
":generate_html_common_cc_file",
|
||||
":generate_http_cc_file",
|
||||
":generate_indexed_db_cc_file",
|
||||
":generate_io_cc_file",
|
||||
":generate_io_patch_cc_file",
|
||||
":generate_js_cc_file",
|
||||
":generate_js_util_cc_file",
|
||||
":generate_metadata_cc_file",
|
||||
":generate_svg_cc_file",
|
||||
":generate_cli_cc_file",
|
||||
":generate_cli_patch_cc_file",
|
||||
":generate_web_audio_cc_file",
|
||||
":generate_web_gl_cc_file",
|
||||
":generate_web_sql_cc_file",
|
||||
"..:libdart_nosnapshot_with_precompiler",
|
||||
]
|
||||
extra_defines = [ "NO_OBSERVATORY" ]
|
||||
extra_sources = [
|
||||
"builtin.cc",
|
||||
"builtin.h",
|
||||
"dfe.cc",
|
||||
"dfe.h",
|
||||
"loader.cc",
|
||||
"loader.h",
|
||||
"gzip.cc",
|
||||
"gzip.h",
|
||||
"observatory_assets_empty.cc",
|
||||
"snapshot_empty.cc",
|
||||
|
||||
# Include generated source files.
|
||||
"$target_gen_dir/builtin_gen.cc",
|
||||
"$target_gen_dir/html_common_gen.cc",
|
||||
"$target_gen_dir/html_gen.cc",
|
||||
"$target_gen_dir/http_gen.cc",
|
||||
"$target_gen_dir/indexed_db_gen.cc",
|
||||
"$target_gen_dir/io_gen.cc",
|
||||
"$target_gen_dir/io_patch_gen.cc",
|
||||
"$target_gen_dir/js_gen.cc",
|
||||
"$target_gen_dir/js_util_gen.cc",
|
||||
"$target_gen_dir/metadata_gen.cc",
|
||||
"$target_gen_dir/resources_gen.cc",
|
||||
"$target_gen_dir/svg_gen.cc",
|
||||
"$target_gen_dir/cli_gen.cc",
|
||||
"$target_gen_dir/cli_patch_gen.cc",
|
||||
"$target_gen_dir/web_audio_gen.cc",
|
||||
"$target_gen_dir/web_gl_gen.cc",
|
||||
"$target_gen_dir/web_sql_gen.cc",
|
||||
]
|
||||
if (!exclude_kernel_service) {
|
||||
extra_deps += [ ":dart_kernel_platform_cc" ]
|
||||
}
|
||||
}
|
||||
|
||||
executable("process_test") {
|
||||
sources = [
|
||||
"process_test.cc",
|
||||
@@ -1204,7 +935,7 @@ executable("run_vm_tests") {
|
||||
heap_tests = rebase_path(heap_sources_tests, ".", "../vm/heap")
|
||||
|
||||
sources = [
|
||||
"builtin_nolib.cc",
|
||||
"builtin.cc",
|
||||
"dfe.cc",
|
||||
"dfe.h",
|
||||
"error_exit.cc",
|
||||
|
||||
+8
-100
@@ -8,96 +8,26 @@
|
||||
|
||||
#include "bin/builtin.h"
|
||||
#include "bin/dartutils.h"
|
||||
#include "bin/platform.h"
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
Builtin::builtin_lib_props Builtin::builtin_libraries_[] = {
|
||||
/* { url_, source_, patch_url_, patch_source_, has_natives_ } */
|
||||
{DartUtils::kBuiltinLibURL, _builtin_source_paths_, NULL, NULL, true},
|
||||
{DartUtils::kIOLibURL, io_source_paths_, DartUtils::kIOLibPatchURL,
|
||||
io_patch_paths_, true},
|
||||
{DartUtils::kHttpLibURL, _http_source_paths_, NULL, NULL, false},
|
||||
{DartUtils::kCLILibURL, cli_source_paths_, DartUtils::kCLILibPatchURL,
|
||||
cli_patch_paths_, true},
|
||||
|
||||
#if defined(DART_NO_SNAPSHOT)
|
||||
// Only include these libraries in the dart_bootstrap case for now.
|
||||
{"dart:html", html_source_paths_, NULL, NULL, true},
|
||||
{"dart:html_common", html_common_source_paths_, NULL, NULL, true},
|
||||
{"dart:js", js_source_paths_, NULL, NULL, true},
|
||||
{"dart:js_util", js_util_source_paths_, NULL, NULL, true},
|
||||
{"dart:indexed_db", indexed_db_source_paths_, NULL, NULL, true},
|
||||
{"dart:web_gl", web_gl_source_paths_, NULL, NULL, true},
|
||||
{"metadata.dart", metadata_source_paths_, NULL, NULL, true},
|
||||
{"dart:web_sql", web_sql_source_paths_, NULL, NULL, true},
|
||||
{"dart:svg", svg_source_paths_, NULL, NULL, true},
|
||||
{"dart:web_audio", web_audio_source_paths_, NULL, NULL, true},
|
||||
#endif // defined(DART_NO_SNAPSHOT)
|
||||
/* { url_, has_natives_ } */
|
||||
{DartUtils::kBuiltinLibURL, true},
|
||||
{DartUtils::kIOLibURL, true},
|
||||
{DartUtils::kHttpLibURL, false},
|
||||
{DartUtils::kCLILibURL, true},
|
||||
|
||||
// End marker.
|
||||
{NULL, NULL, NULL, NULL, false}};
|
||||
{NULL, false}};
|
||||
|
||||
Dart_Port Builtin::load_port_ = ILLEGAL_PORT;
|
||||
const int Builtin::num_libs_ =
|
||||
sizeof(Builtin::builtin_libraries_) / sizeof(Builtin::builtin_lib_props);
|
||||
|
||||
// Patch all the specified patch files in the array 'patch_files' into the
|
||||
// library specified in 'library'.
|
||||
static void LoadPatchFiles(Dart_Handle library,
|
||||
const char* patch_uri,
|
||||
const char** patch_files) {
|
||||
for (intptr_t j = 0; patch_files[j] != NULL; j += 2) {
|
||||
// Use the sources linked in the binary.
|
||||
const char* source = patch_files[j + 1];
|
||||
Dart_Handle patch_src = Dart_NewStringFromUTF8(
|
||||
reinterpret_cast<const uint8_t*>(source), strlen(source));
|
||||
|
||||
// Prepend the patch library URI to form a unique script URI for the patch.
|
||||
const char* unprefixed_patch_file = strchr(patch_files[j], '/') + 1;
|
||||
intptr_t len = snprintf(NULL, 0, "%s/%s", patch_uri, unprefixed_patch_file);
|
||||
char* patch_filename = DartUtils::ScopedCString(len + 1);
|
||||
snprintf(patch_filename, len + 1, "%s/%s", patch_uri,
|
||||
unprefixed_patch_file);
|
||||
Dart_Handle patch_file_uri = DartUtils::NewString(patch_filename);
|
||||
|
||||
DART_CHECK_VALID(Dart_LibraryLoadPatch(library, patch_file_uri, patch_src));
|
||||
}
|
||||
}
|
||||
|
||||
Dart_Handle Builtin::Source(BuiltinLibraryId id) {
|
||||
ASSERT(static_cast<int>(id) >= 0);
|
||||
ASSERT(static_cast<int>(id) < num_libs_);
|
||||
|
||||
// Try to read the source using the path specified for the uri.
|
||||
const char* uri = builtin_libraries_[id].url_;
|
||||
const char** source_paths = builtin_libraries_[id].source_paths_;
|
||||
return GetSource(source_paths, uri);
|
||||
}
|
||||
|
||||
Dart_Handle Builtin::PartSource(BuiltinLibraryId id, const char* part_uri) {
|
||||
ASSERT(static_cast<int>(id) >= 0);
|
||||
ASSERT(static_cast<int>(id) < num_libs_);
|
||||
|
||||
// Try to read the source using the path specified for the uri.
|
||||
const char** source_paths = builtin_libraries_[id].source_paths_;
|
||||
return GetSource(source_paths, part_uri);
|
||||
}
|
||||
|
||||
Dart_Handle Builtin::GetSource(const char** source_paths, const char* uri) {
|
||||
if (source_paths == NULL) {
|
||||
return Dart_Null(); // No path mapping information exists for library.
|
||||
}
|
||||
for (intptr_t i = 0; source_paths[i] != NULL; i += 2) {
|
||||
if (!strcmp(uri, source_paths[i])) {
|
||||
// Use the sources linked in the binary.
|
||||
const char* source = source_paths[i + 1];
|
||||
return Dart_NewStringFromUTF8(reinterpret_cast<const uint8_t*>(source),
|
||||
strlen(source));
|
||||
}
|
||||
}
|
||||
return Dart_Null(); // Uri does not exist in path mapping information.
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
void Builtin::SetNativeResolver(BuiltinLibraryId id) {
|
||||
@@ -114,24 +44,6 @@ void Builtin::SetNativeResolver(BuiltinLibraryId id) {
|
||||
}
|
||||
}
|
||||
|
||||
Dart_Handle Builtin::LoadLibrary(Dart_Handle url, BuiltinLibraryId id) {
|
||||
ASSERT(static_cast<int>(id) >= 0);
|
||||
ASSERT(static_cast<int>(id) < num_libs_);
|
||||
|
||||
Dart_Handle library = Dart_LoadLibrary(url, Dart_Null(), Source(id), 0, 0);
|
||||
if (!Dart_IsError(library) && (builtin_libraries_[id].has_natives_)) {
|
||||
// Setup the native resolver for built in library functions.
|
||||
DART_CHECK_VALID(
|
||||
Dart_SetNativeResolver(library, NativeLookup, NativeSymbol));
|
||||
}
|
||||
if (builtin_libraries_[id].patch_url_ != NULL) {
|
||||
ASSERT(builtin_libraries_[id].patch_paths_ != NULL);
|
||||
LoadPatchFiles(library, builtin_libraries_[id].patch_url_,
|
||||
builtin_libraries_[id].patch_paths_);
|
||||
}
|
||||
return library;
|
||||
}
|
||||
|
||||
Builtin::BuiltinLibraryId Builtin::FindId(const char* url_string) {
|
||||
int id = 0;
|
||||
while (true) {
|
||||
@@ -150,11 +62,7 @@ Dart_Handle Builtin::LoadAndCheckLibrary(BuiltinLibraryId id) {
|
||||
ASSERT(static_cast<int>(id) < num_libs_);
|
||||
|
||||
Dart_Handle url = DartUtils::NewString(builtin_libraries_[id].url_);
|
||||
Dart_Handle library = Dart_LookupLibrary(url);
|
||||
if (Dart_IsError(library)) {
|
||||
library = LoadLibrary(url, id);
|
||||
}
|
||||
return library;
|
||||
return Dart_LookupLibrary(url);
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
|
||||
@@ -33,16 +33,12 @@ class Builtin {
|
||||
kCLILibrary,
|
||||
};
|
||||
|
||||
// Get source corresponding to built in library specified in 'id'.
|
||||
static Dart_Handle Source(BuiltinLibraryId id);
|
||||
|
||||
// Get source of part file specified in 'uri'.
|
||||
static Dart_Handle PartSource(BuiltinLibraryId id, const char* part_uri);
|
||||
|
||||
// Setup native resolver method built in library specified in 'id'.
|
||||
static void SetNativeResolver(BuiltinLibraryId id);
|
||||
|
||||
static Dart_Handle LoadLibrary(Dart_Handle url, BuiltinLibraryId id);
|
||||
static BuiltinLibraryId FindId(const char* url_string);
|
||||
|
||||
// Check if built in library specified in 'id' is already loaded, if not
|
||||
@@ -57,10 +53,6 @@ class Builtin {
|
||||
}
|
||||
|
||||
private:
|
||||
// Map specified URI to an actual file name from 'source_paths' and read
|
||||
// the file.
|
||||
static Dart_Handle GetSource(const char** source_paths, const char* uri);
|
||||
|
||||
// Native method support.
|
||||
static Dart_NativeFunction NativeLookup(Dart_Handle name,
|
||||
int argument_count,
|
||||
@@ -68,31 +60,11 @@ class Builtin {
|
||||
|
||||
static const uint8_t* NativeSymbol(Dart_NativeFunction nf);
|
||||
|
||||
static const char* _builtin_source_paths_[];
|
||||
static const char* _http_source_paths_[];
|
||||
static const char* io_source_paths_[];
|
||||
static const char* io_patch_paths_[];
|
||||
static const char* html_source_paths_[];
|
||||
static const char* html_common_source_paths_[];
|
||||
static const char* js_source_paths_[];
|
||||
static const char* js_util_source_paths_[];
|
||||
static const char* indexed_db_source_paths_[];
|
||||
static const char* web_gl_source_paths_[];
|
||||
static const char* metadata_source_paths_[];
|
||||
static const char* web_sql_source_paths_[];
|
||||
static const char* cli_source_paths_[];
|
||||
static const char* cli_patch_paths_[];
|
||||
static const char* svg_source_paths_[];
|
||||
static const char* web_audio_source_paths_[];
|
||||
|
||||
static Dart_Port load_port_;
|
||||
static const int num_libs_;
|
||||
|
||||
typedef struct {
|
||||
const char* url_;
|
||||
const char** source_paths_;
|
||||
const char* patch_url_;
|
||||
const char** patch_paths_;
|
||||
bool has_natives_;
|
||||
} builtin_lib_props;
|
||||
static builtin_lib_props builtin_libraries_[];
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
// Copyright (c) 2012, 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.
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "include/dart_api.h"
|
||||
|
||||
#include "bin/builtin.h"
|
||||
#include "bin/dartutils.h"
|
||||
#include "bin/io_natives.h"
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
||||
Builtin::builtin_lib_props Builtin::builtin_libraries_[] = {
|
||||
/* { url_, source_, patch_url_, patch_source_, has_natives_ } */
|
||||
{DartUtils::kBuiltinLibURL, NULL, NULL, NULL, true},
|
||||
{DartUtils::kIOLibURL, NULL, NULL, NULL, true},
|
||||
{DartUtils::kHttpLibURL, NULL, NULL, NULL, false},
|
||||
{DartUtils::kCLILibURL, NULL, NULL, NULL, true},
|
||||
// End marker.
|
||||
{NULL, NULL, NULL, NULL, false}};
|
||||
|
||||
Dart_Port Builtin::load_port_ = ILLEGAL_PORT;
|
||||
const int Builtin::num_libs_ =
|
||||
sizeof(Builtin::builtin_libraries_) / sizeof(Builtin::builtin_lib_props);
|
||||
|
||||
Dart_Handle Builtin::Source(BuiltinLibraryId id) {
|
||||
return DartUtils::NewError("Unreachable code in Builtin::Source (%d).", id);
|
||||
}
|
||||
|
||||
Dart_Handle Builtin::PartSource(BuiltinLibraryId id, const char* uri) {
|
||||
return DartUtils::NewError("Unreachable code in Builtin::PartSource (%d).",
|
||||
id);
|
||||
}
|
||||
|
||||
Dart_Handle Builtin::GetSource(const char** source_paths, const char* uri) {
|
||||
return DartUtils::NewError("Unreachable code in Builtin::GetSource (%s).",
|
||||
uri);
|
||||
}
|
||||
|
||||
void Builtin::SetNativeResolver(BuiltinLibraryId id) {
|
||||
ASSERT(static_cast<int>(id) >= 0);
|
||||
ASSERT(static_cast<int>(id) < num_libs_);
|
||||
|
||||
if (builtin_libraries_[id].has_natives_) {
|
||||
Dart_Handle url = DartUtils::NewString(builtin_libraries_[id].url_);
|
||||
Dart_Handle library = Dart_LookupLibrary(url);
|
||||
ASSERT(!Dart_IsError(library));
|
||||
// Setup the native resolver for built in library functions.
|
||||
DART_CHECK_VALID(
|
||||
Dart_SetNativeResolver(library, NativeLookup, NativeSymbol));
|
||||
}
|
||||
}
|
||||
|
||||
Dart_Handle Builtin::LoadLibrary(Dart_Handle url, BuiltinLibraryId id) {
|
||||
return DartUtils::NewError("Unreachable code in Builtin::LoadLibrary (%d).",
|
||||
id);
|
||||
}
|
||||
|
||||
Builtin::BuiltinLibraryId Builtin::FindId(const char* url_string) {
|
||||
return kInvalidLibrary;
|
||||
}
|
||||
|
||||
Dart_Handle Builtin::LoadAndCheckLibrary(BuiltinLibraryId id) {
|
||||
ASSERT(static_cast<int>(id) >= 0);
|
||||
ASSERT(static_cast<int>(id) < num_libs_);
|
||||
|
||||
Dart_Handle url = DartUtils::NewString(builtin_libraries_[id].url_);
|
||||
Dart_Handle library = Dart_LookupLibrary(url);
|
||||
return library;
|
||||
}
|
||||
|
||||
} // namespace bin
|
||||
} // namespace dart
|
||||
+80
-24
@@ -22,6 +22,7 @@
|
||||
#include "bin/log.h"
|
||||
#include "bin/options.h"
|
||||
#include "bin/platform.h"
|
||||
#include "bin/snapshot_utils.h"
|
||||
#include "bin/thread.h"
|
||||
#include "bin/utils.h"
|
||||
#include "bin/vmservice_impl.h"
|
||||
@@ -112,7 +113,9 @@ static const char* kSnapshotKindNames[] = {
|
||||
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(dependencies, dependencies_filename) \
|
||||
V(load_compilation_trace, load_compilation_trace_filename) \
|
||||
@@ -315,16 +318,35 @@ static int ParseArguments(int argc,
|
||||
break;
|
||||
}
|
||||
case kAppAOTBlobs: {
|
||||
if ((vm_snapshot_data_filename == NULL) ||
|
||||
(vm_snapshot_instructions_filename == NULL) ||
|
||||
(isolate_snapshot_data_filename == NULL) ||
|
||||
(isolate_snapshot_instructions_filename == NULL) ||
|
||||
(*script_name == NULL)) {
|
||||
if (*script_name == NULL) {
|
||||
Log::PrintErr(
|
||||
"Building an AOT snapshot as blobs requires specifying "
|
||||
" a kernel file.\n\n");
|
||||
return -1;
|
||||
}
|
||||
if ((blobs_container_filename == NULL) &&
|
||||
((vm_snapshot_data_filename == NULL) ||
|
||||
(vm_snapshot_instructions_filename == NULL) ||
|
||||
(isolate_snapshot_data_filename == NULL) ||
|
||||
(isolate_snapshot_instructions_filename == NULL))) {
|
||||
Log::PrintErr(
|
||||
"Building an AOT snapshot as blobs requires specifying output "
|
||||
"file for --blobs_container_filename or "
|
||||
"files for --vm_snapshot_data, --vm_snapshot_instructions, "
|
||||
"--isolate_snapshot_data and --isolate_snapshot_instructions and a "
|
||||
"kernel file.\n\n");
|
||||
"--isolate_snapshot_data and --isolate_snapshot_instructions.\n\n");
|
||||
return -1;
|
||||
}
|
||||
if ((blobs_container_filename != NULL) &&
|
||||
((vm_snapshot_data_filename != NULL) ||
|
||||
(vm_snapshot_instructions_filename != NULL) ||
|
||||
(isolate_snapshot_data_filename != NULL) ||
|
||||
(isolate_snapshot_instructions_filename != NULL))) {
|
||||
Log::PrintErr(
|
||||
"Building an AOT snapshot as blobs requires specifying output "
|
||||
"file for --blobs_container_filename or "
|
||||
"files for --vm_snapshot_data, --vm_snapshot_instructions, "
|
||||
"--isolate_snapshot_data and --isolate_snapshot_instructions"
|
||||
" not both.\n\n");
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
@@ -440,12 +462,21 @@ class DependenciesFileWriter : public ValueObject {
|
||||
// WriteDependenciesWithTarget(isolate_snapshot_instructions_filename);
|
||||
break;
|
||||
case kCoreJIT:
|
||||
case kAppAOTBlobs:
|
||||
WriteDependenciesWithTarget(vm_snapshot_data_filename);
|
||||
// WriteDependenciesWithTarget(vm_snapshot_instructions_filename);
|
||||
// WriteDependenciesWithTarget(isolate_snapshot_data_filename);
|
||||
// WriteDependenciesWithTarget(isolate_snapshot_instructions_filename);
|
||||
break;
|
||||
case kAppAOTBlobs:
|
||||
if (blobs_container_filename != NULL) {
|
||||
WriteDependenciesWithTarget(blobs_container_filename);
|
||||
} else {
|
||||
WriteDependenciesWithTarget(vm_snapshot_data_filename);
|
||||
// WriteDependenciesWithTarget(vm_snapshot_instructions_filename);
|
||||
// WriteDependenciesWithTarget(isolate_snapshot_data_filename);
|
||||
// WriteDependenciesWithTarget(isolate_snapshot_instructions_filename);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
@@ -692,13 +723,29 @@ static void CreateAndWritePrecompiledSnapshot() {
|
||||
const uint8_t* shared_instructions = NULL;
|
||||
std::unique_ptr<MappedMemory> mapped_shared_data;
|
||||
std::unique_ptr<MappedMemory> mapped_shared_instructions;
|
||||
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);
|
||||
if (shared_blobs_filename != NULL) {
|
||||
AppSnapshot* shared_blobs = NULL;
|
||||
Log::PrintErr("Shared blobs in gen_snapshot are for testing only.\n");
|
||||
shared_blobs = Snapshot::TryReadAppSnapshot(shared_blobs_filename);
|
||||
if (shared_blobs == NULL) {
|
||||
Log::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;
|
||||
@@ -717,15 +764,24 @@ static void CreateAndWritePrecompiledSnapshot() {
|
||||
&isolate_snapshot_instructions_size, shared_data, shared_instructions);
|
||||
CHECK_RESULT(result);
|
||||
|
||||
WriteFile(vm_snapshot_data_filename, vm_snapshot_data_buffer,
|
||||
vm_snapshot_data_size);
|
||||
WriteFile(vm_snapshot_instructions_filename,
|
||||
vm_snapshot_instructions_buffer, vm_snapshot_instructions_size);
|
||||
WriteFile(isolate_snapshot_data_filename, isolate_snapshot_data_buffer,
|
||||
isolate_snapshot_data_size);
|
||||
WriteFile(isolate_snapshot_instructions_filename,
|
||||
isolate_snapshot_instructions_buffer,
|
||||
isolate_snapshot_instructions_size);
|
||||
if (blobs_container_filename != NULL) {
|
||||
Snapshot::WriteAppSnapshot(
|
||||
blobs_container_filename, vm_snapshot_data_buffer,
|
||||
vm_snapshot_data_size, vm_snapshot_instructions_buffer,
|
||||
vm_snapshot_instructions_size, isolate_snapshot_data_buffer,
|
||||
isolate_snapshot_data_size, isolate_snapshot_instructions_buffer,
|
||||
isolate_snapshot_instructions_size);
|
||||
} else {
|
||||
WriteFile(vm_snapshot_data_filename, vm_snapshot_data_buffer,
|
||||
vm_snapshot_data_size);
|
||||
WriteFile(vm_snapshot_instructions_filename,
|
||||
vm_snapshot_instructions_buffer, vm_snapshot_instructions_size);
|
||||
WriteFile(isolate_snapshot_data_filename, isolate_snapshot_data_buffer,
|
||||
isolate_snapshot_data_size);
|
||||
WriteFile(isolate_snapshot_instructions_filename,
|
||||
isolate_snapshot_instructions_buffer,
|
||||
isolate_snapshot_instructions_size);
|
||||
}
|
||||
}
|
||||
|
||||
// Serialize obfuscation map if requested.
|
||||
|
||||
@@ -856,35 +856,6 @@ Dart_Handle Loader::DartColonLibraryTagHandler(Dart_LibraryTag tag,
|
||||
if (tag == Dart_kCanonicalizeUrl) {
|
||||
// These will be handled internally.
|
||||
return url;
|
||||
} else if (tag == Dart_kImportTag) {
|
||||
Builtin::BuiltinLibraryId id = Builtin::FindId(url_string);
|
||||
if (id == Builtin::kInvalidLibrary) {
|
||||
return DartUtils::NewError(
|
||||
"The built-in library '%s' is not available"
|
||||
" on the stand-alone VM.\n",
|
||||
url_string);
|
||||
}
|
||||
return Builtin::LoadLibrary(url, id);
|
||||
} else {
|
||||
ASSERT(tag == Dart_kSourceTag);
|
||||
Builtin::BuiltinLibraryId id = Builtin::FindId(library_url_string);
|
||||
if (id == Builtin::kInvalidLibrary) {
|
||||
return DartUtils::NewError(
|
||||
"The built-in library '%s' is not available"
|
||||
" on the stand-alone VM. Trying to load"
|
||||
" '%s'.\n",
|
||||
library_url_string, url_string);
|
||||
}
|
||||
// Prepend the library URI to form a unique script URI for the part.
|
||||
intptr_t len = snprintf(NULL, 0, "%s/%s", library_url_string, url_string);
|
||||
char* part_uri = reinterpret_cast<char*>(malloc(len + 1));
|
||||
snprintf(part_uri, len + 1, "%s/%s", library_url_string, url_string);
|
||||
Dart_Handle part_uri_obj = DartUtils::NewString(part_uri);
|
||||
Dart_Handle result =
|
||||
Dart_LoadSource(library, part_uri_obj, Dart_Null(),
|
||||
Builtin::PartSource(id, part_uri), 0, 0);
|
||||
free(part_uri);
|
||||
return result;
|
||||
}
|
||||
// All cases should have been handled above.
|
||||
UNREACHABLE();
|
||||
|
||||
@@ -270,15 +270,15 @@ static bool WriteInt64(File* file, int64_t size) {
|
||||
return file->WriteFully(&size, sizeof(size));
|
||||
}
|
||||
|
||||
static void WriteAppSnapshot(const char* filename,
|
||||
uint8_t* vm_data_buffer,
|
||||
intptr_t vm_data_size,
|
||||
uint8_t* vm_instructions_buffer,
|
||||
intptr_t vm_instructions_size,
|
||||
uint8_t* isolate_data_buffer,
|
||||
intptr_t isolate_data_size,
|
||||
uint8_t* isolate_instructions_buffer,
|
||||
intptr_t isolate_instructions_size) {
|
||||
void Snapshot::WriteAppSnapshot(const char* filename,
|
||||
uint8_t* vm_data_buffer,
|
||||
intptr_t vm_data_size,
|
||||
uint8_t* vm_instructions_buffer,
|
||||
intptr_t vm_instructions_size,
|
||||
uint8_t* isolate_data_buffer,
|
||||
intptr_t isolate_data_size,
|
||||
uint8_t* isolate_instructions_buffer,
|
||||
intptr_t isolate_instructions_size) {
|
||||
File* file = File::Open(NULL, filename, File::kWriteTruncate);
|
||||
if (file == NULL) {
|
||||
ErrorExit(kErrorExitCode, "Unable to write snapshot file '%s'\n", filename);
|
||||
|
||||
@@ -38,6 +38,15 @@ class Snapshot {
|
||||
static void GenerateAppAOTAsAssembly(const char* snapshot_filename);
|
||||
|
||||
static AppSnapshot* TryReadAppSnapshot(const char* script_name);
|
||||
static void WriteAppSnapshot(const char* filename,
|
||||
uint8_t* vm_data_buffer,
|
||||
intptr_t vm_data_size,
|
||||
uint8_t* vm_instructions_buffer,
|
||||
intptr_t vm_instructions_size,
|
||||
uint8_t* isolate_data_buffer,
|
||||
intptr_t isolate_data_size,
|
||||
uint8_t* isolate_instructions_buffer,
|
||||
intptr_t isolate_instructions_size);
|
||||
|
||||
private:
|
||||
DISALLOW_ALLOCATION();
|
||||
|
||||
+6
-214
@@ -81,226 +81,18 @@ library_for_all_configs("libdart_vm") {
|
||||
include_dirs = [ ".." ]
|
||||
}
|
||||
|
||||
template("process_library_source") {
|
||||
assert(defined(invoker.libsources), "Need libsources in $target_name")
|
||||
assert(defined(invoker.output), "Need output in $target_name")
|
||||
action(target_name) {
|
||||
visibility = [ ":*" ] # Only targets in this file can see this.
|
||||
libsources = invoker.libsources
|
||||
|
||||
script = invoker.script
|
||||
inputs = invoker.inputs + libsources
|
||||
outputs = [
|
||||
invoker.output,
|
||||
]
|
||||
args = invoker.args + rebase_path(libsources, root_build_dir)
|
||||
}
|
||||
}
|
||||
|
||||
template("generate_library_source") {
|
||||
assert(defined(invoker.libname), "Need libname in $target_name")
|
||||
assert(defined(invoker.libsources), "Need libsources in $target_name")
|
||||
assert(defined(invoker.kind), "Need kind in $target_name")
|
||||
assert(defined(invoker.output), "Need output in $target_name")
|
||||
|
||||
process_library_source(target_name) {
|
||||
libname = invoker.libname
|
||||
libsources = invoker.libsources
|
||||
kind = invoker.kind
|
||||
script = "../tools/gen_library_src_paths.py"
|
||||
inputs = [
|
||||
"../lib/libgen_in.cc",
|
||||
]
|
||||
output = invoker.output
|
||||
args = [
|
||||
"--output",
|
||||
rebase_path(invoker.output, root_build_dir),
|
||||
"--input_cc",
|
||||
rebase_path("../lib/libgen_in.cc", root_build_dir),
|
||||
"--include",
|
||||
"vm/bootstrap.h",
|
||||
"--var_name",
|
||||
"dart::Bootstrap::${libname}_${kind}_paths_",
|
||||
"--library_name",
|
||||
"dart:${libname}",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
# This templates expects invoker.sources to be a list of lists.
|
||||
# The lists contain the following information about each library:
|
||||
# library name (string)
|
||||
# library sources (list of strings)
|
||||
# library source base path (string)
|
||||
# filename (string)
|
||||
# do_patch (boolean)
|
||||
#
|
||||
# If do_patch is true, the lists additionally contains
|
||||
# patch sources (list of strings)
|
||||
# patch source base path (string)
|
||||
#
|
||||
# The template iterates over the list, and generates generate_library_source
|
||||
# actions for each. After that, it generates targets to compile the generated
|
||||
# sources to make libdart_lib_*.
|
||||
template("generate_core_libraries") {
|
||||
assert(defined(invoker.sources), "Need sources in $target_name")
|
||||
assert(defined(invoker.allsources), "Need allsources in $target_name")
|
||||
liboutputs = []
|
||||
libdeps = []
|
||||
foreach(lib, invoker.sources) {
|
||||
libname = lib[0]
|
||||
filename = lib[3]
|
||||
do_patch = lib[4]
|
||||
generate_library_source("generate_${filename}_cc_file") {
|
||||
libname = libname
|
||||
libsources = rebase_path(lib[1], ".", lib[2])
|
||||
kind = "source"
|
||||
output = "$target_gen_dir/${filename}_gen.cc"
|
||||
}
|
||||
if (do_patch) {
|
||||
generate_library_source("generate_${filename}_patch_cc_file") {
|
||||
libname = libname
|
||||
libsources = rebase_path(lib[5], ".", lib[6])
|
||||
kind = "patch"
|
||||
output = "$target_gen_dir/${filename}_patch_gen.cc"
|
||||
}
|
||||
}
|
||||
|
||||
liboutputs += [ "$target_gen_dir/${filename}_gen.cc" ]
|
||||
libdeps += [ ":generate_${filename}_cc_file" ]
|
||||
if (do_patch) {
|
||||
liboutputs += [ "$target_gen_dir/${filename}_patch_gen.cc" ]
|
||||
libdeps += [ ":generate_${filename}_patch_cc_file" ]
|
||||
}
|
||||
}
|
||||
|
||||
all_libsources = rebase_path(invoker.allsources, ".", "../lib")
|
||||
|
||||
library_for_all_configs("libdart_lib") {
|
||||
target_type = "source_set"
|
||||
include_dirs = [ ".." ]
|
||||
sources = all_libsources
|
||||
snapshot_sources = [ "bootstrap_nocore.cc" ]
|
||||
nosnapshot_sources = [ "bootstrap.cc" ] + liboutputs
|
||||
nosnapshot_deps = libdeps
|
||||
}
|
||||
}
|
||||
|
||||
generate_core_libraries("core_libraries") {
|
||||
sources = [
|
||||
[
|
||||
"async",
|
||||
async_sdk_sources,
|
||||
"../../sdk/lib/async",
|
||||
"async",
|
||||
true,
|
||||
async_runtime_sources,
|
||||
"../lib",
|
||||
],
|
||||
[
|
||||
"collection",
|
||||
collection_sdk_sources,
|
||||
"../../sdk/lib/collection",
|
||||
"collection",
|
||||
true,
|
||||
collection_runtime_sources,
|
||||
"../lib",
|
||||
],
|
||||
[
|
||||
"convert",
|
||||
convert_sdk_sources,
|
||||
"../../sdk/lib/convert",
|
||||
"convert",
|
||||
true,
|
||||
convert_runtime_sources,
|
||||
"../lib",
|
||||
],
|
||||
[
|
||||
"core",
|
||||
core_sdk_sources,
|
||||
"../../sdk/lib/core",
|
||||
"core",
|
||||
true,
|
||||
core_runtime_sources,
|
||||
"../lib",
|
||||
],
|
||||
[
|
||||
"developer",
|
||||
developer_sdk_sources,
|
||||
"../../sdk/lib/developer",
|
||||
"developer",
|
||||
true,
|
||||
developer_runtime_sources,
|
||||
"../lib",
|
||||
],
|
||||
[
|
||||
"_internal",
|
||||
internal_sdk_sources,
|
||||
"../../sdk/lib/internal",
|
||||
"internal",
|
||||
true,
|
||||
internal_runtime_sources,
|
||||
"../lib",
|
||||
],
|
||||
[
|
||||
"isolate",
|
||||
isolate_sdk_sources,
|
||||
"../../sdk/lib/isolate",
|
||||
"isolate",
|
||||
true,
|
||||
isolate_runtime_sources,
|
||||
"../lib",
|
||||
],
|
||||
[
|
||||
"math",
|
||||
math_sdk_sources,
|
||||
"../../sdk/lib/math",
|
||||
"math",
|
||||
true,
|
||||
math_runtime_sources,
|
||||
"../lib",
|
||||
],
|
||||
[
|
||||
"mirrors",
|
||||
mirrors_sdk_sources,
|
||||
"../../sdk/lib/mirrors",
|
||||
"mirrors",
|
||||
true,
|
||||
mirrors_runtime_sources,
|
||||
"../lib",
|
||||
],
|
||||
[
|
||||
"profiler",
|
||||
profiler_sdk_sources,
|
||||
"../../sdk/lib/profiler",
|
||||
"profiler",
|
||||
false,
|
||||
],
|
||||
[
|
||||
"typed_data",
|
||||
typed_data_sdk_sources,
|
||||
"../../sdk/lib/typed_data",
|
||||
"typed_data",
|
||||
true,
|
||||
typed_data_runtime_sources,
|
||||
"../lib",
|
||||
],
|
||||
[
|
||||
"_vmservice",
|
||||
vmservice_sdk_sources,
|
||||
"../../sdk/lib/vmservice",
|
||||
"vmservice",
|
||||
true,
|
||||
vmservice_runtime_sources,
|
||||
"../lib",
|
||||
],
|
||||
]
|
||||
library_for_all_configs("libdart_lib") {
|
||||
target_type = "source_set"
|
||||
include_dirs = [ ".." ]
|
||||
allsources = async_runtime_sources + collection_runtime_sources +
|
||||
convert_runtime_sources + core_runtime_sources +
|
||||
developer_runtime_sources + internal_runtime_sources +
|
||||
isolate_runtime_sources + math_runtime_sources +
|
||||
mirrors_runtime_sources + profiler_runtime_sources +
|
||||
typed_data_runtime_sources + vmservice_runtime_sources
|
||||
sources = [ "bootstrap.cc" ] + rebase_path(allsources, ".", "../lib")
|
||||
snapshot_sources = []
|
||||
nosnapshot_sources = []
|
||||
}
|
||||
|
||||
compile_platform("vm_legacy_platform") {
|
||||
|
||||
+10
-249
@@ -6,7 +6,6 @@
|
||||
|
||||
#include "include/dart_api.h"
|
||||
|
||||
#include "vm/bootstrap_natives.h"
|
||||
#include "vm/class_finalizer.h"
|
||||
#include "vm/compiler/jit/compiler.h"
|
||||
#include "vm/dart_api_impl.h"
|
||||
@@ -23,18 +22,13 @@ namespace dart {
|
||||
struct BootstrapLibProps {
|
||||
ObjectStore::BootstrapLibraryId index;
|
||||
const char* uri;
|
||||
const char** source_paths;
|
||||
const char* patch_uri;
|
||||
const char** patch_paths;
|
||||
};
|
||||
|
||||
enum { kPathsUriOffset = 0, kPathsSourceOffset = 1, kPathsEntryLength = 2 };
|
||||
|
||||
const char** Bootstrap::profiler_patch_paths_ = NULL;
|
||||
|
||||
#if !defined(DART_PRECOMPILED_RUNTIME)
|
||||
#define MAKE_PROPERTIES(CamelName, name) \
|
||||
{ObjectStore::k##CamelName, "dart:" #name, Bootstrap::name##_source_paths_, \
|
||||
"dart:" #name "-patch", Bootstrap::name##_patch_paths_},
|
||||
{ObjectStore::k##CamelName, "dart:" #name},
|
||||
|
||||
static const BootstrapLibProps bootstrap_libraries[] = {
|
||||
FOR_EACH_BOOTSTRAP_LIBRARY(MAKE_PROPERTIES)};
|
||||
@@ -42,186 +36,6 @@ static const BootstrapLibProps bootstrap_libraries[] = {
|
||||
#undef MAKE_PROPERTIES
|
||||
|
||||
static const intptr_t kBootstrapLibraryCount = ARRAY_SIZE(bootstrap_libraries);
|
||||
|
||||
static RawString* GetLibrarySourceByIndex(intptr_t index,
|
||||
const String& uri,
|
||||
bool patch) {
|
||||
ASSERT(index >= 0 && index < kBootstrapLibraryCount);
|
||||
|
||||
// Try to read the source using the path specified for the uri.
|
||||
const char** source_paths = patch ? bootstrap_libraries[index].patch_paths
|
||||
: bootstrap_libraries[index].source_paths;
|
||||
if (source_paths == NULL) {
|
||||
return String::null(); // No path mapping information exists for library.
|
||||
}
|
||||
const char* source_data = NULL;
|
||||
for (intptr_t i = 0; source_paths[i] != NULL; i += kPathsEntryLength) {
|
||||
if (uri.Equals(source_paths[i + kPathsUriOffset])) {
|
||||
source_data = source_paths[i + kPathsSourceOffset];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (source_data == NULL) {
|
||||
return String::null(); // Uri does not exist in path mapping information.
|
||||
}
|
||||
|
||||
const uint8_t* utf8_array = NULL;
|
||||
intptr_t file_length = -1;
|
||||
|
||||
if (source_data != NULL) {
|
||||
file_length = strlen(source_data);
|
||||
utf8_array = reinterpret_cast<const uint8_t*>(source_data);
|
||||
} else {
|
||||
return String::null();
|
||||
}
|
||||
ASSERT(utf8_array != NULL);
|
||||
ASSERT(file_length >= 0);
|
||||
return String::FromUTF8(utf8_array, file_length);
|
||||
}
|
||||
|
||||
static RawString* GetLibrarySource(Zone* zone,
|
||||
const Library& lib,
|
||||
const String& uri,
|
||||
bool patch) {
|
||||
// First check if this is a valid bootstrap library and find its index in
|
||||
// the 'bootstrap_libraries' table above.
|
||||
intptr_t index;
|
||||
const String& lib_uri = String::Handle(lib.url());
|
||||
for (index = 0; index < kBootstrapLibraryCount; ++index) {
|
||||
if (lib_uri.Equals(bootstrap_libraries[index].uri)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index == kBootstrapLibraryCount) {
|
||||
return String::null(); // The library is not a bootstrap library.
|
||||
}
|
||||
|
||||
const Array& strings = Array::Handle(zone, Array::New(3));
|
||||
strings.SetAt(0, lib_uri);
|
||||
strings.SetAt(1, Symbols::Slash());
|
||||
strings.SetAt(2, uri);
|
||||
const String& part_uri = String::Handle(zone, String::ConcatAll(strings));
|
||||
|
||||
return GetLibrarySourceByIndex(index, part_uri, patch);
|
||||
}
|
||||
|
||||
static RawError* Compile(const Library& library, const Script& script) {
|
||||
bool update_lib_status = (script.kind() == RawScript::kScriptTag ||
|
||||
script.kind() == RawScript::kLibraryTag);
|
||||
if (update_lib_status) {
|
||||
library.SetLoadInProgress();
|
||||
}
|
||||
const Error& error = Error::Handle(Compiler::Compile(library, script));
|
||||
if (update_lib_status) {
|
||||
if (error.IsNull()) {
|
||||
library.SetLoaded();
|
||||
} else {
|
||||
// Compilation errors are not Dart instances, so just mark the library
|
||||
// as having failed to load without providing an error instance.
|
||||
library.SetLoadError(Object::null_instance());
|
||||
}
|
||||
}
|
||||
return error.raw();
|
||||
}
|
||||
|
||||
static Dart_Handle LoadPartSource(Thread* thread,
|
||||
const Library& lib,
|
||||
const String& uri) {
|
||||
Zone* zone = thread->zone();
|
||||
const String& part_source =
|
||||
String::Handle(zone, GetLibrarySource(zone, lib, uri, false));
|
||||
const String& lib_uri = String::Handle(zone, lib.url());
|
||||
if (part_source.IsNull()) {
|
||||
return Api::NewError("Unable to read part file '%s' of library '%s'",
|
||||
uri.ToCString(), lib_uri.ToCString());
|
||||
}
|
||||
|
||||
// Prepend the library URI to form a unique script URI for the part.
|
||||
const Array& strings = Array::Handle(zone, Array::New(3));
|
||||
strings.SetAt(0, lib_uri);
|
||||
strings.SetAt(1, Symbols::Slash());
|
||||
strings.SetAt(2, uri);
|
||||
const String& part_uri = String::Handle(zone, String::ConcatAll(strings));
|
||||
|
||||
// Create a script object and compile the part.
|
||||
const Script& part_script = Script::Handle(
|
||||
zone, Script::New(part_uri, part_source, RawScript::kSourceTag));
|
||||
const Error& error = Error::Handle(zone, Compile(lib, part_script));
|
||||
return Api::NewHandle(thread, error.raw());
|
||||
}
|
||||
|
||||
static Dart_Handle BootstrapLibraryTagHandler(Dart_LibraryTag tag,
|
||||
Dart_Handle library,
|
||||
Dart_Handle uri) {
|
||||
Thread* thread = Thread::Current();
|
||||
Zone* zone = thread->zone();
|
||||
// This handler calls into the VM directly and does not use the Dart
|
||||
// API so we transition back to VM.
|
||||
TransitionNativeToVM transition(thread);
|
||||
if (!Dart_IsLibrary(library)) {
|
||||
return Api::NewError("not a library");
|
||||
}
|
||||
if (!Dart_IsString(uri)) {
|
||||
return Api::NewError("uri is not a string");
|
||||
}
|
||||
if (tag == Dart_kCanonicalizeUrl) {
|
||||
// In the bootstrap loader we do not try and do any canonicalization.
|
||||
return uri;
|
||||
}
|
||||
const String& uri_str = Api::UnwrapStringHandle(zone, uri);
|
||||
ASSERT(!uri_str.IsNull());
|
||||
if (tag == Dart_kImportTag) {
|
||||
// We expect the core bootstrap libraries to only import other
|
||||
// core bootstrap libraries.
|
||||
// We have precreated all the bootstrap library objects hence
|
||||
// we do not expect to be called back with the tag set to kImportTag.
|
||||
// The bootstrap process explicitly loads all the libraries one by one.
|
||||
return Api::NewError("Invalid import of '%s' in a bootstrap library",
|
||||
uri_str.ToCString());
|
||||
}
|
||||
ASSERT(tag == Dart_kSourceTag);
|
||||
const Library& lib = Api::UnwrapLibraryHandle(zone, library);
|
||||
ASSERT(!lib.IsNull());
|
||||
return LoadPartSource(thread, lib, uri_str);
|
||||
}
|
||||
|
||||
static RawError* LoadPatchFiles(Thread* thread,
|
||||
const Library& lib,
|
||||
intptr_t index) {
|
||||
const char** patch_files = bootstrap_libraries[index].patch_paths;
|
||||
if (patch_files == NULL) return Error::null();
|
||||
|
||||
Zone* zone = thread->zone();
|
||||
String& patch_uri = String::Handle(
|
||||
zone, Symbols::New(thread, bootstrap_libraries[index].patch_uri));
|
||||
String& patch_file_uri = String::Handle(zone);
|
||||
String& source = String::Handle(zone);
|
||||
Script& script = Script::Handle(zone);
|
||||
Error& error = Error::Handle(zone);
|
||||
const Array& strings = Array::Handle(zone, Array::New(3));
|
||||
strings.SetAt(0, patch_uri);
|
||||
strings.SetAt(1, Symbols::Slash());
|
||||
for (intptr_t j = 0; patch_files[j] != NULL; j += kPathsEntryLength) {
|
||||
patch_file_uri = String::New(patch_files[j + kPathsUriOffset]);
|
||||
source = GetLibrarySourceByIndex(index, patch_file_uri, true);
|
||||
if (source.IsNull()) {
|
||||
const String& message = String::Handle(
|
||||
String::NewFormatted("Unable to find dart patch source for %s",
|
||||
patch_file_uri.ToCString()));
|
||||
return ApiError::New(message);
|
||||
}
|
||||
// Prepend the patch library URI to form a unique script URI for the patch.
|
||||
strings.SetAt(2, patch_file_uri);
|
||||
patch_file_uri = String::ConcatAll(strings);
|
||||
script = Script::New(patch_file_uri, source, RawScript::kPatchTag);
|
||||
error = lib.Patch(script);
|
||||
if (!error.IsNull()) {
|
||||
return error.raw();
|
||||
}
|
||||
}
|
||||
return Error::null();
|
||||
}
|
||||
|
||||
static void Finish(Thread* thread) {
|
||||
Bootstrap::SetupNativeResolver();
|
||||
if (!ClassFinalizer::ProcessPendingClasses()) {
|
||||
@@ -260,56 +74,6 @@ static void Finish(Thread* thread) {
|
||||
Compiler::CompileClass(cls);
|
||||
}
|
||||
|
||||
static RawError* BootstrapFromSource(Thread* thread) {
|
||||
Isolate* isolate = thread->isolate();
|
||||
Zone* zone = thread->zone();
|
||||
String& uri = String::Handle(zone);
|
||||
String& source = String::Handle(zone);
|
||||
Script& script = Script::Handle(zone);
|
||||
Library& lib = Library::Handle(zone);
|
||||
Error& error = Error::Handle(zone);
|
||||
|
||||
// Set the library tag handler for the isolate to the bootstrap
|
||||
// library tag handler so that we can load all the bootstrap libraries.
|
||||
Dart_LibraryTagHandler saved_tag_handler = isolate->library_tag_handler();
|
||||
isolate->set_library_tag_handler(BootstrapLibraryTagHandler);
|
||||
|
||||
// Load, compile and patch bootstrap libraries.
|
||||
for (intptr_t i = 0; i < kBootstrapLibraryCount; ++i) {
|
||||
ObjectStore::BootstrapLibraryId id = bootstrap_libraries[i].index;
|
||||
uri = Symbols::New(thread, bootstrap_libraries[i].uri);
|
||||
lib = isolate->object_store()->bootstrap_library(id);
|
||||
ASSERT(!lib.IsNull());
|
||||
ASSERT(lib.raw() == Library::LookupLibrary(thread, uri));
|
||||
source = GetLibrarySourceByIndex(i, uri, false);
|
||||
if (source.IsNull()) {
|
||||
const String& message = String::Handle(String::NewFormatted(
|
||||
"Unable to find dart source for %s", uri.ToCString()));
|
||||
error ^= ApiError::New(message);
|
||||
break;
|
||||
}
|
||||
script = Script::New(uri, source, RawScript::kLibraryTag);
|
||||
error = Compile(lib, script);
|
||||
if (!error.IsNull()) {
|
||||
break;
|
||||
}
|
||||
// If a patch exists, load and patch the script.
|
||||
error = LoadPatchFiles(thread, lib, i);
|
||||
if (!error.IsNull()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (error.IsNull()) {
|
||||
Finish(thread);
|
||||
}
|
||||
// Restore the library tag handler for the isolate.
|
||||
isolate->set_library_tag_handler(saved_tag_handler);
|
||||
|
||||
return error.raw();
|
||||
}
|
||||
|
||||
#if !defined(DART_PRECOMPILED_RUNTIME)
|
||||
static RawError* BootstrapFromKernel(Thread* thread,
|
||||
const uint8_t* kernel_buffer,
|
||||
intptr_t kernel_buffer_size) {
|
||||
@@ -362,14 +126,6 @@ static RawError* BootstrapFromKernel(Thread* thread,
|
||||
|
||||
return Error::null();
|
||||
}
|
||||
#else
|
||||
static RawError* BootstrapFromKernel(Thread* thread,
|
||||
const uint8_t* kernel_buffer,
|
||||
intptr_t kernel_buffer_size) {
|
||||
UNREACHABLE();
|
||||
return Error::null();
|
||||
}
|
||||
#endif
|
||||
|
||||
RawError* Bootstrap::DoBootstrapping(const uint8_t* kernel_buffer,
|
||||
intptr_t kernel_buffer_size) {
|
||||
@@ -395,9 +151,14 @@ RawError* Bootstrap::DoBootstrapping(const uint8_t* kernel_buffer,
|
||||
}
|
||||
}
|
||||
|
||||
return (kernel_buffer == NULL)
|
||||
? BootstrapFromSource(thread)
|
||||
: BootstrapFromKernel(thread, kernel_buffer, kernel_buffer_size);
|
||||
return BootstrapFromKernel(thread, kernel_buffer, kernel_buffer_size);
|
||||
}
|
||||
#else
|
||||
RawError* Bootstrap::DoBootstrapping(const uint8_t* kernel_buffer,
|
||||
intptr_t kernel_buffer_size) {
|
||||
UNREACHABLE();
|
||||
return Error::null();
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace dart
|
||||
|
||||
@@ -29,38 +29,6 @@ class Bootstrap : public AllStatic {
|
||||
|
||||
static void SetupNativeResolver();
|
||||
static bool IsBootstrapResolver(Dart_NativeEntryResolver resolver);
|
||||
|
||||
// Source path mapping for library URI and 'parts'.
|
||||
static const char* async_source_paths_[];
|
||||
static const char* core_source_paths_[];
|
||||
static const char* collection_source_paths_[];
|
||||
static const char* convert_source_paths_[];
|
||||
static const char* developer_source_paths_[];
|
||||
static const char* _internal_source_paths_[];
|
||||
static const char* isolate_source_paths_[];
|
||||
static const char* json_source_paths_[];
|
||||
static const char* math_source_paths_[];
|
||||
static const char* mirrors_source_paths_[];
|
||||
static const char* profiler_source_paths_[];
|
||||
static const char* typed_data_source_paths_[];
|
||||
static const char* utf_source_paths_[];
|
||||
static const char* _vmservice_source_paths_[];
|
||||
|
||||
// Source path mapping for patch URI and 'parts'.
|
||||
static const char* async_patch_paths_[];
|
||||
static const char* core_patch_paths_[];
|
||||
static const char* collection_patch_paths_[];
|
||||
static const char* convert_patch_paths_[];
|
||||
static const char* developer_patch_paths_[];
|
||||
static const char* _internal_patch_paths_[];
|
||||
static const char* isolate_patch_paths_[];
|
||||
static const char* math_patch_paths_[];
|
||||
static const char* mirrors_patch_paths_[];
|
||||
static const char* typed_data_patch_paths_[];
|
||||
static const char* _vmservice_patch_paths_[];
|
||||
|
||||
// NULL patch paths for libraries that do not have patch files.
|
||||
static const char** profiler_patch_paths_;
|
||||
};
|
||||
|
||||
} // namespace dart
|
||||
|
||||
@@ -1,160 +0,0 @@
|
||||
// Copyright (c) 2012, 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.
|
||||
|
||||
#include "vm/bootstrap.h"
|
||||
|
||||
#include "include/dart_api.h"
|
||||
|
||||
#if !defined(DART_PRECOMPILED_RUNTIME)
|
||||
#include "vm/class_finalizer.h"
|
||||
#include "vm/compiler/jit/compiler.h"
|
||||
#include "vm/kernel_loader.h"
|
||||
#endif
|
||||
#include "vm/object.h"
|
||||
#if !defined(DART_PRECOMPILED_RUNTIME)
|
||||
#include "vm/object_store.h"
|
||||
#endif
|
||||
|
||||
namespace dart {
|
||||
|
||||
#if !defined(DART_PRECOMPILED_RUNTIME)
|
||||
#define MAKE_PROPERTIES(CamelName, name) \
|
||||
{ObjectStore::k##CamelName, "dart:" #name},
|
||||
|
||||
struct BootstrapLibProps {
|
||||
ObjectStore::BootstrapLibraryId index;
|
||||
const char* uri;
|
||||
};
|
||||
|
||||
static BootstrapLibProps bootstrap_libraries[] = {
|
||||
FOR_EACH_BOOTSTRAP_LIBRARY(MAKE_PROPERTIES)};
|
||||
|
||||
#undef MAKE_PROPERTIES
|
||||
|
||||
static const intptr_t bootstrap_library_count = ARRAY_SIZE(bootstrap_libraries);
|
||||
|
||||
static void Finish(Thread* thread) {
|
||||
Bootstrap::SetupNativeResolver();
|
||||
ClassFinalizer::ProcessPendingClasses();
|
||||
|
||||
// Eagerly compile the _Closure class as it is the class of all closure
|
||||
// instances. This allows us to just finalize function types without going
|
||||
// through the hoops of trying to compile their scope class.
|
||||
ObjectStore* object_store = thread->isolate()->object_store();
|
||||
Zone* zone = thread->zone();
|
||||
Class& cls = Class::Handle(zone, object_store->closure_class());
|
||||
Compiler::CompileClass(cls);
|
||||
|
||||
#if defined(DEBUG)
|
||||
// Verify that closure field offsets are identical in Dart and C++.
|
||||
const Array& fields = Array::Handle(zone, cls.fields());
|
||||
ASSERT(fields.Length() == 6);
|
||||
Field& field = Field::Handle(zone);
|
||||
field ^= fields.At(0);
|
||||
ASSERT(field.Offset() == Closure::instantiator_type_arguments_offset());
|
||||
field ^= fields.At(1);
|
||||
ASSERT(field.Offset() == Closure::function_type_arguments_offset());
|
||||
field ^= fields.At(2);
|
||||
ASSERT(field.Offset() == Closure::delayed_type_arguments_offset());
|
||||
field ^= fields.At(3);
|
||||
ASSERT(field.Offset() == Closure::function_offset());
|
||||
field ^= fields.At(4);
|
||||
ASSERT(field.Offset() == Closure::context_offset());
|
||||
field ^= fields.At(5);
|
||||
ASSERT(field.Offset() == Closure::hash_offset());
|
||||
#endif // defined(DEBUG)
|
||||
|
||||
// Eagerly compile Bool class, bool constants are used from within compiler.
|
||||
cls = object_store->bool_class();
|
||||
Compiler::CompileClass(cls);
|
||||
}
|
||||
|
||||
RawError* BootstrapFromKernel(Thread* thread,
|
||||
const uint8_t* kernel_buffer,
|
||||
intptr_t kernel_buffer_size) {
|
||||
Zone* zone = thread->zone();
|
||||
const char* error = nullptr;
|
||||
kernel::Program* program = kernel::Program::ReadFromBuffer(
|
||||
kernel_buffer, kernel_buffer_size, &error);
|
||||
if (program == nullptr) {
|
||||
const intptr_t kMessageBufferSize = 512;
|
||||
char message_buffer[kMessageBufferSize];
|
||||
Utils::SNPrint(message_buffer, kMessageBufferSize,
|
||||
"Can't load Kernel binary: %s.", error);
|
||||
const String& msg = String::Handle(String::New(message_buffer, Heap::kOld));
|
||||
return ApiError::New(msg, Heap::kOld);
|
||||
}
|
||||
kernel::KernelLoader loader(program);
|
||||
Isolate* isolate = thread->isolate();
|
||||
|
||||
// Load the bootstrap libraries in order (see object_store.h).
|
||||
Library& library = Library::Handle(zone);
|
||||
String& dart_name = String::Handle(zone);
|
||||
for (intptr_t i = 0; i < bootstrap_library_count; ++i) {
|
||||
ObjectStore::BootstrapLibraryId id = bootstrap_libraries[i].index;
|
||||
library = isolate->object_store()->bootstrap_library(id);
|
||||
dart_name = library.url();
|
||||
for (intptr_t j = 0; j < program->library_count(); ++j) {
|
||||
const String& kernel_name = loader.LibraryUri(j);
|
||||
if (kernel_name.Equals(dart_name)) {
|
||||
loader.LoadLibrary(j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Finish bootstrapping, including class finalization.
|
||||
Finish(thread);
|
||||
|
||||
// The platform binary may contain other libraries (e.g., dart:_builtin or
|
||||
// dart:io) that will not be bundled with application. Load them now.
|
||||
const Object& result = Object::Handle(loader.LoadProgram());
|
||||
delete program;
|
||||
if (result.IsError()) {
|
||||
return Error::Cast(result).raw();
|
||||
}
|
||||
|
||||
// The builtin library should be registered with the VM.
|
||||
dart_name = String::New("dart:_builtin");
|
||||
library = Library::LookupLibrary(thread, dart_name);
|
||||
isolate->object_store()->set_builtin_library(library);
|
||||
|
||||
return Error::null();
|
||||
}
|
||||
|
||||
RawError* Bootstrap::DoBootstrapping(const uint8_t* kernel_buffer,
|
||||
intptr_t kernel_buffer_size) {
|
||||
Thread* thread = Thread::Current();
|
||||
Isolate* isolate = thread->isolate();
|
||||
Zone* zone = thread->zone();
|
||||
String& uri = String::Handle(zone);
|
||||
Library& lib = Library::Handle(zone);
|
||||
|
||||
HANDLESCOPE(thread);
|
||||
|
||||
// Ensure there are library objects for all the bootstrap libraries.
|
||||
for (intptr_t i = 0; i < bootstrap_library_count; ++i) {
|
||||
ObjectStore::BootstrapLibraryId id = bootstrap_libraries[i].index;
|
||||
uri = Symbols::New(thread, bootstrap_libraries[i].uri);
|
||||
lib = isolate->object_store()->bootstrap_library(id);
|
||||
ASSERT(lib.raw() == Library::LookupLibrary(thread, uri));
|
||||
if (lib.IsNull()) {
|
||||
lib = Library::NewLibraryHelper(uri, false);
|
||||
lib.SetLoadRequested();
|
||||
lib.Register(thread);
|
||||
isolate->object_store()->set_bootstrap_library(id, lib);
|
||||
}
|
||||
}
|
||||
|
||||
return BootstrapFromKernel(thread, kernel_buffer, kernel_buffer_size);
|
||||
}
|
||||
#else
|
||||
RawError* Bootstrap::DoBootstrapping(const uint8_t* kernel_buffer,
|
||||
intptr_t kernel_buffer_size) {
|
||||
UNREACHABLE();
|
||||
return Error::null();
|
||||
}
|
||||
#endif // !defined(DART_PRECOMPILED_RUNTIME)
|
||||
|
||||
} // namespace dart
|
||||
@@ -121,7 +121,7 @@ static void PrecompilationModeHandler(bool value) {
|
||||
#endif
|
||||
|
||||
#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
|
||||
// Set flags affecting runtime accordingly for dart_bootstrap.
|
||||
// Set flags affecting runtime accordingly for gen_snapshot.
|
||||
// These flags are constants with PRODUCT and DART_PRECOMPILED_RUNTIME.
|
||||
FLAG_deoptimize_alot = false; // Used in some tests.
|
||||
FLAG_deoptimize_every = 0; // Used in some tests.
|
||||
|
||||
@@ -140,9 +140,6 @@ enum SerializeState {
|
||||
|
||||
// Structure capturing the raw snapshot.
|
||||
//
|
||||
// TODO(turnidge): Remove this class once the snapshot does not have a
|
||||
// header anymore. This is pending on making the embedder pass in the
|
||||
// length of their snapshot.
|
||||
class Snapshot {
|
||||
public:
|
||||
enum Kind {
|
||||
@@ -150,7 +147,7 @@ class Snapshot {
|
||||
kFullJIT, // Full + JIT code
|
||||
kFullAOT, // Full + AOT code
|
||||
kMessage, // A partial snapshot used only for isolate messaging.
|
||||
kNone, // dart_bootstrap/gen_snapshot
|
||||
kNone, // gen_snapshot
|
||||
kInvalid
|
||||
};
|
||||
static const char* KindToCString(Kind kind);
|
||||
|
||||
@@ -32,8 +32,6 @@ void main(List<String> args) {
|
||||
try {
|
||||
args = <String>[
|
||||
'--aot',
|
||||
'--strong-mode',
|
||||
'--sync-async',
|
||||
'--platform=$buildDir/vm_platform_strong.dill',
|
||||
'-o',
|
||||
scriptPathDill,
|
||||
@@ -42,25 +40,21 @@ void main(List<String> args) {
|
||||
runSync("pkg/vm/tool/gen_kernel${Platform.isWindows ? '.bat' : ''}", args);
|
||||
|
||||
args = <String>[
|
||||
"--strong",
|
||||
"--deterministic",
|
||||
"--use-blobs",
|
||||
"--snapshot-kind=app-aot",
|
||||
"--snapshot=$snapshot1Path",
|
||||
"--snapshot-kind=app-aot-blobs",
|
||||
"--blobs_container_filename=$snapshot1Path",
|
||||
scriptPathDill,
|
||||
];
|
||||
runSync("$buildDir/dart_bootstrap", args);
|
||||
runSync("$buildDir/gen_snapshot", args);
|
||||
|
||||
args = <String>[
|
||||
"--strong",
|
||||
"--deterministic",
|
||||
"--use-blobs",
|
||||
"--snapshot-kind=app-aot",
|
||||
"--snapshot=$snapshot2Path",
|
||||
"--snapshot-kind=app-aot-blobs",
|
||||
"--blobs_container_filename=$snapshot2Path",
|
||||
"--shared-blobs=$snapshot1Path",
|
||||
scriptPathDill,
|
||||
];
|
||||
runSync("$buildDir/dart_bootstrap", args);
|
||||
runSync("$buildDir/gen_snapshot", args);
|
||||
|
||||
var sizeWithoutSharing = new File(snapshot1Path).statSync().size;
|
||||
var deltaWhenSharing = new File(snapshot2Path).statSync().size;
|
||||
@@ -71,7 +65,6 @@ void main(List<String> args) {
|
||||
}
|
||||
|
||||
args = <String>[
|
||||
"--strong",
|
||||
"--shared-blobs=$snapshot1Path",
|
||||
snapshot2Path,
|
||||
"--child",
|
||||
|
||||
@@ -83,7 +83,7 @@ for command; do
|
||||
out/ReleaseIA32/dart-sdk \
|
||||
tools/dart2js/angular2_testing_deps \
|
||||
out/ReleaseIA32/dart \
|
||||
out/ReleaseIA32/dart_bootstrap \
|
||||
out/ReleaseIA32/gen_snapshot \
|
||||
out/ReleaseIA32/gen_kernel_bytecode.dill \
|
||||
out/ReleaseIA32/run_vm_tests \
|
||||
third_party/d8/linux/ia32/d8 \
|
||||
@@ -132,7 +132,7 @@ for command; do
|
||||
-K '_ZN4dart7Version14snapshot_hash_E' \
|
||||
-K '_ZN4dart7Version4str_E' \
|
||||
-K '_ZN4dart7Version7commit_E' \
|
||||
-K '_ZN4dart9Bootstrap*_paths_E' out/ReleaseIA32/dart_bootstrap
|
||||
-K '_ZN4dart9Bootstrap*_paths_E' out/ReleaseIA32/gen_snapshot
|
||||
strip -w \
|
||||
-K 'kDartVmSnapshotData' \
|
||||
-K 'kDartVmSnapshotInstructions' \
|
||||
@@ -183,7 +183,7 @@ for command; do
|
||||
out/ReleaseIA32/dart-sdk \
|
||||
tools/dart2js/angular2_testing_deps \
|
||||
out/ReleaseIA32/dart \
|
||||
out/ReleaseIA32/dart_bootstrap \
|
||||
out/ReleaseIA32/gen_snapshot \
|
||||
out/ReleaseIA32/gen_kernel_bytecode.dill \
|
||||
out/ReleaseIA32/run_vm_tests \
|
||||
third_party/d8/linux/ia32/d8 \
|
||||
@@ -230,7 +230,6 @@ EOF
|
||||
elif [ "$command" = linux-x64-build ]; then
|
||||
./tools/build.py --mode=release --arch=x64 create_sdk
|
||||
./tools/build.py --mode=release --arch=x64 runtime
|
||||
./tools/build.py --mode=release --arch=x64 dart_bootstrap
|
||||
./tools/build.py --mode=release --arch=x64 dart_precompiled_runtime
|
||||
./tools/build.py --mode=release --arch=simdbc64 runtime
|
||||
./tools/build.py --mode=release --arch=x64 runtime_kernel
|
||||
@@ -246,7 +245,7 @@ EOF
|
||||
out/ReleaseSIMDBC64/dart \
|
||||
out/ReleaseX64/gen/kernel-service.dart.snapshot \
|
||||
out/ReleaseX64/dart \
|
||||
out/ReleaseX64/dart_bootstrap \
|
||||
out/ReleaseX64/gen_snapshot \
|
||||
out/ReleaseX64/gen_kernel_bytecode.dill \
|
||||
out/ReleaseX64/run_vm_tests \
|
||||
third_party/d8/linux/x64/d8 \
|
||||
@@ -297,7 +296,7 @@ EOF
|
||||
-K '_ZN4dart7Version14snapshot_hash_E' \
|
||||
-K '_ZN4dart7Version4str_E' \
|
||||
-K '_ZN4dart7Version7commit_E' \
|
||||
-K '_ZN4dart9Bootstrap*_paths_E' out/ReleaseX64/dart_bootstrap
|
||||
-K '_ZN4dart9Bootstrap*_paths_E' out/ReleaseX64/gen_snapshot
|
||||
strip -w \
|
||||
-K 'kDartVmSnapshotData' \
|
||||
-K 'kDartVmSnapshotInstructions' \
|
||||
@@ -367,7 +366,7 @@ EOF
|
||||
out/ReleaseSIMDBC64/dart \
|
||||
out/ReleaseX64/gen/kernel-service.dart.snapshot \
|
||||
out/ReleaseX64/dart \
|
||||
out/ReleaseX64/dart_bootstrap \
|
||||
out/ReleaseX64/gen_snapshot \
|
||||
out/ReleaseX64/gen_kernel_bytecode.dill \
|
||||
out/ReleaseX64/run_vm_tests \
|
||||
third_party/d8/linux/x64/d8 \
|
||||
|
||||
@@ -25,7 +25,6 @@ POSIX_INFO = 'ps -p %s -o args'
|
||||
EXECUTABLE_NAMES = {
|
||||
'win32': {
|
||||
'chrome': 'chrome.exe',
|
||||
'dart_bootstrap': 'dart_bootstrap.exe',
|
||||
'dart': 'dart.exe',
|
||||
'dart_precompiled_runtime': 'dart_precompiled_runtime.exe',
|
||||
'firefox': 'firefox.exe',
|
||||
@@ -37,7 +36,6 @@ EXECUTABLE_NAMES = {
|
||||
},
|
||||
'linux': {
|
||||
'chrome': 'chrome',
|
||||
'dart_bootstrap': 'dart_bootstrap',
|
||||
'dart': 'dart',
|
||||
'dart_precompiled_runtime': 'dart_precompiled_runtime',
|
||||
'firefox': 'firefox',
|
||||
@@ -47,7 +45,6 @@ EXECUTABLE_NAMES = {
|
||||
'macos': {
|
||||
'chrome': 'Chrome',
|
||||
'chrome_helper': 'Chrome Helper',
|
||||
'dart_bootstrap': 'dart_bootstrap',
|
||||
'dart': 'dart',
|
||||
'dart_precompiled_runtime': 'dart_precompiled_runtime',
|
||||
'firefox': 'firefox',
|
||||
@@ -231,7 +228,6 @@ def KillVSBuild():
|
||||
|
||||
def KillDart():
|
||||
status = Kill("dart", dump_stacks=True)
|
||||
status += Kill("dart_bootstrap", dump_stacks=True)
|
||||
status += Kill("gen_snapshot", dump_stacks=True)
|
||||
status += Kill("dart_precompiled_runtime", dump_stacks=True)
|
||||
return status
|
||||
|
||||
@@ -651,21 +651,21 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
|
||||
String exec;
|
||||
if (_isAndroid) {
|
||||
if (_isArm) {
|
||||
exec = "$buildDir/clang_x86/dart_bootstrap";
|
||||
exec = "$buildDir/clang_x86/gen_snapshot";
|
||||
} else if (_configuration.architecture == Architecture.arm64) {
|
||||
exec = "$buildDir/clang_x64/dart_bootstrap";
|
||||
exec = "$buildDir/clang_x64/gen_snapshot";
|
||||
}
|
||||
} else {
|
||||
exec = "$buildDir/dart_bootstrap";
|
||||
exec = "$buildDir/gen_snapshot";
|
||||
}
|
||||
|
||||
final args = <String>[];
|
||||
args.add("--snapshot-kind=app-aot");
|
||||
if (_configuration.useBlobs) {
|
||||
args.add("--snapshot=$tempDir/out.aotsnapshot");
|
||||
args.add("--use-blobs");
|
||||
args.add("--snapshot-kind=app-aot-blobs");
|
||||
args.add("--blobs_container_filename=$tempDir/out.aotsnapshot");
|
||||
} else {
|
||||
args.add("--snapshot=$tempDir/out.S");
|
||||
args.add("--snapshot-kind=app-aot-assembly");
|
||||
args.add("--assembly=$tempDir/out.S");
|
||||
}
|
||||
|
||||
if (_isAndroid && _isArm) {
|
||||
|
||||
@@ -184,6 +184,7 @@ template("aot_assembly") {
|
||||
aot_vm_args = invoker.vm_args
|
||||
}
|
||||
main_dart = invoker.main_dart
|
||||
aot_vm_args = aot_vm_args + [ rebase_path("$main_dart") ]
|
||||
name = target_name
|
||||
if (defined(invoker.name)) {
|
||||
name = invoker.name
|
||||
@@ -205,11 +206,10 @@ template("aot_assembly") {
|
||||
if (defined(invoker.output)) {
|
||||
output = invoker.output
|
||||
}
|
||||
dart_bootstrap_action(target_name) {
|
||||
gen_snapshot_action(target_name) {
|
||||
deps = extra_deps
|
||||
depfile = "$output.d"
|
||||
|
||||
script = main_dart
|
||||
inputs = extra_inputs
|
||||
|
||||
outputs = [
|
||||
@@ -221,8 +221,8 @@ template("aot_assembly") {
|
||||
vm_args = [
|
||||
"--deterministic",
|
||||
"--packages=$dot_packages",
|
||||
"--snapshot-kind=app-aot",
|
||||
"--snapshot=$abs_output",
|
||||
"--snapshot-kind=app-aot-assembly",
|
||||
"--assembly=$abs_output",
|
||||
] + aot_vm_args
|
||||
|
||||
args = []
|
||||
|
||||
Reference in New Issue
Block a user