From d1ed915244a056240cdd70e806c9ed81aa667a2a Mon Sep 17 00:00:00 2001 From: Martin Kustermann Date: Tue, 12 Dec 2017 13:47:11 +0000 Subject: [PATCH] Use batch mode compilation for normal -cdartkp Issue https://github.com/dart-lang/sdk/issues/31585 Change-Id: I70790a33cfbfbc7c2c48c6e77074f955d6de7e01 Reviewed-on: https://dart-review.googlesource.com/28280 Commit-Queue: Martin Kustermann Reviewed-by: Vyacheslav Egorov --- pkg/vm/tool/gen_kernel | 2 + .../testing/dart/compiler_configuration.dart | 43 +++++++++---------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/pkg/vm/tool/gen_kernel b/pkg/vm/tool/gen_kernel index ec122ec1747..5b960477282 100755 --- a/pkg/vm/tool/gen_kernel +++ b/pkg/vm/tool/gen_kernel @@ -25,6 +25,8 @@ CUR_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" SDK_DIR="$CUR_DIR/../../.." +# TODO(kustermann): For windows as well as for hosts running on arm, our +# checked-in dart binaries must be adjusted. if [[ `uname` == 'Darwin' ]]; then DART="$SDK_DIR/tools/sdks/mac/dart-sdk/bin/dart" OUT_DIR="$SDK_DIR/xcodebuild" diff --git a/tools/testing/dart/compiler_configuration.dart b/tools/testing/dart/compiler_configuration.dart index 58718f14d8a..5ea98fcd2d6 100644 --- a/tools/testing/dart/compiler_configuration.dart +++ b/tools/testing/dart/compiler_configuration.dart @@ -574,18 +574,14 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration { List arguments, Map environmentOverrides) { var commands = []; - if (_isStrong) { - commands.add(computeCompileToKernelCommand( - tempDir, arguments, environmentOverrides)); - } + commands.add(computeCompileToKernelCommand( + tempDir, arguments, environmentOverrides)); commands.add( - computeCompilationCommand(tempDir, arguments, environmentOverrides)); + computeDartBootstrapCommand(tempDir, arguments, environmentOverrides)); - if (_isStrong) { - commands.add(computeRemoveKernelFileCommand( - tempDir, arguments, environmentOverrides)); - } + commands.add(computeRemoveKernelFileCommand( + tempDir, arguments, environmentOverrides)); if (!_configuration.useBlobs) { commands.add( @@ -604,14 +600,25 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration { Map environmentOverrides) { final genKernel = Platform.script.resolve('../../../pkg/vm/tool/gen_kernel').toFilePath(); + + final kernelBinariesFolder = _useSdk + ? '${_configuration.buildDirectory}/dart-sdk/lib/_internal' + : '${_configuration.buildDirectory}'; + + final vmPlatform = _isStrong + ? '$kernelBinariesFolder/vm_platform_strong.dill' + : '$kernelBinariesFolder/vm_platform.dill'; + final dillFile = tempKernelFile(tempDir); - var args = [ + final args = [ '--aot', - '--platform=${_configuration.buildDirectory}/vm_platform_strong.dill', + _isStrong ? '--strong-mode' : '--no-strong-mode', + '--platform=$vmPlatform', '-o', dillFile, ]; args.add(arguments.where((name) => name.endsWith('.dart')).single); + return Command.vmKernelCompilation(dillFile, true, bootstrapDependencies(), genKernel, args, environmentOverrides); } @@ -631,7 +638,7 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration { alwaysCompile: !_useSdk); } - Command computeCompilationCommand(String tempDir, List arguments, + Command computeDartBootstrapCommand(String tempDir, List arguments, Map environmentOverrides) { var buildDir = _configuration.buildDirectory; String exec; @@ -645,17 +652,7 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration { exec = "$buildDir/dart_bootstrap"; } - var args = []; - if (useDfe) { - if (!_isStrong) { - args.add('--dfe=pkg/vm/bin/kernel_service.dart'); - args.add('--kernel-binaries=' + - (_useSdk - ? '${_configuration.buildDirectory}/dart-sdk/lib/_internal' - : '${buildDir}')); - } - } - + final args = []; args.add("--snapshot-kind=app-aot"); if (_configuration.useBlobs) { args.add("--snapshot=$tempDir/out.aotsnapshot");