Skip to content

Commit 3edcf8f

Browse files
alexmarkovcommit-bot@chromium.org
authored andcommitted
[vm/bytecode] Split AST and bytecode platform dill files
Currently Dart SDK has 2 platform dill files: * vm_platform_strong.dill is used when compiling Dart sources (in kernel service and various kernel compilers). * vm_platform_strong_stripped.dill is used to build core snapshot, so its contents is used for execution in the VM. Before this change, if Dart SDK is built with bytecode, then both vm_platform_strong.dill and vm_platform_strong_stripped.dill contain bytecode and AST. This change removes bytecode from vm_platform_strong.dill, and removes AST from vm_platform_strong_stripped.dill. Sizes: Dart SDK is built without bytecode: 5861400 out/ReleaseX64/vm_platform_strong.dill 2819336 out/ReleaseX64/vm_platform_strong_stripped.dill 32105720 out/ReleaseX64/dart-sdk/bin/dart Dart SDK is built with bytecode, before this change: 11146480 out/ReleaseX64/vm_platform_strong.dill 4846488 out/ReleaseX64/vm_platform_strong_stripped.dill 34219256 out/ReleaseX64/dart-sdk/bin/dart Dart SDK is built with bytecode, after this change: 5861400 out/ReleaseX64/vm_platform_strong.dill 2027224 out/ReleaseX64/vm_platform_strong_stripped.dill 28382456 out/ReleaseX64/dart-sdk/bin/dart Change-Id: Ia7c61a9bce1c95edfd3b2810a67c0964fb37377f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118371 Reviewed-by: Régis Crelier <[email protected]> Commit-Queue: Alexander Markov <[email protected]>
1 parent dbe8f6a commit 3edcf8f

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

pkg/front_end/tool/_fasta/entry_points.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ import 'package:kernel/target/targets.dart' show Target, TargetFlags, getTarget;
1818

1919
import 'package:kernel/type_environment.dart' show SubtypeTester;
2020

21-
import 'package:vm/bytecode/gen_bytecode.dart' show generateBytecode;
21+
import 'package:vm/bytecode/gen_bytecode.dart'
22+
show createFreshComponentWithBytecode, generateBytecode;
23+
2224
import 'package:vm/bytecode/options.dart' show BytecodeOptions;
2325

2426
import 'package:front_end/src/api_prototype/compiler_options.dart'
@@ -330,16 +332,18 @@ Future<void> compilePlatformInternal(CompilerContext c, Uri fullOutput,
330332
new File.fromUri(outlineOutput).writeAsBytesSync(result.summary);
331333
c.options.ticker.logMs("Wrote outline to ${outlineOutput.toFilePath()}");
332334

335+
Component component = result.component;
333336
if (c.options.bytecode) {
334-
generateBytecode(result.component,
337+
generateBytecode(component,
335338
options: new BytecodeOptions(
336339
enableAsserts: true,
337340
emitSourceFiles: true,
338341
emitSourcePositions: true,
339342
environmentDefines: c.options.environmentDefines));
343+
component = createFreshComponentWithBytecode(component);
340344
}
341345

342-
await writeComponentToFile(result.component, fullOutput,
346+
await writeComponentToFile(component, fullOutput,
343347
filter: (lib) => !lib.isExternal);
344348

345349
c.options.ticker.logMs("Wrote component to ${fullOutput.toFilePath()}");

runtime/vm/BUILD.gn

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,13 @@ template("gen_vm_platform") {
140140
"-Ddart.developer.causal_async_stacks=$allow_causal_async_stacks",
141141
"-Ddart.isVM=true",
142142
]
143-
144143
if (defined(invoker.exclude_source) && invoker.exclude_source) {
145144
args += [ "--exclude-source" ]
146145
}
147-
outline = "vm_outline" + output_postfix + ".dill"
148-
if (dart_platform_bytecode) {
146+
if (defined(invoker.bytecode) && invoker.bytecode) {
149147
args += [ "--bytecode" ]
150148
}
149+
outline = "vm_outline" + output_postfix + ".dill"
151150
}
152151
}
153152

@@ -161,6 +160,10 @@ gen_vm_platform("vm_platform_stripped") {
161160
add_implicit_vm_platform_dependency = false
162161
exclude_source = true
163162
output_postfix = "_strong_stripped"
163+
164+
if (dart_platform_bytecode) {
165+
bytecode = true
166+
}
164167
}
165168

166169
group("kernel_platform_files") {

0 commit comments

Comments
 (0)