[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 <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
Alexander Markov 2019-09-23 23:08:41 +00:00 committed by commit-bot@chromium.org
parent dbe8f6a9df
commit 3edcf8f959
2 changed files with 13 additions and 6 deletions

View file

@ -18,7 +18,9 @@ import 'package:kernel/target/targets.dart' show Target, TargetFlags, getTarget;
import 'package:kernel/type_environment.dart' show SubtypeTester;
import 'package:vm/bytecode/gen_bytecode.dart' show generateBytecode;
import 'package:vm/bytecode/gen_bytecode.dart'
show createFreshComponentWithBytecode, generateBytecode;
import 'package:vm/bytecode/options.dart' show BytecodeOptions;
import 'package:front_end/src/api_prototype/compiler_options.dart'
@ -330,16 +332,18 @@ Future<void> compilePlatformInternal(CompilerContext c, Uri fullOutput,
new File.fromUri(outlineOutput).writeAsBytesSync(result.summary);
c.options.ticker.logMs("Wrote outline to ${outlineOutput.toFilePath()}");
Component component = result.component;
if (c.options.bytecode) {
generateBytecode(result.component,
generateBytecode(component,
options: new BytecodeOptions(
enableAsserts: true,
emitSourceFiles: true,
emitSourcePositions: true,
environmentDefines: c.options.environmentDefines));
component = createFreshComponentWithBytecode(component);
}
await writeComponentToFile(result.component, fullOutput,
await writeComponentToFile(component, fullOutput,
filter: (lib) => !lib.isExternal);
c.options.ticker.logMs("Wrote component to ${fullOutput.toFilePath()}");

View file

@ -140,14 +140,13 @@ template("gen_vm_platform") {
"-Ddart.developer.causal_async_stacks=$allow_causal_async_stacks",
"-Ddart.isVM=true",
]
if (defined(invoker.exclude_source) && invoker.exclude_source) {
args += [ "--exclude-source" ]
}
outline = "vm_outline" + output_postfix + ".dill"
if (dart_platform_bytecode) {
if (defined(invoker.bytecode) && invoker.bytecode) {
args += [ "--bytecode" ]
}
outline = "vm_outline" + output_postfix + ".dill"
}
}
@ -161,6 +160,10 @@ gen_vm_platform("vm_platform_stripped") {
add_implicit_vm_platform_dependency = false
exclude_source = true
output_postfix = "_strong_stripped"
if (dart_platform_bytecode) {
bytecode = true
}
}
group("kernel_platform_files") {