Commit Graph

470 Commits

Author SHA1 Message Date
Paul Berry 85a7affb7c Record information about parts of dependent libraries in summaries.
This information will be necessary in order to determine whether a
summary needs to be re-linked, since a change to a part of library A may
affect any other library that depends on library A, even if the defining
compilation unit of library A is unaffected.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1574113002 .
2016-01-12 12:02:47 -08:00
Konstantin Shcheglov 65f1aa1ef0 Cache values of fields and lists in summary implementations.
This significantly improves analysis time of a trivial HTML app.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1579663002 .
2016-01-11 09:29:23 -08:00
Paul Berry 0b7c10e2b1 Create a prelinker for summaries.
The prelinker is capable of rebuilding the "Prelinked" summary
information based on the "Unlinked" information.  We will need to do
this in order to make efficient use of summaries when some files are
changed but not others, or when a pub package is upgraded but another
package that depends on it is left alone.

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

Review URL: https://codereview.chromium.org/1576743002 .
2016-01-11 07:58:21 -08:00
Konstantin Shcheglov 5e326a505c Remove BuilderContext from summary builders.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1577663002 .
2016-01-10 14:03:41 -08:00
Konstantin Shcheglov 7b21739c27 Use addBool() and BoolReader in summaries.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1570383002 .
2016-01-09 14:57:17 -08:00
Konstantin Shcheglov 68bf8244f8 Use FlatBuffers for summaries.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1576663002 .
2016-01-09 10:55:00 -08:00
Paul Berry 52aa46b3be Add support for Element.docRange to the summary.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1564343004 .
2016-01-09 07:05:18 -08:00
Paul Berry c0bd3091b1 Implement support for Element.documentationComment in summaries.
Support for Element.docRange will be added in a future CL.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1573633002 .
2016-01-08 14:35:26 -08:00
Paul Berry acc709b46b Add Element.nameOffset and LibraryElement.nameLength to summaries.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1569033002 .
2016-01-07 14:47:14 -08:00
Paul Berry f6a8f29ef0 Add uriOffset and uriEnd to the summary.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1565283002 .
2016-01-07 12:55:44 -08:00
Paul Berry 9d5e7bf83d Add a count of type parameters to UnlinkedPublicName.
This will be necessary to allow summaries to be relinked.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1558353003 .
2016-01-06 11:34:21 -08:00
Paul Berry 5d47028137 Eliminate constructor return types from summaries.
These can be easily inferred at the time the summary is resynthesized
into an element model.  This should make the summary size marginally
smaller, and make it easier to create summaries straight from the AST.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1565643002 .
2016-01-06 06:47:58 -08:00
Konstantin Shcheglov dfda5d273a Generate documentation for summaries.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1563453002 .
2016-01-05 09:53:48 -08:00
William Hesse 634e5a1d02 Refs #25328 Use a portable shebang
BSD systems don't place bash in /bin and a lot of the dart tools
hardcode a #!/bin/bash shebang that fails the 'all' target build
(not able to execute dart2js since the interpreter is not found).

Solve the issue by using #!/usr/bin/env as the shebang. For scripts
that need to pass arguments to bash modify the script to use the set
command as the first executed line of shell.

BUG=
R=whesse@google.com

Review URL: https://codereview.chromium.org/1552313002 .
2016-01-05 16:26:28 +01:00
Paul Berry e626abcebc Encode number of type parameters in prelinked summary.
In a future CL, this should allow the element model to be
resynthesized from a summary more efficiently, since it won't be
necessary to consult the referenced elements when resynthesizing a
FunctionTypeImpl.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1555233002 .
2016-01-04 15:37:35 -08:00
Paul Berry 8991b1c58d Use List<String> for combinators in summaries.
Now that summaries can contain List<String>, there's no need to use a
list of an intermediate data structure.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1559963002 .
2016-01-04 10:11:02 -08:00
Paul Berry 8a445a3f01 Introduce code to generate UnlinkedPublicNamespace directly from an AST.
This is an initial step towards allowing the entire summary to be
generated directly from the AST rather than requiring an element model
to be built.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1544213002 .
2015-12-25 19:17:59 -08:00
Paul Berry ac37dc71d0 Create a section of the summary for public namespace information.
This will make it easier to re-link summaries when a file changes,
since all the information that is needed from imported libraries will
be in the "public namespace" section of the summary.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1543403002 .
2015-12-24 15:55:16 -08:00
Konstantin Shcheglov 69723d3388 Change SdkBundle to better fit its usage by SummaryResynthesizer.
This is probably a better format for using with FlatBuffers - we don't
need to read every library to find an unlinked unit.

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

