Skip to content

Commit a24192e

Browse files
bkonyicommit-bot@chromium.org
authored andcommitted
Revert "[ VM ] Print a meaningful error message when a user attempts to run an AOT snapshot with a JIT VM."
This reverts commit d870a71. Reason for revert: ASAN failures Original change's description: > [ VM ] Print a meaningful error message when a user attempts to run an AOT snapshot with a JIT VM. > > Fixes #42482 > > Change-Id: I284a5673e30f59b127e69c712df93552cdfcde41 > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154834 > Commit-Queue: Ben Konyi <[email protected]> > Reviewed-by: Ryan Macnak <[email protected]> [email protected],[email protected],[email protected] Change-Id: I3639ede6987fbb51fb95584685c472abb789970e No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155303 Reviewed-by: Ben Konyi <[email protected]> Commit-Queue: Ben Konyi <[email protected]>
1 parent 3eaa777 commit a24192e

File tree

7 files changed

+3
-153
lines changed

7 files changed

+3
-153
lines changed

runtime/bin/main.cc

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,16 +1221,9 @@ void main(int argc, char** argv) {
12211221
#endif // !defined(DART_PRECOMPILED_RUNTIME)
12221222

12231223
if (should_run_user_program) {
1224-
if (!Dart_IsPrecompiledRuntime() && Snapshot::IsAOTSnapshot(script_name)) {
1225-
Syslog::PrintErr(
1226-
"%s is an AOT snapshot and should be run with 'dartaotruntime'\n",
1227-
script_name);
1228-
Platform::Exit(kErrorExitCode);
1229-
} else {
1230-
// Run the main isolate until we aren't told to restart.
1231-
while (RunMainIsolate(script_name, &dart_options)) {
1232-
Syslog::PrintErr("Restarting VM\n");
1233-
}
1224+
// Run the main isolate until we aren't told to restart.
1225+
while (RunMainIsolate(script_name, &dart_options)) {
1226+
Syslog::PrintErr("Restarting VM\n");
12341227
}
12351228
}
12361229

runtime/bin/snapshot_utils.cc

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -537,24 +537,5 @@ void Snapshot::GenerateAppAOTAsAssembly(const char* snapshot_filename) {
537537
}
538538
}
539539

540-
bool Snapshot::IsAOTSnapshot(const char* snapshot_filename) {
541-
// Header is simply "ELF" prefixed with the DEL character.
542-
const char elf_header[] = {0x7F, 0x45, 0x4C, 0x46};
543-
const int64_t elf_header_len = strlen(elf_header);
544-
File* file = File::Open(NULL, snapshot_filename, File::kRead);
545-
if (file == nullptr) {
546-
return false;
547-
}
548-
if (file->Length() < elf_header_len) {
549-
file->Release();
550-
return false;
551-
}
552-
auto buf = std::unique_ptr<char[]>(new char[elf_header_len]);
553-
bool success = file->ReadFully(buf.get(), elf_header_len);
554-
file->Release();
555-
ASSERT(success);
556-
return (strncmp(elf_header, buf.get(), elf_header_len) == 0);
557-
}
558-
559540
} // namespace bin
560541
} // namespace dart

runtime/bin/snapshot_utils.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ class Snapshot {
3434
static void GenerateAppJIT(const char* snapshot_filename);
3535
static void GenerateAppAOTAsAssembly(const char* snapshot_filename);
3636

37-
// Returns true if snapshot_filename points to an AOT snapshot (aka,
38-
// an ELF binary). May report false negatives.
39-
static bool IsAOTSnapshot(const char* snapshot_filename);
40-
4137
static AppSnapshot* TryReadAppendedAppSnapshotElf(const char* container_path);
4238
static AppSnapshot* TryReadAppSnapshot(
4339
const char* script_uri,

tests/standalone/check_for_aot_snapshot_jit_test.dart

Lines changed: 0 additions & 59 deletions
This file was deleted.

tests/standalone/standalone_precompiled.status

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
dwarf_stack_trace_test: Pass, RuntimeError # Issue 35563
77

88
[ $runtime == dart_precompiled ]
9-
check_for_aot_snapshot_jit_test: SkipByDesign
109
http_launch_test: Skip
1110
io/addlatexhash_test: Skip
1211
io/dart_std_io_pipe_test: Skip

tests/standalone_2/check_for_aot_snapshot_jit_test.dart

Lines changed: 0 additions & 59 deletions
This file was deleted.

tests/standalone_2/standalone_2_precompiled.status

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# BSD-style license that can be found in the LICENSE file.
44

55
[ $runtime == dart_precompiled ]
6-
check_for_aot_snapshot_jit_test: SkipByDesign
76
http_launch_test: Skip
87
io/addlatexhash_test: Skip
98
io/dart_std_io_pipe_test: Skip

0 commit comments

Comments
 (0)