The StackTrace argument will never be null, but may be a default.
Also rewrite the type descriptions to use function type syntax instead
of the legacy argument syntax, and remove a redundant parameter name.
Bug: #43655
Change-Id: Ie91024b2a70d66c24ce29e413c811a61beae3bfc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166460
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
This is a reland of 6a1c54ec30
Original change's description:
> Flow analysis: promote to non-nullable on initialization
>
> When flow analysis encounters a variable declaration of the form `T? x
> = expr;`, if the type of `expr` is `T`, then the variable is
> immediately promoted to type `T`.
>
> Fixes#43099.
>
> Change-Id: Ia206fe0d50e2fdd9bdf637e13c85633d8490dbcc
> Bug: https://github.com/dart-lang/sdk/issues/43099
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163841
> Commit-Queue: Paul Berry <paulberry@google.com>
> Reviewed-by: Bob Nystrom <rnystrom@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Bug: https://github.com/dart-lang/sdk/issues/43099
Change-Id: I7530bb0f7c24674a7b500558b89d50b35e045aca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166305
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Currently we don't push or pop anything on the stack, we just
manipulate the single value that's on the stack. So there's no
functional change. Logic that pushes and pops the stack will be added
in a follow-up CL.
Bug: https://github.com/dart-lang/sdk/issues/40009
Change-Id: I4deb4cbe06644a2b2c9b5e2c1dc140fb4cd805cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165145
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This change compiles opt-out libraries with opt-out semantics even when
sound null safety was requested. The compile-time error that libraries
cannot opt out with sound null safety is still produces but spurious errors
from interpreting opt-out as opt-in are avoided.
This also aligns the compilation of from-source with from-dill for the
case of opt-out libraries in face of sound null safety.
Closes#43327
Change-Id: I19d659219b7c7b357d15fc5f1ca4415fe1fc4592
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166243
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Change-Id: Ieba83cc4d632eb8db3c0054210040fd8ade5d74a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166380
Reviewed-by: Michal Terepeta <michalt@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
TL;DR on the below: On a big internal app, this makes the constant
evaluator ~17% faster and use less ram.
Details:
Detauls for 5 runs before this CL and with this CL when compiling a big
internal app with dart2js (stopping at around "stopAfterClosedWorld"
with instrumented code available as patch-set #1):
Original:
Spend 9829 ms in ConstantEvaluator.
Spend 9935 ms in ConstantEvaluator.
Spend 9769 ms in ConstantEvaluator.
Spend 9725 ms in ConstantEvaluator.
Spend 9915 ms in ConstantEvaluator.
With this CL:
Spend 8110 ms in ConstantEvaluator.
Spend 8080 ms in ConstantEvaluator.
Spend 8183 ms in ConstantEvaluator.
Spend 8174 ms in ConstantEvaluator.
Spend 8155 ms in ConstantEvaluator.
Difference at 95.0% confidence
-1694.2 +/- 103.924
-17.2269% +/- 1.05672%
(Student's t, pooled s = 71.2569)
Original:
Maximum resident set size (kbytes): 13164908
Maximum resident set size (kbytes): 13179968
Maximum resident set size (kbytes): 13226748
Maximum resident set size (kbytes): 13296908
Maximum resident set size (kbytes): 13220740
With this CL:
Maximum resident set size (kbytes): 13006996
Maximum resident set size (kbytes): 13006720
Maximum resident set size (kbytes): 13020884
Maximum resident set size (kbytes): 13018172
Maximum resident set size (kbytes): 13160120
Difference at 95.0% confidence
-175276 +/- 86297.8
-1.32605% +/- 0.652888%
(Student's t, pooled s = 59171.2)
Original:
Minor (reclaiming a frame) page faults: 5720311
Minor (reclaiming a frame) page faults: 5688423
Minor (reclaiming a frame) page faults: 5693923
Minor (reclaiming a frame) page faults: 5699729
Minor (reclaiming a frame) page faults: 5650061
With this CL:
Minor (reclaiming a frame) page faults: 5612492
Minor (reclaiming a frame) page faults: 5603543
Minor (reclaiming a frame) page faults: 5600394
Minor (reclaiming a frame) page faults: 5628675
Minor (reclaiming a frame) page faults: 5621994
Difference at 95.0% confidence
-77069.8 +/- 29166.7
-1.35436% +/- 0.512552%
(Student's t, pooled s = 19998.5)
Said another way, we have some confidence that this change decrease the
runtime of the constant evaluator with ~17% on this application.
Similar we have some confidence that this change decrease the memory
usage with ~1.3% overall for dart2js (note though, again, stopping
early), or something like ~170MB less memory in this case.
(And having a similar percetage less minor page faults).
Change-Id: Ib269ad50f705b967e0e60e88fdcbfd9b050b3a24
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166105
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This reverts commit 706ab39eba.
Reason for revert: Analyzer crash b/170276354
Original change's description:
> Return declared elements for linked AST nodes.
>
> For now only top-level nodes and elements, will do class members later.
>
> These changes would be useful to fix matching elements and nodes, e.g.
> https://github.com/dart-lang/sdk/issues/43153 or https://bit.ly/3jCfhVx
>
> Change-Id: I37861ba60b4e70f637019bf4f8a4d0d007c97965
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166200
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
TBR=scheglov@google.com,brianwilkerson@google.com,srawlins@google.com
Change-Id: I0b13f9e4fbecf9cb0e4d059580837f79bd1cf2b2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166381
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
I'm still not able to reproduce the "Missing library" issue.
But I making several changes that might help.
Change-Id: Ieed6f14351a109565d20019deae6bf6e72e78112
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166306
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
I'd always meant to test the cartesian product of possible
reachabilities for the `restrict` function. Due to a copy/paste error
I was missing one of the four possibilities.
Change-Id: I3a99c72051e7f12afd8f345d8c2dafe92d6e2c48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166220
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This will make it easier for upcoming bug fixes. Calling this verifier
in BestPracticesVerifier means it will only be run when hints are
enabled, perhaps boosting performance.
Also add a few more test cases.
Change-Id: If22ab02313d9f98f067ad4325b2f5ac473f4862c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164580
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Previously (before NNBD) VariableGet.promotedType was used when
variable type was promoted after a successful 'is' test. TFA used that
to infer non-nullability in certain cases (successful 'x is int'
implies that x is non-nullable).
However, this is no longer true as front-end started to use
promotedType in more cases. Also, TFA should be able to
infer the same non-nullability from the successful 'is' test itself.
So this change removes use of VariableGet.promotedType from TFA.
Change-Id: Id14dafad4451453572d6f20ff567b7792f17881a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165625
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
The previous implementation of type promotion in the CFE was unsound,
didn't follow the spec, and contained a lot of unnecessary logic
related to experiments that eventually led to flow analysis. This
change updates type promotion to be nearly spec compliant and removes
most of the unnecessary logic.
The lack of spec compliance went (astonishingly) unnoticed for over
three years, probably mostly due to the fact that for the most part it
promoted more eagerly than it should; as a result, any code that was
erroneously accepted by the CFE was rejected by the analyzer.
Unfortunately, in at least one case the erroneous promotion led to
incorrect VM behavior (issue #43640).
There's one aspect in which the CFE implementation is still not spec
compliant. The spec says that when analyzing an expression `e1 &&
e2`, if `e2` shows that a variable `v` has type `T`, but `e1` assigns
to `v`, then promotion does not occur. This turns out to be difficult
to model in the existing architecture, since much of the type
promotion logic happens during parsing, and any assignments that occur
in `e1` are parsed prior to figuring out that a logical and is in
progress. Fortunately, this is a rare circumstance, and allowing type
promotion in this situation is sound, so it should not lead to
incorrect VM behavior. Considering how long the other incorrect logic
(which was much more severe) went unnoticed, it seems unlikely that it
will cause problems for users.
Bug: https://github.com/dart-lang/sdk/issues/43640
Change-Id: If97293733e64e286780de5079a703717b8f6f142
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166040
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Instead of having two similar concrete implementations of WriteText
that differ mostly in the output format, abstract out the parts that
differ and create a single, non-virtual WriteText that calls the
abstracted-out methods as appropriate.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-mac-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-win-release-x64-try
Change-Id: Ic728cd4d3376af32780d428efba19cd36e73c3ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164562
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Before, picking a symbol name for a Code object when generating
assembly required adding a placeholder entry in the Dwarf object,
because the Dwarf object separately used a SnapshotTextObjectNamer
to determine the appropriate symbol name to use in relocations.
Instead, now the ImageWriter subclasses are entirely responsible for
creating the symbol name for a given Code object, and that name is
passed when adding the Code object to the Dwarf object.
For Elf output, we eagerly create symbols for sections and Code objects
again in the appropriate symbol table, and so looking up the start of a
given section or Code object can be done simply by asking for the
corresponding symbol's address, removing special case methods and other
workarounds.
We also clean up the generated static and dynamic symbol tables by
only generating local symbols for Code objects and BSS sections (these
are local in assembly output also), and only adding global symbols to
the dynamic symbol table.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-mac-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-precomp-win-release-x64-try
Change-Id: Ie40c0c836681e98f345483136bb6860e5588ef30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166002
Reviewed-by: Martin Kustermann <kustermann@google.com>
Before, we only wrapped the Instructions payloads in an
InstructionsSection in precompiled snapshots with bare instructions mode
enabled. This CL changes that to always add an InstructionsSection
wrapper in precompiled snapshots, even when not in bare instructions
mode, and moves all the information from the old ImageHeader object into
the InstructionsSection object instead. Note that in non-bare mode, the
InstructionsSection has no payload, and the Instructions objects follow
the InstructionsSection object instead of being contained by it.
This CL also wraps all implementations of AssemblyImageWriter and
SnapshotTextObjectNamer methods in a single DART_PRECOMPILER ifdef
block, since we only generate assembly in precompiled mode. This
removes the need for the smaller DART_PRECOMPILER ifdef blocks scattered
across the AssemblyImageWriter method implementations.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-mac-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-precomp-win-release-x64-try
Change-Id: I3676fb5c6675845463707acbbb4759a465cfa342
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165563
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This reverts commit f79c6bed7f.
Reason for revert: Causing problems for google3--I'll investigate and handle the reland. b/170193203
Original change's description:
> Update to the latest version of package:tflite_native.
>
> Change-Id: Id9eb5e5a9297a6bbdb83805c6a205663b9220937
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166140
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Devon Carew <devoncarew@google.com>
TBR=devoncarew@google.com,brianwilkerson@google.com
Change-Id: I5b4823e702d15984c37401374dae27f8a6a61f15
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166103
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
This CL adds a new PAYLOAD_SIZEOF specification to
runtime_offsets_list.h which defines InstanceSize methods given an
method name to invoke to get the header size (i.e., the size of
the object portion before the payload).
It uses this new specification to create appropriate InstanceSize()
methods for objects written to read-only sections of snapshots,
instead of needing separate size calculations for SIMARM_X64.
It adds more methods to Instructions to avoid special casing for bare
instructions mode. It also removes the special casing for SIMARM_X64,
serializing all read-only objects in the same manner even when not
in a crossword situation.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-mac-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-win-release-x64-try
Change-Id: Ie3e4009f4bc03688998c32281e42fa22a255731d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165501
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
JS templates should always use their own source information. DDC
was incorrectly caching and reusing templates with the same source
information in various parts of the program. This lead to incorrect
source maps and in some cases compiler crashes when the source map
in a user application pointed to source location in the SDK.
Change-Id: I11607e6f02b894ead1d350e9b3071173ba36a048
Fixes: https://github.com/dart-lang/sdk/issues/43589
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166122
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This reverts commit 53895b2270.
Reason for revert: Replacing this change with a new strategy for better module reordering.
Original change's description:
> [dartdevc] Fixing issue related to dual exports of multiple entrypoints in a cyclic import loop.
>
> See: https://github.com/flutter/flutter/issues/64011
> Change-Id: I8a11e9d3f19428a516cf7a60ee45c3bacf26545d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162383
> Commit-Queue: Mark Zhou <markzipan@google.com>
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
TBR=sigmund@google.com,nshahan@google.com,markzipan@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: Iee91d33d1696ffa7406b724466144ab06af80394
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165873
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
- add handling a 'Shutdown' message to expression compiler worker
so the parent program can terminate it before exiting itself
Closes: https://github.com/dart-lang/sdk/issues/43513
Change-Id: I18a4cbd9214a5e72c90d725039c2936e6e67a231
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163960
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
For the main program snapshot, this has no effect. For secondary loading unit snapshots, this ensures they only reference their own objects or objects from parents and not objects from siblings that were written earlier.
Bug: https://github.com/dart-lang/sdk/issues/41974
Change-Id: Ia7c5bec3b0c66564685ed2fd1b2bec52d2459024
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163460
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>