Skip to content

Commit 79c7d3d

Browse files
rmacnak-googlecommit-bot@chromium.org
authored andcommitted
[vm] Always use bytecode when it is present in a kernel file. Let FLAG_use_bytecode_compiler only control whether the kernel isolate generates bytecode.
We no longer generate kernel files containing both AST and bytecode, so we don't need a flag to choose between them. Change-Id: I1a4f7df507c649019c9fe254fa18a5826e2006aa Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122402 Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
1 parent 7db3b15 commit 79c7d3d

File tree

8 files changed

+8
-47
lines changed

8 files changed

+8
-47
lines changed

runtime/vm/benchmark_test.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,6 @@ static int64_t GenKernelKernelBenchmark(const char* name,
131131
bool read_fully = file->ReadFully(kernel_buffer, kernel_buffer_size);
132132
EXPECT(read_fully);
133133

134-
// Enable bytecode compiler in order to read bytecode.
135-
// Enabling interpreter also does the trick, but it causes flaky crashes
136-
// as unoptimized background compiler (which is required for interpreter)
137-
// was not initialized when isolate was created.
138-
SetFlagScope<bool> sfs(&FLAG_use_bytecode_compiler, true);
139-
140134
Timer timer(true, name);
141135
if (benchmark_load) {
142136
timer.Start();

runtime/vm/clustered_snapshot.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -605,13 +605,6 @@ class FunctionDeserializationCluster : public DeserializationCluster {
605605
if (func.HasCode() && !code.IsDisabled()) {
606606
func.SetInstructions(code); // Set entrypoint.
607607
func.SetWasCompiled(true);
608-
#if !defined(DART_PRECOMPILED_RUNTIME)
609-
} else if (FLAG_enable_interpreter && func.HasBytecode()) {
610-
// Set the code entry_point to InterpretCall stub.
611-
func.SetInstructions(StubCode::InterpretCall());
612-
} else if (FLAG_use_bytecode_compiler && func.HasBytecode()) {
613-
func.SetInstructions(StubCode::LazyCompile());
614-
#endif // !defined(DART_PRECOMPILED_RUNTIME)
615608
} else {
616609
func.ClearCode(); // Set code and entrypoint to lazy compile stub.
617610
}

runtime/vm/compilation_trace.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,9 +449,6 @@ static char* CompilerFlags() {
449449
ADD_FLAG(causal_async_stacks);
450450
ADD_FLAG(fields_may_be_reset);
451451
#undef ADD_FLAG
452-
buffer.AddString(FLAG_use_bytecode_compiler || FLAG_enable_interpreter
453-
? " bytecode"
454-
: " no-bytecode");
455452

456453
return buffer.Steal();
457454
}

runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -993,13 +993,6 @@ FlowGraph* StreamingFlowGraphBuilder::BuildGraph() {
993993
ActiveTypeParametersScope active_type_params(active_class(), function, Z);
994994

995995
if (function.is_declared_in_bytecode()) {
996-
if (!(FLAG_use_bytecode_compiler || FLAG_enable_interpreter)) {
997-
FATAL1(
998-
"Cannot run bytecode function %s: specify --enable-interpreter or "
999-
"--use-bytecode-compiler",
1000-
function.ToFullyQualifiedCString());
1001-
}
1002-
1003996
bytecode_metadata_helper_.ParseBytecodeFunction(parsed_function());
1004997

1005998
switch (function.kind()) {

runtime/vm/compiler/jit/compiler.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ static void PrecompilationModeHandler(bool value) {
108108
FLAG_reorder_basic_blocks = true;
109109
FLAG_use_field_guards = false;
110110
FLAG_use_cha_deopt = false;
111-
FLAG_use_bytecode_compiler = true;
112111

113112
#if !defined(DART_PRECOMPILED_RUNTIME)
114113
// Not present with DART_PRECOMPILED_RUNTIME

runtime/vm/dart.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -847,9 +847,6 @@ const char* Dart::FeaturesString(Isolate* isolate,
847847
buffer.AddString(FLAG_causal_async_stacks ? " causal_async_stacks"
848848
: " no-causal_async_stacks");
849849

850-
buffer.AddString((FLAG_enable_interpreter || FLAG_use_bytecode_compiler)
851-
? " bytecode"
852-
: " no-bytecode");
853850

854851
// Generated code must match the host architecture and ABI.
855852
#if defined(TARGET_ARCH_ARM)

runtime/vm/kernel_loader.cc

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,7 @@ void KernelLoader::InitializeFields(UriToSourceTable* uri_to_source_table) {
430430
scripts.SetAt(index, script);
431431
}
432432

433-
if (FLAG_enable_interpreter || FLAG_use_bytecode_compiler) {
434-
bytecode_metadata_helper_.ReadBytecodeComponent();
435-
}
433+
bytecode_metadata_helper_.ReadBytecodeComponent();
436434
}
437435

438436
KernelLoader::KernelLoader(const Script& script,
@@ -734,12 +732,7 @@ RawObject* KernelLoader::LoadProgram(bool process_pending_classes) {
734732

735733
LongJumpScope jump;
736734
if (setjmp(*jump.Set()) == 0) {
737-
bool libraries_loaded = false;
738-
if (FLAG_enable_interpreter || FLAG_use_bytecode_compiler) {
739-
libraries_loaded = bytecode_metadata_helper_.ReadLibraries();
740-
}
741-
742-
if (!libraries_loaded) {
735+
if (!bytecode_metadata_helper_.ReadLibraries()) {
743736
// Note that `problemsAsJson` on Component is implicitly skipped.
744737
const intptr_t length = program_->library_count();
745738
for (intptr_t i = 0; i < length; i++) {
@@ -785,11 +778,9 @@ RawObject* KernelLoader::LoadProgram(bool process_pending_classes) {
785778
void KernelLoader::LoadLibrary(const Library& library) {
786779
ASSERT(!library.Loaded());
787780

788-
if (FLAG_enable_interpreter || FLAG_use_bytecode_compiler) {
789-
bytecode_metadata_helper_.ReadLibrary(library);
790-
if (library.Loaded()) {
791-
return;
792-
}
781+
bytecode_metadata_helper_.ReadLibrary(library);
782+
if (library.Loaded()) {
783+
return;
793784
}
794785
const auto& uri = String::Handle(Z, library.url());
795786
const intptr_t num_libraries = program_->library_count();
@@ -916,11 +907,9 @@ void KernelLoader::walk_incremental_kernel(BitVector* modified_libs,
916907
bool* is_empty_program,
917908
intptr_t* p_num_classes,
918909
intptr_t* p_num_procedures) {
919-
if (FLAG_enable_interpreter || FLAG_use_bytecode_compiler) {
920-
if (bytecode_metadata_helper_.FindModifiedLibrariesForHotReload(
921-
modified_libs, is_empty_program, p_num_classes, p_num_procedures)) {
922-
return;
923-
}
910+
if (bytecode_metadata_helper_.FindModifiedLibrariesForHotReload(
911+
modified_libs, is_empty_program, p_num_classes, p_num_procedures)) {
912+
return;
924913
}
925914
intptr_t length = program_->library_count();
926915
*is_empty_program = *is_empty_program && (length == 0);

runtime/vm/object.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5887,7 +5887,6 @@ bool Function::IsBytecodeAllowed(Zone* zone) const {
58875887

58885888
void Function::AttachBytecode(const Bytecode& value) const {
58895889
DEBUG_ASSERT(IsMutatorOrAtSafepoint());
5890-
ASSERT(FLAG_enable_interpreter || FLAG_use_bytecode_compiler);
58915890
ASSERT(!value.IsNull());
58925891
// Finish setting up code before activating it.
58935892
if (!value.InVMIsolateHeap()) {

0 commit comments

Comments
 (0)