Commit graph

20256 commits

Author SHA1 Message Date
Martin Kustermann 404b71b2c5 [gardening] Fix null-save vm/dart/spawn_shutdown_test to not have compile-time error
TEST=Make vm/dart/spawn_shutdown_test run

Change-Id: Iaf5785f43918b2428a9810320677a9d1309fca6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281622
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-02-08 12:07:57 +00:00
Martin Kustermann 63b5f5d4b1 [vm] Ensure we copy shallow (but not deeply) immutable lists
The object graph copy code assumed kImmutableCid is used only for
list constants but it turns out our List.immutable([]) implementation
isn't using a wrapper-view, but instead a fixed-length immutable list as
with constants:

  factory List.unmodifiable(Iterable elements) {
    final result = new List<E>.from(elements, growable: false);
    return makeFixedListUnmodifiable(result);
  }

The list constants should already be handled via canonical bit.

Issue https://github.com/dart-lang/sdk/issues/51302

TEST=vm/dart{,_2}/isolates/regress_51302_test

Change-Id: I5924084ff004dc52bf675897455453d728484d1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281421
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-02-08 08:58:40 +00:00
Ryan Macnak e8b6c8a44f Reland "[build] Make build_analyze_snapshot consistent between the host and target toolchains."
Also create this target for Fuchsia, which like Linux and Android uses ELF.

Bug: https://github.com/dart-lang/sdk/issues/51242
Change-Id: I8e991d361b5defaa52b62a78d515a7639a6dfba0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281460
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-02-07 18:45:20 +00:00
William Hesse b5302e52d0 Revert "[build] Make build_analyze_snapshot consistent between the host and target toolchains."
This reverts commit 881825980e.

Reason for revert: The Fuchsia build of Flutter engine is broken by this change, since it uses the analyze_snapshot target.

Original change's description:
> [build] Make `build_analyze_snapshot` consistent between the host and target toolchains.
>
> Bug: https://github.com/dart-lang/sdk/issues/51242
> Change-Id: I7a0ad1f0bc94c4593412945e4887f9045693fd40
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280782
> Reviewed-by: Daco Harkes <dacoharkes@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=rmacnak@google.com,dacoharkes@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I3f069274fdef9366fea347ae5f452d2eb2267f70
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/51242
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281423
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Auto-Submit: William Hesse <whesse@google.com>
2023-02-07 14:33:57 +00:00
なつき cd31999589 Add missing include <initializer_list>
Closes https://github.com/dart-lang/sdk/pull/51238

GitOrigin-RevId: eb85431355a00d8fb270bef963b9d5e6473114d0
Change-Id: Ic108d8f03016a688202914d268a5d107165787fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280540
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-02-06 22:19:55 +00:00
Ryan Macnak 09c9301ca0 [vm] Weakly cache all RegExp per isolate group, instead of strongly caching 256 RegExp per isolate.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/51228
Change-Id: Ie2869585ae847ea154460122d7ec5af81ef7697c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280521
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-02-06 21:49:07 +00:00
Ryan Macnak 881825980e [build] Make build_analyze_snapshot consistent between the host and target toolchains.
Bug: https://github.com/dart-lang/sdk/issues/51242
Change-Id: I7a0ad1f0bc94c4593412945e4887f9045693fd40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280782
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-02-06 18:19:35 +00:00
Alexander Markov 134b2dca86 Revert "[vm] Account for changes in the implicit getters due to load guards"
This reverts commit 87810072db.

Reason for revert: breaks hot reload test case in Flutter,
reverting as temporary workaround to https://github.com/flutter/flutter/issues/120091.

