diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn index 7beca81c66b..18b35480f49 100644 --- a/runtime/bin/BUILD.gn +++ b/runtime/bin/BUILD.gn @@ -552,7 +552,7 @@ gen_snapshot_action("generate_snapshot_bin") { args = [ "--sound-null-safety", "--deterministic", - "--snapshot_kind=" + dart_core_snapshot_kind, + "--snapshot_kind=core", "--vm_snapshot_data=" + rebase_path(vm_snapshot_data, root_build_dir), "--vm_snapshot_instructions=" + rebase_path(vm_snapshot_instructions, root_build_dir), diff --git a/runtime/bin/gen_snapshot.cc b/runtime/bin/gen_snapshot.cc index 12b4ceafcf1..75cea1e262d 100644 --- a/runtime/bin/gen_snapshot.cc +++ b/runtime/bin/gen_snapshot.cc @@ -74,7 +74,6 @@ const uint8_t* isolate_snapshot_instructions = nullptr; // match kSnapshotKindNames below. enum SnapshotKind { kCore, - kCoreJIT, kApp, kAppJIT, kAppAOTAssembly, @@ -87,7 +86,6 @@ static SnapshotKind snapshot_kind = kCore; static const char* const kSnapshotKindNames[] = { // clang-format off "core", - "core-jit", "app", "app-jit", "app-aot-assembly", @@ -246,19 +244,6 @@ static int ParseArguments(int argc, } break; } - case kCoreJIT: { - if ((vm_snapshot_data_filename == nullptr) || - (vm_snapshot_instructions_filename == nullptr) || - (isolate_snapshot_data_filename == nullptr) || - (isolate_snapshot_instructions_filename == nullptr)) { - Syslog::PrintErr( - "Building a core JIT snapshot requires specifying output " - "files for --vm_snapshot_data, --vm_snapshot_instructions, " - "--isolate_snapshot_data and --isolate_snapshot_instructions.\n\n"); - return -1; - } - break; - } case kApp: case kAppJIT: { if ((load_vm_snapshot_data_filename == nullptr) || @@ -385,8 +370,7 @@ static void MaybeLoadExtraInputs(const CommandLineOptions& inputs) { } static void MaybeLoadCode() { - if (compile_all && - ((snapshot_kind == kCoreJIT) || (snapshot_kind == kAppJIT))) { + if (compile_all && (snapshot_kind == kAppJIT)) { Dart_Handle result = Dart_CompileAll(); CHECK_RESULT(result); } @@ -415,15 +399,13 @@ static void CreateAndWriteCoreSnapshot() { WriteFile(vm_snapshot_data_filename, vm_snapshot_data_buffer, vm_snapshot_data_size); if (vm_snapshot_instructions_filename != nullptr) { - // Create empty file for the convenience of build systems. Makes things - // polymorphic with generating core-jit snapshots. + // Create empty file for the convenience of build systems. WriteFile(vm_snapshot_instructions_filename, nullptr, 0); } WriteFile(isolate_snapshot_data_filename, isolate_snapshot_data_buffer, isolate_snapshot_data_size); if (isolate_snapshot_instructions_filename != nullptr) { - // Create empty file for the convenience of build systems. Makes things - // polymorphic with generating core-jit snapshots. + // Create empty file for the convenience of build systems. WriteFile(isolate_snapshot_instructions_filename, nullptr, 0); } } @@ -452,45 +434,6 @@ static std::unique_ptr MapFile(const char* filename, return std::unique_ptr(mapping); } -static void CreateAndWriteCoreJITSnapshot() { - ASSERT(snapshot_kind == kCoreJIT); - ASSERT(vm_snapshot_data_filename != nullptr); - ASSERT(vm_snapshot_instructions_filename != nullptr); - ASSERT(isolate_snapshot_data_filename != nullptr); - ASSERT(isolate_snapshot_instructions_filename != nullptr); - - Dart_Handle result; - uint8_t* vm_snapshot_data_buffer = nullptr; - intptr_t vm_snapshot_data_size = 0; - uint8_t* vm_snapshot_instructions_buffer = nullptr; - intptr_t vm_snapshot_instructions_size = 0; - uint8_t* isolate_snapshot_data_buffer = nullptr; - intptr_t isolate_snapshot_data_size = 0; - uint8_t* isolate_snapshot_instructions_buffer = nullptr; - intptr_t isolate_snapshot_instructions_size = 0; - - // First create a snapshot. - result = Dart_CreateCoreJITSnapshotAsBlobs( - &vm_snapshot_data_buffer, &vm_snapshot_data_size, - &vm_snapshot_instructions_buffer, &vm_snapshot_instructions_size, - &isolate_snapshot_data_buffer, &isolate_snapshot_data_size, - &isolate_snapshot_instructions_buffer, - &isolate_snapshot_instructions_size); - CHECK_RESULT(result); - - // Now write the vm isolate and isolate snapshots out to the - // specified file and exit. - WriteFile(vm_snapshot_data_filename, vm_snapshot_data_buffer, - vm_snapshot_data_size); - WriteFile(vm_snapshot_instructions_filename, vm_snapshot_instructions_buffer, - vm_snapshot_instructions_size); - WriteFile(isolate_snapshot_data_filename, isolate_snapshot_data_buffer, - isolate_snapshot_data_size); - WriteFile(isolate_snapshot_instructions_filename, - isolate_snapshot_instructions_buffer, - isolate_snapshot_instructions_size); -} - static void CreateAndWriteAppSnapshot() { ASSERT(snapshot_kind == kApp); ASSERT(isolate_snapshot_data_filename != nullptr); @@ -506,8 +449,7 @@ static void CreateAndWriteAppSnapshot() { WriteFile(isolate_snapshot_data_filename, isolate_snapshot_data_buffer, isolate_snapshot_data_size); if (isolate_snapshot_instructions_filename != nullptr) { - // Create empty file for the convenience of build systems. Makes things - // polymorphic with generating core-jit snapshots. + // Create empty file for the convenience of build systems. WriteFile(isolate_snapshot_instructions_filename, nullptr, 0); } } @@ -813,9 +755,6 @@ static int CreateIsolateAndSnapshot(const CommandLineOptions& inputs) { case kCore: CreateAndWriteCoreSnapshot(); break; - case kCoreJIT: - CreateAndWriteCoreJITSnapshot(); - break; case kApp: CreateAndWriteAppSnapshot(); break; @@ -889,8 +828,8 @@ int main(int argc, char** argv) { // so generated code should not depend on the CPU features // of the system where snapshot was generated. vm_options.AddArgument("--target_unknown_cpu"); - } else if ((snapshot_kind == kCoreJIT) || (snapshot_kind == kAppJIT)) { - // Core-jit and app-jit snapshot can be deployed to another machine, + } else if (snapshot_kind == kAppJIT) { + // App-jit snapshot can be deployed to another machine, // so generated code should not depend on the CPU features // of the system where snapshot was generated. vm_options.AddArgument("--target_unknown_cpu"); diff --git a/runtime/include/dart_api.h b/runtime/include/dart_api.h index 5700d23fe2a..3ed71bdacec 100644 --- a/runtime/include/dart_api.h +++ b/runtime/include/dart_api.h @@ -4126,20 +4126,6 @@ Dart_CreateAppJITSnapshotAsBlobs(uint8_t** isolate_snapshot_data_buffer, uint8_t** isolate_snapshot_instructions_buffer, intptr_t* isolate_snapshot_instructions_size); -/** - * Like Dart_CreateAppJITSnapshotAsBlobs, but also creates a new VM snapshot. - */ -DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle -Dart_CreateCoreJITSnapshotAsBlobs( - uint8_t** vm_snapshot_data_buffer, - intptr_t* vm_snapshot_data_size, - uint8_t** vm_snapshot_instructions_buffer, - intptr_t* vm_snapshot_instructions_size, - uint8_t** isolate_snapshot_data_buffer, - intptr_t* isolate_snapshot_data_size, - uint8_t** isolate_snapshot_instructions_buffer, - intptr_t* isolate_snapshot_instructions_size); - /** * Get obfuscation map for precompiled code. * diff --git a/runtime/runtime_args.gni b/runtime/runtime_args.gni index f6c9fff15b6..92bf387959b 100644 --- a/runtime/runtime_args.gni +++ b/runtime/runtime_args.gni @@ -49,11 +49,6 @@ declare_args() { # Windows for now. dart_use_crashpad = false - # Controls the kind of core snapshot linked into the standalone VM. Using a - # core-jit snapshot breaks the ability to change various flags that affect - # code generation. - dart_core_snapshot_kind = "core" - # Whether the Dart binary version string should include the git hash and # git commit time. dart_version_git_info = true diff --git a/runtime/tests/vm/dart/exported_symbols_test.dart b/runtime/tests/vm/dart/exported_symbols_test.dart index 6b2abe4f25a..d466fe341c0 100644 --- a/runtime/tests/vm/dart/exported_symbols_test.dart +++ b/runtime/tests/vm/dart/exported_symbols_test.dart @@ -71,7 +71,6 @@ main() { "Dart_CreateAppAOTSnapshotAsElf", "Dart_CreateAppAOTSnapshotAsElfs", "Dart_CreateAppJITSnapshotAsBlobs", - "Dart_CreateCoreJITSnapshotAsBlobs", "Dart_CreateIsolateGroup", "Dart_CreateIsolateGroupFromKernel", "Dart_CreateIsolateInGroup", diff --git a/runtime/tests/vm/dart/v8_snapshot_profile_writer_test.dart b/runtime/tests/vm/dart/v8_snapshot_profile_writer_test.dart index 1af4fa393bc..937de8b7eb3 100644 --- a/runtime/tests/vm/dart/v8_snapshot_profile_writer_test.dart +++ b/runtime/tests/vm/dart/v8_snapshot_profile_writer_test.dart @@ -60,7 +60,6 @@ Snapshot testProfile(String profilePath) { } Future testJIT(String dillPath, String snapshotKind) async { - final includesCode = snapshotKind == 'core-jit'; final description = snapshotKind; Expect.isTrue(_seenDescriptions.add(description), "test configuration $description would be run multiple times"); @@ -75,10 +74,6 @@ Future testJIT(String dillPath, String snapshotKind) async { await run(genSnapshot, [ '--snapshot-kind=$snapshotKind', - if (includesCode) ...[ - '--vm_snapshot_instructions=$vmTextPath', - '--isolate_snapshot_instructions=$isolateTextPath', - ], '--vm_snapshot_data=$vmDataPath', '--isolate_snapshot_data=$isolateDataPath', "--write-v8-snapshot-profile-to=$profilePath", @@ -94,10 +89,6 @@ Future testJIT(String dillPath, String snapshotKind) async { // This ensures that all bytes are accounted for in some way. int actualSize = await File(vmDataPath).length() + await File(isolateDataPath).length(); - if (includesCode) { - actualSize += await File(vmTextPath).length() + - await File(isolateTextPath).length(); - } final expectedSize = profile.nodes.fold(0, (size, n) => size + n.selfSize); @@ -423,8 +414,6 @@ main() async { // Test profile generation with a core snapshot (no code). await testJIT(jitDillPath, 'core'); - // Test profile generation with a core JIT snapshot (with code). - await testJIT(jitDillPath, 'core-jit'); // Test unstripped ELF generation directly. await testAOT(aotDillPath); diff --git a/runtime/tools/create_snapshot_bin.py b/runtime/tools/create_snapshot_bin.py index 10519b27be9..7e8309f174c 100755 --- a/runtime/tools/create_snapshot_bin.py +++ b/runtime/tools/create_snapshot_bin.py @@ -94,14 +94,6 @@ def ProcessOptions(options): if not options.isolate_output_bin: sys.stderr.write('--isolate_output_bin not specified\n') return False - if (options.snapshot_kind == 'core-jit' and - not options.vm_instructions_output_bin): - sys.stderr.write('--vm_instructions_output_bin not specified\n') - return False - if (options.snapshot_kind == 'core-jit' and - not options.isolate_instructions_output_bin): - sys.stderr.write('--isolate_instructions_output_bin not specified\n') - return False return True diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc index 3400afc935d..1076a708857 100644 --- a/runtime/vm/dart_api_impl.cc +++ b/runtime/vm/dart_api_impl.cc @@ -6926,74 +6926,6 @@ static void DropRegExpMatchCode(Zone* zone) { #endif // (!defined(TARGET_ARCH_IA32) && !defined(DART_PRECOMPILED_RUNTIME)) -DART_EXPORT Dart_Handle Dart_CreateCoreJITSnapshotAsBlobs( - uint8_t** vm_snapshot_data_buffer, - intptr_t* vm_snapshot_data_size, - uint8_t** vm_snapshot_instructions_buffer, - intptr_t* vm_snapshot_instructions_size, - uint8_t** isolate_snapshot_data_buffer, - intptr_t* isolate_snapshot_data_size, - uint8_t** isolate_snapshot_instructions_buffer, - intptr_t* isolate_snapshot_instructions_size) { -#if defined(TARGET_ARCH_IA32) - return Api::NewError("Snapshots with code are not supported on IA32."); -#elif defined(DART_PRECOMPILED_RUNTIME) - return Api::NewError("JIT app snapshots cannot be taken from an AOT runtime"); -#else - DARTSCOPE(Thread::Current()); - API_TIMELINE_DURATION(T); - CHECK_NULL(vm_snapshot_data_buffer); - CHECK_NULL(vm_snapshot_data_size); - CHECK_NULL(vm_snapshot_instructions_buffer); - CHECK_NULL(vm_snapshot_instructions_size); - CHECK_NULL(isolate_snapshot_data_buffer); - CHECK_NULL(isolate_snapshot_data_size); - CHECK_NULL(isolate_snapshot_instructions_buffer); - CHECK_NULL(isolate_snapshot_instructions_size); - // Finalize all classes if needed. - Dart_Handle state = Api::CheckAndFinalizePendingClasses(T); - if (Api::IsError(state)) { - return state; - } - - NoBackgroundCompilerScope no_bg_compiler(T); - - DropRegExpMatchCode(Z); - - ProgramVisitor::Dedup(T); - - TIMELINE_DURATION(T, Isolate, "WriteCoreJITSnapshot"); - ZoneWriteStream vm_snapshot_data(Api::TopScope(T)->zone(), - FullSnapshotWriter::kInitialSize); - ZoneWriteStream vm_snapshot_instructions(Api::TopScope(T)->zone(), - FullSnapshotWriter::kInitialSize); - ZoneWriteStream isolate_snapshot_data(Api::TopScope(T)->zone(), - FullSnapshotWriter::kInitialSize); - ZoneWriteStream isolate_snapshot_instructions( - Api::TopScope(T)->zone(), FullSnapshotWriter::kInitialSize); - - BlobImageWriter image_writer(T, &vm_snapshot_instructions, - &isolate_snapshot_instructions); - FullSnapshotWriter writer(Snapshot::kFullJIT, &vm_snapshot_data, - &isolate_snapshot_data, &image_writer, - &image_writer); - writer.WriteFullSnapshot(); - - *vm_snapshot_data_buffer = vm_snapshot_data.buffer(); - *vm_snapshot_data_size = vm_snapshot_data.bytes_written(); - *vm_snapshot_instructions_buffer = vm_snapshot_instructions.buffer(); - *vm_snapshot_instructions_size = vm_snapshot_instructions.bytes_written(); - *isolate_snapshot_data_buffer = isolate_snapshot_data.buffer(); - *isolate_snapshot_data_size = isolate_snapshot_data.bytes_written(); - *isolate_snapshot_instructions_buffer = - isolate_snapshot_instructions.buffer(); - *isolate_snapshot_instructions_size = - isolate_snapshot_instructions.bytes_written(); - - return Api::Success(); -#endif -} - #if !defined(TARGET_ARCH_IA32) && !defined(DART_PRECOMPILED_RUNTIME) static void KillNonMainIsolatesSlow(Thread* thread, Isolate* main_isolate) { auto group = main_isolate->group();