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

Issue 2953703002: Tweak public APIs and use them in patch_sdk, dart2js, and kernel-service (Closed)

Created:
3 years, 6 months ago by Siggi Cherem (dart-lang)
Modified:
3 years, 5 months ago
CC:
reviews_dartlang.org, turnidge, rmacnak, dart-fe-team+reviews_google.com, vm-dev_dartlang.org
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Tweak public APIs and use them in patch_sdk, dart2js, and kernel-service. This CL tweaks the public APIs in package:front_end, and starts using those APIs outside the package. For example, this removes 9 uses of DillTarget, so it is not longer mentioned outside pkg/front_end and the analyzer_target. Actual changes: - in package:front_end * added kernel_generator_impl: new file contains code that used to be in kernel_generator. Code has some modifications: it uses a single canonical-root when loading summaries, and it supports generating both outlines and kernel in one go. * removed code that didn't belong here: a. most of calculating deps for .GN moved to patch_sdk b. vm-specific outcomes moved to kernel-service * updated how `native` is implemented, so we can more easily support dart2js and ddc * updated how we check where `int`, `bool`, etc can be implemented. * added support "hermetic mode" in modular builds ('chaseDependencies = false' option) * moved `trim` step out of fasta, and for now call it only within the public API. This is not yet exposed, and I stopped covering it in most tests (now only covered in shaker tests). The plan is to add tests for the public API covering this in the future. * removed `uriToSource` when serializing outlines * added unit tests for public APIs - patch_sdk * use the public API to craete platform.dill, outline.dill (now 500K insted of 3Mb because it excludes sources), and vmservice_io.dill * moved here logic internal to .GN - kernel service * use the public API * moved here logic that depends on VM internals (e.g. status enum, compilation results) - package:compiler * use the public API in tools and unit tests * simplified patched-sdk generation: no more extending fasta's internals - package:kernel * fix bug in deserialization: initializers and other lists were overwritten accidentally with external definitions. * updated unit tests, moved shared logic to frontend/src/fasta/testing R=johnniwinther@google.com, paulberry@google.com Committed: https://github.com/dart-lang/sdk/commit/610d0819477c5bb0ede1d9f219c50e91e5994afa

Patch Set 1 #

Total comments: 157

Patch Set 2 : cl comments #

Total comments: 4

Patch Set 3 : add zone and crash report #

Total comments: 6

Patch Set 4 : cl review updates #

