Commit Graph

470 Commits

Author SHA1 Message Date
Konstantin Shcheglov 6ad38498c8 Extract unresolved AST parsing (PARSED_UNIT1) from full parsing, which includes UriBasedDirective(s) resolution.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2229603003 .
2016-08-08 14:45:27 -07:00
Paul Berry 70bd623f36 Add an "api signature" to summaries.
The API signature of a summary is an MD5 hash of the API of the code
being summarized.  This will be used by analysis server to detect when
a summary needs to be relinked (because it was built with reference to
another summary whose API has since changed).

R=scheglov@google.com

Review URL: https://codereview.chromium.org/2216873003 .
2016-08-04 16:12:49 -07:00
Konstantin Shcheglov fa854d41f6 Fix for limited invalidation in the middle, and the unlimited invalidation for an exported library.
Consider libraries `A`, `B`, and `C`, where `C` imports `B`, and `B`
exports `A`. [RESOLVED_UNIT4] of `C` depends on [LIBRARY_ELEMENT4] of
[IMPORTED_LIBRARIES], i.e. `B`. Even though [LIBRARY_ELEMENT4] of `B`
depends on [LIBRARY_ELEMENT3]s of its [EXPORT_SOURCE_CLOSURE] (i.e. `A`
and `B`), [RESOLVED_UNIT4] of `C` sees only [LIBRARY_ELEMENT4] of `B`.

When invalidate results of `B` (but keep results of `C`), we will
invalidate and remove [LIBRARY_ELEMENT4] of `B`, so we lose knowledge
that [RESOLVED_UNIT4] of `C` indirectly depends on `A`.

The solution is do depend on [EXPORT_SOURCE_CLOSURE] of all
[IMPORTED_LIBRARIES] in [RESOLVED_UNIT4] of `C`.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2171673002 .
2016-07-21 07:26:47 -07:00
William Hesse 60db3bd080 Update task_dependency_graph after analyzer change
BUG=

Review URL: https://codereview.chromium.org/2136543002 .
2016-07-08 15:36:31 +02:00
Paul Berry efe5a31421 Remove "_finished" assertion checks from summary codegen.
These assertions were helpful back when the client manually managed
offsets.  Now that offsets are managed automatically by the toBuffer()
logic, they don't carry any benefit.

Removing these assertions will pave the way for allowing a summary to be
created, serialized, modified, and then serialized again, which we will
need to do to efficiently generate both "full" and "semantic" summaries.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2110693002 .
2016-06-28 16:22:57 -07:00
Konstantin Shcheglov 4bae18ae3b Regenerate tasks graph.
TBR

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/2106483002 .
2016-06-27 12:09:00 -07:00
pq 9a75f18e47 Introduce build configuration to summary building.
Options are largely unused but are in line with what is specified in CLI to support `build_mode` bringing us a step closer to a unified summary builder and in the short term to a provisional API that should work for Flutter SDK generation experiments in the next alpha release.

BUG=
R=brianwilkerson@google.com, paulberry@google.com

Review URL: https://codereview.chromium.org/2078033002 .
2016-06-17 13:37:29 -07:00
Jaime Wren f4ff1edcef Provide direction to users of the now deprecated class FileUriResolver
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2078703002 .
2016-06-16 15:24:17 -07:00
pq 772972ad32 Make SDK summary writing available to analyzer clients.
Not API (in `lib/src`) but available nonethess to clients such as flutter who need to be able to write their own SDK summaries (and ideally not duplicate low-level flat_buffer interactions).

BUG=
R=brianwilkerson@google.com, paulberry@google.com

Review URL: https://codereview.chromium.org/2077583002 .
2016-06-16 15:09:42 -07:00
pq ed4dc77436 Switch statement cleanups.
BUG=
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/2067973002 .
2016-06-14 12:34:08 -07:00
pq 1eefb68c25 SDK summary creation generalization (pt 1).
Steps towards generalizing summary creation bits (to allow for, among other things, flutter SDK summary creation).  API is provisional (note still in `lib/src`).

Next up:
* move result writing out of `tool/` to allow for reuse
* `SummaryBuilder.forPackageMap(..)` factory (or similar) for use in the flutter SDK case

BUG=
R=brianwilkerson@google.com, paulberry@google.com