Original change's description:
> [vm] Account for changes in the implicit getters due to load guards
>
> Hot reload may mark certain fields as 'needs_load_guard', meaning
> types of their values should be checked on access, in the implicit
> getters.
>
> Unoptimized code for implicit getters of such fields should be
> forcefully recompiled during hot reload in order to update their
> code. This ensures that optimized code in future can deoptimize
> into the updated unoptimized code of implicit getters.
>
> TEST=vm/cc/IsolateReload_ImplicitGetterWithLoadGuard
> TEST=corelib/string_fromcharcodes_test, lib/convert/json_utf8_chunk_test
> and vm/dart/string_equals_test on vm-reload-linux-{debug,release}-x64
> configurations.
>
> Fixes https://github.com/dart-lang/sdk/issues/51215
> Fixes https://github.com/flutter/flutter/issues/103268
>
> Change-Id: I1afbeabb4a60b7a5f69ed055f40beeb6d3dcf359
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280401
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Ia7dba382547cceb38524707f9ecef892016108de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281220
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-02-06 17:46:18 +00:00
Martin Kustermann c9f3aca45b [vm] Ensure we only enqueue maps/sets to be rehashed if we know it got copied successfully
Closes https://github.com/dart-lang/sdk/issues/51226

TEST=vm/dart{,_2}/regress_51226_test

Change-Id: I1da2dfe45863d5f1004efde3a4ecaae89ffd62fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280469
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-02-06 11:00:29 +00:00
Brandon DeRosier ad706a96d9 Revert "[VM/Timeline] Improve handling of track metadata"
This reverts commit 3787601dd0.

Reason for revert: Introduces a crash that's blocking the Dart->Flutter roller: https://github.com/flutter/flutter/issues/120012

Original change's description:
> [VM/Timeline] Improve handling of track metadata
>
> The track information that we send over the service is currently
> incomplete. Since we only iterate over the threads that exist at the
> time when getVMTimeline is called, we're missing information about any
> threads that were joined before that. This CL fixes this issue.
>
> TEST=CI, ASAN, and I manually checked that more track names are
> populated when the changes in this CL are applied
>
> Change-Id: Ic4edc9910884c3f4743dc0ca65aa7d2a695ff09d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280058
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Derek Xu <derekx@google.com>

TBR=bkonyi@google.com,derekx@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I920c8d439a3b253c331dd730b637dbfeaad62157
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281000
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Auto-Submit: Brandon DeRosier <bdero@google.com>
2023-02-04 23:47:11 +00:00
asiva dae49a0ca2 [VM/Coverage] Fix memory leak in coverage code.
TEST=ci (existing test which was failing and should pass now)

Bug:51209
Change-Id: Ia156200af2b1271677f0a8ff576998b255adc964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280600
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2023-02-03 23:35:53 +00:00
Alexander Markov 87810072db [vm] Account for changes in the implicit getters due to load guards
Hot reload may mark certain fields as 'needs_load_guard', meaning
types of their values should be checked on access, in the implicit
getters.

Unoptimized code for implicit getters of such fields should be
forcefully recompiled during hot reload in order to update their
code. This ensures that optimized code in future can deoptimize
into the updated unoptimized code of implicit getters.

TEST=vm/cc/IsolateReload_ImplicitGetterWithLoadGuard
TEST=corelib/string_fromcharcodes_test, lib/convert/json_utf8_chunk_test
and vm/dart/string_equals_test on vm-reload-linux-{debug,release}-x64
configurations.

Fixes https://github.com/dart-lang/sdk/issues/51215
Fixes https://github.com/flutter/flutter/issues/103268

Change-Id: I1afbeabb4a60b7a5f69ed055f40beeb6d3dcf359
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280401
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-02-03 22:23:22 +00:00
Derek Xu 3787601dd0 [VM/Timeline] Improve handling of track metadata
The track information that we send over the service is currently
incomplete. Since we only iterate over the threads that exist at the
time when getVMTimeline is called, we're missing information about any
threads that were joined before that. This CL fixes this issue.

TEST=CI, ASAN, and I manually checked that more track names are
populated when the changes in this CL are applied

