Commit Graph

122 Commits

Author SHA1 Message Date
Ryan Macnak 7e76414eab [frontend_server] Support Fuchsia-style package splitting and FAR manifest generation.
Bug: https://github.com/dart-lang/sdk/issues/39126
Change-Id: I79a44316bea4350433a320794569c70ed3baa649
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123464
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-10-30 16:47:04 +00:00
jonahwilliams fe3aa126a2 [frontend_server] fix package-scheme crash in dartdevc target
If the entrypoint is not a file URI, we'll crash as the strong components implementation is unable to find it. Fallback to the first library in the component

Change-Id: Ibd1650978ebc904463ca2a97bd219a4069524b60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122560
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2019-10-28 23:54:53 +00:00
Ryan Macnak 700765a4d7 [vm, bytecode] The AST cache file's directory might not exist.
Change-Id: I7f097497548d84b2944220fbe3630a52c963453a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122683
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-10-23 21:18:17 +00:00
Alexander Aprelev be3348253d [gardening] Fix sink use in frontend-server dartdevc.
This is follow-up to  https://dart-review.googlesource.com/c/sdk/+/122461.

Change-Id: Id0c11daa1f37bf7254e5a75f28d64cac37ea9175
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122520
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2019-10-22 20:53:06 +00:00
Alexander Aprelev db8370e361 [gardening] Fix frontend-server dartdevc windows test.
This is follow-up to https://dart-review.googlesource.com/c/sdk/+/121400.

Change-Id: I45afdc8094f8b8d4be3e774bf475dc7b20a71498
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122461
Reviewed-by: Jonah Williams <jonahwilliams@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2019-10-22 17:49:06 +00:00
Alexander Markov 230f48d685 [vm,aot] Simple unreachable code elimination before type-flow analysis, take 3
This is a reland of 56991ad94b

Original change's description:
> [vm,aot] Simple unreachable code elimination before type-flow analysis, take 2
>
> This is the relanding of https://dart-review.googlesource.com/c/sdk/+/121500
> with fixes.
>
> Original CL description:
>
> This change adds transformation for very early cleanup of unreachable
> code such as code guarded by if statements with constant conditions or
> code used in assert statements when assertions are disabled.
>
> The advantage of cleaning such code early is that type-flow analysis
> won't be looking at it and TFA-based tree shaker is able to remove
> more code.
>
> flutter_gallery_total_size -0.5663% (arm), -0.5409% (arm64)
> build_bench_total_size -2.533% (arm), -2.449% (arm64)
> gesture_detector_total_size -4.183% (arm), -4.072% (arm64)
>
> Change-Id: Ief8ebd0cd828c0e7a847a824f44d2d97a3595b87
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121901
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

Change-Id: I82ea0f70845851f85ec159c366f408aa7f9e5788
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122166
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-10-21 21:41:39 +00:00
jonahwilliams c26d5969f7 [flutter] JavaScript support to frontend_server
Adds support to the frontend server for producing javascript when
compiling with a target model of dartdevc. This uses the ProgramCompiler
and associated types from the dev_compiler package to output the kernel
AST into a "bundle" format.

dev_compiler:
* Exposes additional types needed for JavaScript compilation.
* Allows  overriding CoreTypes instead of forcing it to be created from
Component. This is require to support compilation of the
partial Components created by the incremental compiler.
* provides extraIndexedLibraries in Target class so the CoreTypes produced by the incremental compiler have indexed them.

frontend_server:
* When the target model is dartdev, JavaScript is output instead of
kernel. For each Component we compile, we first compute the strongly
connected components and produce a List of new Components to interop
with the dev compiler. The file uri is used as module name.

Change-Id: I4cc117b20671ffd48dd43f9786961c016a02d056
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121400
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
2019-10-21 15:41:29 +00:00
Alexander Markov eb9480daa5 Revert "[vm,aot] Simple unreachable code elimination before type-flow analysis, take 2"
This reverts commit 56991ad94b.

Reason for revert: broke building Flutter apps in release mode

Original change's description:
> [vm,aot] Simple unreachable code elimination before type-flow analysis, take 2
> 
> This is the relanding of https://dart-review.googlesource.com/c/sdk/+/121500
> with fixes.
> 
> Original CL description:
> 
> This change adds transformation for very early cleanup of unreachable
> code such as code guarded by if statements with constant conditions or
> code used in assert statements when assertions are disabled.
> 
> The advantage of cleaning such code early is that type-flow analysis
> won't be looking at it and TFA-based tree shaker is able to remove
> more code.
> 
> flutter_gallery_total_size -0.5663% (arm), -0.5409% (arm64)
> build_bench_total_size -2.533% (arm), -2.449% (arm64)
> gesture_detector_total_size -4.183% (arm), -4.072% (arm64)
> 
> Change-Id: Ief8ebd0cd828c0e7a847a824f44d2d97a3595b87
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121901
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

