While investigating the flaky test at https://github.com/dart-lang/sdk/issues/60187#issuecomment-3431336127 I found that we had two paths into `handleThreadStartup` - one which explicitly sent a "pause-on-entry" event, and one that did not. The method sets a flag so it only ever runs once.
This means depending on which instance of `handleThreadStartup` occurs, the client may or may not get the pause-on-entry event.
The case where it would is where the isolate already had a pause-start event when we found it. The case where it would not, is if the isolate did not have a pause event (for example it was None because the isolate was just being created).
I can't come up with a good explanation for why we would try to pre-emptively run startup for an isolate we just discovered with no pauseEvent, so I have removed this branch on the assumption that we would always then see a `PauseStart` event for the isolate and then handled it through the same code path (and therefore, always sent the `pause-on-entry` event prior to calling readyToResume).
Fixes https://github.com/dart-lang/sdk/issues/60187
Change-Id: I213e9865480942b074d4d8470703377ea7ddb519
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/457040
Reviewed-by: Helin Shiah <helinx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
* Use lowerCamelCase for constant names
* Use cascades to allow instantiating and returning an ArgParser
without a self-executing closure.
* Use new args APIs: `option`, `flag`, `multiOption`.
Change-Id: I84eb3a1653ef78631911704b41ff0a1e8b979a48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/455860
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Instead of only adding source information if the initializer is null or
one of a few possibilities, instead add a source position if emitting a
store and the variable is not synthesized. This matches an earlier
change which added source information when setting the value of a
non-synthesized variable.
Remove _variableSetNeedsDebugCheck and also remove the only other use of
it as a guard for emitting source positions (static field sets).
TEST=pkg/vm_service/test/breakpoint_on_record_assignment_test
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-dyn-mac-debug-arm64-try
Change-Id: I02b3e118f36714f1e6e29bf9cced7dcd5da8e532
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456980
Auto-Submit: Tess Strickland <sstrickl@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This reverts commit 553887bc56.
Reason for revert: Broken android builds
Original change's description:
> [vm] Add NativeRuntime.streamTimelineTo
>
> This API allows to programmatically generate timeline information
> including profiling samples if timeline format supports it.
>
> This change also includes Perfetto timeline writer and profiler
> into non-mobile PRODUCT builds. The size of Mac OS X dartaotruntime
> has increased by 34352 bytes (0.7%).
>
> TEST=vm/dart/stream_timeline_to_test
>
> CoreLibraryReviewExempt: VM specific dart:developer API.
> Change-Id: I326f5fd29ee82a503160f5f5a2a857a7c55330ec
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426220
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Slava Egorov <vegorov@google.com>
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I583ad74b850514fb47054149da464a07874fc2f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/457000
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
This API allows to programmatically generate timeline information
including profiling samples if timeline format supports it.
This change also includes Perfetto timeline writer and profiler
into non-mobile PRODUCT builds. The size of Mac OS X dartaotruntime
has increased by 34352 bytes (0.7%).
TEST=vm/dart/stream_timeline_to_test
CoreLibraryReviewExempt: VM specific dart:developer API.
Change-Id: I326f5fd29ee82a503160f5f5a2a857a7c55330ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426220
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
In particular, this ensures that the bytecode that initializes pattern
variables has appropriate source information, as those variables have
hoisted definitions with the initialization later happening via a set.
TEST=pkg/vm_service/test/step_through_patterns_test
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-dyn-mac-debug-arm64-try
Change-Id: I9622f88d7205c1efcfa3ca2e761d1b4eb5b5d2b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456660
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Only use the file offset of the assignment operator if the variable has
an initializer, otherwise fall back onto the file offset of the
variable declaration.
TEST=pkg/vm_service/test/issue_25465_test
pkg/vm_service/test/step_through_assign_call_test
pkg/vm_service/test/step_through_assign_int_test
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-dyn-mac-debug-arm64-try
Change-Id: I76284041d941254a10e050a4bebffdec619f2e05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456600
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Changes to IR printing implementation:
* Emit omitted `<...>` marker to make difference between function
without body and function with omitted body clear.
* Extend omtting capability to globals, types and tables
* Extend filtering capability to globals, types, tables
* Better table names: Try to use import or export names if available.
* Option to print globals & types always multiline
* Option to scrub absolute file uris (which aren't stable across machines)
Changes to IR binary / text:
* Extend binary parsing of element section to support imported tables
* Add printing of those (which shows how imported tables are patched)
(The patching of importing tables is used in deferred modules)
Changes to IR test framework:
* Allow more filters (see above) in the test files.
* Allow tests to use helper libraries (containing `.h.` in their name)
without them being considered tests themselves.
* Allow using deferred loading in tests and write expectation files for
main & deferred modules as wat files.
Other things:
* Share more code between `pkg/dart2wasm/bin/wasm2dart.dart` and
`pkg/dart2wasm/test/ir_test.dart`
* Add baseline test for deferred loading using tear off constants
Change-Id: Ica6666f23f5aa6fb2174f414c9082039940f8dc5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456460
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Upon a `textDocument/semanticTokens/full` request the analysis server
sorts the "tokens" via `sort` on List giving it a compare method.
The method, though, created a map literal for each comparison.
This CL "inlines" the map (it only had one entry anyway) and adds a
benchmark, where I note these changes:
```
1000:
Difference at 95.0% confidence
-0.0274151 +/- 0.0135978
-33.1981% +/- 16.4662%
(Student's t, pooled s = 0.0181832)
2000:
Difference at 95.0% confidence
-0.027344 +/- 0.0096196
-20.9529% +/- 7.3712%
(Student's t, pooled s = 0.0128635)
4000:
Difference at 95.0% confidence
-0.108847 +/- 0.0196627
-35.3172% +/- 6.37987%
(Student's t, pooled s = 0.0262932)
8000:
Difference at 95.0% confidence
-0.20647 +/- 0.0272577
-34.4932% +/- 4.55371%
(Student's t, pooled s = 0.0364494)
16000:
Difference at 95.0% confidence
-0.384931 +/- 0.0401393
-31.4809% +/- 3.28272%
(Student's t, pooled s = 0.0536748)
```
Change-Id: Ibacce056cd3f154afc9377805bbccfd8c5ca9ea9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456341
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Given the existing assumptions that original source files will be
served in a directory structure similar to layout defined by the
package_config.json but without `lib/` directories this change
attempts to detect when a source map contains sources from multiple
lib directories and clean them up from the relative paths.
The strategy used relies on passing a package_config.json as a signal
to detect when sources come from different packages.
Fixes: https://github.com/dart-lang/webdev/issues/1692
Issue: https://github.com/dart-lang/sdk/issues/40251
Change-Id: I6b82b33bae485d74fc61ef118dbe9ffddafab9a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456500
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
We rename constant names to use lowerCamelCase, and append
"AttributeName" in most cases, as most constants refer to a (as it is
documented) "JSON attribute."
Additionally the `toJson` methods can be simplified by returning
Map literals, instead of setting key/value pairs in individual
statements.
Change-Id: I5f0adabfa3c4d274407ae8a5b5684dce22f9b5fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/455880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This is the sibling CL to https://dart-review.googlesource.com/c/sdk/+/455040. In that CL, I made changes to
BestPracticesVerifier, which handles `deprecated_member_use`, but
neglected to handle this lint rule.
When a generative, non-redirecting constructor does not feature a
super-initiailizer, then the supertype's unnamed constructor is called
implicitly. If that super-constructor is deprecated, then we should
report any implicit call as usage.
Change-Id: I990e7f53da5f5ba98612193941e9607f1d3cbca4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456180
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Introduce first-class support for duplicate or cross-kind top-level name
conflicts in the fine-grained analyzer pipeline.
- Add `declaredConflicts` to `LibraryManifest` to record names that are
declared more than once (e.g., two classes) or across kinds (e.g., a
class and a top-level function). Conflicts are assigned a generated
`ManifestItemId` that is exported and used consistently.
- Ensure conflict handling covers related lookup names (e.g., getter/
setter pairs `foo` and `foo=`), removing them from per-kind declared
maps and placing a single entry in `declaredConflicts`.
- Update manifest building to detect conflicts deterministically:
- Stage variables, then getters/setters, then non-property members.
- Track `conflictingTopLevelElements` to skip invalid incremental
updates.
- Include `declaredConflicts` in serialization/deserialization and in
`exportMap` / `exportedIds`. Make `getDeclaredId` prefer conflicts.
- In `manifest_context`, resolve top-level IDs via `declaredConflicts`
before per-kind maps for stable identity.
- In requirements computation, skip conflicted names when producing
instances/interfaces, preventing inconsistent shapes and crashes.
- Make exported extensions resolution null-safe when duplicates exist.
- Extend result printing to display `declaredConflicts`.
- Bump `DATA_VERSION` to 580.
Why: Previously the analyzer assumed unique top-level names, which led
to crashes and inconsistent IDs when a library contained duplicates
(e.g., duplicate extension types, multiple classes named the same, or a
class/function collision). Representing conflicts explicitly yields
stable IDs, predictable exports, and reliable incremental linking and
diagnostics.
Bug: https://github.com/dart-lang/sdk/issues/61741
Change-Id: If153ce467f45156ee3918b5211b8e5e7b7f164ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456485
Reviewed-by: Paul Berry <paulberry@google.com>
In future this would allow us to automatically include libraries
specified in dynamic_interface.yaml into the compilation set as if
they were imported from Dart code.
Bug: b/452833638
TEST=ci
CoreLibraryReviewExempt: no API changes, only pragmas
Change-Id: If5705159148cd48f49f21485550747db1365767c
Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try,vm-dyn-mac-debug-arm64-try,vm-ffi-dyn-mac-debug-simarm64_arm64-try,vm-ffi-dyn-mac-release-simarm64_arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456401
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
This CL tests the following:
- A declaring body constructor can have a body and an initializer list
as well as initializing formals and super parameters, just like other
constructors in the body.
- A declaring header constructor can have a body and an initializer
list. These elements are placed in the class body in a declaration that provides "the rest" of the constructor declaration which is given in the header.
- Declaring constructors with optional parameters can have default values, but they must be constant.
- Declaring constructors can have initializing formals.
- Declaring constructors can have super parameters.
- Declaring constructors can have named parameters, required or not.
- Declaring constructors can be constant.
- Declaring constructors can have assertions.
- Declaring constructors can have optional parameters. These optional parameters can have default values (which must be constant).
Bug: https://github.com/dart-lang/sdk/issues/61687
Change-Id: Id1c53a99a7c7748ac92ca8c4a411f762eea21a37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456164
Reviewed-by: Erik Ernst <eernst@google.com>
Not for performance, because it is one shot, but all language/ and co19/
code will go through manifests builder, and give us better coverage.
Change-Id: Iae83ec685084847358d960deff81d18fb9904f4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456404
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Saw a crash in logs:
StateError: Bad state: Missing a visit method for a node of type NullAwareElementImpl
at ExitDetector.visitNode (exit_detector.dart:457)
at GeneralizingAstVisitor.visitCatchClause (visitor.g.dart:89)
at GeneralizingAstVisitor.visitExpression (visitor.g.dart:216)
at NullAwareElementImpl.accept (ast.dart:17535)
at _extension#1.terminatesControl (use_build_context_synchronously.dart:1377)
at AsyncStateVisitor._visitIfLike (use_build_context_synchronously.dart:857)
at AsyncStateVisitor.visitIfStatement (use_build_context_synchronously.dart:426)
at IfElementImpl.accept (ast.dart:12479)
at AsyncStateVisitor._asynchronousIfAnyIsAsync.<fn> (use_build_context_synchronously.dart:682)
Change-Id: Idf79a71b33411eba63b2a01b22d1f18b89fbeac4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456111
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
A recent change somewhere caused some Dart-Code tests to fail. The expression "DateTime.now().ye" used to fail to compile and resulted in a failed RCP call to the VM service ("Expression compilation error") but now it returns a valid result that is a `vm.ErrorRef`.
This applies the same regex to the error message in this path to extract the most useful part of the error text when in the "watch" context so that the visible part of the message is not just "Unhandled exception".
Fixes https://github.com/Dart-Code/Dart-Code/issues/5759
Change-Id: I2933f9d811ec28446f4d2a857c1fd5bd18c94816
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456241
Reviewed-by: Helin Shiah <helinx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Saw a crash in logs:
_TypeError: Null check operator used on a null value
at OverrideVerifier._isOverride (override_verifier.dart:91)
at OverrideVerifier.visitFieldDeclaration (override_verifier.dart:43)
at FieldDeclarationImpl.accept (ast.dart:8995)
at NodeListImpl.accept (ast.dart:17222)
at ClassDeclarationImpl.visitChildren (ast.dart:3207)
at RecursiveAstVisitor.visitClassDeclaration (visitor.g.dart:833)
at OverrideVerifier.visitClassDeclaration (override_verifier.dart:26)
Change-Id: Ia61c0659b299795b1054840377ed066373cfe1ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456110
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Saw a crash in logs:
_TypeError: Null check operator used on a null value at
RequiredParametersVerifier._check
(required_parameters_verifier.dart:147) at
RequiredParametersVerifier.visitInstanceCreationExpression
(required_parameters_verifier.dart:83) at
ErrorVerifier.visitInstanceCreationExpression (error_verifier.dart:1153)
at InstanceCreationExpressionImpl.accept (ast.dart:13711) at
NamedExpressionImpl.visitChildren (ast.dart:16661) at
RecursiveAstVisitor.visitNamedExpression (visitor.g.dart:1345)
Change-Id: Ia78df6ee7179f511d869ebb4706da5cda6a0ea29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456109
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>