Change-Id: Ic4edc9910884c3f4743dc0ca65aa7d2a695ff09d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280058
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-02-03 21:40:58 +00:00
Ryan Macnak da70eb45f2 [test] Skip slow tests on reload bots.
Change-Id: I1e5e068bd765b1850b70f0253466d6e2e8c12a1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280781
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-02-03 20:52:03 +00:00
Sam Rawlins 4495ccf80d [observatory] Fix nullable catch paramter issues
`NULLABLE_TYPE_IN_CATCH_CLAUSE` is becoming a warning, so these must be
fixed (or ignored).

TEST=presubmit

Bug: https://github.com/dart-lang/sdk/issues/50796
Change-Id: I8343f3e1f49ed3c05dcf2d99a98cef8a953afc7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280563
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-02-03 17:32:27 +00:00
Daco Harkes 67f1d3ea3c [vm] MemoryCopyInstr clean up UB arithmetic
TEST=runtime/vm/compiler/backend/memory_copy_test.cc

Change-Id: I7d986567fe03a15d7f99db43940226b2c3adf9ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280467
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-02-03 16:42:52 +00:00
Daco Harkes 360fd45435 [vm] MemoryCopyInstr increase element size if possible
A larger element size results in larger mov instructions. This reduces
code size and increase performance.

The element size can only be increased if
* src_offset, dest_offset, and length parameters are const,
* and if they contain a common denominator (powers of two).

TEST=runtime/vm/compiler/backend/memory_copy_test.cc

Bug: https://github.com/dart-lang/sdk/issues/51031
Change-Id: If35fb419aa118c497b15c122bdf6279266e2294a
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-kernel-nnbd-mac-debug-arm64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-win-debug-x64c-try,vm-kernel-win-debug-ia32-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-reload-rollback-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279506
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-02-03 12:55:31 +00:00
Daco Harkes 534453e20d [vm] MemoryCopyInstr Remove constant length loops
Removes loops with constant lenght taking code-size into account.

On ia32 and x64 only removes single iteration (removing the branch).
This speeds up single byte copies.

On arm, arm64, and risc-v, removes loops up to 4 iterations,
shrinking code size.
No speedups were measured on these platforms.

TEST=runtime/vm/compiler/backend/memory_copy_test.cc

Bug: https://github.com/dart-lang/sdk/issues/51031
Change-Id: I292ebde023b3ec2c3a9ce872e0c9543ac43371b9
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-kernel-nnbd-mac-debug-arm64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-win-debug-x64c-try,vm-kernel-win-debug-ia32-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-reload-rollback-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279178
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-02-03 12:55:31 +00:00
Daco Harkes e51b24ad5d [vm] MemoryCopyInstr unbox length
This CL removes a Smi untagging by taking an unboxed input for the
length in the memory copy instruction or changing the loop decrementor
to 2 instead of 1.

Unboxing required implementing the method in the inliner because
unboxed representations cannot be used in the method recognizer.

Reduces code size slightly.
Does not measurably improve speed.

TEST=runtime/vm/compiler/backend/memory_copy_test.cc

Bug: https://github.com/dart-lang/sdk/issues/51031
Change-Id: Ie311929af25b76c3b899ff2791bfaf4e40b1f06f
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-kernel-nnbd-mac-debug-arm64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-win-debug-x64c-try,vm-kernel-win-debug-ia32-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-reload-rollback-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279172
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-02-03 12:55:31 +00:00
Daco Harkes 1aa7a9397a [vm] MemoryCopyInstr optimize constant src and dest start
When constants are passed in to the source and destination start,
no registers are needed for these. The constants are directly compiled
into the machine code. If the constant happens to be 0, no machine
code is emitted at all.

I did not measure any speed improvements. Likely the micro-code
schedulers in the CPUs already noticed the no-ops.

I have verified manually that we emit smaller machine code with
these changes on x64.

TEST=runtime/vm/compiler/backend/memory_copy_test.cc

