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

Issue 2757753002: Migrate DDC to the new analysis driver.

Created:
3 years, 9 months ago by scheglov
Modified:
3 years, 6 months ago
CC:
reviews_dartlang.org
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Migrate DDC to the new analysis driver. This version is not ready to be landed as is yet. Known problems: 1. The changes to AnalysisDriver and file system state are not tested, and some are just incorrect are is (e.g. _cachedResults). 2. There are still 16 test failures while running DDC presubmit. But, I'd like to get review from DDC people, whether they think this approach is OK, or there are some fundamental problems. R=vsm@google.com, jmesserly@google.com, brianwilkerson@google.com BUG=

Patch Set 1 #

Total comments: 8

Patch Set 2 : Clean up, make less async. #

Patch Set 3 : Update native types. #

Total comments: 1

Patch Set 4 : Rebase #

Patch Set 5 : Rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+279 lines, -226 lines) Patch
M pkg/dev_compiler/bin/dartdevc.dart View 1 2 chunks +2 lines, -2 lines 0 comments Download
M pkg/dev_compiler/lib/src/analyzer/context.dart View 1 1 chunk +1 line, -1 line 0 comments Download
M pkg/dev_compiler/lib/src/compiler/code_generator.dart View 1 2 3 4 14 chunks +34 lines, -35 lines 0 comments Download
M pkg/dev_compiler/lib/src/compiler/command.dart View 1 2 3 4 6 chunks +7 lines, -6 lines 0 comments Download
M pkg/dev_compiler/lib/src/compiler/compiler.dart View 1 2 3 4 7 chunks +113 lines, -49 lines 0 comments Download
M pkg/dev_compiler/lib/src/compiler/element_helpers.dart View 1 1 chunk +1 line, -1 line 0 comments Download
M pkg/dev_compiler/lib/src/compiler/error_helpers.dart View 1 4 chunks +16 lines, -17 lines 0 comments Download
M pkg/dev_compiler/lib/src/compiler/extension_types.dart View 1 2 4 chunks +37 lines, -57 lines 0 comments Download
M pkg/dev_compiler/lib/src/compiler/nullable_type_inference.dart View 1 2 chunks +2 lines, -2 lines 0 comments Download
M pkg/dev_compiler/lib/src/compiler/side_effect_analysis.dart View 1 3 chunks +6 lines, -5 lines 0 comments Download
M pkg/dev_compiler/test/codegen_test.dart View 1 6 chunks +8 lines, -7 lines 0 comments Download
M pkg/dev_compiler/test/not_yet_strong_tests.dart View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M pkg/dev_compiler/test/options/options_test.dart View 1 5 chunks +7 lines, -7 lines 0 comments Download
M pkg/dev_compiler/tool/build_pkgs.dart View 1 2 3 4 5 chunks +37 lines, -28 lines 0 comments Download
M pkg/dev_compiler/tool/build_sdk.dart View 1 2 3 4 2 chunks +2 lines, -2 lines 0 comments Download
M pkg/dev_compiler/web/web_command.dart View 1 2 3 4 5 chunks +5 lines, -7 lines 0 comments Download

Messages