TBR=vegorov@google.com,kustermann@google.com,rmacnak@google.com,alexmarkov@google.com

Change-Id: I25fe5d4457bfcc5ee25506810aa7eee01ca1b28a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122023
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-10-17 21:23:38 +00:00
Alexander Markov 56991ad94b [vm,aot] Simple unreachable code elimination before type-flow analysis, take 2
This is the relanding of https://dart-review.googlesource.com/c/sdk/+/121500
with fixes.

Original CL description:

This change adds transformation for very early cleanup of unreachable
code such as code guarded by if statements with constant conditions or
code used in assert statements when assertions are disabled.

The advantage of cleaning such code early is that type-flow analysis
won't be looking at it and TFA-based tree shaker is able to remove
more code.

flutter_gallery_total_size -0.5663% (arm), -0.5409% (arm64)
build_bench_total_size -2.533% (arm), -2.449% (arm64)
gesture_detector_total_size -4.183% (arm), -4.072% (arm64)

Change-Id: Ief8ebd0cd828c0e7a847a824f44d2d97a3595b87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121901
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-10-17 20:34:46 +00:00
Alexander Markov 882a6b57d2 Enable bytecode in AOT compilation pipeline
Change-Id: I3f1bb7d56522cf5dfedf68c022fbed59c3d04717
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118103
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-10-17 17:22:12 +00:00
Ryan Macnak f26aa6fff4 [vm, bytecode] Put the 'main' sub-component last when generating a single file.
Fixes 'hot_mode_dev_cycle_linux__benchmark' when bytecode is enabled.

Change-Id: I73d42b3d8fa0fb43fe028f877813b27891dae3aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121650
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-10-16 16:40:08 +00:00
Alexander Markov fbc406aec3 Revert "[vm,aot] Simple unreachable code elimination before type-flow analysis"
This reverts commit 41b65b27c2.

Reason for revert: broke protobuf-aot benchmarks.

Original change's description:
> [vm,aot] Simple unreachable code elimination before type-flow analysis
> 
> This change adds transformation for very early cleanup of unreachable
> code such as code guarded by if statements with constant conditions or
> code used in assert statements when assertions are disabled.
> 
> The advantage of cleaning such code early is that type-flow analysis
> won't be looking at it and TFA-based tree shaker is able to remove
> more code.
> 
> flutter_gallery_total_size -0.5663% (arm), -0.5409% (arm64)
> build_bench_total_size -2.533% (arm), -2.449% (arm64)
> gesture_detector_total_size -4.183% (arm), -4.072% (arm64)
> 
> Change-Id: Ic764c056b6594164dc32eed4fd5679a7077ea2f9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121500
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=vegorov@google.com,kustermann@google.com,rmacnak@google.com,alexmarkov@google.com

Change-Id: I3e5668176a7a90d2891126bf79139ac5859bc630
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121824
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-10-16 00:05:54 +00:00
Alexander Markov 41b65b27c2 [vm,aot] Simple unreachable code elimination before type-flow analysis
This change adds transformation for very early cleanup of unreachable
code such as code guarded by if statements with constant conditions or
code used in assert statements when assertions are disabled.

The advantage of cleaning such code early is that type-flow analysis
won't be looking at it and TFA-based tree shaker is able to remove
more code.

flutter_gallery_total_size -0.5663% (arm), -0.5409% (arm64)
build_bench_total_size -2.533% (arm), -2.449% (arm64)
gesture_detector_total_size -4.183% (arm), -4.072% (arm64)

Change-Id: Ic764c056b6594164dc32eed4fd5679a7077ea2f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121500
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-15 22:58:58 +00:00
jonahwilliams a9e1e7e4fd Remove 'new' from frontend_server
Change-Id: I23afa1ab5d9e722f355eabaaa0491b3f08f261eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121404
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
2019-10-11 19:47:40 +00:00
Jens Johansen 8796723b82 [frontend_server] Enable incremental serializer by default
Trying it out in flutter (for flutter test runs):

Running "flutter test" in flutter/packages/flutter:

BEFORE ENABLING
===============
$ flutter test --local-engine=host_debug
[...]
03:38 +5149 ~27: All tests passed!

$ flutter test --local-engine=host_debug
[...]
03:11 +5149 ~27: All tests passed!

$ flutter test --local-engine=host_debug
[...]
03:10 +5149 ~27: All tests passed!


With coverage:

$ flutter test --local-engine=host_debug --coverage
[...]
08:37 +5149 ~27: All tests passed!