Bug: https://github.com/dart-lang/sdk/issues/51031

Change-Id: I70f12c9ae299b44a8f5007ca3a8c5ee56a9aff40
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-kernel-nnbd-mac-debug-arm64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-win-debug-x64c-try,vm-kernel-win-debug-ia32-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-reload-rollback-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279170
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-02-03 12:55:31 +00:00
Daco Harkes bf7d643686 [vm/test] MemoryCopyInstr unit tests
TEST=runtime/vm/compiler/backend/memory_copy_test.cc

Bug: https://github.com/dart-lang/sdk/issues/51031
Change-Id: I6b0b2eb63f97ae9d7d3c9c80d998929f657ef482
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-kernel-nnbd-mac-debug-arm64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-win-debug-x64c-try,vm-kernel-win-debug-ia32-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-reload-rollback-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279387
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-02-03 12:55:31 +00:00
Martin Kustermann 809ae4cc1d [gardening] Fix ubsan integer overflow when testing max distances for pc-relative calls
Closes https://github.com/dart-lang/sdk/issues/51211

TEST=Fixes vm/cc/PCRelativeCallPatterns in ubsan

Change-Id: I4c00e6ed2b73f63581a2df90a08cf70d1184898a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280322
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-02-03 11:00:18 +00:00
Ryan Macnak c81b00938d [standalone] Fix memory leak in the tag handler.
TEST=asan
Bug: https://github.com/dart-lang/sdk/issues/37030
Bug: https://github.com/dart-lang/sdk/issues/51210
Change-Id: Ia62a4d7d1805c6ac4a311ef9952fff248e7b4693
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280284
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-02-02 21:35:47 +00:00
Ryan Macnak 9cd26c14f0 [test] Mark weak_canonical_string_table_test as slow on TSAN.
Change-Id: I2cf0004e2b861cd9521f89aa003ce83ccba8d5c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280405
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-02-02 20:55:38 +00:00
Liam Appelbe 9ad59be793 Revert "Suppress sign-compare warnings for musl libc"
This reverts commit 9fefe1054e.

Reason for revert: Breaks the riscv64 bot: https://logs.chromium.org/logs/dart-internal/buildbucket/cr-buildbucket/8790248947000585777/+/u/build_dart/stdout

Original change's description:
> Suppress sign-compare warnings for musl libc
>
> Closes https://github.com/dart-lang/sdk/pull/51225
>
> GitOrigin-RevId: 0c2d3d4b79a461d1af2127061b3857f08c22856d
> Change-Id: I9e58cccfdf65604baf0789c2a4294dfb50590e95
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280252
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Slava Egorov <vegorov@google.com>

TBR=vegorov@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com,copybara-worker-blackhole@google.com

Change-Id: I05c64d556b7bd6f4099f8468a94557d9a51e5260
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280480
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2023-02-02 20:28:46 +00:00
Dan Chevalier deca6a66e7 Reland "Update HTTP Profiling ids to use Strings"
This is a reland of commit e7d8261f9a




Original change's description:
> Update HTTP Profiling ids to use Strings
>
> The internal Dart Ids can be 64 bit integers, and are passed to Dev Tools as integers. This is causing errors fetching requests as the ids can overflow once they get to dev tools.
>
> Interaction between `getHttpProfile` and `getHttpProfileRequest` are already performed in https://dart-review.googlesource.com/c/sdk/+/279122/3/pkg/vm_service/test/get_http_profile_test.dart
>
> https://github.com/flutter/devtools/issues/2860
>
> TEST=The original tests test the surface of the RPCs that are updated here. Any tests that needed tweaking have also been fixed. https://github.com/flutter/devtools/pull/5127 is being submitted to Devtools and G3, and the regressions have been tested against vm_service:10.0.0 and vm_service:11.0.0
> CoreLibraryReviewExempt: Changes are only to http profiling
> Change-Id: Ie560dde7629f91f4221c1fe18d153cd999691086
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279122
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Dan Chevalier <danchevalier@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>