Review URL: https://codereview.chromium.org/1539103002 .
2015-12-20 10:27:07 -08:00
Konstantin Shcheglov 69068313c6 Allow String and List<String> in summary IDL.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1533213002 .
2015-12-20 10:05:59 -08:00
Leaf Petersen a34bab7fde Use READY_RESOLVED_UNIT flag for ordering tasks.
Fixes #25271.

BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1534033004 .
2015-12-18 14:17:52 -08:00
Konstantin Shcheglov 49d8910e6c A Dart script for building SDK summary.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1538923003 .
2015-12-18 12:35:56 -08:00
Paul Berry f1ea359020 Fix "if" conditions in summary Builder setters.
Previously, we were generating code like:

    if (_value != null || _value == <default>) {
      <store _value in the summary>
    }

which meant that (a) default values were being unnecessarily stored in
the summaries, and (b) passing null to a summary Builder setter would
have caused a crash.

This CL modifies the code generator to output code like this:

    if (!(_value == null || _value == <default>)) {
      <store _value in the summary>
    }

which has the intended behavior of treating `null` like the default
value, and suppressing the default value from appearing in the summary.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1539953002 .
2015-12-18 10:23:03 -08:00
Ivan Posva 7e6d5a579d - Fix more bad uses of Platform.packageRoot.
- Simplify previous fixes.

BUG=
R=lrn@google.com

Review URL: https://codereview.chromium.org/1536043002 .
2015-12-18 08:34:07 -08:00
Konstantin Shcheglov 50876b0b2c Information about SDK libraries.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1540493003 .
2015-12-18 07:01:34 -08:00
Paul Berry 3ff75cc723 Separate prelinked and unlinked parts of summaries.
This will allow summaries to be "re-linked" without having to touch
their UnlinkedUnit data structures (which are much larger than the
corresponding prelinked data).

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1530303005 .
2015-12-17 14:27:10 -08:00
Konstantin Shcheglov e1455ce920 Stop using RESOLVED_UNIT_x for other libraries.
This makes analysis of a command line Hello World application about 20% faster.
Even before summaries :-)

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1531393002 .
2015-12-17 13:57:20 -08:00
Ivan Posva a3f816e75b - Fix usage of Platform.packageRoot.
BUG=

Review URL: https://codereview.chromium.org/1533693003 .
2015-12-17 13:08:19 -08:00
Konstantin Shcheglov 83c1106ffe Compute values of elements a unit constant expressions depend on.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1539623002 .
2015-12-17 11:47:54 -08:00
Paul Berry 493a03a0ed Add UnlinkedClass.hasNoSupertype property to summaries.
This is necessary in order to properly summarize the core type `Object`,
which lacks a supertype.

Note that there is no test for this functionality in
resynthesize_test.dart.  It will be covered as soon as the test
`fail_core` is enabled.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1531913002 .
2015-12-16 15:18:49 -08:00
Paul Berry ac170168dd Add support for the "external" keyword to summaries.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1528983004 .
2015-12-16 13:32:19 -08:00
Paul Berry b22d7d532f Merge the prefix and references tables.
This makes the UnlinkedLibrary type go away, which means that we no
longer have any unlinked summary data which is spread across the
compilation units constituting a library.  That in turn means that we
should be able to safely re-link summaries even in the (pathological)
case where a change to URI resolution affects the relationship between a
library and its parts.

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

Review URL: https://codereview.chromium.org/1528113002 .
2015-12-15 12:33:25 -08:00
Paul Berry ceecfe862b Reserve element 0 in the references table for dynamic.
In addition to simplifying some serialization/deserialization code, this
paves the way for merging the references table with the prefixes table
by allowing the zeroth entry in both tables to act as a sentinel value.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1528083002 .
2015-12-15 11:25:11 -08:00
Paul Berry 518ae623d6 Move summary references into UnlinkedUnit and PrelinkedUnit.
This is a follow up to commit
f85684604b, which reorganized the
declarations by compilation unit to pave the way for allowing
summaries to be "re-linked" if the relationship between part files
changes.  Organizing references by compilation unit is another
necessary step to make that possible.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1523093003 .
2015-12-15 10:55:45 -08:00
Konstantin Shcheglov db1bf5fecf Couple comment tweaks for summaries IDL.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1521963003 .
2015-12-15 09:52:45 -08:00
Paul Berry f85684604b Organize summary declarations by unit rather than by library.
In the initial implementation of summaries, all declarations for a
given library were thrown together into a single bucket, regardless of
the compilation unit in which they appeared.  This was done on the
grounds that semantically, the compilation unit in which a declaration
appears is irrelevant.

