Commit Graph

17 Commits

Author SHA1 Message Date
Alexander Markov 5129cff930 [vm/aot] Discard Code objects from the heap
While deserializing AOT snapshot, Code objects which do not contain
valuable information besides entry point and stack maps are discarded
and not allocated on the heap (they are replaced with
StubCode::UnknownDartCode()).

PC -> Code/CompressedStackMaps lookup is implemented using a separate
table (InstructionsTable).

Flutter gallery in release-sizeopt mode:
Heap size of snapshot objects: arm -26.89%, arm64 -27.68%

Large Flutter application in release mode with --dwarf-stack-traces:
Heap size of snapshot objects: -24.3%.
Discarded Code objects: 72.5% of all Code objects.

Issue: https://github.com/dart-lang/sdk/issues/44852.

TEST=existing tests; "--dwarf_stack_traces --no-retain_function_objects
--no-retain_code_objects" mode is enabled for a few tests.

Change-Id: I5fe3e283630c8e8f4442319d5dcae38d174dd0d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189560
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-04-13 02:36:16 +00:00
Brian Wilkerson 3392632667 Unify three diagnostics for documentation purposes
Change-Id: Id90d4e82d01b59056117c7fc234d8b3a5a8ec7e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192286
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-03-22 14:44:33 +00:00
Brian Wilkerson 41e00354a3 Unify four diagnostics for documentation purposes
Change-Id: Ifefe90cdbc3ddb9e243a056398b5d8611b3bf22e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192287
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-03-22 14:43:43 +00:00
Lasse R.H. Nielsen 726904ac17 Add onError extension method to Future.
Provides better typing than `catchError`.

Change-Id: If0d4487b7c3a499160fb719740a1d65c0545024d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151512
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-01-21 23:13:56 +00:00
Danny Tuppeny c818059287 [Analyzer] Report EXTRA_POSITIONAL_ARGUMENTS and EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED against first unmatched argument
Fixes #44598.

Change-Id: I6bccf4f5448de024f27d0ed1ba51c730e22b6fe9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178020
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-01-11 18:46:26 +00:00
Stephen Adams 7490e91cd0 [tests] fix language/deferred/split_constants_canonicalization_test
Change the 'mint' value to one that is a legal Dart-web value

TBR: sigmund@google.com

Change-Id: I4486459b0f77a55357909597b2d94496b99aaaf9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175181
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-12-05 17:47:43 +00:00
Ryan Macnak 88fdb3ee68 Add tests for the identity of constants repeated in different loading units but not present in the main unit.
Bug: https://github.com/dart-lang/sdk/issues/41974
Change-Id: I29a00aa6139dc2a1f865f8c5f659169c84c8e45d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169790
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-10-30 19:16:42 +00:00
Ryan Macnak c1bb9a520c [vm] Don't write LibraryPrefix::importer_ in AOT snapshots.
This field won't be used at runtime and is not accounted for during tree-shaking.

Bug: https://github.com/dart-lang/sdk/issues/41974
Bug: https://github.com/dart-lang/sdk/issues/43245
Change-Id: Ie5a669608e896aa8cee74a3a4249ba99ec6f980a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161220
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-09-01 16:49:49 +00:00
Brian Wilkerson e224540b1c Unify four diagnostic codes for the purpose of documentation
I would have prefered to have renamed them all to undefined_super_member,
but that would have broken existing links. Some day we should add the
support necessary to allow for forwarding so that we can rename codes.

Change-Id: I81e416407e3464b5b60a4dbbfe60a375eb47bb84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157921
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-08-11 01:07:44 +00:00
Konstantin Shcheglov 8de8a1c226 Move codes from StaticTypeWarningCode into CompileTimeErrorCode.
They are all errors now.

Change-Id: If48d38e38e845fd5b5a950dd5514bf1cbbce03d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-07-27 16:44:15 +00:00
Konstantin Shcheglov ba92b78acd Move errors from StaticWarningCode to CompileTimeErrorCode.
Bug: https://github.com/dart-lang/sdk/issues/42821
Change-Id: I153c48d7a2e4a02026928e6203aacf8f2dc029ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155849
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-07-26 04:19:25 +00:00
Ryan Macnak c5a94db091 [vm] Initial implementation of deferred loading.
(Assignment of libraries to loading units is already done in the kernel generation step.)

After compiling and before serializing, we walk the program and for each Code we assign its Instructions, CodeSourceMap and CompressedStackMap to the loading unit of that Code's defining library. Deduplication may cause Instructions, CodeSourceMaps and CompressedStackMaps to belong to more than one loading unit; in this case the objects are assigned to the root loading unit. Later they can be more precisely assigned to the dominating loading unit.

All objects except some Instructions, CodeSourceMaps and CompressedStackMaps belong to the root loading unit's snapshot. This snapshot is written like an unsplit snapshot, except that when serializing Code, we will write a reference to a stub or null when the Code's Instructions, CodeSourceMap or CompressedStackMap belongs to a non-root loading unit. The snapshots of non-root loading units contain these deferred objects and references to the corresponding Code objects to patch. The types of objects we defer (Instructions, CodeSourceMaps and CompressedStackMaps) usually represent 70+% of the snapshot size.

Bare instructions mode must be disabled when splitting because we cannot have PC-relative calls between loading units. Later we can re-enable this for calls within loading units.

Broken: Compactor probably crashes we can now have an unbounded number of image pages and the compactor assumes a fixed number.

Embedder's guide:

At compile-time, gen_snapshot should be passed --loading_unit_manifest with a path, which will enable splitting and output a mapping from loading unit ids to snapshot output paths.

At runtime, sometime during isolate startup, an embedder should call Dart_SetDeferredLoadHandler, probably near an existing call to Dart_SetLibraryTagHandler. The callback is given a loading unit id, and should eventually call Dart_DeferredLoadComplete[Error].

Bug: https://github.com/dart-lang/sdk/issues/41974
Change-Id: Ib597eb87c8cd634416d5ee1f00629c5550aebb00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152427
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-07-17 19:29:47 +00:00
Johnni Winther a5eb0b559c [cfe] Handle callable extension getters
Closes #40596
Closes #40713
Closes #39889

Change-Id: I183560b912e2f6f2c02d51278c0d28c8a6d67f99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139203
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-03-13 10:46:39 +00:00
Leaf Petersen 5e9be81d5e Make all CastErrors be TypeErrors.
This makes CastError implement TypeError, and changes all test
expectations to look for TypeError.  A followup CL will deprecate
CastError.

Bug: https://github.com/dart-lang/language/issues/787
Bug: https://github.com/dart-lang/sdk/issues/34097
Change-Id: I7102c6260901317572d2df08c4be9c4c48197688
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138670
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-03-11 23:31:06 +00:00
Konstantin Shcheglov b7326f2807 Fix deferredPrefix.loadLibrary() resolution to check for extra arguments.
R=brianwilkerson@google.com

Change-Id: I75cab6bf235110e32e4d9c21d656c12eb42685d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130600
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-01-07 22:30:19 +00:00
Sam Rawlins 4c6757a9ff new analyzer compile-time error: load_library_takes_no_arguments
Fixes #38281

Change-Id: I8a626a9e006a988bcd449e6aa89338afc716ad94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129901
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-01-07 05:20:12 +00:00
Robert Nystrom fc1b1ecc71 Move files under language_2 into subdirectories.
Change-Id: Idbcc965a27e9ffeedf5e0a1068b019de4193070f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127745
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2019-12-11 19:18:00 +00:00