TEST=The original tests test the surface of the RPCs that are updated here. Any tests that needed tweaking have also been fixed. https://github.com/flutter/devtools/pull/5127 is being submitted to Devtools and G3, and the regressions have been tested against vm_service:10.0.0 and vm_service:11.0.0
CoreLibraryReviewExempt: Changes are only to http profiling
Change-Id: I132f30111ca9c4c53dec377f6038453cacfc6243
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280020
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Dan Chevalier <danchevalier@google.com>
2023-02-02 19:22:49 +00:00
asiva df84ed6d35 Fix leak memory leak in Dart_GetObfuscationMap.
TEST=ci (fixes an existing test failure).

Bug:51224
Change-Id: I73e6f954f3c36a8675c94a919964b8403abc1498
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280254
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-02-02 17:42:58 +00:00
Ben Konyi 0d5f297bc7 [ VM ] Don't attempt to build a Profile with a null sample buffer
TEST=N/A

Change-Id: I7c3c505fb73a9d568ab567fcf41c91c8fc9216d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280440
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-02-02 17:34:57 +00:00
Alexander Markov a9d9b7395b [kernel] Enable sound null safety in TargetFlags by default
TargetFlags.enableNullSafety is set to true by default and
also renamed to TargetFlags.soundNullSafety to better reflect its
meaning.

TEST=ci

Change-Id: I2c2f30c2af6502fd9a96141dc60e4afbf8c524fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280216
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-02-02 14:54:18 +00:00
なつき 9fefe1054e Suppress sign-compare warnings for musl libc
Closes https://github.com/dart-lang/sdk/pull/51225

GitOrigin-RevId: 0c2d3d4b79a461d1af2127061b3857f08c22856d
Change-Id: I9e58cccfdf65604baf0789c2a4294dfb50590e95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280252
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-02-02 09:07:58 +00:00
Ryan Macnak 1f7ac27eec Revert "Suppress clang warning for musl libc inline"
This reverts commit ddc19f7f92.

Reason for revert: Breaks gcc build
../../runtime/bin/socket_base_posix.cc:161: error: ignoring #pragma clang diagnostic [-Werror=unknown-pragmas]
  161 |     cmsg = CMSG_NEXTHDR(&msg, cmsg);
      |
cc1plus: all warnings being treated as errors

Original change's description:
> Suppress clang warning for musl libc inline
>
> Closes https://github.com/dart-lang/sdk/pull/51191
>
> GitOrigin-RevId: d7064c43adce0b115c79e818800e44ba4f60739e
> Change-Id: Ie73e96c83294d43baf3be6772cb84705ba2d2712
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280136
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Slava Egorov <vegorov@google.com>

TBR=vegorov@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com,copybara-worker-blackhole@google.com

Change-Id: I8b726d616ba1b5434b92c239c3b8897a942fad5b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280300
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-02-01 23:25:47 +00:00
Alexander Markov 638b3aa8c5 [vm] Correct rebind rule for static call to Record.get:_fieldNames
This change fixes assertion

../../runtime/vm/object_reload.cc: 942: error: expected: old_target_.is_static() || old_target_.kind() == UntaggedFunction::kConstructor

which happened when updating a target of static call from
record field getter to Record._fieldNames.

TEST=language/records/simple/dynamic_field_access_test
(on vm-reload-linux-debug-x64 configuration)

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I0e80a91969778ca5a14805d79f4127ba53bc4aa7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280246
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-02-01 23:24:09 +00:00
Derek Xu 68c0ebe48a [VM/Service] Add optional parameters to getInstances
This CL updates the VM Service spec to v4.1 and adds the optional
`includeSubclasses` and `includeImplementers` parameters to the
`getInstances` service procedure.

This CL also adds `pkg/vm_service/test/get_instances_rpc_test.dart`
which is based on
`runtime/observatory/tests/service/get_instances_as_array_rpc_test.dart`

