Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 91b5862

Browse files
zandersocommit-bot@chromium.org
authored andcommitted
[vm] Add core-jit-all snapshot kind to gen_snapshot
This is for comparing with including bytecode in the core-jit snapshot. Change-Id: I51f98df5c4845ee3bf69438a059eddbd87b02e06 Reviewed-on: https://dart-review.googlesource.com/c/80263 Commit-Queue: Zach Anderson <zra@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com>
1 parent 0f32be2 commit 91b5862

1 file changed

Lines changed: 24 additions & 5 deletions

File tree

runtime/bin/gen_snapshot.cc

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,12 @@ const uint8_t* isolate_snapshot_data = NULL;
6666
const uint8_t* isolate_snapshot_instructions = NULL;
6767

6868
// Global state that indicates whether a snapshot is to be created and
69-
// if so which file to write the snapshot into.
69+
// if so which file to write the snapshot into. The ordering of this list must
70+
// match kSnapshotKindNames below.
7071
enum SnapshotKind {
7172
kCore,
7273
kCoreJIT,
74+
kCoreJITAll,
7375
kAppJIT,
7476
kAppAOTBlobs,
7577
kAppAOTAssembly,
@@ -91,14 +93,17 @@ static bool ProcessEnvironmentOption(const char* arg,
9193
&environment);
9294
}
9395

96+
// The ordering of this list must match the SnapshotKind enum above.
9497
static const char* kSnapshotKindNames[] = {
98+
// clang-format off
9599
"core",
96100
"core-jit",
101+
"core-jit-all",
97102
"app-jit",
98103
"app-aot-blobs",
99104
"app-aot-assembly",
100-
"vm-aot-assembly",
101-
NULL,
105+
"vm-aot-assembly", NULL,
106+
// clang-format on
102107
};
103108

104109
#define STRING_OPTIONS_LIST(V) \
@@ -289,6 +294,7 @@ static int ParseArguments(int argc,
289294
}
290295
break;
291296
}
297+
case kCoreJITAll:
292298
case kCoreJIT: {
293299
if ((vm_snapshot_data_filename == NULL) ||
294300
(vm_snapshot_instructions_filename == NULL) ||
@@ -461,6 +467,7 @@ class DependenciesFileWriter : public ValueObject {
461467
WriteDependenciesWithTarget(isolate_snapshot_data_filename);
462468
// WriteDependenciesWithTarget(isolate_snapshot_instructions_filename);
463469
break;
470+
case kCoreJITAll:
464471
case kCoreJIT:
465472
WriteDependenciesWithTarget(vm_snapshot_data_filename);
466473
// WriteDependenciesWithTarget(vm_snapshot_instructions_filename);
@@ -569,6 +576,13 @@ static void LoadCompilationTrace() {
569576
}
570577
}
571578

579+
static void CompileAll() {
580+
if (snapshot_kind == kCoreJITAll) {
581+
Dart_Handle result = Dart_CompileAll();
582+
CHECK_RESULT(result);
583+
}
584+
}
585+
572586
static void CreateAndWriteCoreSnapshot() {
573587
ASSERT(snapshot_kind == kCore);
574588
ASSERT(vm_snapshot_data_filename != NULL);
@@ -625,7 +639,7 @@ static std::unique_ptr<MappedMemory> MapFile(const char* filename,
625639
}
626640

627641
static void CreateAndWriteCoreJITSnapshot() {
628-
ASSERT(snapshot_kind == kCoreJIT);
642+
ASSERT((snapshot_kind == kCoreJIT) || (snapshot_kind == kCoreJITAll));
629643
ASSERT(vm_snapshot_data_filename != NULL);
630644
ASSERT(vm_snapshot_instructions_filename != NULL);
631645
ASSERT(isolate_snapshot_data_filename != NULL);
@@ -886,6 +900,10 @@ static int GenerateSnapshotFromKernel(const uint8_t* kernel_buffer,
886900
case kCore:
887901
CreateAndWriteCoreSnapshot();
888902
break;
903+
case kCoreJITAll:
904+
CompileAll();
905+
CreateAndWriteCoreJITSnapshot();
906+
break;
889907
case kCoreJIT:
890908
LoadBytecode();
891909
LoadCompilationTrace();
@@ -976,7 +994,8 @@ int main(int argc, char** argv) {
976994
if (IsSnapshottingForPrecompilation()) {
977995
vm_options.AddArgument("--precompilation");
978996
}
979-
if (snapshot_kind == kCoreJIT || snapshot_kind == kAppJIT) {
997+
if ((snapshot_kind == kCoreJITAll) || (snapshot_kind == kCoreJIT) ||
998+
(snapshot_kind == kAppJIT)) {
980999
vm_options.AddArgument("--fields_may_be_reset");
9811000
vm_options.AddArgument("--link_natives_lazily");
9821001
#if !defined(PRODUCT)

0 commit comments

Comments
 (0)