Skip to content

Commit

Permalink
Front-end server: use VM-specific package:vm/kernel_front_end (flutt…
Browse files Browse the repository at this point in the history
…er#4412)

* Use the VM-specific wrapper for the kernel front-end to support VM-specific kernel transformations.
* Also, pass a flag to distinguish AOT mode from JIT mode to enable whole-program optimizations.
  • Loading branch information
alexmarkov authored Dec 3, 2017
1 parent 22e63c3 commit 3e84bf0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions frontend_server/.packages
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ test:../../third_party/dart/third_party/pkg/test/lib/
typed_data:../../third_party/dart/third_party/pkg/typed_data/lib/
usage:../../third_party/dart/third_party/pkg/usage/lib/
utf:../../third_party/dart/third_party/pkg/utf/lib/
vm:../../third_party/dart/pkg/vm/lib/
watcher:../../third_party/dart/third_party/pkg/watcher/lib/
web_socket_channel:../../third_party/dart/third_party/pkg/web_socket_channel/lib/
when:../../third_party/pkg/when/lib/
Expand Down
9 changes: 7 additions & 2 deletions frontend_server/lib/server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import 'package:front_end/src/api_prototype/compilation_message.dart';
import 'package:front_end/src/api_prototype/byte_store.dart';
import 'package:front_end/src/api_prototype/compiler_options.dart';
import 'package:front_end/src/api_prototype/incremental_kernel_generator.dart';
import 'package:front_end/src/api_prototype/kernel_generator.dart';
import 'package:kernel/ast.dart';
import 'package:kernel/binary/ast_to_binary.dart';
import 'package:kernel/binary/limited_ast_to_binary.dart';
import 'package:kernel/target/flutter.dart';
import 'package:kernel/target/targets.dart';
import 'package:usage/uuid/uuid.dart';
import 'package:vm/kernel_front_end.dart' show compileToKernel;

ArgParser _argParser = new ArgParser(allowTrailingOptions: true)
..addFlag('train',
Expand All @@ -37,6 +37,9 @@ ArgParser _argParser = new ArgParser(allowTrailingOptions: true)
help: 'Path to file byte store used to keep incremental compiler state.'
' If omitted, then memory byte store is used.',
defaultsTo: null)
..addFlag('aot',
help: 'Run compiler in AOT mode (enables whole-program transformations)',
defaultsTo: false)
..addFlag('link-platform',
help: 'When in batch mode, link platform kernel file into result kernel file.'
' Intended use is to satisfy different loading strategies implemented'
Expand Down Expand Up @@ -177,7 +180,9 @@ class _FrontendCompiler implements CompilerInterface {
sdkRoot.resolve('platform.dill')
];
}
program = await kernelForProgram(Uri.base.resolve(_filename), compilerOptions);
program = await compileToKernel(
Uri.base.resolve(_filename), compilerOptions,
aot: options['aot']);
}
if (program != null) {
final IOSink sink = new File(_kernelBinaryFilename).openWrite();
Expand Down
3 changes: 3 additions & 0 deletions frontend_server/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dependencies:
source_span: any
typed_data: any
usage: any
vm: any

dev_dependencies:
analyzer: any
Expand Down Expand Up @@ -90,6 +91,8 @@ dependency_overrides:
path: ../../third_party/dart/third_party/pkg/typed_data
usage:
path: ../../third_party/dart/third_party/pkg/usage
vm:
path: ../../third_party/dart/pkg/vm/

analyzer:
path: ../../third_party/dart/pkg/analyzer
Expand Down

0 comments on commit 3e84bf0

Please sign in to comment.