In order to support causal-async-stacks, the following synthetic calls
are inserted: _asyncStackTraceHelper, _setAsyncThreadStackTrace and
_clearAsyncThreadStackTrace.
_asyncStackTraceHelper is always generated in the async transformation.
_setAsyncThreadStackTrace and _clearAsyncThreadStackTrace are inserted
during bytecode generation (or in the flow graph builder in case of AST
pipeline). If bytecode generation options are set inconsistently with
--causal-async-stacks VM option, then it was possible that
_asyncStackTraceHelper was generated but other calls were not generated,
causing incorrect (full, non-truncated) async stack traces. This also
causes performance regression as collecting full stack traces takes
much more time.
This change makes generation of all these calls more consistent: if
causal async stacks are disabled during bytecode generation, then all
three calls are omitted. Also, in case these calls were generated and
present in bytecode, but VM option --causal-async-stacks is disabled,
then bytecode flow graph builder turns all these three calls into no-ops.
Change-Id: I93eb1d83c675ee093799bb8e37ca3d60a3c5c19d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120927
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Doesn't do anything with the new target, but establishes a public API for dev_compiler (at least within the SDK)
Change-Id: I4c86b890d3993f96cf32ed0f749608a72a173da6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119526
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Though we disable deduplication for instance methods because switchable
calls rely on a unique PC -> Code mapping atm.
Change-Id: I80915e97f5e06c3f1251ea3176d5c4f8413a81ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120041
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
The tests were passing by luck.
Change-Id: I1b44c6d675b59c84e6a6bd70741462d6f29c51e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120922
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Rather than suppress all promotions for variables written to in
closures, we track whether a closure might exist that captures a write
to a variable, and only suppress promotions once such a closure
exists. This is consistent with what is proposed in
https://github.com/dart-lang/language/pull/473.
Contains a repro of #38791.
Change-Id: I4683581908703b510a3231b8fa8ed697121b09da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120680
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Account for null result from kernelForProgram.
Change-Id: Ia4349c68ce023a5714752bf3294ab1e293b1d409
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120749
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Previously, we considered a variable to be captured by a closure if a
write to that variable occurred anywhere inside a local function. But
that was overly broad; it meant that we incorrectly classified all
written-to local variables of a local function to be captured.
This CL makes the AssignedVariables logic aware of variable
declaration sites, so that it only considers a variable to be captured
if it is written to at a lower level of local function nesting than
its declaration. As a side bonus, it means that it can now exclude
out-of-scope variables from all sets of closed-upon and written-to
variables, which should make flow analysis faster by preventing it
from spending a lot of time accounting for variables that aren't
visible.
It also adds tracking of the set of all variables written to and
captured within each top level function.
This partially reverts commit 55466fd3cc.
Change-Id: Ibcd6476445addebed13cfc5ecc470d644e519148
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120800
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
There's no good reason to unify the flow analysis for several
variables declared together, and it would break some assertions I'm
going to add to flow analysis in future CLs.
Change-Id: I4dafb7b5e9b078cb741d506cd0bbfab1bcab5ebb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120840
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
In a follow-up CL, I'm going to add logic to track the complete set of
assigned and captured variables seen so far. We will need these sets
in order to properly cancel promotions on entry to a closure or nested
function. But for performance reasons we don't want these sets to
include all variables seen in the entire file; just the local function
is sufficient.
Change-Id: I32a42075916be791f2fb7798814cec4c020e8b3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120751
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
While emitting code for a ParallelMove on ARM32, the TMP register was
being used as a dest/src. When the stack slot offset is large,
StoreToOffset creates a new base in TMP in order to use a smaller
offset. Since the ParallelMove implementation was hardcoding TMP as the
dest/src register, the assert that the register != TMP failed with large
offsets. Now we instead perform a check to see if the offset will fit to
determine whether or not we can use TMP or if we need to fall back and
use LR as our temporary (we can do this since we're in the middle of a
ParallelMove).
Fixes https://github.com/dart-lang/sdk/issues/38654
Change-Id: I4d8cc8b54f6090d86992aabb8ff44d088bc02d3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119584
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Add an incremental serializer that can be used to avoid re-serializing
the same thing again and again.
It does this by grouping libraries into Components / bundles,
serializing them individually and using the concatenated dill feature to
output the wanted data --- just potentially faster if we had the data
in cache.
Note that the serialized output might contain *more* than the input given
if we cached the wanted data into a bigger bundle.
The output will always be "closed" though, i.e. if the stuff that is
included that is too much added a new dependency, that dependency will be
included as well.
This should generally make it safe, although one can imagine situations
where it could pull in lots of dependencies that it wouldn't otherwise
have.
It is being driven by the incremental compiler which makes sure to
invalidate the cache when the data changes.
Except for situations where the libraries are changed externally after
being serialized, but before being serialized again, where one then wants
the updated library serialized, the feature should be safe.
Change-Id: I2a504abe6dbb68434c3b04abff13480ef72a6a6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120786
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
The master branch in the co19 repository is now the NNBD fork. For the
time being, we want to roll the legacy variant into co19_2. At a later
stage, we will also depend on the NNBD fork, but it will likely be a
different suite.
Change the script to use dart/try rather than the legacy bucket format.
TBR=whesse@google.com
Change-Id: I9b43d9d4a49f2cfd16b8be9cca025c6d750cf2bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120781
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
From this roll on forward, co19_2 is tracking the pre-nnbd branch rather than the master branch in
the co19 repo. The master branch (the NNBD fork of co19) will be re-introduced as a different suite
later.
Issues reported:
https://github.com/dart-lang/co19/issues/492 (ShortCircuitOperators_A01_t12 test is wrong)
https://github.com/dart-lang/co19/issues/493 (ShortCircuitOperators_A04_t27 has a syntax error)
https://github.com/dart-lang/co19/issues/494 (ShortCircuitOperators_A03_t12 is an invalid test)
2019-10-04 irina.arkhipets@gmail.com Issue 490: useless constant-update-2018 option removed from the tests.
2019-10-04 irina.arkhipets@gmail.com Issue 490: useless constant-update-2018 option removed from the tests.
2019-10-04 sgrekhov@unipro.ru Fixes 484. Use floating point value which decimal part
2019-10-04 sgrekhov@unipro.ru Fixes 486. Fix test expectations (method call has higher priority than unary minus)
2019-10-04 sgrekhov@unipro.ru Fixes 483. Use List instead of Iterable
2019-10-04 irina.arkhipets@gmail.com Issue 485, 488: test expectations corrected.
2019-09-30 irina.arkhipets@gmail.com Issue 477: More tests for constant short circuit operations added.
2019-09-30 irina.arkhipets@gmail.com Issue 477: More tests for constant short circuit operations added.
2019-09-25 irina.arkhipets@gmail.com Issue 481: Test expanded into A Function(Null) instead of A Function(A) by the instantiate-to-bound algorithm.
2019-09-23 irina.arkhipets@gmail.com Issue 477: tests for Constant-2019-update added.
2019-09-19 sgrekhov@unipro.ru Fixes 480. Use '==' for checking actual type
2019-09-17 irina.arkhipets@gmail.com Issue 477: tests for Constant-2019-update added.
2019-09-17 irina.arkhipets@gmail.com Issue 477: tests for Constant-2019-update added.
2019-09-17 sgrekhov@unipro.ru NNBD tests removed from this legacy branch
2019-09-16 irina.arkhipets@gmail.com Issue 477: tests for short circuit operators added.
2019-09-13 sgrekhov@unipro.ru 466. Subtyping tests for NNBD added.
2019-09-12 sgrekhov@unipro.ru 466. Subtyping tests for NNBDc. Copyright year updated
2019-09-12 sgrekhov@unipro.ru 466. Subtyping tests for NNBDc. Right Object tests added
2019-09-11 sgrekhov@unipro.ru 464. Added tests for legacy type fields
2019-09-11 irina.arkhipets@gmail.com Issue 465: tests for Generics in NNBD added.
2019-09-10 irina.arkhipets@gmail.com Issue 465: test for Generics in NNBD added.
2019-09-10 sgrekhov@unipro.ru 466. Subtyping tests changed according to NNBD spec
2019-09-09 sgrekhov@unipro.ru 466. Subtyping tests changed according to NNBD spec
2019-09-06 irina.arkhipets@gmail.com Issue 465: tests for Generics in NNBD added.
2019-09-06 sgrekhov@unipro.ru More tests for type Never
2019-09-05 irina.arkhipets@gmail.com Issue 465: tests for Generics in NNBD added.
2019-09-05 sgrekhov@unipro.ru Fix using and checking of Never
2019-09-04 sgrekhov@unipro.ru Fixes 464. Legacy-libraries tests added
2019-09-04 irina.arkhipets@gmail.com Fixed Issue 460: tests for Null promotion added, typos corrected.
2019-09-02 sgrekhov@unipro.ru Fixes 458. More null-aware operators tests
2019-09-02 sgrekhov@unipro.ru Fixes 459. Late fields and variables test added
2019-09-02 sgrekhov@unipro.ru 459. Late fields and variables tests added
2019-08-30 sgrekhov@unipro.ru 459. Late fields and variables tests added
2019-08-29 sgrekhov@unipro.ru 459. Late fields and variables tests added
2019-08-29 sgrekhov@unipro.ru 389. Fixed static warnings processing
2019-08-28 sgrekhov@unipro.ru 458. Null-aware operators tests added
2019-08-27 sgrekhov@unipro.ru 458. Null-aware operators tests added
2019-08-27 sgrekhov@unipro.ru Removed covariant final member
2019-08-27 sgrekhov@unipro.ru Typo and order of modifiers fixed
2019-08-23 sgrekhov@unipro.ru 461. A couple of NNBD nested nullable types tests added
2019-08-23 sgrekhov@unipro.ru 389. NNBD static errors tests. Some tests fixed, several tests added (mainly for legacy libraries)
2019-08-23 sgrekhov@unipro.ru Fixes 389. A couple of legacy types tests added
2019-08-23 sgrekhov@unipro.ru Fixes 461.Conditional expression ambiguities tests added
2019-08-23 sgrekhov@unipro.ru 461. Add nested nullable types tests
2019-08-23 sgrekhov@unipro.ru Fixes 475. Modifier 'late' must be before 'final'
2019-08-22 sgrekhov@unipro.ru 389. NNBD static errors tests. Fixed work with legacy libraries and new tests added
2019-08-22 sgrekhov@unipro.ru 461. NNBD syntax tests added for required and null-aware selector
Change-Id: Icd4d0c536f0091100aa0276ff5b836b16db0ff35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120782
Reviewed-by: William Hesse <whesse@google.com>
Prior to this change, loading the sdk dill twice for instance would
result in additional exports as well as parameter counts doubling,
essentially destroying the result.
Change-Id: I4d694bec1926d6df6572e9bb36e8a88ec0822e27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120785
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
If a const constructor redirects to a non-const constructor, report a
compile-time error (no change here).
At runtime, a const instantiation will result in an invalid expression,
whereas a non-const (explicit or implicit new) instantiation will
work normally.
Closes https://github.com/dart-lang/sdk/issues/23622
Change-Id: Ief0e9c62fb8de34203df49fd862f20aba41a3cde
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120042
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
MSVC won't update .lib file if there were no changes, and this restat attribute tells ninja to honor that.
Change-Id: If78184aecf13578617570478cbf158276981e25d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120747
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Added ability to recognize a MethodMirror to be a mirror of an extension member
Added ability to recognize a VariableMirror to be a mirror of a static
extension field.
Change-Id: I56715a491bba0d8cafb2796ebb755bd339e147c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120760
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
This reverts commit f2c882bd87.
Reason for revert: batch mode failures
Original change's description:
> [vm, bytecode] Use CoreTypes and ClassHierarchy from non-incremental front end results when generating bytecode.
>
> Change-Id: I9a8b2530009ff6cc6880ee177a6bee4bb9101e82
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120626
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
TBR=rmacnak@google.com,alexmarkov@google.com
Change-Id: I8ea8e155af0d2a4c4382107d723f7bf8a50dc3d7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120748
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Previously, calls through field/getter were generated as dynamic calls
because InterfaceCall with field/getter target doesn't correctly
represent what such call should do. This results in a quite inefficient
code in AOT mode.
With this change, calls through fields/getters are decomposed into two
calls, while keeping the same order of evaluation.
Change-Id: Ieb33927c1b39d1b4d8eafb7bd542675820474068
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120628
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Merge the two copies of a function that convert a JS promise to a Dart
Future. Reuse this function for the specialized case of converting to a
`Future<Map>`.
- Rename `convertNativePromiseToDartFuture` to the shorter and more
widely used `promiseToFuture`. Update one existing use of the old
name.
- Make the method generic to match the previous implementation of
`promiseToFuture`.
- Update the code generator template to not emit the second copy of the
method.
- Use the existing `promiseToFuture` with a `.then` call to implement
`promiseToFutureAsMap`. Update the doc comment to follow best
practices.
- Duplicate all above changes to nnbd SDK copy.
Change-Id: Ib3bbf17477efec3666b24fd4019ca8ce68f0b5b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119174
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Tests have both correct and erroneous implementations
of variance.
Change-Id: I49dd76f42399015dd6e3f9688e598c271ce7ab1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119722
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
This reverts commit 31996aa24f.
Reason for revert: bytecode mode is disabled to avoid gaps in testing of AST-based mode.
Original change's description:
> [vm/bytecode] Enable bytecode compiler by default in Dart SDK
>
> This is the reland of https://dart-review.googlesource.com/c/sdk/+/110551.
>
> Change-Id: I85fcfadfd20fdba752fa8225650a1cb6c32fff31
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117931
> Reviewed-by: Régis Crelier <regis@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
TBR=rmacnak@google.com,alexmarkov@google.com,asiva@google.com,regis@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I941eff705b599c59251e5ba2337c307cc84f373b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120720
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This fixes 10 "side casts" (from T to Future<T>).
FutureOr logic no longer needs to be specialized as _handleAssignment
now supports that.
Change-Id: Ie01b13797a49ec29b4eb723f580720f1caffffab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120420
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
I used the regex replaces documented on the `load` and `store` deprecated methods.
I manually replaced some `.val` to `.ref` when a regex could not detect whether something was a primitive value or a struct.
Issue: https://github.com/dart-lang/sdk/issues/37773
Change-Id: I3534b6dd00d9ac45fa1a11fe75c80fb3cccc07dc
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-dartkb-linux-debug-simarm64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-dartkb-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-mac-debug-simdbc64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-reload-mac-release-simdbc64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-precomp-mac-release-simarm_x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118993
Reviewed-by: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>