$ flutter test --local-engine=host_debug --coverage
[...]
08:21 +5149 ~27: All tests passed!


WITH THIS ENABLED
=================
$ flutter test --local-engine=host_debug
[...]
01:39 +5149 ~27: All tests passed!

$ flutter test --local-engine=host_debug
[...]
01:32 +5149 ~27: All tests passed!

$ flutter test --local-engine=host_debug
[...]
01:31 +5149 ~27: All tests passed!


With coverage:

$ flutter test --local-engine=host_debug --coverage
[...]
08:33 +5149 ~27: All tests passed!

$ flutter test --local-engine=host_debug --coverage
[...]
08:34 +5149 ~27: All tests passed!


So, without coverage more than twice as fast!
With coverage ~no change (which makes sense considering it's the VM thats spending extra time collecting coverage, so the compilation is not the bottleneck).


Running "flutter test" in a new project created with "flutter create" (i.e. with a single test):


BEFORE ENABLING
===============
$ time flutter test --local-engine=host_debug
00:05 +1: All tests passed!

real    0m6.360s
user    0m8.783s
sys     0m0.987s

$ time flutter test --local-engine=host_debug
00:02 +1: All tests passed!

real    0m2.790s
user    0m3.089s
sys     0m0.962s

$ time flutter test --local-engine=host_debug
00:02 +1: All tests passed!

real    0m2.693s
user    0m2.872s
sys     0m0.933s

WITH THIS ENABLED
=================
$ time flutter test --local-engine=host_debug
00:05 +1: All tests passed!

real    0m6.356s
user    0m8.253s
sys     0m1.161s

$ time flutter test --local-engine=host_debug
00:02 +1: All tests passed!

real    0m3.035s
user    0m3.449s
sys     0m0.880s

$ time flutter test --local-engine=host_debug
00:02 +1: All tests passed!

real    0m3.055s
user    0m3.534s
sys     0m0.885s

So maybe ~10% improvement on non-first runs (where it reuses the serialization from the dill it initialized from).
~no change on a clean run.

Change-Id: I2817fba9ca60190966194aa0b1ae8e16701137a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121121
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-10-11 07:02:43 +00:00
Jens Johansen 18aed26e83 [frontend_server] Wire up incremental serializer into frontend server / package VM
Change-Id: I4d8dbc2d9b0915c654eccae9e35357d7ec9fa13d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120787
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-10-10 11:39:06 +00:00
jonahwilliams cc3e22f724 [flutter] expose dartdevc target to incremental compiler
Doesn't do anything with the new target, but establishes a public API for dev_compiler (at least within the SDK)

Change-Id: I4c86b890d3993f96cf32ed0f749608a72a173da6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119526
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2019-10-09 20:02:42 +00:00
Ryan Macnak 4f752e6598 Reapply "[vm, bytecode] Use CoreTypes and ClassHierarchy from non-incremental front end results when generating bytecode."
Account for null result from kernelForProgram.

Change-Id: Ia4349c68ce023a5714752bf3294ab1e293b1d409
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120749
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-10-09 18:09:58 +00:00
Ryan Macnak 5092b8ef82 Revert "[vm, bytecode] Use CoreTypes and ClassHierarchy from non-incremental front end results when generating bytecode."
This reverts commit f2c882bd87.

Reason for revert: batch mode failures

Original change's description:
> [vm, bytecode] Use CoreTypes and ClassHierarchy from non-incremental front end results when generating bytecode.
> 
> Change-Id: I9a8b2530009ff6cc6880ee177a6bee4bb9101e82
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120626
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

TBR=rmacnak@google.com,alexmarkov@google.com

Change-Id: I8ea8e155af0d2a4c4382107d723f7bf8a50dc3d7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120748
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-10-09 00:21:14 +00:00
Ryan Macnak f2c882bd87 [vm, bytecode] Use CoreTypes and ClassHierarchy from non-incremental front end results when generating bytecode.
Change-Id: I9a8b2530009ff6cc6880ee177a6bee4bb9101e82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120626
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-10-08 21:58:30 +00:00
Johnni Winther 9276d50fdc [cfe] Remove Severity.errorLegacyWarning
Change-Id: I1cc7a34af307b9edee4c92e43e8607a450cf471d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120585
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2019-10-08 09:16:47 +00:00
jonahwilliams 13fbf569f6 [flutter] split frontend_server from vm package
To support JavaScript compilation, the frontend_server will require a dependency on the dev_compiler. To avoid conflating this with the vm specific functionality, the frontend server will be split from its current location.

This change will require a small corresponding update in flutter/engine, documented in the patches directory
Change-Id: I47923765546f7f6fa43e36ef38f8f466d3a7b2fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120321
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2019-10-08 05:32:59 +00:00