Total messages: 12 (0 generated)
scheglov
3 years, 9 months ago (2017-03-16 20:33:49 UTC) #1
vsm
On 2017/03/16 20:33:49, scheglov wrote: Generally ok with this approach. Some q's: do you see ...
3 years, 9 months ago (2017-03-17 15:50:32 UTC) #2
scheglov
On 2017/03/17 15:50:32, vsm wrote: > On 2017/03/16 20:33:49, scheglov wrote: > > Generally ok ...
3 years, 9 months ago (2017-03-17 16:22:17 UTC) #3
Jennifer Messerly
seems very promising!!! high level comment ... it's best to keep async as coarse grained ...
3 years, 9 months ago (2017-03-17 18:33:38 UTC) #4
scheglov
PTAL https://codereview.chromium.org/2757753002/diff/1/pkg/dev_compiler/lib/src/compiler/compiler.dart File pkg/dev_compiler/lib/src/compiler/compiler.dart (right): https://codereview.chromium.org/2757753002/diff/1/pkg/dev_compiler/lib/src/compiler/compiler.dart#newcode119 pkg/dev_compiler/lib/src/compiler/compiler.dart:119: { On 2017/03/17 18:33:37, Jennifer Messerly wrote: > ...
3 years, 8 months ago (2017-04-25 17:07:35 UTC) #5
Brian Wilkerson
lgtm
3 years, 8 months ago (2017-04-25 17:13:50 UTC) #6
scheglov
With this change we pass presubmit tests. But when I try to run tool/browser_test.sh, it ...
3 years, 8 months ago (2017-04-25 17:27:00 UTC) #7
scheglov
Some progress. I replaced using HashSet.identity() with normal HashSet. Now all tests run and still, ...
3 years, 8 months ago (2017-04-25 20:39:02 UTC) #8
Jennifer Messerly
On 2017/04/25 20:39:02, scheglov wrote: > Some progress. > I replaced using HashSet.identity() with normal ...
3 years, 7 months ago (2017-05-01 19:27:14 UTC) #9
Jennifer Messerly
Once the test issue is worked out, this LGTM! Thanks for putting so much work ...
3 years, 7 months ago (2017-05-01 19:31:35 UTC) #10
scheglov
On 2017/05/01 19:27:14, Jennifer Messerly wrote: > On 2017/04/25 20:39:02, scheglov wrote: > > Some ...
3 years, 7 months ago (2017-05-03 17:12:40 UTC) #11
Jennifer Messerly
3 years, 7 months ago (2017-05-10 18:53:31 UTC) #12
Okay here's what's up with async_helper:

if I add this print statement to compiler.dart:

      UnitElementResult unitResult = await driver.getUnitElement(sourcePath);
      LibraryElement library = unitResult.element.library;
      print('!!! $sourceUri|${library.source.uri}');
      librariesToCompile.add(library);

and then run ./tool/build_pkgs.sh

... you'll see it print:

!!!
package:async_helper/async_helper.dart|file:///Users/jmesserly/src/dart/sdk/pkg/dev_compiler/test/codegen/async_helper.dart
!!! package:expect/expect.dart|package:expect/expect.dart
!!! package:expect/minitest.dart|package:expect/minitest.dart
...


so we request package:async_helper, but we get back something with a file URI.
This resolves differently. Other packages work.

So what's special about async_helper? well if you look in tools/build_pkgs.dart,
you'll see:

  if (module == 'async_helper') {
    args.add('--url-mapping=package:async_helper/async_helper.dart,'
        'test/codegen/async_helper.dart');
  }

... so my guess is the --url-mapping has changed somehow. It seems to be applied
"eagerly" leaving the LibraryElement without the correct URI.

I don't know if that's a problem or not. I forgot what that Analyzer feature is
intended for.

If you believe that is correct behavior for --url-mapping or you think it's okay
to temporarily regress it, you can fix the test in question with this patch:

diff --git a/pkg/dev_compiler/tool/build_pkgs.dart
b/pkg/dev_compiler/tool/build_pkgs.dart
index 901e9a8a4c..85ca884e66 100755
--- a/pkg/dev_compiler/tool/build_pkgs.dart
+++ b/pkg/dev_compiler/tool/build_pkgs.dart
@@ -101,6 +101,12 @@ Future<Null> compileModule(String module,
   if (module == 'async_helper') {
     args.add('--url-mapping=package:async_helper/async_helper.dart,'
         'test/codegen/async_helper.dart');
+    // The custom url-mapping option in Analyzer has changed.
+    // Now the package URI gets turned into a file URI during resolution.
+    //
+    // Because of that, we need a library-root to find the correct root
+    // directory for this package, and thus find the library's name.
+    args.add('--library-root=test/codegen/');
   }
 
   await compile(args);

Powered by Google App Engine
This is Rietveld 408576698