[ VM / Build ] Added '--no-include-kernel-service' to build.py. By default, the kernel service is now included in all build modes, including product mode. Providing '--no-include-kernel-service' will build the specified configuration without the kernel service.

Change-Id: I682cd7c2895a9bcb215948615f2bdc627abe8d08
Reviewed-on: https://dart-review.googlesource.com/56286
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
This commit is contained in:
Ben Konyi 2018-05-23 20:35:53 +00:00 committed by commit-bot@chromium.org
parent e5eee0d57a
commit e35ed9c749
9 changed files with 42 additions and 17 deletions

View file

@ -40,7 +40,10 @@ config("dart_product_config") {
config("dart_precompiled_runtime_config") {
defines = []
defines += [ "DART_PRECOMPILED_RUNTIME" ]
defines += [
"DART_PRECOMPILED_RUNTIME",
"EXCLUDE_CFE_AND_KERNEL_PLATFORM",
]
}
# Controls DART_PRECOMPILER #define.
@ -149,9 +152,7 @@ config("dart_config") {
if (is_fuchsia) {
import("//build/config/scudo/scudo.gni")
include_dirs += [
"//zircon/system/ulib/zx/include",
]
include_dirs += [ "//zircon/system/ulib/zx/include" ]
if (!use_scudo) {
defines += [ "DART_USE_JEMALLOC" ]
include_dirs += [ "//zircon/third_party/ulib/jemalloc/include" ]

View file

@ -901,6 +901,9 @@ template("dart_executable") {
}
defines = extra_defines
if (exclude_kernel_service) {
defines += [ "EXCLUDE_CFE_AND_KERNEL_PLATFORM" ]
}
if (dart_use_tcmalloc) {
deps += [ "//third_party/tcmalloc" ]
@ -955,9 +958,6 @@ dart_executable("dart") {
if (dart_runtime_mode != "release") {
extra_deps += [ "../observatory:standalone_observatory_archive" ]
}
if (dart_runtime_mode != "release") {
extra_deps += [ ":dart_kernel_platform_cc" ]
}
extra_sources = [
"builtin_nolib.cc",
"dfe.cc",
@ -971,6 +971,9 @@ dart_executable("dart") {
if (dart_runtime_mode == "release") {
extra_sources += [ "observatory_assets_empty.cc" ]
}
if (!exclude_kernel_service) {
extra_deps += [ ":dart_kernel_platform_cc" ]
}
}
dart_executable("dart_precompiled_runtime") {
@ -1038,9 +1041,6 @@ dart_executable("dart_bootstrap") {
":generate_web_sql_cc_file",
"..:libdart_nosnapshot_with_precompiler",
]
if (dart_runtime_mode != "release") {
extra_deps += [ ":dart_kernel_platform_cc" ]
}
extra_defines = [ "NO_OBSERVATORY" ]
extra_sources = [
"builtin.cc",
@ -1073,6 +1073,9 @@ dart_executable("dart_bootstrap") {
"$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") {

View file

@ -615,7 +615,13 @@ static Dart_Isolate CreateIsolateAndSetupHelper(bool is_main_isolate,
platform_kernel_buffer_size = kernel_buffer_size;
}
if (platform_kernel_buffer == NULL) {
#if defined(EXCLUDE_CFE_AND_KERNEL_PLATFORM)
FATAL(
"Binary built with --exclude-kernel-service. Cannot run"
" from source.");
#else
FATAL("platform_program cannot be NULL.");
#endif // defined(EXCLUDE_CFE_AND_KERNEL_PLATFORM)
}
// TODO(sivachandra): When the platform program is unavailable, check if
// application kernel binary is self contained or an incremental binary.

View file

@ -151,10 +151,6 @@
#define NOT_IN_PRECOMPILED(code) code
#endif // defined(DART_PRECOMPILED_RUNTIME)
#if defined(DART_PRECOMPILED_RUNTIME) || defined(PRODUCT)
#define EXCLUDE_CFE_AND_KERNEL_PLATFORM 1
#endif // defined(DART_PRECOMPILED_RUNTIME)
namespace dart {
struct simd128_value_t {

View file

@ -81,4 +81,8 @@ declare_args() {
# Whether the runtime should interpret called functions for which bytecode
# is provided by kernel, rather than compile them before execution.
dart_use_interpreter = false
# Whether the VM includes the kernel service in all modes (debug, release,
# product).
exclude_kernel_service = false
}

View file

@ -801,6 +801,8 @@ void Isolate::FlagsCopyFrom(const Dart_IsolateFlags& api_flags) {
#define FLAG_FOR_NONPRODUCT(action)
#endif
#define FLAG_FOR_PRODUCT(action) action
#define SET_FROM_FLAG(when, name, bitname, isolate_flag, flag) \
FLAG_FOR_##when(isolate_flags_ = bitname##Bit::update( \
api_flags.isolate_flag, isolate_flags_));
@ -809,6 +811,7 @@ void Isolate::FlagsCopyFrom(const Dart_IsolateFlags& api_flags) {
#undef FLAG_FOR_NONPRODUCT
#undef FLAG_FOR_PRECOMPILER
#undef FLAG_FOR_PRODUCT
#undef SET_FROM_FLAG
set_use_dart_frontend(api_flags.use_dart_frontend);

View file

@ -138,10 +138,10 @@ typedef FixedCache<intptr_t, CatchEntryState, 16> CatchEntryStateCache;
V(NONPRODUCT, type_checks, EnableTypeChecks, enable_type_checks, \
FLAG_enable_type_checks) \
V(NONPRODUCT, asserts, EnableAsserts, enable_asserts, FLAG_enable_asserts) \
V(NONPRODUCT, reify_generic_functions, ReifyGenericFunctions, \
V(PRODUCT, reify_generic_functions, ReifyGenericFunctions, \
reify_generic_functions, FLAG_reify_generic_functions) \
V(NONPRODUCT, sync_async, SyncAsync, sync_async, FLAG_sync_async) \
V(NONPRODUCT, strong, Strong, strong, FLAG_strong) \
V(PRODUCT, sync_async, SyncAsync, sync_async, FLAG_sync_async) \
V(PRODUCT, strong, Strong, strong, FLAG_strong) \
V(NONPRODUCT, error_on_bad_type, ErrorOnBadType, enable_error_on_bad_type, \
FLAG_error_on_bad_type) \
V(NONPRODUCT, error_on_bad_override, ErrorOnBadOverride, \
@ -718,6 +718,8 @@ class Isolate : public BaseIsolate {
#define FLAG_FOR_NONPRODUCT(from_field, from_flag) (from_flag)
#endif
#define FLAG_FOR_PRODUCT(from_field, from_flag) (from_field)
#define DECLARE_GETTER(when, name, bitname, isolate_flag_name, flag_name) \
bool name() const { \
const bool false_by_default = false; \
@ -727,6 +729,7 @@ class Isolate : public BaseIsolate {
ISOLATE_FLAG_LIST(DECLARE_GETTER)
#undef FLAG_FOR_NONPRODUCT
#undef FLAG_FOR_PRECOMPILER
#undef FLAG_FOR_PRODUCT
#undef DECLARE_GETTER
#if defined(PRODUCT)

View file

@ -228,6 +228,8 @@ def BuildOneConfig(options, targets, target_os, mode, arch):
build_config = utils.GetBuildConf(mode, arch, target_os)
out_dir = utils.GetBuildRoot(HOST_OS, mode, arch, target_os)
using_goma = False
# TODO(zra): Remove auto-run of gn, replace with prompt for user to run
# gn.py manually.
if ShouldRunGN(out_dir):
RunGN(target_os, mode, arch)
command = ['ninja', '-C', out_dir]

View file

@ -221,6 +221,8 @@ def ToGnArgs(args, mode, arch, target_os):
else:
gn_args['dart_runtime_mode'] = 'develop'
gn_args['exclude_kernel_service'] = args.exclude_kernel_service
dont_use_clang = DontUseClang(args, gn_args['target_os'],
gn_args['host_cpu'],
gn_args['target_cpu'])
@ -392,6 +394,11 @@ def parse_args(args):
help='Generate an IDE file.',
default=os_has_ide(HOST_OS),
action='store_true')
other_group.add_argument('--exclude-kernel-service',
help='Exclude the kernel service.',
default=False,
dest='exclude_kernel_service',
action='store_true')
other_group.add_argument('--msan',
help='Build with MSAN',
default=UseMSAN(),