Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Issue 2986303003: Switch FE to use the libraries.json format. (Closed)

Created:
3 years, 4 months ago by Siggi Cherem (dart-lang)
Modified:
3 years, 4 months ago
Reviewers:
ahe, scheglov, Paul Berry
CC:
reviews_dartlang.org, dart-uxr+reviews_google.com, dart-fe-team+reviews_google.com
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Switch FE to use the libraries.json format. This CL: * introduces the Dart API to operate over libraries specifications and describes the format we intend to use (see libraries_spec.dart) * implements serialization/deserialization for this API * switches over the front_end to use these APIs * public options accept a URI to the JSON file and no longer accept a `dartLibraries` map * internal code uses the LibrariesSpecification API * switches other dependencies on these APIs (resynthesizer_test and patch_sdk.dart) This is the first step in migrating over to use the libraries.json format and eventually remove the patched_sdk step. In particular, some of the next steps include: * add a build step to generate .json files from .yaml files * add a libraries.yaml file for the sdk * split the patched_sdk step in two: * patching files * generating .dill files * add any missing support for patch-files in fasta * finally remove the patching files step, and only have a build step for generating .dill files BUG= R=ahe@google.com, paulberry@google.com, scheglov@google.com Committed: https://github.com/dart-lang/sdk/commit/abf2d23af2315fae6dc688741147ef677ec34835 Committed: https://github.com/dart-lang/sdk/commit/b48584d3d0eb480943d72958104baf8e0e366074

Patch Set 1 #

Total comments: 52

Patch Set 2 : cl comments #

Patch Set 3 : fix issues found on bots #

Unified diffs Side-by-side diffs Delta from patch set Stats (+871 lines, -211 lines) Patch
M pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart View 1 2 2 chunks +8 lines, -4 lines 0 comments Download
M pkg/compiler/lib/src/library_loader.dart View 1 2 1 chunk +0 lines, -1 line 0 comments Download
M pkg/front_end/example/incremental_reload/compiler_with_invalidation.dart View 3 chunks +0 lines, -14 lines 0 comments Download
M pkg/front_end/lib/compiler_options.dart View 1 1 chunk +9 lines, -10 lines 0 comments Download
M pkg/front_end/lib/incremental_kernel_generator.dart View 2 chunks +7 lines, -4 lines 0 comments Download
A pkg/front_end/lib/src/base/libraries_specification.dart View 1 1 chunk +221 lines, -0 lines 0 comments Download
M pkg/front_end/lib/src/base/processed_options.dart View 1 5 chunks +83 lines, -32 lines 0 comments Download
M pkg/front_end/lib/src/fasta/fasta_codes_generated.dart View 1 2 chunks +51 lines, -0 lines 0 comments Download
M pkg/front_end/lib/src/fasta/uri_translator_impl.dart View 1 3 chunks +10 lines, -70 lines 0 comments Download
M pkg/front_end/lib/src/testing/compiler_common.dart View 1 2 chunks +19 lines, -7 lines 0 comments Download
M pkg/front_end/messages.yaml View 1 2 chunks +7 lines, -0 lines 0 comments Download
M pkg/front_end/test/fasta/testing/suite.dart View 1 3 chunks +8 lines, -4 lines 0 comments Download
M pkg/front_end/test/fasta/uri_translator_test.dart View 1 3 chunks +10 lines, -10 lines 0 comments Download
M pkg/front_end/test/incremental_kernel_generator_test.dart View 1 1 chunk +2 lines, -4 lines 0 comments Download
M pkg/front_end/test/kernel_generator_test.dart View 1 2 chunks +5 lines, -4 lines 0 comments Download
A pkg/front_end/test/src/base/libraries_specification_test.dart View 1 1 chunk +309 lines, -0 lines 0 comments Download
M pkg/front_end/test/src/base/processed_options_test.dart View 1 3 chunks +57 lines, -2 lines 0 comments Download
M pkg/front_end/test/src/incremental/file_state_test.dart View 1 chunk +2 lines, -4 lines 0 comments Download
M pkg/front_end/test/src/incremental/hot_reload_e2e_test.dart View 1 chunk +1 line, -11 lines 0 comments Download
M pkg/front_end/test/src/incremental/kernel_driver_test.dart View 1 chunk +2 lines, -3 lines 0 comments Download
M pkg/front_end/test/src/incremental/mock_sdk.dart View 1 2 chunks +15 lines, -7 lines 0 comments Download
M pkg/front_end/test/subpackage_relationships_test.dart View 1 chunk +1 line, -0 lines 0 comments Download
M pkg/front_end/tool/fasta_perf.dart View 3 chunks +6 lines, -4 lines 0 comments Download
M tools/patch_sdk.dart View 1 2 9 chunks +38 lines, -16 lines 0 comments Download

Messages