Patch Set 5 : cl review updates: cleanup in kernel deserialization #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1975 lines, -1301 lines) Patch
A pkg/compiler/lib/src/kernel/dart2js_target.dart View 1 2 3 1 chunk +92 lines, -0 lines 0 comments Download
M pkg/compiler/lib/src/kernel/fasta_support.dart View 1 chunk +0 lines, -201 lines 0 comments Download
M pkg/compiler/tool/generate_kernel.dart View 1 2 3 1 chunk +45 lines, -24 lines 0 comments Download
M pkg/front_end/example/incremental_reload/compiler_with_invalidation.dart View 1 chunk +1 line, -1 line 0 comments Download
M pkg/front_end/lib/compiler_options.dart View 1 2 3 4 chunks +103 lines, -56 lines 0 comments Download
A pkg/front_end/lib/front_end.dart View 1 2 3 1 chunk +14 lines, -0 lines 0 comments Download
M pkg/front_end/lib/kernel_generator.dart View 1 2 3 3 chunks +32 lines, -135 lines 0 comments Download
M pkg/front_end/lib/src/base/processed_options.dart View 1 2 3 8 chunks +208 lines, -42 lines 0 comments Download
M pkg/front_end/lib/src/fasta/builder/library_builder.dart View 1 chunk +2 lines, -0 lines 0 comments Download
M pkg/front_end/lib/src/fasta/compile_platform.dart View 1 2 3 2 chunks +27 lines, -34 lines 0 comments Download
M pkg/front_end/lib/src/fasta/fasta.dart View 5 chunks +8 lines, -79 lines 0 comments Download
M pkg/front_end/lib/src/fasta/kernel/body_builder.dart View 1 2 3 4 chunks +8 lines, -2 lines 0 comments Download
M pkg/front_end/lib/src/fasta/kernel/kernel_outline_shaker.dart View 2 chunks +5 lines, -4 lines 0 comments Download
M pkg/front_end/lib/src/fasta/kernel/kernel_target.dart View 6 chunks +5 lines, -86 lines 0 comments Download
M pkg/front_end/lib/src/fasta/kernel/utils.dart View 1 2 3 2 chunks +24 lines, -0 lines 0 comments Download
M pkg/front_end/lib/src/fasta/loader.dart View 1 chunk +3 lines, -0 lines 0 comments Download
M pkg/front_end/lib/src/fasta/parser/dart_vm_native.dart View 1 2 3 1 chunk +0 lines, -56 lines 0 comments Download
M pkg/front_end/lib/src/fasta/parser/listener.dart View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
A pkg/front_end/lib/src/fasta/parser/native_support.dart View 1 2 3 1 chunk +86 lines, -0 lines 0 comments Download
M pkg/front_end/lib/src/fasta/parser/parser.dart View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M pkg/front_end/lib/src/fasta/source/diet_listener.dart View 1 2 3 5 chunks +10 lines, -4 lines 0 comments Download
M pkg/front_end/lib/src/fasta/source/outline_builder.dart View 1 2 3 5 chunks +11 lines, -6 lines 0 comments Download
M pkg/front_end/lib/src/fasta/source/source_loader.dart View 2 chunks +1 line, -9 lines 0 comments Download
M pkg/front_end/lib/src/fasta/target_implementation.dart View 2 chunks +0 lines, -25 lines 0 comments Download
M pkg/front_end/lib/src/fasta/testing/kernel_chain.dart View 2 chunks +39 lines, -1 line 0 comments Download
D pkg/front_end/lib/src/fasta/vm.dart View 1 chunk +0 lines, -165 lines 0 comments Download
M pkg/front_end/lib/src/incremental_kernel_generator_impl.dart View 4 chunks +3 lines, -19 lines 0 comments Download
A pkg/front_end/lib/src/kernel_generator_impl.dart View 1 2 3 1 chunk +171 lines, -0 lines 0 comments Download
M pkg/front_end/lib/src/simple_error.dart View 1 2 3 1 chunk +0 lines, -11 lines 0 comments Download
A pkg/front_end/lib/src/testing/compiler_common.dart View 1 2 3 4 1 chunk +123 lines, -0 lines 0 comments Download
M pkg/front_end/lib/summary_generator.dart View 1 2 chunks +18 lines, -7 lines 0 comments Download
M pkg/front_end/test/fasta/shaker_test.dart View 5 chunks +12 lines, -30 lines 0 comments Download
M pkg/front_end/test/fasta/testing/suite.dart View 3 chunks +6 lines, -9 lines 0 comments Download
M pkg/front_end/test/incremental_kernel_generator_test.dart View 2 chunks +3 lines, -6 lines 0 comments Download
A pkg/front_end/test/kernel_generator_test.dart View 1 chunk +210 lines, -0 lines 0 comments Download
M pkg/front_end/test/src/base/processed_options_test.dart View 4 chunks +111 lines, -2 lines 0 comments Download
M pkg/front_end/test/src/incremental/hot_reload_e2e_test.dart View 1 chunk +1 line, -1 line 0 comments Download
M pkg/front_end/test/subpackage_relationships_test.dart View 1 2 3 4 chunks +7 lines, -10 lines 0 comments Download
A pkg/front_end/test/summary_generator_test.dart View 1 chunk +152 lines, -0 lines 0 comments Download
M pkg/front_end/tool/fasta_perf.dart View 1 2 3 7 chunks +23 lines, -36 lines 0 comments Download
M pkg/front_end/tool/perf.dart View 1 2 3 3 chunks +2 lines, -6 lines 0 comments Download
M pkg/kernel/lib/binary/ast_from_binary.dart View 1 2 3 4 4 chunks +32 lines, -9 lines 0 comments Download
M pkg/kernel/lib/binary/limited_ast_to_binary.dart View 1 2 3 4 2 chunks +25 lines, -1 line 0 comments Download
M pkg/kernel/lib/target/targets.dart View 1 chunk +23 lines, -0 lines 0 comments Download
M pkg/kernel/lib/target/vm.dart View 1 chunk +8 lines, -0 lines 0 comments Download
M pkg/kernel/test/closures/suite.dart View 4 chunks +13 lines, -73 lines 0 comments Download
M pkg/kernel/test/interpreter/suite.dart View 1 chunk +7 lines, -72 lines 0 comments Download
M pkg/pkg.status View 1 chunk +2 lines, -0 lines 0 comments Download
D runtime/bin/vmservice_sdk/lib/libraries.json View 1 chunk +0 lines, -6 lines 0 comments Download
M tests/compiler/dart2js/dart2js.status View 1 chunk +0 lines, -2 lines 0 comments Download
M tests/compiler/dart2js/dill_loader_test.dart View 3 chunks +21 lines, -17 lines 0 comments Download
M tools/patch_sdk.dart View 1 4 chunks +104 lines, -45 lines 0 comments Download
M utils/kernel-service/kernel-service.dart View 3 chunks +172 lines, -7 lines 0 comments Download

Messages