TEST=CI

Fixes https://github.com/dart-lang/sdk/issues/51003
Change-Id: Ia1ebec0ebeb6cba274621853e6486bab7cb7eb78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279201
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-02-01 22:04:29 +00:00
なつき ddc19f7f92 Suppress clang warning for musl libc inline
Closes https://github.com/dart-lang/sdk/pull/51191

GitOrigin-RevId: d7064c43adce0b115c79e818800e44ba4f60739e
Change-Id: Ie73e96c83294d43baf3be6772cb84705ba2d2712
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280136
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-02-01 21:58:18 +00:00
Alexander Markov 6074b4ff0d [vm/compiler] Handle uninitialized late local variables at OSR entries
TEST=tests/language/nnbd/syntax/late_modifier_edge_cases_test.dart
(on vm-eager-optimization-linux-release-x64 configuration)

Fixes https://github.com/dart-lang/sdk/issues/51192

Change-Id: I8eea931722f665d6ee8e5fa2602ba6b08edb8a7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280052
Commit-Queue: Slava Egorov <vegorov@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2023-02-01 09:15:49 +00:00
Derek Xu 5577eafdba [VM] Add OSThread::GetCurrentThreadName() method
Some fields of `OSThread` are initialized by retrieving information by
calling OS functions. For example, `trace_id_` is initialized by calling
`OSThread::GetCurrentThreadTraceId()`. Similarly, this CL adds the
`OSThread::GetCurrentThreadName()` method and uses it to initialize
`name_`.

TEST=CI

Change-Id: Iee121d71e660be01ff684a298144fa7d59e3b61d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278662
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-01-31 22:37:30 +00:00
Alexander Markov 9be13288b0 [vm] Support multiple local variables with the same name in the same scope
When lowering patterns, front-end can add multiple distinct local
variables with the same name into the same local scope.
Previously, VM identified local variables in a local scope by name.
However, this no longer works with patterns.

With this change, local variables are now identified by pair (name,
kernel offset). Name is still taken into account as compiler can add
extra variables which do not correspond to kernel variables,
such as 'this'.

TEST=runtime/tests/vm/dart/regress_51091_test.dart
Fixes https://github.com/dart-lang/sdk/issues/51091
Issue https://github.com/dart-lang/sdk/issues/49755

Change-Id: I0263769cb31f3f8d9652f5d6534800510ac882fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279650
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-01-31 18:47:46 +00:00
Brian Quinlan 252015b30b [io] Fix a bug where large reads would return partial data.
Bug: https://github.com/dart-lang/sdk/issues/51071
Change-Id: Ia64d803c9709b106e52a1c671c1c3288c051bd85
Tested: ci + new test
CoreLibraryReviewExempt: bug fix only for vm
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279204
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-01-31 18:41:39 +00:00
Ryan Macnak 0c87126ea2 [vm] Finish removing legacy restart mechanism.
Cf. a4adbffb50.

TEST=ci
Change-Id: I9d2517c6cb0b5630990d087812e9a54241f41bb8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280043
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-01-31 18:28:59 +00:00
Roland McGrath 82664d0a26 [fuchsia] Fix zx_thread_state_general_regs_t type name
The public API is the zx_thread_state_general_regs_t typedef,
not the zx_thread_state_general_regs struct tag.

TEST=ci
Change-Id: I4ce2f3dd08b5873378326fe4d162add33317a9c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280047
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Roland McGrath <mcgrathr@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-01-31 18:16:39 +00:00
Alexander Aprelev 4443d2d561 [vm/isolate] Ensure that isolate can correctly resume and exit if paused on exit.
It could happen that an isolate gets stuck unable to exit if paused on exit when using Isolate.exit.

Fixes https://github.com/dart-lang/sdk/issues/51164
TEST=isolate_exit_resume_test