Total messages: 17 (8 generated)
Siggi Cherem (dart-lang)
https://codereview.chromium.org/2986303003/diff/40001/pkg/front_end/test/src/base/processed_options_test.dart File pkg/front_end/test/src/base/processed_options_test.dart (right): https://codereview.chromium.org/2986303003/diff/40001/pkg/front_end/test/src/base/processed_options_test.dart#newcode21 pkg/front_end/test/src/base/processed_options_test.dart:21: CompilerContext.runWithDefaultOptions((_) { FYI - this line is not needed ...
3 years, 4 months ago (2017-08-03 03:01:39 UTC) #6
ahe
Despite all the non-file file URIs, LGTM :-D https://codereview.chromium.org/2986303003/diff/40001/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart File pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart (right): https://codereview.chromium.org/2986303003/diff/40001/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart#newcode82 pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart:82: new ...
3 years, 4 months ago (2017-08-03 11:58:16 UTC) #7
Paul Berry
lgtm https://codereview.chromium.org/2986303003/diff/40001/pkg/front_end/lib/src/base/libraries_spec.dart File pkg/front_end/lib/src/base/libraries_spec.dart (right): https://codereview.chromium.org/2986303003/diff/40001/pkg/front_end/lib/src/base/libraries_spec.dart#newcode14 pkg/front_end/lib/src/base/libraries_spec.dart:14: /// readability purposes): On 2017/08/03 11:58:15, ahe wrote: ...
3 years, 4 months ago (2017-08-03 17:50:41 UTC) #8
scheglov
lgtm
3 years, 4 months ago (2017-08-03 18:14:14 UTC) #9
Siggi Cherem (dart-lang)
Thanks everyone! https://codereview.chromium.org/2986303003/diff/40001/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart File pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart (right): https://codereview.chromium.org/2986303003/diff/40001/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart#newcode82 pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart:82: new LibraryInfo(name, Uri.parse('file://$path'), const []); On 2017/08/03 ...
3 years, 4 months ago (2017-08-05 00:41:02 UTC) #11
Siggi Cherem (dart-lang)
Committed patchset #2 (id:80001) manually as abf2d23af2315fae6dc688741147ef677ec34835 (presubmit successful).
3 years, 4 months ago (2017-08-05 00:41:36 UTC) #13
Siggi Cherem (dart-lang)
I had to revert, but just uploaded a new patchset with the fixes for the ...
3 years, 4 months ago (2017-08-05 03:06:15 UTC) #14
Siggi Cherem (dart-lang)
Committed patchset #3 (id:100001) manually as b48584d3d0eb480943d72958104baf8e0e366074 (presubmit successful).
3 years, 4 months ago (2017-08-07 15:41:35 UTC) #16
ahe
3 years, 4 months ago (2017-08-07 22:12:04 UTC) #17
Message was sent while issue was closed.
https://codereview.chromium.org/2986303003/diff/40001/pkg/front_end/lib/src/b...
File pkg/front_end/lib/src/base/processed_options.dart (right):

https://codereview.chromium.org/2986303003/diff/40001/pkg/front_end/lib/src/b...
pkg/front_end/lib/src/base/processed_options.dart:292: ticker.logMs("Read
libraries file");
On 2017/08/05 00:41:02, Siggi Cherem (dart-lang) wrote:
> On 2017/08/03 17:50:41, Paul Berry wrote:
> > On 2017/08/03 11:58:16, ahe wrote:
> > > You need to make sure you know precisely when ticker.logMs is called. It
> > doesn't
> > > work when stuff is initialized by demand. There's an arbitrary amount of
> > things
> > > happening before reading the library specification.
> > > 
> > > I suggest that you compute the TargetSpecification explicitly before
> creating
> > > the ProcessedOptions object.
> > > 
> > > Ideally, the flow of the code should be:
> > > 
> > > ticker.logMs("The previous phase").
> > > TargetLibrariesSpecification specification = await
> > > computeLibrarySpecification();
> > > ticker.logMs("Read libraries specification");
> > > ProcessedOptions options = ...;
> > > ticker.logMs("Processed options");
> > > // Invariant: all computations in processed options are done now.
> > 
> > It seems like you're suggesting a flow where the client does some processing
> > (based on options) before creating the ProcessedOptions object.  I really
want
> > to avoid that because the whole idea of ProcessedOptions is to make sure
that
> > all the APIs in the front end deal with options in a uniform way; requiring
> > computation to be done before creating ProcessedOptions creates the danger
of
> > drift between what the different implementations do before creating
> > ProcessedOptions.
> > 
> > Personally I don't have as big a concern about initializing stuff on demand.

> As
> > long as we call ticker.logMs before and after doing things, we can safely do
> > things on demand because the order of operations will be clear in the log.
> > 
> > So I think all we need to do here is add the following line just before line
> > 291:
> > 
> > ticker.logMs("Compute library specification");
> 
> Done. Added the extra tick as Paul suggested.

I don't think that will work. This will print something like this:

Compute library specification in N ms.
Read libraries file in M ms.

Those N ms will apply to something else.

This is not how the ticker works, it only has one stopwatch. The alternatives
don't appeal to me:

* "measure" as known from dart2js can measure things that are on-demand and
asynchronous, but it adds a lot of overhead simply to measure.

* profiling, often statistically, and often measures short running programs
incorrectly. This makes it a poor tool for understanding start up performance
(which this code belongs to).

Unfortunately, it's not easy to make sure that the ticker is used correctly and
that all (potentially) expensive things are timed. But when we take care to do
it correctly, we see the correct timings all the time. This is important to me
as this is how I monitor performance. Golem is also nice, but not a substitute
for the in-your-face approach of Ticker.

Another option is to completely remove uses of Ticker from ProcessedOptions and
rely on the user of ProcessedOptions to initialize all the stuff that it needs
in a predicable sequence (by calling the corresponding getters).

FWIW, I wasn't suggesting that the client has to do computations before
initializing the ProcessedOptions object. The code snippet I provided could go
in a static async method on ProcessedOptions.

Powered by Google App Engine
This is Rietveld 408576698