Total messages: 39 (21 generated)
Siggi Cherem (dart-lang)
Note: I wrote a general summary of the changes in the CL description, I also ...
3 years, 5 months ago (2017-06-29 03:38:41 UTC) #19
ahe
Comments so far. I'm working my way through the API, and I expect to work ...
3 years, 5 months ago (2017-06-29 11:09:15 UTC) #20
Johnni Winther
package:compiler changes LGTM
3 years, 5 months ago (2017-06-29 12:44:26 UTC) #21
Paul Berry
https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/lib/compiler_options.dart File pkg/front_end/lib/compiler_options.dart (right): https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/lib/compiler_options.dart#newcode51 pkg/front_end/lib/compiler_options.dart:51: /// will be used. On 2017/06/29 11:09:15, ahe wrote: ...
3 years, 5 months ago (2017-06-29 18:51:08 UTC) #22
Siggi Cherem (dart-lang)
https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/lib/compiler_options.dart File pkg/front_end/lib/compiler_options.dart (right): https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/lib/compiler_options.dart#newcode19 pkg/front_end/lib/compiler_options.dart:19: typedef void ErrorHandler(CompilationError error); On 2017/06/29 11:09:14, ahe wrote: ...
3 years, 5 months ago (2017-06-30 04:12:02 UTC) #24
Siggi Cherem (dart-lang)
I just uploaded more patch from a couple suggestions Peter mentioned offine: I just added ...
3 years, 5 months ago (2017-06-30 23:03:11 UTC) #25
ahe
Comments so far. https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/lib/compiler_options.dart File pkg/front_end/lib/compiler_options.dart (right): https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/lib/compiler_options.dart#newcode43 pkg/front_end/lib/compiler_options.dart:43: ErrorHandler onError = defaultErrorHandler; I think ...
3 years, 5 months ago (2017-07-03 10:05:31 UTC) #26
Paul Berry
lgtm https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/lib/compiler_options.dart File pkg/front_end/lib/compiler_options.dart (right): https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/lib/compiler_options.dart#newcode51 pkg/front_end/lib/compiler_options.dart:51: /// will be used. On 2017/06/30 04:12:01, Siggi ...
3 years, 5 months ago (2017-07-04 15:12:15 UTC) #27
Siggi Cherem (dart-lang)
Thanks for all the comments! Peter - it's great to see all your API suggestions. ...
3 years, 5 months ago (2017-07-05 03:39:30 UTC) #28
ahe
I'm sorry, but I'm still working on this review. Comments so far. So far I'm ...
3 years, 5 months ago (2017-07-05 13:29:40 UTC) #29
Siggi Cherem (dart-lang)
Thanks! > I'm sorry, but I'm still working on this review. Comments so far. No ...
3 years, 5 months ago (2017-07-05 18:42:12 UTC) #31
ahe
Still working... https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/lib/src/testing/compiler_common.dart File pkg/front_end/lib/src/testing/compiler_common.dart (right): https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/lib/src/testing/compiler_common.dart#newcode6 pkg/front_end/lib/src/testing/compiler_common.dart:6: library front_end.test.compiler_options_common; front_end.test -> fasta.testing https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/lib/src/testing/compiler_common.dart#newcode68 pkg/front_end/lib/src/testing/compiler_common.dart:68: ...
3 years, 5 months ago (2017-07-06 13:12:22 UTC) #32
Paul Berry
https://codereview.chromium.org/2953703002/diff/140001/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/2953703002/diff/140001/pkg/front_end/test/src/base/processed_options_test.dart#newcode30 pkg/front_end/test/src/base/processed_options_test.dart:30: new Program(libraries: [new Library(Uri.parse('file:///a/b.dart'))]); On 2017/07/06 13:12:22, ahe wrote: ...
3 years, 5 months ago (2017-07-06 14:20:05 UTC) #33
Siggi Cherem (dart-lang)
https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/lib/src/testing/compiler_common.dart File pkg/front_end/lib/src/testing/compiler_common.dart (right): https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/lib/src/testing/compiler_common.dart#newcode6 pkg/front_end/lib/src/testing/compiler_common.dart:6: library front_end.test.compiler_options_common; On 2017/07/06 13:12:22, ahe wrote: > front_end.test ...
3 years, 5 months ago (2017-07-06 19:05:28 UTC) #34
Siggi Cherem (dart-lang)
Peter said offline that he will continue reviewing, but that I can go ahead and ...
3 years, 5 months ago (2017-07-07 22:03:51 UTC) #35
Siggi Cherem (dart-lang)
Committed patchset #5 (id:260001) manually as 610d0819477c5bb0ede1d9f219c50e91e5994afa (presubmit successful).
3 years, 5 months ago (2017-07-07 22:14:29 UTC) #37
ahe
This completes my review of patch set 1. https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/test/kernel_generator_test.dart File pkg/front_end/test/kernel_generator_test.dart (right): https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/test/kernel_generator_test.dart#newcode23 pkg/front_end/test/kernel_generator_test.dart:23: await ...
3 years, 5 months ago (2017-07-11 09:34:27 UTC) #38
Siggi Cherem (dart-lang)
3 years, 5 months ago (2017-07-11 23:16:32 UTC) #39
Message was sent while issue was closed.
https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/test/ker...
File pkg/front_end/test/kernel_generator_test.dart (right):

