Skip to content

Commit

Permalink
[vm] Fix bytecode in core-jit for simarm64
Browse files Browse the repository at this point in the history
simarm64 doesn't support --enable_interpreter, so we need
another way to get bytecode into the core-jit snapshot.
For this it makes sense to use --use_bytecode_compiler
since we'll need to switch to the bytecode-only pipeline
at some point anyway.

Change-Id: I761acd0439663cb488c3d2143cbaa8f96f9a0a4b
Reviewed-on: https://dart-review.googlesource.com/c/79180
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
  • Loading branch information
zanderso authored and commit-bot@chromium.org committed Oct 11, 2018
1 parent fab5d0a commit 58c90dc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion runtime/bin/gen_snapshot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,8 @@ static void CreateAndWriteDependenciesFile() {
}

static void LoadBytecode() {
if (Dart_IsVMFlagSet("enable_interpreter") &&
if ((Dart_IsVMFlagSet("enable_interpreter") ||
Dart_IsVMFlagSet("use_bytecode_compiler")) &&
((snapshot_kind == kCoreJIT) || (snapshot_kind == kAppJIT))) {
Dart_Handle result = Dart_ReadAllBytecode();
CHECK_RESULT(result);
Expand Down
3 changes: 2 additions & 1 deletion runtime/bin/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,8 @@ static void ReadFile(const char* filename, uint8_t** buffer, intptr_t* size) {
}

static void LoadBytecode() {
if (Dart_IsVMFlagSet("enable_interpreter")) {
if (Dart_IsVMFlagSet("enable_interpreter") ||
Dart_IsVMFlagSet("use_bytecode_compiler")) {
Dart_Handle result = Dart_ReadAllBytecode();
CHECK_RESULT(result);
}
Expand Down
9 changes: 7 additions & 2 deletions runtime/vm/clustered_snapshot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,13 @@ class FunctionDeserializationCluster : public DeserializationCluster {
func.SetInstructions(code); // Set entrypoint.
func.SetWasCompiled(true);
#if !defined(DART_PRECOMPILED_RUNTIME)
} else if (func.HasBytecode() && !code.IsDisabled()) {
func.SetInstructions(code); // Set entrypoint.
} else if (FLAG_enable_interpreter && func.HasBytecode()) {
// Set the code entry_point to InterpretCall stub.
func.SetInstructions(
Code::Handle(StubCode::InterpretCall_entry()->code()));
} else if (FLAG_use_bytecode_compiler && func.HasBytecode()) {
func.SetInstructions(
Code::Handle(StubCode::LazyCompile_entry()->code()));
#endif // !defined(DART_PRECOMPILED_RUNTIME)
} else {
func.ClearCode(); // Set code and entrypoint to lazy compile stub.
Expand Down
3 changes: 2 additions & 1 deletion runtime/vm/compiler/jit/compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1346,7 +1346,8 @@ RawError* Compiler::ReadAllBytecode(const Class& cls) {
for (int i = 0; i < functions.Length(); i++) {
func ^= functions.At(i);
ASSERT(!func.IsNull());
if (func.IsBytecodeAllowed(zone) && !func.HasBytecode()) {
if (func.IsBytecodeAllowed(zone) && !func.HasBytecode() &&
!func.HasCode()) {
RawError* error =
kernel::BytecodeReader::ReadFunctionBytecode(thread, func);
if (error != Error::null()) {
Expand Down

0 comments on commit 58c90dc

Please sign in to comment.