Change-Id: I114686ce0637434827e56988821932cb91238032
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280044
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-01-31 17:15:38 +00:00
Alexander Markov f2304f9ec0 [vm/compiler] Fix numbering of SSA values during inlining
When building SSA form for callee graph during inlining, numbering of
SSA values starts with the number of SSA values in the caller graph.
However, parameter stubs may contain constants which are already added
to the callee graph and occupy certain range of SSA numbers. If that
number is larger than number of SSA values in the caller graph, then
numbers, already assigned to constants, can be incorrectly reused
during SSA construction.

The fix is to adjust number of SSA values in the callee graph
before parameter stubs are created, and then use current number of
SSA values as a starting point when building SSA.

TEST=runtime/tests/vm/dart/regress_flutter119220_test.dart
Fixes https://github.com/flutter/flutter/issues/119220

Change-Id: I7efd52e626b63bf64fb47861ec210b291911ef28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280041
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-01-31 16:47:44 +00:00
Josh Soref 77978889eb Spelling
Closes https://github.com/dart-lang/sdk/pull/51143

GitOrigin-RevId: 9e21c99a222d588e4fc95980725a2f8c9784965c
Change-Id: If0870e8936c7649935dce7e23cd783d62aa5610c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279916
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-01-30 18:29:59 +00:00
Lasse R.H. Nielsen bee7ab2b32 Make record positional field getters start at $1.
An update for co19 is available at https://github.com/dart-lang/co19/pull/1759

TEST=Existing tests run after change, two new tests for edge cases.

Change-Id: I408e398d532ba2c2e8e60777bb4f7bd0057e27fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278912
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-01-30 08:14:28 +00:00
Ryan Macnak 92972ff5cf [vm, gc] Disable time-based components of the growth policy when running under --deterministic.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/51125
Change-Id: Ic716a0cc917b9237a4d1b452714bfc4c54f6aae6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279470
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-01-28 00:24:09 +00:00
Alexander Aprelev 7c409eaa42 [vm/gardening] Skip two failing tests on iso-stress-linux.
The tests were not included into non-nnbd testing.
BUG=https://github.com/dart-lang/sdk/issues/51148
TEST=ci

Change-Id: Ib838cd0d70ebffe83ba2c5f2482e403c18f55317
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280060
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-01-27 20:48:17 +00:00
Ryan Macnak 2b8ca6f2f5 [vm, gc] Set the idle duration to effectively infinite.
This applies only to isolates running on the VM's thread pool.

TEST=manually inspect timeline in program with very large heap
Bug: https://github.com/dart-lang/sdk/issues/51125
Change-Id: Ib70cee7c163231b7aef4d723f35d056d4cb1cbf7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279477
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-01-27 19:03:18 +00:00
Alexander Aprelev c09d4d1c3d [vm/reload] Reject failed compilation during isolate reload
This is needed so that the expression evaluation works correctly after attempt to reload to bad source code.

Bug: https://github.com/dart-lang/sdk/issues/45846
Change-Id: Ib9fccc54141433bc662cbca923037fd12616ccd2
TEST=bad_reload_test
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278664
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-01-27 17:47:38 +00:00
Martin Kustermann b15da0b0e9 [gardening] Build analyze_snapshot/gen_snapshot in both host & target toolchain
This should make vm/dart_2/analyze_snapshot_binary_test pass on
dartkp-linux-release-arm64 & dartk-linux-release-arm64

by ensuring arm64 `gen_snapshot` & `analyze_snapshot` binaries
are available on the device when running tests on arm64 HW.

Change-Id: Icd814ff6df22a33b651733e4c3dc99873cf56a58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279970
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-01-27 12:44:30 +00:00
Martin Kustermann 0a78aac714 [vm] Make iso-stress builder compile & run null safety tests
Change-Id: I2a85491ac63635b4bd1d1f531466a0760f54e9e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279969
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-01-27 10:31:14 +00:00