Commit Graph

264 Commits

Author SHA1 Message Date
Paul Berry f93e2d3212 Remove some summary TODOs that have already been addressed.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1636893003 .
2016-01-26 11:13:10 -08:00
Konstantin Shcheglov 8485e42a27 Record static constant public fields.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1639533003 .
2016-01-26 10:44:21 -08:00
Konstantin Shcheglov b0836ee7b9 Support for constructor references in constant serializer and prelinker.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1633863002 .
2016-01-26 08:23:12 -08:00
Konstantin Shcheglov 013f0066ff Include explicit constructors and static methods into UnlinkedPublicName
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1619253003 .
2016-01-25 09:27:24 -08:00
Paul Berry e97db5219c Store the result of type inference in summaries.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1624853002 .
2016-01-25 08:04:50 -05:00
Paul Berry 52386076f5 Drop implicit types from summaries.
Previously, implicit types were serialized in the summary as
references to `dynamic`.  Now, we simply omit the types from the
summary and the dynamic type is inferred at resynthesis time.

This should reduce the summary size and simplify the implementation of
inferred types.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1622673002 .
2016-01-22 14:57:33 -05:00
Paul Berry d1f3290c38 Use the explicit string 'void' to refer to void in summaries.
Previously we used a null EntityRef as a special case to mean "void".
This saved a tiny amount of space in the summary file, but it's not
worth it because (a) it will complicate some error handling scenarios,
and (b) it would be more worthwhile to use a null EntityRef to
represent implicit types.  Both (a) and (b) will be addressed in
future CLs.

This CL changes "void" so that it's serialized as though it were
defined in the defining compilation unit of each library.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1625543002 .
2016-01-22 13:26:35 -05:00
Paul Berry ef3935b590 Use the explicit string 'dynamic' to refer to dynamic in summaries.
Previously we used reference 0 as a special case to mean "dynamic".
This saved a tiny amount of space in the summary file, but it's not
worth it because it will complicate some error handling scenarios
(which will be addressed in future CLs).

This CL changes "dynamic" so that it's serialized as though it were
defined in the defining compilation unit of each library.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1621763002 .
2016-01-22 12:57:01 -05:00
Paul Berry dd209aa19c Rename TypeRef to EntityRef.
Now that we're storing constants in the summary, the we can have
legitimate references to things other than types.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1619913005 .
2016-01-21 17:53:59 -05:00
Paul Berry 5e27219e9a Modify summary codegen so that builder getters return builders.
This should allow more flexibility in the code that creates summaries,
since it will be possible to things like:

    FooBuilder foo = new FooBuilder(bar: new BarBuilder);
    foo.bar.baz = ...;

(Previously this would have been disallowed because foo.bar would have
returned a `Foo` rather than a `FooBuilder`, and the `Foo` class doesn't
have a setter for `baz`).

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1606283003 .
2016-01-21 11:26:53 -08:00
Konstantin Shcheglov b0704262d9 Generate documentation for enumeration values.
I missed it previous time, now noticed that format.dart does not change
when I update the idl.dart file constant operations.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1617123002 .
2016-01-21 10:59:49 -08:00
Konstantin Shcheglov 709cbcd76c Add named arguments support into constant ASTs.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1616023002 .
2016-01-21 10:25:44 -08:00
Konstantin Shcheglov 2d47247b73 Serialize long integers as unsigned 32-bit pieces.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1612863002 .
2016-01-21 08:26:01 -08:00
Konstantin Shcheglov 6794b47c38 Use Uint32 for int in IDL.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1615453002 .
2016-01-20 14:40:44 -08:00
Konstantin Shcheglov 0a495243c6 Validate that int values that we write to summaries are >= 0.
Also make tweaks for TestTypeProvider to ensure that this is true.

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

Review URL: https://codereview.chromium.org/1605763007 .
2016-01-20 13:38:10 -08:00
Paul Berry c6dd4a3967 Add propagated types to summary files.
Note: the prelinker doesn't support type propagation, since type
propagation may require looking at files beyond direct imports and the
transitive closure of exports.  However, to pave the way for a future
implementation of a full linker, we still maintain the distinction
between linked and unlinked data.  The unlinked data for a propagated
type is simply a unique "slot id" for each type in the compilation
unit which may be propagated.  The linked data is the propagated type
to fill into each slot, if any.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1610043002 .
2016-01-20 06:36:04 -08:00
Paul Berry 1db9d760fc Rename UnlinkedTypeRef to TypeRef.
This data structure is going to be re-used in the "linked" section of
summaries to refer to propagated and inferred types.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1610003002 .
2016-01-19 18:52:05 -08:00
Konstantin Shcheglov 07f8831bc2 Serialize constant initializers.
No implementation for element references in this CL.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1602203004 .
2016-01-19 13:42:51 -08:00
Konstantin Shcheglov 028254cea1 Generate code UnlinkedConst / UnlinkedConstOperation.
R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1596703002 .
2016-01-17 08:58:35 -08:00
Konstantin Shcheglov 6f5082ea7c Generate enum readers.
This is just nicer for the clients, plus also will allow us to use
these readers in lists.

R=paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/1589823007 .
2016-01-15 15:05:56 -08:00
Paul Berry a07b997e63 Downplay the distinction between linked and prelinked summaries.
Following a discussion on Tuesday, we've decided to only deal with the
distinction between linked and unlinked information in the summary
definition for now.  This should allow fully-linked information (such as
constant evaluation, propagated types, and inferred types) to be added
to summaries without much trouble.

The distinction is preserved in the prelinker (which can't currently
handle fully-linked information), and to some degree it will be
preserved in unit tests (to minimize future churn).

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1584313005 .
2016-01-14 16:58:03 -08:00
Paul Berry ba31abe429 Use constructor args in favor of summary "encode" functions.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1585973004 .
2016-01-14 09:30:04 -08:00
Paul Berry 834263789f Include the export namespace in the prelinked summary.
This prevents having to traverse the transitive closure of exports
when resynthesizing a library from its summary.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1589573003 .
2016-01-13 13:16:23 -08:00
Paul Berry c1642e9d9f Make summary builder classes implement summary interfaces.
This allows for easier unit testing, since we can use a builder class
directly rather than having to serialize and deserialize it.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/1581993002 .
2016-01-13 08:54:48 -08:00
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
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
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
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
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