However, it turns out that this conflicts with one of the design goals
of summaries, which is to allow summaries to be quickly "re-linked"
when URI resolution changes.  Since "part" declarations use URIs to
refer to part files, this means that URI resolution may affect the
relationship among compilation units within a library; thus, the
declarations for each compilation unit need to be in their own data
structure.

A side benefit of this reorganization is to make the structure of the
summary more similar to the structure of the element model; this
should in turn make it simpler (and possibly more performant) to
convert between element models and summaries.

This CL reorganizes the declarations themselves; future CLs will
reorganize the dependency and resolution information to match.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1530503002 .
2015-12-14 16:30:15 -08:00
Brian Wilkerson 2a190aa11a Fix imports within the analyzer package
R=paulberry@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1524893002 .
2015-12-14 12:25:41 -08:00
Paul Berry 9cff7ca404 Ensure that summary builders aren't used after call to finish()
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1522123002 .
2015-12-14 08:59:20 -08:00
Brian Wilkerson 1f3dabd9c7 Ensure that a complete library element has constants evaluated (issue 24890)
R=danrubel@google.com, eernst@google.com, paulberry@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/1486663003 .
2015-12-14 07:51:07 -08:00
Paul Berry 45068f01ed Track implicit vs explicit types in summaries.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1524443002 .
2015-12-11 13:49:14 -08:00
Brian Wilkerson f0d249e269 Clean up package imports and library names
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1513643009 .
2015-12-10 08:11:56 -08:00
Brian Wilkerson 600fc17de1 Clean-up the registration of plugins
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1487953002 .
2015-12-02 13:25:28 -08:00
Konstantin Shcheglov aa9668b264 Propagate types for import/export closure before resolving.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1465303002 .
2015-11-23 12:52:03 -08:00
Paul Berry ce7625a22c Buildbot fixes after 8c324a5b8d
- Regenerate tasks.dot

- Mark a test as passing that previously failed
  (fail_finalPropertyInducingVariable_classMember_instance_unprefixed)

Note that there are three other tests that I would have expected to
start passing as well (see
fail_finalPropertyInducingVariable_classMember_instance_*), but they
still fail.

TBR=scheglov@google.com

Review URL: https://codereview.chromium.org/1469093002 .
2015-11-23 09:04:43 -08:00
Paul Berry 84c3cdb048 Add a unit index to prelinked type references in summaries.
In order to avoid having to reconstitute the entire element model when
deserializing a library summary, we'll need to be able to create element
handles for any elements referenced by the library.  Since element
handles operate using a "location", and the "location" records
information about the compilation unit containing the element, this
means that the library summary needs to track which unit each referenced
element lives in (even though this information would otherwise not be
semantically relevant).

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1468583002 .
2015-11-20 14:10:42 -08:00
Brian Wilkerson b2728c15a6 Revert "Fix test failures on the bots"
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1468623002 .
2015-11-20 14:04:11 -08:00
Brian Wilkerson 6b45d6544c Fix test failures on the bots
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1467623002 .
2015-11-20 11:48:35 -08:00
Paul Berry 0aebd7d6b2 Implement support for generic methods in summaries.
In theory generic top level functions are also supported, but they
aren't tested due to lack of parser support.

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

Review URL: https://codereview.chromium.org/1455863003 .
2015-11-18 10:26:28 -08:00
Paul Berry 178cebb634 Modify summary Builder classes to avoid the use of Object.
Instead of passing around opaque Objects which are the result of
calling the Builder.finish() methods, we pass around the Builder
objects themselves, and we call finish() from within the generated
code.  This pushes the lack of type safety into the generated code,
leaving the handwritten code type safe.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1452363002 .
2015-11-17 15:50:26 -08:00
Paul Berry 74f09b99f1 Introduce code to generate summaries from an element model.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1420053011 .
2015-11-11 13:17:59 -08:00