[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>
This commit is contained in:
committed by
commit-bot@chromium.org
parent
7db3b15a48
commit
79c7d3d8bc
@@ -131,12 +131,6 @@ static int64_t GenKernelKernelBenchmark(const char* name,
|
||||
bool read_fully = file->ReadFully(kernel_buffer, kernel_buffer_size);
|
||||
EXPECT(read_fully);
|
||||
|
||||
// Enable bytecode compiler in order to read bytecode.
|
||||
// Enabling interpreter also does the trick, but it causes flaky crashes
|
||||
// as unoptimized background compiler (which is required for interpreter)
|
||||
// was not initialized when isolate was created.
|
||||
SetFlagScope<bool> sfs(&FLAG_use_bytecode_compiler, true);
|
||||
|
||||
Timer timer(true, name);
|
||||
if (benchmark_load) {
|
||||
timer.Start();
|
||||
|
||||
@@ -605,13 +605,6 @@ class FunctionDeserializationCluster : public DeserializationCluster {
|
||||
if (func.HasCode() && !code.IsDisabled()) {
|
||||
func.SetInstructions(code); // Set entrypoint.
|
||||
func.SetWasCompiled(true);
|
||||
#if !defined(DART_PRECOMPILED_RUNTIME)
|
||||
} else if (FLAG_enable_interpreter && func.HasBytecode()) {
|
||||
// Set the code entry_point to InterpretCall stub.
|
||||
func.SetInstructions(StubCode::InterpretCall());
|
||||
} else if (FLAG_use_bytecode_compiler && func.HasBytecode()) {
|
||||
func.SetInstructions(StubCode::LazyCompile());
|
||||
#endif // !defined(DART_PRECOMPILED_RUNTIME)
|
||||
} else {
|
||||
func.ClearCode(); // Set code and entrypoint to lazy compile stub.
|
||||
}
|
||||
|
||||
@@ -449,9 +449,6 @@ static char* CompilerFlags() {
|
||||
ADD_FLAG(causal_async_stacks);
|
||||
ADD_FLAG(fields_may_be_reset);
|
||||
#undef ADD_FLAG
|
||||
buffer.AddString(FLAG_use_bytecode_compiler || FLAG_enable_interpreter
|
||||
? " bytecode"
|
||||
: " no-bytecode");
|
||||
|
||||
return buffer.Steal();
|
||||
}
|
||||
|
||||
@@ -993,13 +993,6 @@ FlowGraph* StreamingFlowGraphBuilder::BuildGraph() {
|
||||
ActiveTypeParametersScope active_type_params(active_class(), function, Z);
|
||||
|
||||
if (function.is_declared_in_bytecode()) {
|
||||
if (!(FLAG_use_bytecode_compiler || FLAG_enable_interpreter)) {
|
||||
FATAL1(
|
||||
"Cannot run bytecode function %s: specify --enable-interpreter or "
|
||||
"--use-bytecode-compiler",
|
||||
function.ToFullyQualifiedCString());
|
||||
}
|
||||
|
||||
bytecode_metadata_helper_.ParseBytecodeFunction(parsed_function());
|
||||
|
||||
switch (function.kind()) {
|
||||
|
||||
@@ -108,7 +108,6 @@ static void PrecompilationModeHandler(bool value) {
|
||||
FLAG_reorder_basic_blocks = true;
|
||||
FLAG_use_field_guards = false;
|
||||
FLAG_use_cha_deopt = false;
|
||||
FLAG_use_bytecode_compiler = true;
|
||||
|
||||
#if !defined(DART_PRECOMPILED_RUNTIME)
|
||||
// Not present with DART_PRECOMPILED_RUNTIME
|
||||
|
||||
@@ -847,9 +847,6 @@ const char* Dart::FeaturesString(Isolate* isolate,
|
||||
buffer.AddString(FLAG_causal_async_stacks ? " causal_async_stacks"
|
||||
: " no-causal_async_stacks");
|
||||
|
||||
buffer.AddString((FLAG_enable_interpreter || FLAG_use_bytecode_compiler)
|
||||
? " bytecode"
|
||||
: " no-bytecode");
|
||||
|
||||
// Generated code must match the host architecture and ABI.
|
||||
#if defined(TARGET_ARCH_ARM)
|
||||
|
||||
@@ -430,9 +430,7 @@ void KernelLoader::InitializeFields(UriToSourceTable* uri_to_source_table) {
|
||||
scripts.SetAt(index, script);
|
||||
}
|
||||
|
||||
if (FLAG_enable_interpreter || FLAG_use_bytecode_compiler) {
|
||||
bytecode_metadata_helper_.ReadBytecodeComponent();
|
||||
}
|
||||
bytecode_metadata_helper_.ReadBytecodeComponent();
|
||||
}
|
||||
|
||||
KernelLoader::KernelLoader(const Script& script,
|
||||
@@ -734,12 +732,7 @@ RawObject* KernelLoader::LoadProgram(bool process_pending_classes) {
|
||||
|
||||
LongJumpScope jump;
|
||||
if (setjmp(*jump.Set()) == 0) {
|
||||
bool libraries_loaded = false;
|
||||
if (FLAG_enable_interpreter || FLAG_use_bytecode_compiler) {
|
||||
libraries_loaded = bytecode_metadata_helper_.ReadLibraries();
|
||||
}
|
||||
|
||||
if (!libraries_loaded) {
|
||||
if (!bytecode_metadata_helper_.ReadLibraries()) {
|
||||
// Note that `problemsAsJson` on Component is implicitly skipped.
|
||||
const intptr_t length = program_->library_count();
|
||||
for (intptr_t i = 0; i < length; i++) {
|
||||
@@ -785,11 +778,9 @@ RawObject* KernelLoader::LoadProgram(bool process_pending_classes) {
|
||||
void KernelLoader::LoadLibrary(const Library& library) {
|
||||
ASSERT(!library.Loaded());
|
||||
|
||||
if (FLAG_enable_interpreter || FLAG_use_bytecode_compiler) {
|
||||
bytecode_metadata_helper_.ReadLibrary(library);
|
||||
if (library.Loaded()) {
|
||||
return;
|
||||
}
|
||||
bytecode_metadata_helper_.ReadLibrary(library);
|
||||
if (library.Loaded()) {
|
||||
return;
|
||||
}
|
||||
const auto& uri = String::Handle(Z, library.url());
|
||||
const intptr_t num_libraries = program_->library_count();
|
||||
@@ -916,11 +907,9 @@ void KernelLoader::walk_incremental_kernel(BitVector* modified_libs,
|
||||
bool* is_empty_program,
|
||||
intptr_t* p_num_classes,
|
||||
intptr_t* p_num_procedures) {
|
||||
if (FLAG_enable_interpreter || FLAG_use_bytecode_compiler) {
|
||||
if (bytecode_metadata_helper_.FindModifiedLibrariesForHotReload(
|
||||
modified_libs, is_empty_program, p_num_classes, p_num_procedures)) {
|
||||
return;
|
||||
}
|
||||
if (bytecode_metadata_helper_.FindModifiedLibrariesForHotReload(
|
||||
modified_libs, is_empty_program, p_num_classes, p_num_procedures)) {
|
||||
return;
|
||||
}
|
||||
intptr_t length = program_->library_count();
|
||||
*is_empty_program = *is_empty_program && (length == 0);
|
||||
|
||||
@@ -5887,7 +5887,6 @@ bool Function::IsBytecodeAllowed(Zone* zone) const {
|
||||
|
||||
void Function::AttachBytecode(const Bytecode& value) const {
|
||||
DEBUG_ASSERT(IsMutatorOrAtSafepoint());
|
||||
ASSERT(FLAG_enable_interpreter || FLAG_use_bytecode_compiler);
|
||||
ASSERT(!value.IsNull());
|
||||
// Finish setting up code before activating it.
|
||||
if (!value.InVMIsolateHeap()) {
|
||||
|
||||
Reference in New Issue
Block a user