Review URL: https://codereview.chromium.org/2055543002 .
2016-06-09 12:06:36 -07:00
pq ae9a984057 Regen task graph.
BUG=
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2023543002 .
2016-05-27 15:02:56 -07:00
Konstantin Shcheglov 0f441fa3ea Use BufferContext + offset instead of BufferPointer.
This lets us avoid creating tens of millions of BufferPointer instances
and makes DDC compilation about 6% faster.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1998833002 .
2016-05-19 20:08:26 -07:00
Paul Berry 6090636607 Improve dumping of inferred types.
We now disambiguate all types by their full library
URI (e.g. "dart:core.Map" instead of "Map").  In addition, we now expand
function types based on local functions into their arguments and return
types (e.g. "() -> dynamic" rather than
"typeof(....localFunction[0].localFunction[0])".

This allows more accurate comparison of AST-based and element-based
summaries.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1997753002 .
2016-05-19 11:04:49 -07:00
Paul Berry 655e9155a8 Add a strong-outputs mode to build_sdk_summaries.dart.
This is needed by dev_compiler, which currently has its own fork of the
SDK that can only be summarized successfully in strong mode.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1979333002 .
2016-05-16 11:29:46 -07:00
Brian Wilkerson 23b02bc351 Add support to the task model for the @required annotation
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1977903002 .
2016-05-13 11:11:48 -07:00
Paul Berry a407f6ad37 Modify dump_inferred_types to use SummaryDataStore.
This paves the way for further improvements to dump_inferred_types to
allow it to make use of linker data structures.  That will in turn make
it easier to validate the linker code by exercising more of it.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1969313006 .
2016-05-12 10:35:44 -07:00
Paul Berry abd7a34476 Update dump_inferred_types to show an index of libraries and parts.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1962813002 .
2016-05-09 12:38:33 -07:00
Paul Berry f10f138cd1 Drop trailing dynamic when dumping inferred types.
This makes it easier to compare the output of AST-based and
element-based summaries, since element-based summaries cannot
distinguish between implicit type arguments and explicitly-specified
type arguments that happen to match the default (usually `dynamic`).

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1957133002 .
2016-05-08 11:36:22 -07:00
Paul Berry 5f3481e811 Skip local variables when dumping inferred types.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1956433002 .
2016-05-05 09:14:16 -07:00
Paul Berry fca48b75de Skip local functions when dumping inferred types.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1948103002 .
2016-05-04 11:29:38 -07:00
Paul Berry c351cb3c37 Skip more initializers when dumping inferred types.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1939973002 .
2016-05-02 14:55:27 -07:00
Konstantin Shcheglov 0f0b38dab3 Implement stable resolution of generic types without type arguments to their bounds.
R=brianwilkerson@google.com, leafp@google.com
BUG= https://github.com/dart-lang/sdk/issues/26265

Review URL: https://codereview.chromium.org/1927323002 .
2016-04-29 08:25:55 -07:00
Paul Berry 09c98dc456 Modify dump_inferred_types.dart to handle missing unlinked units.
In rare cases a summary package bundle may contain a LinkedLibrary
object but not its corresponding UnlinkedUnits.  (This could happen, for
instance, if both a package and one of its dependencies contain
libraries that reference the same file as a "part"--in this case, the
UnlinkedUnit for the part might only be included in one of the package
bundles, because it is redundant in the other).

This CL modifies dump_inferred_types.dart so that it doesn't crash in
this rare corner case.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1930663003 .
2016-04-27 14:22:30 -07:00
Paul Berry f821542305 Build strong mode SDK summary with dart2js paths
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1922233002 .
2016-04-26 15:06:48 -07:00
Paul Berry abd0e1f205 Add a "raw" mode to the summary inspector
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1914073003 .
2016-04-26 09:16:23 -07:00
Paul Berry 9ab526d7bd Support additional corner cases in dump_inferred_types.dart
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1915123003 .
2016-04-25 13:39:56 -07:00
Paul Berry d8e8cbe3c8 Add a debugging tool for inspecting the contents of a summary file.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1905173002 .
2016-04-21 15:31:44 -07:00
Paul Berry 516542dc7f Don't visit parts redundantly when dumping inferred types.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1901303003 .
2016-04-20 14:11:47 -07:00
Konstantin Shcheglov 8a7b4ea225 Don't use AnalysisContext.exists() in VerifyUnitTask.
Use REFERENCED_SOURCES and MODIFICATION_TIME instead.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1902403005 .
2016-04-20 14:02:01 -07:00
Paul Berry 22369c3e19 Regenerate task dependency graph after c1475a13a0
TBR=scheglov@google.com

Review URL: https://codereview.chromium.org/1903873002 .
2016-04-20 12:26:14 -07:00
Konstantin Shcheglov cd685d96e8 Use single map of Source to modification time.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1899303003 .
2016-04-19 15:50:56 -07:00
Paul Berry 5e3b3f8d50 Regenerate task dependency graph after d3f6c67732
TBR=scheglov@google.com

Review URL: https://codereview.chromium.org/1896153002 .
2016-04-19 08:14:25 -07:00
Paul Berry 0f7c0a18e2 Add a utility for dumping inferred types from summary files.
This should be useful in validating the correctness of AST-based summary
type inference.

R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1890943002 .
2016-04-14 13:10:15 -07:00
Brian Wilkerson 9f002011ea Generate the task model graph as an HTML file and put it in the doc directory.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1817913002 .
2016-04-09 09:15:52 -07:00
Konstantin Shcheglov 9cc7f2d936 Fixes for import/export directive resolution and tasks graph.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1854003003 .
2016-04-03 12:19:26 -07:00
Brian Wilkerson deae702994 Format everything in analyzer
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1842563003 .
2016-03-28 18:16:43 -07:00
Konstantin Shcheglov 58bde1b3b4 Add the --build-summary-exclude-informative flag.
It (in combination with --build-summary-only-diet) makes the
package:path summary is almost 3 times smaller, partially because of
skipping bodies, patially because of excluding documentation comments,
and partially because of making 'codeRange' fields informative.

We also remove MD5 hashes.

As I can see after changes in method bodies we generate the exactly
same file (or at least 'cmp -l' thinks so). Adding a new field results
in a file of different length.

R=paulberry@google.com, brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1828973002 .
2016-03-24 08:20:56 -07:00
Konstantin Shcheglov 552aef6a5c Fix for building SDK summaries.
TBR

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1834433002 .
2016-03-23 13:45:11 -07:00
Konstantin Shcheglov 5e4218b754 Issue 26063. Index declarations in even partically analyzed units.
R=brianwilkerson@google.com
BUG= https://github.com/dart-lang/sdk/issues/26063

Review URL: https://codereview.chromium.org/1829463002 .
2016-03-22 17:24:17 -07:00
Konstantin Shcheglov c4c92c1f8d Use specialized _FbUint8List and Uint8ListReader.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1792523002 .
2016-03-11 14:44:27 -08:00
Konstantin Shcheglov 5a927c7373 Add hacks into build_sdk_summaries to workaround bugs in build tools.
Paul thinks that there is a bug in gyp or make, and we should generate
only one output. So, we generate the whole bundle with all summaries
and index information. And then we have separate actions that take
this bundle and extract one output each - spec.sum and strong.sum files.

R=paulberry@google.com, whesse@google.com
BUG=

Review URL: https://codereview.chromium.org/1775973003 .
2016-03-09 11:37:17 -08:00
Leaf Petersen 7d2976c7d5 Add instantiate method on ParameterizedType and InterfaceType,
and deprecate the old substitute4 in favor of instantiate.

BUG=
R=brianwilkerson@google.com, jmesserly@google.com

Review URL: https://codereview.chromium.org/1758913002 .
2016-03-02 15:06:38 -08:00
Paul Berry ff6a744f38 Implement forwards compatibility for summary enums.
If an attempt is made to read an unrecognized enum value, then rather
than crashing, we will read the default (first) value of the enum type.

This facilitates forwards compatibility by ensuring that if a new enum
value is added in the future, older code will still be able to read the
resulting summary files without crashing.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1747413002 .
2016-03-01 13:28:10 -08:00
Paul Berry 9a983bcbda Add the ability to deprecate Flatbuffer fields.
If an IDL field is marked as `@deprecated`, no setter will be
generated for it, and the getter generated for it will throw an
UnimplementedError.  This is similar to the behavior of standard
Flatbuffer tools (which generate neither setters nor getters for
deprecated fields) except that we have to generate a getter in order
to avoid warnings.

Once we have begun using summaries in the wild, we will need to make
use of this feature in order to avoid changing Id numbers and breaking
backwards compatibility.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1753883002 .
2016-03-01 13:25:02 -08:00
Konstantin Shcheglov 7d0fbd1b11 Separate 'isQualified' flags as List<bool>.
It turned out that for used names we don't need any flags because we
want to store only qualified unresolved (potential) class member
usages. So, no flags for used names at all, at least for now.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1750163003 .
2016-03-01 11:06:40 -08:00
Paul Berry e399f0f5a7 Generate a ".fbs" file representing the summary format.
This file can be consumed by standard flatbuffer tools, allowing
summaries to be consumed from other languages.  For example, a summary
file can now be converted to JSON using:

    flatc -o $outputDirectory -t \
        pkg/analyzer/lib/src/summary/format.fbs -- $inputFile

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1743713002 .
2016-02-26 10:53:33 -08:00
Konstantin Shcheglov a09461a010 Initial package indexing implementation.
More tests will be added in following CLs.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1735243003 .
2016-02-26 08:24:05 -08:00
Paul Berry 7481eff6a8 Add file identifiers to summaries.
These should make it easier for summary files to interoperate with
standard FlatBuffer tools.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1738833004 .
2016-02-25 10:36:42 -08:00
Konstantin Shcheglov 8e9aac65ab Extract PackageBundleAssembler and use for SDK and package summary generation.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1722413002 .
2016-02-24 08:26:05 -08:00