[vm] Adds targets for gen_snapshot that include the interpreter
As the interpreter matures it will hopefully be merged into the regular
jit configuration, but for now we make a separate configuration for it.
Change-Id: Ie287ffccadbf34243d64d90ee43cf5d429966082
Reviewed-on: https://dart-review.googlesource.com/69420
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn
index 5cd4241..a4c50fb 100644
--- a/runtime/bin/BUILD.gn
+++ b/runtime/bin/BUILD.gn
@@ -333,7 +333,6 @@
configs += [
"..:dart_arch_config",
"..:dart_config",
- "..:dart_maybe_interpreter_config",
"..:dart_precompiler_config",
] + extra_configs
if (is_fuchsia) {
@@ -409,6 +408,7 @@
build_gen_snapshot("gen_snapshot") {
extra_configs = [
+ "..:dart_maybe_interpreter_config",
"..:dart_maybe_product_config",
"..:dart_os_config",
]
@@ -421,6 +421,7 @@
build_gen_snapshot("gen_snapshot_product") {
extra_configs = [
+ "..:dart_maybe_interpreter_config",
"..:dart_product_config",
"..:dart_os_config",
]
@@ -433,6 +434,7 @@
build_gen_snapshot("gen_snapshot_fuchsia") {
extra_configs = [
+ "..:dart_maybe_interpreter_config",
"..:dart_maybe_product_config",
"..:dart_os_fuchsia_config",
]
@@ -445,6 +447,7 @@
build_gen_snapshot("gen_snapshot_product_fuchsia") {
extra_configs = [
+ "..:dart_maybe_interpreter_config",
"..:dart_product_config",
"..:dart_os_fuchsia_config",
]
@@ -455,6 +458,60 @@
]
}
+if (!is_win) {
+ build_gen_snapshot("gen_snapshot_interpreter") {
+ extra_configs = [
+ "..:dart_interpreter_config",
+ "..:dart_maybe_product_config",
+ "..:dart_os_config",
+ ]
+ extra_deps = [
+ ":gen_snapshot_dart_io",
+ ":libdart_builtin",
+ "..:libdart_nosnapshot_with_precompiler_interpreter",
+ ]
+ }
+
+ build_gen_snapshot("gen_snapshot_product_interpreter") {
+ extra_configs = [
+ "..:dart_interpreter_config",
+ "..:dart_product_config",
+ "..:dart_os_config",
+ ]
+ extra_deps = [
+ ":gen_snapshot_dart_io",
+ ":libdart_builtin",
+ "..:libdart_nosnapshot_with_precompiler_interpreter",
+ ]
+ }
+
+ build_gen_snapshot("gen_snapshot_interpreter_fuchsia") {
+ extra_configs = [
+ "..:dart_interpreter_config",
+ "..:dart_maybe_product_config",
+ "..:dart_os_fuchsia_config",
+ ]
+ extra_deps = [
+ ":gen_snapshot_dart_io_fuchsia",
+ ":libdart_builtin_fuchsia",
+ "..:libdart_nosnapshot_with_precompiler_interpreter_fuchsia",
+ ]
+ }
+
+ build_gen_snapshot("gen_snapshot_product_interpreter_fuchsia") {
+ extra_configs = [
+ "..:dart_interpreter_config",
+ "..:dart_product_config",
+ "..:dart_os_fuchsia_config",
+ ]
+ extra_deps = [
+ ":gen_snapshot_dart_io_product_fuchsia",
+ ":libdart_builtin_product_fuchsia",
+ "..:libdart_nosnapshot_with_precompiler_product_interpreter_fuchsia",
+ ]
+ }
+}
+
# A source set for the implementation of 'dart:io' library
# (without secure sockets) suitable for linking with gen_snapshot.
template("build_gen_snapshot_dart_io") {
diff --git a/runtime/configs.gni b/runtime/configs.gni
index be99ecd..fa5658f 100644
--- a/runtime/configs.gni
+++ b/runtime/configs.gni
@@ -16,25 +16,33 @@
"$_dart_runtime:dart_os_fuchsia_config",
]
-_jit_config = _base_config + [
- "$_dart_runtime:dart_maybe_interpreter_config",
- "$_dart_runtime:dart_maybe_product_config",
- ]
+_maybe_interpreter_maybe_product = [
+ "$_dart_runtime:dart_maybe_interpreter_config",
+ "$_dart_runtime:dart_maybe_product_config",
+]
-_jit_product_config = _base_config + [
- "$_dart_runtime:dart_maybe_interpreter_config",
- "$_dart_runtime:dart_product_config",
- ]
+_maybe_interpreter_product = [
+ "$_dart_runtime:dart_maybe_interpreter_config",
+ "$_dart_runtime:dart_product_config",
+]
-_jit_interpreter_config = _base_config + [
- "$_dart_runtime:dart_interpreter_config",
- "$_dart_runtime:dart_maybe_product_config",
- ]
+_interpreter_maybe_product = [
+ "$_dart_runtime:dart_interpreter_config",
+ "$_dart_runtime:dart_maybe_product_config",
+]
-_jit_product_interpreter_config = _base_config + [
- "$_dart_runtime:dart_interpreter_config",
- "$_dart_runtime:dart_product_config",
- ]
+_interpreter_product = [
+ "$_dart_runtime:dart_interpreter_config",
+ "$_dart_runtime:dart_product_config",
+]
+
+_jit_config = _base_config + _maybe_interpreter_maybe_product
+
+_jit_product_config = _base_config + _maybe_interpreter_product
+
+_jit_interpreter_config = _base_config + _interpreter_maybe_product
+
+_jit_product_interpreter_config = _base_config + _interpreter_product
_precompiled_runtime_config =
_base_config + [
@@ -58,33 +66,34 @@
"$_dart_runtime:dart_precompiler_config",
]
+_nosnapshot_precompiler_base = [
+ "$_dart_runtime:dart_nosnapshot_config",
+ "$_dart_runtime:dart_precompiler_config",
+]
+
_nosnapshot_with_precompiler_config =
- _base_config + [
- "$_dart_runtime:dart_maybe_product_config",
- "$_dart_runtime:dart_nosnapshot_config",
- "$_dart_runtime:dart_precompiler_config",
- ]
+ _base_config + _nosnapshot_precompiler_base + _maybe_interpreter_maybe_product
+
+_nosnapshot_with_precompiler_interpreter_config =
+ _base_config + _nosnapshot_precompiler_base + _interpreter_maybe_product
+
+_nosnapshot_with_precompiler_product_interpreter_config =
+ _base_config + _nosnapshot_precompiler_base + _interpreter_product
_nosnapshot_with_precompiler_product_config =
- _base_config + [
- "$_dart_runtime:dart_product_config",
- "$_dart_runtime:dart_nosnapshot_config",
- "$_dart_runtime:dart_precompiler_config",
- ]
+ _base_config + _nosnapshot_precompiler_base + _maybe_interpreter_product
_nosnapshot_with_precompiler_fuchsia_config =
- _base_fuchsia_config + [
- "$_dart_runtime:dart_maybe_product_config",
- "$_dart_runtime:dart_nosnapshot_config",
- "$_dart_runtime:dart_precompiler_config",
- ]
+ _base_fuchsia_config + _nosnapshot_precompiler_base + _maybe_interpreter_maybe_product
_nosnapshot_with_precompiler_product_fuchsia_config =
- _base_fuchsia_config + [
- "$_dart_runtime:dart_product_config",
- "$_dart_runtime:dart_nosnapshot_config",
- "$_dart_runtime:dart_precompiler_config",
- ]
+ _base_fuchsia_config + _nosnapshot_precompiler_base + _maybe_interpreter_product
+
+_nosnapshot_with_precompiler_interpreter_fuchsia_config =
+ _base_fuchsia_config + _nosnapshot_precompiler_base + _interpreter_maybe_product
+
+_nosnapshot_with_precompiler_product_interpreter_fuchsia_config =
+ _base_fuchsia_config + _nosnapshot_precompiler_base + _interpreter_product
_all_configs = [
{
@@ -152,6 +161,26 @@
configs = _jit_product_interpreter_config
snapshot = true
},
+ {
+ suffix = "_nosnapshot_with_precompiler_interpreter"
+ configs = _nosnapshot_with_precompiler_interpreter_config
+ snapshot = false
+ },
+ {
+ suffix = "_nosnapshot_with_precompiler_product_interpreter"
+ configs = _nosnapshot_with_precompiler_product_interpreter_config
+ snapshot = false
+ },
+ {
+ suffix = "_nosnapshot_with_precompiler_interpreter_fuchsia"
+ configs = _nosnapshot_with_precompiler_interpreter_fuchsia_config
+ snapshot = false
+ },
+ {
+ suffix = "_nosnapshot_with_precompiler_product_interpreter_fuchsia"
+ configs = _nosnapshot_with_precompiler_product_interpreter_fuchsia_config
+ snapshot = false
+ },
]
}
diff --git a/runtime/platform/globals.h b/runtime/platform/globals.h
index 8c09582..0959729 100644
--- a/runtime/platform/globals.h
+++ b/runtime/platform/globals.h
@@ -140,11 +140,6 @@
#error DART_PRECOMPILED_RUNTIME and DART_NOSNAPSHOT are mutually exclusive
#endif // defined(DART_PRECOMPILED_RUNTIME) && defined(DART_NOSNAPSHOT)
-#if defined(DART_PRECOMPILED_RUNTIME) || defined(DART_PRECOMPILER)
-// TODO(zra): Fix GN build file not to define DART_USE_INTERPRETER in this case.
-#undef DART_USE_INTERPRETER
-#endif // defined(DART_PRECOMPILED_RUNTIME) || defined(DART_PRECOMPILER)
-
#if defined(DART_PRECOMPILED_RUNTIME)
#define NOT_IN_PRECOMPILED(code)
#else
diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc
index 0217714..6ad3188 100644
--- a/runtime/vm/class_finalizer.cc
+++ b/runtime/vm/class_finalizer.cc
@@ -2735,6 +2735,11 @@
THR_Print("Finalize %s\n", cls.ToCString());
}
+#if !defined(PRODUCT)
+ TimelineDurationScope tds(thread, Timeline::GetCompilerStream(),
+ "ClassFinalizer::FinalizeClass");
+#endif // !defined(PRODUCT)
+
#if !defined(DART_PRECOMPILED_RUNTIME)
// If loading from a kernel, make sure that the class is fully loaded.
// Top level classes are always fully loaded.
diff --git a/runtime/vm/compiler/frontend/bytecode_reader.cc b/runtime/vm/compiler/frontend/bytecode_reader.cc
index 941e713..3dd64c7 100644
--- a/runtime/vm/compiler/frontend/bytecode_reader.cc
+++ b/runtime/vm/compiler/frontend/bytecode_reader.cc
@@ -10,6 +10,7 @@
#include "vm/compiler/assembler/disassembler_kbc.h"
#include "vm/constants_kbc.h"
#include "vm/dart_entry.h"
+#include "vm/timeline.h"
#if !defined(DART_PRECOMPILED_RUNTIME)
#if defined(DART_USE_INTERPRETER)
@@ -33,6 +34,11 @@
active_class_(active_class) {}
void BytecodeMetadataHelper::ReadMetadata(const Function& function) {
+#if !defined(PRODUCT)
+ TimelineDurationScope tds(Thread::Current(), Timeline::GetCompilerStream(),
+ "BytecodeMetadataHelper::ReadMetadata");
+#endif // !defined(PRODUCT)
+
const intptr_t node_offset = function.kernel_offset();
const intptr_t md_offset = GetNextMetadataPayloadOffset(node_offset);
if (md_offset < 0) {
@@ -85,6 +91,11 @@
const Function& inner_function,
const ObjectPool& pool,
intptr_t from_index) {
+#if !defined(PRODUCT)
+ TimelineDurationScope tds(Thread::Current(), Timeline::GetCompilerStream(),
+ "BytecodeMetadataHelper::ReadPoolEntries");
+#endif // !defined(PRODUCT)
+
// These enums and the code below reading the constant pool from kernel must
// be kept in sync with pkg/vm/lib/bytecode/constant_pool.dart.
enum ConstantPoolTag {
@@ -488,6 +499,11 @@
}
RawCode* BytecodeMetadataHelper::ReadBytecode(const ObjectPool& pool) {
+#if !defined(PRODUCT)
+ TimelineDurationScope tds(Thread::Current(), Timeline::GetCompilerStream(),
+ "BytecodeMetadataHelper::ReadBytecode");
+#endif // !defined(PRODUCT)
+
intptr_t size = helper_->reader_.ReadUInt();
intptr_t offset = helper_->reader_.offset();
const uint8_t* data = helper_->reader_.BufferAt(offset);
@@ -499,6 +515,11 @@
}
void BytecodeMetadataHelper::ReadExceptionsTable(const Code& bytecode) {
+#if !defined(PRODUCT)
+ TimelineDurationScope tds(Thread::Current(), Timeline::GetCompilerStream(),
+ "BytecodeMetadataHelper::ReadExceptionsTable");
+#endif // !defined(PRODUCT)
+
const intptr_t try_block_count = helper_->reader_.ReadListLength();
if (try_block_count > 0) {
const ObjectPool& pool =
diff --git a/runtime/vm/flag_list.h b/runtime/vm/flag_list.h
index 1e74d39..b2493cc 100644
--- a/runtime/vm/flag_list.h
+++ b/runtime/vm/flag_list.h
@@ -130,7 +130,7 @@
P(new_gen_semi_initial_size, int, (kWordSize <= 4) ? 1 : 2, \
"Initial size of new gen semi space in MB") \
P(omit_strong_type_checks, bool, false, "Omit strong mode type checks.") \
- P(optimization_counter_threshold, int, 30000, \
+ P(optimization_counter_threshold, int, USING_KBC ? -1 : 30000, \
"Function's usage-counter value before it is optimized, -1 means never") \
P(old_gen_heap_size, int, kDefaultMaxOldGenHeapSize, \
"Max size of old gen heap size in MB, or 0 for unlimited," \