Instead of using InferenceContext.getContext and
InferenceContext.setType to associate type inference information with
ArgumentList nodes, we pass the contextual information around on the
stack. This should be more efficient (since it avoids a map lookup),
and it should make the code easier to reason about (since it makes the
flow of data in the type inference process more explicit).
This is part of a larger effort to elimiate the use of
InferenceContext.getContext and InferenceContext.setType entirely.
Change-Id: I331792cf6d7289a27fc71edfc6af33cd1af5288c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230942
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Rather than do two passes over each collection literal (one to push
contexts down and a second pass to resolve), we pass the contexts down
on the stack during a single resolve pass.
I decided to create an extra data structure to hold the context
information (so I only had one thing to pass around on the stack
rather than four). The extra allocation will carry a small
performance cost. However, I was able to reduce the number of passes
over the collection literal from two to one, replace a chain of
is-tests with a virtual dispatch, and eliminate a double-dispatch in
some cases, so hopefully the benefit of those improvements will more
than offset the cost.
This is part of a larger effort to elimiate the use of
InferenceContext.getContext and InferenceContext.setType entirely.
Change-Id: I949c2c5ef99fc3395de3d67eaa8f326b7af5b158
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231062
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
The VM patch files contain many annotations that guide the TFA and the
VM compilation pipeline. Most of these are not relevant to dart2wasm,
and having the TFA look at these when running inside dart2wasm leads to
sub-optimal, and sometimes even unsound, results.
In order to enable sharing of patch files between the VM and dart2wasm,
the annotation parser is given a target flag to control which
annotations it should recognize and how to parse them. The annotation
parser thus becomes an abstraction layer between the concrete
annotations in the patch files and the parsed annotations that the TFA
sees.
Additionally, external members used by dart2wasm don't always have
external names. To support this, the signature shaker must skip all
external members, not just the ones with an external name. This makes no
difference for the VM, since all of its external members either have an
external name or are implemented in a patch file, making them no longer
external.
TEST=ci + upcoming dart2wasm CL
Change-Id: Id425dd1ccc5560721034ae83c8cdc1593801a4e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231102
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Related to commits
- master branch 57db739be0
- stable (2.16.0) branch f5bb0b33f5
Change-Id: Iad8d84600c870e4b819fc6c62fbb4d6861a575de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231161
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Auto-Submit: Kevin Moore <kevmoo@google.com>
This adjusts RISC-V to match the other architectures in checking only the generational barrier.
TEST=fuzzer
Change-Id: I86965bb2caaae27aa9770769f392cffc8edb6eb8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231046
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
On 32-bit ARM in AOT mode Pointer.asTypedList is generated so that
there is a LoadField from Pointer.data_field which has kUnboxedFfiIntPtr
representation (uint32) and then the value is passed to a
StoreInstanceField for TypedDataBase.data_field which has kUnboxedIntPtr
representation (int32). As a result, a speculative uint32->int32
IntConverter instruction is inserted by SelectRepresentations pass.
AOT doesn't support deoptimization so code generation crashes after
retrying without speculative inlining.
This change fixes the type incompatibility by loading value with
LoadUntagged and then converting it with ConvertUntaggedToUnboxed(kUnboxedIntPtr).
TEST=ffi/regress_flutter97301_test
Fixes https://github.com/flutter/flutter/issues/97301
Change-Id: I4a00d4ac7978b4775add0ddae510841a2b4cbae0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230956
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
- Fixes mostly just include outputting raw names instead of identifiers where we don't want prefixing to happen.
Change-Id: I99c349fd742be2b027290ed02daea57002f152e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231041
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
It was probably one of the first tests of this resolution approach,
and so it lingered in all-in-one-place, even though we decided to
put diagnostics in separate files.
Change-Id: Ic98e3fbdd13b2b41cdc037a8a664833ed63b98de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230960
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This reverts commit 8d412e80e1.
Reason for revert: b/209838275#comment53
TEST=ci
Original change's description:
> [vm] Disable longjmp() wrapper in exceptional flow in TSAN until g3 issue is fixed
>
> Issue b/209838275
>
> TEST=ci
>
> Change-Id: Ie0a2e6f68a0c4f855dfd367dd3dd0a37053be479
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/222760
> Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
> Commit-Queue: Martin Kustermann <kustermann@google.com>
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: Iab202ddbd54060f609096b71f8ef83da53249d40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231005
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Creation of concrete forwarding stubs didn't take into account that an
override might add additional optional parameters making the overridden
member an invalid implementation for the override. This lead to a crash
when trying to compute the super parameter type for the additional
parameters.
Closes https://github.com/dart-lang/sdk/issues/48242
Change-Id: Ie46859d8de328a31eacf7905bb429b0bba61447f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230663
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This CL also adds support for redirecting enum factories.
Part of https://github.com/dart-lang/sdk/issues/47453
Change-Id: Idd16598316a52ac6122a47f4c12f82ab5750d8f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230661
Auto-Submit: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
We already have `get fields`, and it seems that for consistency
we should also have `getField()`.
Change-Id: Id2684eaecf2e77377a63c53271301e5d9b652918
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230920
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
File browser web interface might fail to download large files, so one needs
to use cas tool to download those.
Change-Id: I8053860f9ba443dc481319e5574ecd6d41baf8f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/225560
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Previously we were skipping the donwards inference step. This CL
refactors the downwards inference logic from
instance_creation_expression_resolver.dart so that it can be re-used
for annotations.
Fixes#48201.
Bug: https://github.com/dart-lang/sdk/issues/48201
Change-Id: Ia1b7939cdd350bab9bd019a14a1cf40fb61199ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230821
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This CL fixes one part of #48118 by no longer accidentally calling
String.prototype.at.
- Update the list of names that should not be used for minified instance
method names.
- Expand comment.
- Add a script in tools for finding all the names from within a browser.
Bug: 48118
Change-Id: Iac41bd707d7b447a998d0d94a8b37576dc7d1493
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/228300
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
When a static property lookup fails, the analyzer's error recovery
logic tries to fall back on looking up an instance member. An
unfortunate consequence of this is that the looked-up member may have
a type that refers to unbound type parameters. For example:
class C<T> {
List<T> t = [];
}
var x = C.t; // (1)
Although the line at (1) has an error, the analyzer continues to
analyze it assuming the reference to `t` is valid, producing a static
type for `x` of `List<T>`. But this isn't a valid type because `T`
has no meaning outside the context of the definition of class C.
To avoid unbound type parameters leaking outside the class, we do an
"instantiate to bounds" operation at the time of the error recovery;
for this example that results in a type `List<dynamic>` instead of
`List<T>`.
Change-Id: I763bf32d16345b0a1a6f9f6893e78a138e85c8c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230460
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This is something I noticed when 'gardening': HStringify can throw but
the node was using the default 'canThrow' which returns 'false'. This
has the potential for bad codegen, though I am not aware of an instance
of it happening.
This CL makes the default for `HStringify.canThrow` be `true`.
Stringification for primitive types is pure, so this is added as an
optimization. There are a few improvements from this, including removing
an unused stringification.
Change-Id: I9285d91ec906fb544f8793944578b7e3feb8a634
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230221
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Add dynamic to JS foreign function calls to get implicit
downcast to T, which will cause more accurate type errors
for DDC and dart2js with -O2. Checks will be omitted
with dart2js and -O3.
Bug: #47832
Change-Id: Ie85faf47d58d748b068bc7e902a17a99292f02e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230823
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>