It is safe for multiple isolates to set their values concurrently. Only growth of the field tables needs to be excluded by the write lock.
A storm of such setters are invoked as part of core library initialization during isolate spawning.
TEST=ci, tsan
Change-Id: I4677e33ee80bb06d261ada2ae9d6b71c94fde611
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405400
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
This moves the existing `debugPrintCommunication` flag out of `test/lsp` into `test/` and passes it to the `MockServerChannel` to simplify printing protocol messages for LSP-over-Legacy tests (similar to what MockLspServerChannel already does).
Change-Id: Ic5fa6309e8de01ce0c624584ad6eb653ced90698
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406021
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
The async state machine uses a single state in the heap to store the current exception and stacktrace when within a catch block in case they need to be rethrown. When catch blocks are nested this state can be overwritten.
With this new change, before entering a new catch we store the current value of the exception/stacktrace in a local that we can restore after exiting the associated catch blocks. A wasm catch can represent multiple Dart catch blocks so we only need to store the state per wasm catch.
Fixes: https://github.com/dart-lang/sdk/issues/59981
Change-Id: I738084fdecdf5aceac65c5d3698e40b791175171
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405920
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Convert range boundaries with symbolic references to other instructions
into constant boundaries to avoid serializing extra references.
Specially handle serialization of arguments descriptors which are
cached in the VM isolate.
TEST=ci
Change-Id: Ifab3bb4d9b037aaefd81d38dd93d47cd4b42cf1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405571
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Say you have a class method like this:
```
class Bar {
/*offset a*/ void /*offset b*/ qux() {
/*offset c*/ print("hello");
}
}
```
Lets also say that this method is run.
This will mark offset a and offset c as hits.
Offset b does not exist in coverage terms.
Now say you have an extension mehod like this:
```
extension Foo on Bar {
/*offset a*/ void /*offset b*/ baz() {
/*offset c*/ print("hello");
}
}
```
Lets also say that this method is also executed.
This will mark offset a and offset c as hits.
Offset b does not exist in coverage terms for this method.
Because extension methods are special though we create a special tearoff for
it. Lets say we didn't execute that one.
The tearoff method - before this CL - had offset b on positions that caused
the position to exist in coverage terms, and as the method wasn't executed
this would make it a miss.
This CL fixes the issue by setting the offsets on the tearoff that before
introduced offset b to offset a instead.
Change-Id: I3a5339135f3d76327624b35f04cc14afccaf487a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404563
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This class had a few methods which only pertain to the resource provider
and can just be extensions on ResourceProvider. They also have the
exact same impl! So one can redirect to the other.
Change-Id: I3a0433304adba1b71f69d0a4afc8a44515a23d10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405600
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Field types, getter types, method return types, and method parameter
types are changed to `Impl` types in the following classes:
- `BodyInferenceContext`
- `BinaryExpressionResolver`
- `ForResolver`
- `ListPatternResolver`
- `PrefixExpressionResolver`
- `StaticTypeAnalyzer`
- `TypeConstraintGatherer`
- `TypeSystemOperations`
- `YieldStatementResolver`
Additionally, the type `DartType` is changed so that it no longer
implements `SharedTypeStructure`. Instead, the private class
`TypeImpl` implements `SharedTypeStructure`.
There is no change to the analyzer public API.
This is part of a larger arc of work to change the analyzer's use of
the shared code so that the type parameters it supplies are not part
of the analyzer public API. See
https://github.com/dart-lang/sdk/issues/59763.
Change-Id: Idbf09e25a26249a16e65a59274e66b477480d697
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405802
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Field types, getter types, method return types, and method parameter
types are changed to `Impl` types in the following classes:
- `AssignmentExpressionResolver`
- `DartPatternImpl` and its subtypes
- `ExpressionImpl` and some of its subtypes
- `PropertyElementResolver`
- `RecordLiteralResolver`
- `TypeParameterElementImpl2`
- `TypeSystemImpl`
- `_InferenceLogWriterImpl`
There is no change to the analyzer public API.
This is part of a larger arc of work to change the analyzer's use of
the shared code so that the type parameters it supplies are not part
of the analyzer public API. See
https://github.com/dart-lang/sdk/issues/59763.
Change-Id: I2cc0dcf0a8e0d97053bf6da4975c729500bb1131
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405840
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
When running in an iframe without specific flags, DDC may not have access to `localStorage`. In this context, even trying to access `window.localStorage` can cause an exception in the iframe.
Wrapping the check in a try/catch allows us to safely check for access before using it.
Change-Id: I0c5d3d0ac34a550444c12b52f6519a9446ebfe9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405608
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Field types, getter types, method return types, and method parameter
types are changed to `Impl` types in the following classes and
extensions:
- `CompoundAssignmentExpressionImpl`
- `ExecutableElementExtensionQuestion`
- `ExtensionElementImpl`
- `ExtensionResolutionError`
- `FunctionReferenceResolver`
- `InstanceElementImpl2`
- `InstantiatedExtensionWithMember`
- `InstantiatedExtensionWithMember2`
- `InterfaceElementImpl`
- `InvocationInferrer`
- `LexicalLookupResult`
- `LocalVariableTypeProvider`
- `PostfixExpressionResolver`
- `PropertyElementResolverResult`
- `RecordTypeExtension`
- `ResolutionResult`
- `ResolverVisitor`
- `SimpleResolutionResult`
- `TypePropertyResolver`
There is no change to the analyzer public API.
This is part of a larger arc of work to change the analyzer's use of
the shared code so that the type parameters it supplies are not part
of the analyzer public API. See
https://github.com/dart-lang/sdk/issues/59763.
Change-Id: I5d0d432301df38c7a5ccc7c65767cf73ce7b5d7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405801
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Some of the LSP-over-Legacy tests were intermittently failing because the test did not correctly wait for the `setClientCapabilities` request to complete.
The reason for this was that it used the ID `0` (from `_newRequestId`) but so did `setAnalysisRoots`. If the timing was right, the second request would appear to complete when the first did (because the response had id=0) and the test would start before the capabilities had actually been set (and since the test reads them directly off the server, they would be incorrect).
This moves the `_nextRequestId` field down into a base class and updates the helpers for requests like `setAnalysisRoots` to use it too.
Change-Id: Ice44191aad39c7ea81c40e501827557fe563e3d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405760
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
* Normalize white space around source code strings before producing
diffs by trimming and appending a single newline character.
* Write an empty line between the source code and diff text in
generation files.
* Run dart format on all test files.
With these changes you should be able to run the hot reload suite with
`--diff write` and dart format the code multiple times without
introducing changes in the file.
Change-Id: Ifc0b1dd7032bd448f5f6568c5aa3c18dde076c71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405247
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This does some micro-optimizations in UTF-8 decoder that wasm-opt
doesn't do for us.
- Inline some small and/or single-use functions.
- Instead of passing `U8List` to parser functions, pass the `array i8`
of the `U8List`. This eliminates a layer of indirection when accessing
the array in loops.
- Copy `_Utf8Decoder.transitionTable` and `_Utf8Decoder.typeTable`,
which are `String`s, as `array i8`s. This also eliminates a layer of
indirection when accessing the tables.
CoreLibraryReviewExempt: added dart2wasm inline pragma.
Change-Id: I1fd2b6a94e74e1565ba87068299cb80f5a0e9e94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405480
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
This is a reland of commit 103ffd6041
Parent CL adds "aarch64" as a `uname -m` possibility for ARM64.
TEST=manual testing
Original change's description:
> [pkg/vm] Handle cross compilation in dart_precompiled_runtime2.
>
> When cross compiling, use qemu-<arch> to run dartaotruntime for
> the target architecture.
>
> TEST=manual testing with native X64 and cross-compiling ARM64 on X64.
>
> Change-Id: I6ce4e2cfa3108108fe05c7a1fcd2c400a8a47492
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404600
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Tess Strickland <sstrickl@google.com>
Change-Id: I4407f64e804fbc19d05440ed961a67b5e1c2c047
Cq-Include-Trybots: luci.dart.try:benchmark-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405761
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
This is a reland of commit 11a338000b
Adds "aarch64" as a `uname -m` possibility for ARM64.
TEST=manual testing
Original change's description:
> [pkg/vm] Handle cross compilation in the precompiler2 script.
>
> When cross compiling, gen_snapshot for the host architecture is in
> ${BUILD_DIR}/clang_<arch>/gen_snapshot.
>
> TEST=manual testing with native X64 and cross-compiling ARM64 on X64.
>
> Change-Id: I9f6af045675612651c659683081aca3e65acad1b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404421
> Reviewed-by: Slava Egorov <vegorov@google.com>
Change-Id: I4fb4812dfa96ba582ca3bedbfd68d58ce2a4ab5b
Cq-Include-Trybots: luci.dart.try:benchmark-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405780
Reviewed-by: Slava Egorov <vegorov@google.com>
For entry-point pragma annotations, most of the time they are
used with either no argument or with an argument that evaluates
to either
* false to denote the annotation should not take effect, or
* null or true to denote the annotation should take effect.
However, the user can also specify that only part of the operations
on a member should be accessed from native code by using a string
argument that is either 'call', 'set', or 'get'.
The entry point verification in Invoke/InvokeGetter/InvokeSetter
assumes that for getters and setters, the only valid string argument
is 'get' or 'set', respectively. This is because those methods are
called via `Dart_GetField`[0] and `Dart_SetField`, respectively, as if
they were the getter or setter of a defined field.
However, the precompiler previously assumed that the string
argument 'call' was the only string argument that meant the link
to a function's code object should be saved. Similarly, it assumed the
string argument 'get' for functions meant that their implicit closure
function should be saved, which ends up including getters. Furthermore,
it did not do anything with setters annotated with the string argument
'set'. This means that the code link would not be saved for getters or
setters that were annotated with the string argument expected by the
entry point verifier.
This CL aligns the precompiler to match the expectations of other
parts of the codebase. It also changes TFA to report an error
if a getter or setter is marked with the string argument 'call'.
[0] `Dart_Invoke` can be called with the name of a getter that
returns a closure, but doing so is semantically equivalent to
calling `Dart_GetField` followed by `Dart_InvokeClosure`.
TEST=vm/dart/entrypoint_verification_test
Fixes: https://github.com/dart-lang/sdk/issues/59920
Change-Id: Ia2768bbaf9058bb14a1cdfb331eb85fa082a0e90
Cq-Include-Trybots: luci.dart.try:vm-aot-dwarf-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-product-x64-try,vm-aot-mac-product-arm64-try,vm-aot-obfuscate-linux-release-x64-try,vm-linux-debug-x64-try,vm-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404823
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>