https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/test/ker...
pkg/front_end/test/kernel_generator_test.dart:23: await compileScript('main() =>
print("hi");', options: options);
On 2017/07/11 09:34:26, ahe wrote:
> Make this source snippet a shared constant and test that it can actually be
> compiled.

will do

https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/test/ker...
pkg/front_end/test/kernel_generator_test.dart:31: ..sdkSummary =
Uri.parse('file:///not_existing_summary_file')
On 2017/07/11 09:34:26, ahe wrote:
> Use custom URI.

Ack (I replied in more detail on the other file)

https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/test/ker...
pkg/front_end/test/kernel_generator_test.dart:79:
expect(program.uriToSource['file:///a/b/c/a.dart'], isNotNull);
On 2017/07/11 09:34:26, ahe wrote:
> Use custom URI.

Acknowledged.

https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/test/ker...
pkg/front_end/test/kernel_generator_test.dart:83: var program = await
compileScript('a() => print("hi"); main() {}',
On 2017/07/11 09:34:26, ahe wrote:
> Add TODO about requiring main here?

I am not sure I follow - you want to not require it?

Note that to keep this unrelated to the summary generator tests I decided to use
here the compileScript + serialize it as a summary (hence why it needs a
`main`). I could just use the summary generator here instead though, then the
main would not be necessary.

https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/test/ker...
pkg/front_end/test/kernel_generator_test.dart:102: .firstWhere((lib) =>
lib.importUri.path == '/a/b/c/a.dart');
On 2017/07/11 09:34:26, ahe wrote:
> Custom URI.

Acknowledged.

https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/test/ker...
pkg/front_end/test/kernel_generator_test.dart:107: var program = await
compileScript('a() => print("hi"); main() {}',
On 2017/07/11 09:34:26, ahe wrote:
> TODO about main?

Acknowledged.

https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/test/ker...
pkg/front_end/test/kernel_generator_test.dart:125: .firstWhere((lib) =>
lib.importUri.path == '/a/b/c/a.dart');
On 2017/07/11 09:34:26, ahe wrote:
> Custom URI.

Acknowledged.

https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/test/src...
File pkg/front_end/test/src/base/processed_options_test.dart (right):

https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/test/src...
pkg/front_end/test/src/base/processed_options_test.dart:30: new
Program(libraries: [new Library(Uri.parse('file:///a/b.dart'))]);
On 2017/07/11 09:34:26, ahe wrote:
> On 2017/07/06 14:20:05, Paul Berry wrote:
> > On 2017/07/06 13:12:22, ahe wrote:
> > > As far as I can tell, this file relies heavily on the assumption that its
> > being
> > > run on a machine that doesn't have a the following directories:
> > > 
> > > /a
> > > /sdk
> > > etc.
> > > 
> > > This is super brittle and easily avoided by using custom URI schemes.
> > 
> > Actually it doesn't matter what directories exist on the machine, since
we're
> > using a MemoryFileSystem.  The physical file system is never examined.
> 
> I think it matters for the same reason as this is problematic:
> 
>     const bool isTrue = false;
> 
> Using file URIs as fake URIs is brittle, especially since we also have a
hybrid
> file system.

Next time we see each other we can discuss more about this. For now I filed
https://github.com/dart-lang/sdk/issues/30141

https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/tool/fas...
File pkg/front_end/tool/fasta_perf.dart (right):

https://codereview.chromium.org/2953703002/diff/140001/pkg/front_end/tool/fas...
pkg/front_end/tool/fasta_perf.dart:74:
Uri.base.resolve(Platform.resolvedExecutable).resolve('patched_sdk/');
On 2017/07/11 09:34:26, ahe wrote:
> Uri.base.resolveUri(new
> Uri.file(Platform.resolvedExecutable)).resolve('patched_sdk/');

When do these two options behave differently? If you have a different scheme?

https://codereview.chromium.org/2953703002/diff/140001/tools/patch_sdk.dart
File tools/patch_sdk.dart (right):

https://codereview.chromium.org/2953703002/diff/140001/tools/patch_sdk.dart#n...
tools/patch_sdk.dart:129: var target = forVm
On 2017/07/11 09:34:26, ahe wrote:
> This seems brittle compared to:
> 
> switch (mode) {
>   case "vm": ...
>   case "flutter": ...
>   case "dart2js" ...
>   default:
>     throw "Unhandled mode: $mode";
> }

will do

Powered by Google App Engine
This is Rietveld 408576698