Commit graph

17311 commits

Author SHA1 Message Date
Zichang Guo 4489805956 Revert "[dart:io] Fixes the FileIO performance regression"
This reverts commit ba25fd190e.

Reason for revert: It broke dart2js. https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket.appspot.com/8878578963299042720/+/steps/build_dart/0/stdout?format=raw.
Unimplemented handling of missing static target.

Original change's description:
> [dart:io] Fixes the FileIO performance regression
> 
> Previous CL (https://dart-review.googlesource.com/c/sdk/+/139881) causes
> performance regression.
> 
> Improves:
> FileIO_readwrite_512kb: 196.5%, 224.1%
> FileIO_readwrite_verify_512kb: 38.28% 46.71%
> 
> 
> Change-Id: I5fb7752f14a2b39238e82bf45b059fe145b9087f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148563
> Commit-Queue: Zichang Guo <zichangguo@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Jonas Termansen <sortie@google.com>

TBR=sortie@google.com,kustermann@google.com,zichangguo@google.com

Change-Id: I170eeed56484f2ece3c3b7f1b93f54edf5ae2736
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149743
Reviewed-by: Zichang Guo <zichangguo@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-06-02 19:14:05 +00:00
Zichang Guo ba25fd190e [dart:io] Fixes the FileIO performance regression
Previous CL (https://dart-review.googlesource.com/c/sdk/+/139881) causes
performance regression.

Improves:
FileIO_readwrite_512kb: 196.5%, 224.1%
FileIO_readwrite_verify_512kb: 38.28% 46.71%


Change-Id: I5fb7752f14a2b39238e82bf45b059fe145b9087f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148563
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2020-06-02 17:47:05 +00:00
Martin Kustermann 3d53df52af Revert "[vm] Call OSThread::Cleanup() during VM shutdown (as with all other Init/Cleanup functions)"
See b/157883819: Custom embedder doesn't correctly join threads that
interacted with Dart API, which causes us to hit the newly added
RELEASE_ASSERT.

This reverts commit ea4b17533c.

Change-Id: I9fec45196646f67ae46efccc2f83a43e8941a626
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149592
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-06-02 13:25:01 +00:00
Alexander Aprelev d315f906de Revert "[vm, service, observatory] Bang Bang (My Type System Shot Me Down)."
This reverts commit d806959461.

Reason for revert: multiple failures on service and other tests on various buildbots

Original change's description:
> [vm, service, observatory] Bang Bang (My Type System Shot Me Down).
> 
> Port the service tests and Observatory to Dart 3.
> 
> Change-Id: Ia43b169a110e5209a9770aeda1b9a4007427f064
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143381
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>

TBR=bkonyi@google.com,rmacnak@google.com

Change-Id: Id22f40dafa8c0fc3fb8c3052321629a48cb7dbc3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149684
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-06-02 03:03:57 +00:00
Ryan Macnak d806959461 [vm, service, observatory] Bang Bang (My Type System Shot Me Down).
Port the service tests and Observatory to Dart 3.

Change-Id: Ia43b169a110e5209a9770aeda1b9a4007427f064
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143381
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-06-02 01:20:08 +00:00
Alexander Aprelev 13ea0b3e9f [vm/deterministic] When sorting CallTargets by frequency, sort by id in case of ties.
This addresses an issue that AOT snapshot, disassembly and flowgraph are different when generated on Windows vs Linux.
Difference is caused by different order of targets in CallTargets, caused by the fact that qsort doesn't have to preserve the order of equal elements in the original list.
While qsort on Linux preserves original (by id) order, on Windows it does not.

See https://github.com/flutter/flutter/issues/44425 for context.

Change-Id: I74c17fd83e5ae21f9733712a87de8f55a1ba94fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149496
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-06-01 23:55:08 +00:00
Alexander Aprelev 164948ab0a [vm/aot] Fix aot cross-compilation scenario when gen_snapshot runs on Windows targets android x64.
At present calling convention code is guarded by _WIN64 macro, which indicates that compiler is running on Windows, doesn't take into account target os. This causes problems when one attempts to generate aot snapshot for Android os.

Fixes https://github.com/flutter/flutter/issues/44425.

Change-Id: I8b21d9e9c357071f29632826dd7bbedc19be00a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149497
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-06-01 23:21:38 +00:00
Ben Konyi bac15a80ce [ VM / DartDev ] Add special flags '--enable-analytics' and '--disable-analytics' which are treated as VM options but always forwarded to DartDev
Change-Id: Ief9d03f49176c9eacbf5fc953be9bc99e53aa21b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149662
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-06-01 23:10:18 +00:00
Alexander Markov 1618fd965b [vm/compiler] Optimize lazy field initialization
Load*Field and Init*Field IL instructions are fused into load
instructions with 'calls_initializer' flag.

A new, more powerful elimination of lazy initializer calls uses
data flow analysis and load forwarding (place numbering).

In addition to improved elimination of initializer calls,
fusing instructions avoids extra load after field is already
loaded for lazy initialization check.

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

Change-Id: Ibb2a63f84b9b0c970db67b3d6684ec15384a64e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148283
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-06-01 21:28:18 +00:00
Alexander Markov dd6dc29c21 [vm/nnbd] Prepare to migrate runtime/tests/vm/dart to NNBD
This change mechanically copies

  runtime/tests/vm/dart -> runtime/tests/vm/dart_2

in preparation for the migration of runtime/tests/vm/dart to NNBD.

Corresponding statuses in vm.status are duplicated.

Added vm_nnbd builder tag for NNBD bots.
vm/dart/* tests are allowed to run only on vm_nnbd builders.
vm/dart_2/* tests are allowed to run only on non-vm_nnbd builders.

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

Change-Id: I079da92da17960605f37c1c0e28e48362b236739
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149485
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-06-01 17:57:27 +00:00
William Hesse d3959945f7 Skip unicode surrogate test on android
This test crashes the android test runner, and should be fixed
when issue https://github.com/dart-lang/sdk/issues/42094 is rolled
to the checked-in SDK.

BUG=https://github.com/dart-lang/sdk/issues/42094

Change-Id: I91e5ea5358b08d3776ae485b90aff7cd01d02322
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149580
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-30 23:29:02 +00:00
Ryan Macnak cd55d62ac1 [vm] Change THR_Print to filter based on isolate group.
Parts of the GC now run without a current isolate, so THR_Prints there were all silenced.

Change-Id: Icd4be68eca8a2edfa43b4f140f69babd798f17af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149371
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-05-30 01:06:44 +00:00
Ben Konyi 8ff37f07dc [ VM ] Fix asserts in ARM64 simulator
https://dart-review.googlesource.com/c/sdk/+/148539 hoisted an assert
out of a conditional block and started causing failures for DebugSIMARM64
fuzzing runs as `stxr` does not have `Rs = 31`.

Change-Id: Ibbcc1ba105567ca1142843261756b8ee6a8e119f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149483
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-05-29 21:54:04 +00:00
Ryan Macnak 3451c348db [vm, gc] Prevent a program dominated by direct old-space allocations from avoiding scavenges for too long.
Bug: https://github.com/flutter/flutter/issues/48360
Change-Id: I75263809aed45879ff513e60280ea3f28b61b1c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149480
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-29 21:40:57 +00:00
asiva 02bfe67840 [VM/Runtime] - Remove Dart_CompileSourcesToKernel from the Dart C API
Remove Dart_CompileSourcesToKernel from the Dart C API as it is not used
anywhere except in unit tests (unit_test.cc)

Change-Id: I314dafbe4cddbe20a81890505bc07c8bf2100eaa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149380
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-05-29 18:43:54 +00:00
Filip Filmar cf30ff2953 Replaces fuchsia.deprecatedtimezone
The FIDL library fuchsia.deprecatedtimezone is going away.  There are
different and better ways to obtain the same functionality.  This change
removes the dependency on fuchsia.deprecatedtimezone from the Dart SDK.

Adds inspect metrics that allow whitebox testing of the runners.  Here's
a sample `fx iquery` excerpt from a running device, showing both a dart
and a flutter runner exposing the same OS diagnostic metrics.

```
/hub/c/dart_jit_runner.cmx/70981/out/diagnostics:
  /hub/c/dart_jit_runner.cmx/70981/out/diagnostics#os:
    dst_status = 0
    get_profile_status = 0
    timezone_content_status = 0
    tz_data_close_status = 0
    tz_data_status = 0
/hub/c/flutter_jit_runner.cmx/29567/out/diagnostics:
  /hub/c/flutter_jit_runner.cmx/29567/out/diagnostics#os:
    dst_status = 0
    get_profile_status = 0
    timezone_content_status = 0
    tz_data_close_status = 0
    tz_data_status = 0
```

Under nominal operation, all of the above values should be equal to 0.
Nonzero values indicate an error.

This functionality is guarded by Fuchsia integration tests at
//src/tests/intl.

Tested:
  (compile locally for Fuchsia and deploy)
  fx test //src/tests/intl

Fixes #39650

Change-Id: I5fc3ed305301abe1b183948a7cf478e014f351e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149206
Commit-Queue: Filip Filmar <fmil@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-29 18:36:58 +00:00
Alexander Markov f57c99fc31 [vm/compiler] Fix crash in inliner when receiver is dead
Fixes https://github.com/dart-lang/sdk/issues/42065

Change-Id: Ib66163a41a13f02cfa9df9bcb1cf505e934fea93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149370
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-05-29 16:34:45 +00:00
Aske Simon Christensen bbf34035dd Revert "[vm] Check prefix.loadLibrary is called and returns before prefix members are used."
This reverts commit f049a410e5.

Reason for revert: Broke reload bots.

Original change's description:
> [vm] Check prefix.loadLibrary is called and returns before prefix members are used.
> 
> Not loading is actually deferred.
> 
> Bug: https://github.com/dart-lang/sdk/issues/41974
> Change-Id: I62688007bd36dbcb2e8ffb4a1fd2dceb1775b1c8
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149053
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=rmacnak@google.com,alexmarkov@google.com,asiva@google.com

Change-Id: I923e339465fdf13199efc11a9cef4a842abebd67
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/41974
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149423
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2020-05-29 09:04:02 +00:00
Martin Kustermann ea4b17533c [vm] Call OSThread::Cleanup() during VM shutdown (as with all other Init/Cleanup functions)
Change-Id: I3cfa51714247a62fe39951636ca1a75c34f6c95b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149293
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-05-29 08:02:59 +00:00
Tess Strickland f89d930e38 [vm/aot] Separate out stream methods from the Elf class.
Introduce an internal StreamingWriteStream wrapper and use that instead.

Also add more ELF-defined constants and use those appropriately.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-linux-product-x64-try
Change-Id: I2bd34ebac60e789aea82c8f064c59351e2c55dd3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149291
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-05-29 07:47:08 +00:00
Martin Kustermann a2b5373eaa [vm/concurrency] Avoid stopping mutators when updating subtype test cache
To avoid stopping all mutators when updating subtype test caches, we
ensure that any updates to the subtype test cache will be visible in a
consistent way to mutators by adding a store-release barrier when
updating the backing array of the STC.

Since STCs are always grown by allocating a new array with size+1, there
is no need to actually add barriers when accessing the individual
entries of the backing store.

To prevent multiple writers creating STCs and patching the pool or
updating a STC we add a mutex.

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

Change-Id: Ic705619fe16772565ac11438fd15d3977cbb49c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149164
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-05-29 04:47:22 +00:00
Martin Kustermann 764ebab404 [vm/gc] Ensure to tear down mutator pool of an isolate group before waiting for pending GC tasks
The mutator thread pool can, when it becomes idle, cause idle
notifaction, which can cause GC.

So we should turn down the mutator thread pool before waiting for
outstanding GC tasks.

See b/157612890

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

Change-Id: I1645252377ff07763eef1a00f9c1edff95e34f72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149296
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-05-29 04:43:08 +00:00
Alexander Markov 4f3293c70e [vm/compiler] Recognize List.filled factory
Recognized factories have known result type and its type arguments
and length are automatically forwarded (length is forwarded only for
fixed-size lists).

List.filled factory is recognized only if optional 'growable' parameter
is not passed.

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

Change-Id: I0d63428f1c4667f3981447a939dbef67170e542e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149385
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-05-29 03:12:48 +00:00
Ryan Macnak f049a410e5 [vm] Check prefix.loadLibrary is called and returns before prefix members are used.
Not loading is actually deferred.

Bug: https://github.com/dart-lang/sdk/issues/41974
Change-Id: I62688007bd36dbcb2e8ffb4a1fd2dceb1775b1c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149053
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-05-28 23:13:12 +00:00
Martin Kustermann 4c83df8741 [vm/tsan] Fix reported tsan race in message handler test
Closes https://github.com/dart-lang/sdk/issues/42097

Change-Id: I3fb89e18936b3ec95def268cd270ada889e0e9b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149322
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-05-28 17:25:58 +00:00
Martin Kustermann 87ffb0837f [vm] Print isolate group name in stack trace dumping (used e.g. for SEGVs)
Change-Id: I4f94f8e36d5c931c936d90d29ef541bba8f2209e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149282
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-05-28 16:39:18 +00:00
Vyacheslav Egorov 6ab62add0d [vm/compiler] Use unboxed constants when folding away unboxed ops.
Before this change we would replace unboxed definitions (those with
representation not equal to kTagged) which is too loose and causes issues
in subsequent passes, which assume that replacements have normalised
representation.

After this change we make sure that replacement has a matching
representation.

Closes https://github.com/dart-lang/sdk/issues/35371
Fixes https://github.com/dart-lang/sdk/issues/41971

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try
Change-Id: I48543893562acf4f8516651196eba7c0c0769a22
Fixed: 35371,41971
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103139
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-05-28 11:30:49 +00:00
Tess Strickland d881462eae [vm/aot] Clean up old assumptions in Serializer::WriteInstructions().
In the past, negative text offsets were used for instructions shared
by multiple code objects. This is no longer the case.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try
Change-Id: I85085a06b8c955abb21573caea5554e839154979
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149281
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-05-28 10:14:18 +00:00
Parker Lougheed 1fba93f7c7 [runtime/observatory] Clean up rewind command feedback
This check is also replicated later within [debugger.cc](https://github.com/dart-lang/sdk/blob/master/runtime/vm/debugger.cc#L4098), so it didn't necessarily matter that this check did not work.

Despite this, I think the earlier check does not hurt though, and I
also added feedback for when the supplied argument is not an int
rather than just throwing an error.

Bug: https://github.com/dart-lang/sdk/issues/38888
Change-Id: I8a7a237850957d13dbf0aa30873d3b9772eb6d1a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148567
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-28 00:12:04 +00:00
Martin Kustermann 4cf584d4fe [vm/concurrency] Move locks up from Isolate to IsolateGroup
In --enable-isolate group is

  * turned off, then we have 1<->1 mapping between isolate and isolate
    group, so moving the locks should have no impact

  * turned on, then we have N<->1 mapping between isolates and isolate
    group, mutators need to use the same locks to guarantee exclusive
    access (e.g. to symbol table, type canonicalization, type arguments
    canonicalization, ...)

This is a follow-up to share the program structure in AOT mode across
multiple isoltes.

In order to move the existing `Isolate::type_canonicalization_mutex_` to
`IsolateGroup` (and thereby make all mutators use the same lock), we need
to remove the `RunWithMutatorsStopped()` usage in the runtime entry.

  => Without this it can lead to deadlocks.

In order to remove usage of `RunWithMutatorsStopped()` we will change
access to the cached type arguments array to use load-acquire barriers
in generated code and store-release barriers in runtime code.

A nice side effect is that it reduces `sizeof(dart::Isolate)`.

Closes https://github.com/dart-lang/sdk/issues/41912
Issue https://github.com/dart-lang/sdk/issues/36097

Change-Id: Ifd42691524fe41ffe8bb4e2623c5b8c1151de973
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148539
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-05-27 17:04:30 +00:00
James Lin 10e8d5d1a6 Try to clarify the RangeError.range message
The old RangeError.range message was confusing:

  RangeError (index): Invalid value: Not in range 0..2, inclusive: 9

The comma makes the message hard to parse.  I've seen a number of
people misinterpret "inclusive" as describing the invalid value (9)
instead of acting as a modifier on the range.

https://github.com/dart-lang/sdk/issues/29586 has a lot of
bikeshedding about this, but in the interest of mitigating confusion
sooner, I propose changing it to:

  RangeError (index): Invalid value: Not in inclusive range 0..2: 9

I'm intentionally trying to improve the message with minimal
disruption to the structure of the error message.  Although I'd much
prefer that "Invalid value" and the actual value be adjacent instead
of being interrupted by the explanation, such restructuring is rather
non-trivial.  RangeError allows the "Invalid value" message to be
customized, and rearranging terms could produce even worse
constructions.

I also considered:

  RangeError (index): Invalid value: Not in range [0, 2]: 9

And while I like that that is brief and clear, I chose not to use it
for people who are unfamiliar with interval notation and who might
mistake it as a Dart List.

Bug: https://github.com/dart-lang/sdk/issues/29586
Change-Id: I0f23b195437e4053ae5f76b5d303123979a8c9fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146024
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-05-27 14:59:39 +00:00
Clement Skau 205ba04c5e [SDK][Gardening] Fixes profiler_test broken in c4b7097e.
Test Profiler_ArrayAllocation used the non-existing List.empty()
constuctor.
This fix replaces it with the semantic equivalent List.filled(..).

TBR:bkonyi

Change-Id: I70913803a4d3585cb19a39375b14c1184f047644
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149160
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2020-05-27 13:33:09 +00:00
Vyacheslav Egorov b95a1bd567 [vm/aot] Clean static fields handling in precompiler.cc
Instead of maintaining separate list of static fields which
needs to be flushed into list of retained fields in Iterate()
keep track of which precompilation phase we are in - and add static
fields into the retained set only if we are in the fixpoint
code generation (aka Iterate()) phase.

Apply the same treatment to selectors as well.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try
Change-Id: I2c7c7bdf268eaee9623ab1be5cf3eb022991a7c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148403
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-05-27 10:22:19 +00:00
Vyacheslav Egorov 7175ab7329 [vm/compiler] Fix code determining if object can be a smi in LoadClassId.
Previous variant of the code did not handle FutureOr<T> and Comparable<U>
correctly - variables of these types can contain a smi value if T can be a
subclass of num or if U can be num.

Rename HasNonSmiAssignableInterface to CanReceiverBeSmiBasedOnInterfaceTarget
to better conway its meaning.

Fixes https://github.com/flutter/flutter/issues/57398

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try
Change-Id: I67b29908e057632e62c46fb327a5c805fcc78d74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149063
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-27 10:06:49 +00:00
Alexander Markov 2ec934d267 [vm] Fix crash on trampolines in --print_instructions_sizes_to
Trampolines which are generated in use_bare_instructions mode should be
taken into account when dumping sizes in --print_instructions_sizes_to.

This change fixes failing pkg/vm/test/snapshot/instruction_sizes_test on
Windows after https://dart-review.googlesource.com/c/sdk/+/148543.

Change-Id: I343f82699407ba54d9ccb9a9800875c61a6e8df3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149043
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-05-26 23:14:32 +00:00
Ben Konyi c4b7097e97 [ VM ] Migrate VM tests to support null safety and return errors from Dart_GetType and Dart_NewListOf when --null-safety is enabled
These methods return legacy types, which aren't valid with null safety
enabled.

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

Change-Id: I1181f0f3b9a8df156dea4dc4c82fef8afdf97ab9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148685
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-05-26 22:40:52 +00:00
Ryan Macnak 9b9ca0178f [vm/tools] Update references to snapshot_analysis.dart.
Change-Id: I93ddca77cb9b2594493298c1ca41403bd92fd3aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149021
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-05-26 21:21:19 +00:00
Alexander Markov db063ea6d0 [vm/compiler] Remove redundant phis during canonicalization
It might be too late to remove redundant phis in EliminateDeadPhis
because EliminateDeadPhis runs after OptimizeBranches, and
OptimizeBranches may be able to eliminate more branches if redundant
phis are cleaned up.

This change moves elimination of redundant phis into canonicalization
pass which is repeated more frequently.

Fixes recent regressions on several micro-benchmarks after
https://dart-review.googlesource.com/c/sdk/+/139314

Change-Id: Ib0148564615dbd0adb88e93b938ca9f3f59cabfd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148792
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-05-26 17:59:38 +00:00
Alexander Markov 572905d1e9 [vm] Fix crash in disassembler on trampolines
Fixes https://github.com/dart-lang/sdk/issues/42017

Change-Id: I7d9f2694907be2ba673f35c82ce65a4ee8bc77b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148942
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-26 17:31:58 +00:00
Vyacheslav Egorov ff6757f380 [vm/snapshot] Improve precision of --write-v8-snapshot-profile-to.
Attribute bytes written outside of any particular object to the
artificial root node.

https://github.com/dart-lang/sdk/issues/41249

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try
Change-Id: I6d4be9b9a6a42cd0996330bb14552d12d6430ff9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148526
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2020-05-26 10:46:05 +00:00
Tess Strickland 826576dcfc [vm] Store relocated addresses for text sections in BSS.
The relocated addresses are populated during BSS::Initialize() for
natively loaded ELF snapshots, and during the non-native loader when it
is used. Putting this information in the BSS segment avoids having to
change the embedder interface, since we only need this information for
AOT snapshots. This also avoids depending on our ELF snapshot layout
to reverse-engineer the DSO base for ELF-compiled snapshots.

We now always print the DSO base for both the VM and isolate in
non-symbolic stack traces, not just for ELF-compiled snapshots. However,
we still only print the relocated addresses in individual stack frames
if we're guaranteed they match those in separately saved debugging
information.

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

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-precomp-mac-release-simarm64-try
Change-Id: I4837262f78e6e73a32eb7e24ef7a68ccb8ec2669
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148441
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-26 08:47:30 +00:00
Jens Johansen 857fca710f [kernel/VM] Fix 'infinite' loop with memory crash on specific invalid dill
The dill file has an index at the end. The last 4 bytes of that index is
a size that indicates how big the file is. This is done to support
concatenated dill files. If the dill is invalid and the size is read as 0
both the VM and the dart kernel reader will go into an infinite loop where
it allocates another list entry on every loop iteration (making the whole
loop not infinate because we will run out of ram soon enough).

This CL fixes the issue by checking the size to be possitive.

Change-Id: I42da0557c6d4a274fdbe1a729fdaf5b8f149b187
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148538
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-05-26 08:24:05 +00:00
Ben Konyi 65113fd73d Reland "[ VM / DartDev ] Fix issue where EXEUtils returned a relative directory path instead of an absolute path"
This reverts commit c0976b6037.

Change-Id: I17e9b3087ba1e65bf64053011200e4df43c90a44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148943
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-05-22 01:55:52 +00:00
Parker Lougheed ecce58c1e3 [vm/ffi] Remove documentation from setters
Now that bf7e9d13d7 has landed and the analysis
server can pull docs from corresponding getters, we can remove the extra
docs on the setters.

Fixes #38892

Bug: https://github.com/dart-lang/sdk/issues/38892
Change-Id: I0f96a1b1b1513706912c651e9d1d5b3da043a148
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148747
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2020-05-21 09:18:10 +00:00
Ryan Macnak 8e62d5cafc [observatory] Fix viewing RegExp.
Change-Id: I7dbf7c29a1e58c13ff041a70c075dfbeb74a0376
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148661
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-20 19:49:11 +00:00
Ben Konyi c0976b6037 Revert "[ VM / DartDev ] Fix issue where EXEUtils returned a relative directory path instead of an absolute path"
This reverts commit af5ad5f1b0.

Reason for revert: Failing Windows bots.

Original change's description:
> [ VM / DartDev ] Fix issue where EXEUtils returned a relative directory path instead of an absolute path
> 
> This was causing the DartDev snapshot discovery to fail for brew
> installs as the last symlink resolved to '../libexec/bin/dart' which
> meant that we were looking for the snapshot at
> '../libexec/bin/snapshots/dartdev.dart.snapshot'.
> `
> 
> Change-Id: Ic68bfa13ba060f7a059d07e25c04076583b0b118
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148542
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=bkonyi@google.com,asiva@google.com,zichangguo@google.com

Change-Id: I55d3102e87c4cc522bac3a55421ed85f22f97035
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148745
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-05-20 19:36:42 +00:00
Ben Konyi af5ad5f1b0 [ VM / DartDev ] Fix issue where EXEUtils returned a relative directory path instead of an absolute path
This was causing the DartDev snapshot discovery to fail for brew
installs as the last symlink resolved to '../libexec/bin/dart' which
meant that we were looking for the snapshot at
'../libexec/bin/snapshots/dartdev.dart.snapshot'.
`

Change-Id: Ic68bfa13ba060f7a059d07e25c04076583b0b118
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148542
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-05-20 18:59:05 +00:00
Aske Simon Christensen 81ad24322c [vm/compiler] Check BoxInt64 overflow via the overflow flag on ARM64.
This saves one instruction for every BoxInt64 overflow check, reducing
the instructions size for Flutter benchmarks by between 0.26% and 1.03%
(0.26% for Flutter Gallery).

Also add OVERFLOW and NO_OVERFLOW condition aliases to arm and arm64.

Change-Id: I82990419b448f21a22ea2cc7a15a9497d3275943
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145860
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-20 14:05:40 +00:00
Vyacheslav Egorov a7e8fe2061 [vm] Write some nodes into profile even if they were dropped from the snapshot.
Snapshots don't necessarily retain original program structure because we
attempt to drop objects representing elements of the program structure
when it is not observable. However not having this information makes it
harder to understand how various parts of the snapshot graph relate to
the original program.

This CL introduces support for writing artificial nodes into snapshot profile
for the cases when we want to preserve some structure for later analysis.

To make mapping between actual heap objects and their artificial profile
counterparts simple we use currently unutilized part of the object-id space:
negative ids below kUnallocatedReference.

https://github.com/dart-lang/sdk/issues/41249

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try
Change-Id: Idb46491b0e2b21aebf946b0da55eaf67e73aadd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148530
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-05-20 12:35:22 +00:00
linzj d2ee73b251 [vm/compiler] Fix liveness analysis for unboxed parameters on 32-bit.
Fixes https://github.com/dart-lang/sdk/issues/41977

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-debug-simarm_x64-try
Change-Id: Ifcba1aac8e23aa382bdafe7506ce1725b8f2221d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148602
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2020-05-20 08:42:21 +00:00
Tess Strickland 71a8a3c11a [vm] Print DSO base of isolate when available.
Bug: https://github.com/dart-lang/sdk/issues/41880

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-precomp-win-release-x64-try
Change-Id: Ie68248a81167dfe05cbe65960fac8a8e029b9db3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147907
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-05-20 08:14:52 +00:00
Alexander Markov fef83c96fc [vm] Report compile-time errors when loading bootstrap libraries from kernel
Previously, we were crashing when trying to report a compile-time
error via H.ReportError when loading a bootstrap library from kernel.
That happened because we didn't have LongJumpScope set up.

This change sets up LongJumpScope and makes sure compile-time
errors during kernel loading can be reported and propagated up.

This also removes the need to use FATAL error when detecting
a dill file which is incompatible to the current runtime mode,
so we can use less severe compile-time error for that.

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

Change-Id: Ib3690f7812c20e5529f3066ed37fdb9052dd559b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148683
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-05-20 02:14:21 +00:00
P.Y. Laligand 65f132afe7 [fuchsia] Update more trace-engine/trace labels.
Change-Id: I19c165a42d199e1ea314aad00b212b2990745dba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148544
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-20 01:33:21 +00:00
Zichang Guo cdc98a045f [dart:io] Support abstract unix domain socket on Linux
Abstract unix domain socket(UDS) is not supported on platforms other
than Linux/Android. So it has not been supported in the initial design.

This cl will enable users to use abstract UDS.

As long as InternetAddress has a path starting with '@', it will be
interpreted as abstract UDS on Linux/Android.

For abstract UDS, checkout unix man page for more information.

Bug: https://b.corp.google.com/issues/156871566

Change-Id: I393d798b2fc65304677a60639223f90e20aabaa3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148380
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-05-19 21:33:10 +00:00
Regis Crelier 19f49509b0 [VM/nnbd] The equivalent of dynamic as bound is Object? and not Object.
This is a partial fix for https://github.com/dart-lang/sdk/issues/41939

Let's take one step at a time, but later, we should be able to leave the bound as dynamic, since mutual subtyping of bounds is now implemented.

Change-Id: I57f725ba5b02237a64ae77593f340438f7159ab7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148515
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2020-05-19 18:10:54 +00:00
Ryan Macnak 2fa4d3e4d8 [vm, gc] Account for AllocateArray or CloneContext returning objects that have already been added to the remembered set.
Bug: b/156940113
Change-Id: Id212f9826b83981346ea4fbb1ef80a115e831a10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148506
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-19 17:47:11 +00:00
Ryan Macnak 41caebb39e [vm] Fix overly broad HeapIterationScope in getInstances.
Fix nested HeapIterationScopes.

Fix inadvertently disabled UI for getInstances.

Bug: https://github.com/dart-lang/sdk/issues/41943
Change-Id: I09fa385246dda7427a4f51a02144f945ec638557
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148502
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-19 17:37:10 +00:00
Martin Kustermann 7706afbcf5 [vm/concurrency] Optimize access to symbol table & remove isolate-specific symbol lock.
The most common case is to access the symbol table in read-only mode
outside a safepoint. This CL ensures that this use case is fast.

Furthermore it fixes a potential issue where one thread accesses the
symbol table using exclusive access via RW lock and is half-way-through
updating the symbol table while another thread requests a safepoint
operation, and updates the symbol table.

There is a remaining TODO item to not hold a safepoint while allocating
a symbol.

It increases performance by 10x for e.g. vm/dart/isolates/fibonacci_call_test
(26 seconds to 2.6 seconds).

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

Change-Id: I0b4e26aaffc613bed336a8845d12b7c7ee84b146
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148323
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-05-19 12:10:20 +00:00
Vyacheslav Egorov de3779e340 [vm] Update Dart_IsolateGroupCreateCallback comment
R=kustermann@google.com

Change-Id: Ic51b76c4566bfde8ba241763df06be2878be00b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148523
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-19 09:46:44 +00:00
Joyer Huang 06bf32ebb1 [vm] Update comment for Dart_IsolateGroupCreateCallback
Closes https://github.com/dart-lang/sdk/pull/41945
https://github.com/dart-lang/sdk/pull/41945

GitOrigin-RevId: 2e146cfd56cff8035cd15225902d5dd4d8eb450a
Change-Id: I2b06125be11774da2aabbc5cc7031dd91d1e1ea4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148462
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-05-19 08:22:05 +00:00
Regis Crelier 5f9e3e0791 [vm] Hash of generic signature should include hash of its type parameters.
Change-Id: If77e8c55ae72e8fd18de167a736d7efe3c3193ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148185
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2020-05-19 01:11:52 +00:00
Ryan Macnak 6851c0eca3 Reland "[vm, gc] Allow for more parallelism in old-space GCs."
Fix visiting roots to wait for visiting new-space pages to finish, not merely start.

Change-Id: I0c6688701f4563bf5c3b8ae02f215e709d5cac6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148230
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-18 21:19:26 +00:00
Martin Kustermann 4477712ba0 [vm/compiler] Add regression test for many unboxed fields
The GC was sometimes incorrectly calculating the "is-unboxed" bit due to
shifter >= 64. The change in [0] fixed that issue and this CL is adding a
regresion test.

Our tests in `runtime/tests/vm/dart/*` have access to `dart:_internal`.
To make the newly added test reliable we add a `collectAllGarbage()` native
and use it in the test.

[0] https://dart-review.googlesource.com/c/sdk/+/143000

Change-Id: Ifb3f16469a9dc58623acdb029b78807ed7fcc857
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148402
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-05-18 11:30:57 +00:00
zhaoxuyang 313bf285df [vm/arm] Fix DecodeLoadWordFromPool with large offsets.
Previous version of the code did not correctly decode sequences like:

  movw r9, #0x6000
  movt r9, #0x10
  add r9, pp, r9
  ldr r9, [r9, #+3983]

Closes https://github.com/dart-lang/sdk/pull/41937
https://github.com/dart-lang/sdk/pull/41937

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-simarm-try
GitOrigin-RevId: 95cd97c57aa3025875ad89656e267821bc4e0ee1
Change-Id: I7f8b9cb8c9d703fe2ac0774749ab24fd8183b0d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148340
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-05-17 12:43:48 +00:00
Martin Kustermann ecd82166c3 [vm/concurrency] Avoid allocating objects if not needed (and possibly cache objects)
Two growable arrays needed for possibly re-hashing objects when sending
messages using the snappshotter are often unused. Only create them when
needed.

When looking up message handler and calling it avoid repeated
allocations of small arrays (they can be cached savely because right
the transition stubs will copy the arguments out of those arrays).

This improves performance of high-frequency messages but small message
handlers.

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

Change-Id: I623aba5b29064f3a75ea294557ee153067a63d08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148263
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-05-16 06:45:02 +00:00
Ryan Macnak ffd6f54473 [infra] Define a GCC builder configuration.
Change-Id: I5218e5f0858279589ac3b3b71fb27daccb3095c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146697
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2020-05-16 00:26:32 +00:00
P.Y. Laligand db75896497 [fuchsia] Update label for trace-engine library.
Change-Id: I4b30ebb576e64d0b2448a815fb5f5cee2bc5655b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148235
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-16 00:04:22 +00:00
Ben Konyi 54fb6ce3c0 [ Service / DDS ] Prepare for package:dds publishing
Final cleanup work before first full version of package:dds is
published:

- Added `getSupportedProtocols` RPC to the VM service protocol, which returns a
  list of supported service protocols and extensions along with their version
  information.
- Added `getDartDevelopmentServiceVersion` RPC to the DDS protocol.
- Misc code and dependency cleanup recommended by pub

Change-Id: If1bdf46852778adf31242122665c36b63106ad44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148224
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-05-15 22:52:12 +00:00
Ryan Macnak 6b91f92154 [vm] Move megamorphic miss handling into the megamorphic call stub.
This removes the only stub code with a function owner.

Change-Id: I629eb3a1b231430afaf0a2777032bba8eaddd2aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148124
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-05-15 20:28:21 +00:00
Martin Kustermann e30646d9a3 [vm] Fix member-call-on-null ubsan issue
This is a follow up to: https://dart-review.googlesource.com/c/sdk/+/148120

Change-Id: Ibc5f59ae1d1ec13efb15f5d8cc4eae5e1848b083
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148134
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-05-15 12:58:32 +00:00
Martin Kustermann 143c1b9dac [vm/concurrency] Ensure VM behaves well if custom embedder uses custom message handler with unlimited number of threads
If a custom embedder does not use the VM's thread pool implementation
(1) but instead installs a custom message handler and invokes that
message handler on possibly unlimted number of threads, those mutator
threads will be constantly fighting to obtain TLABs.

To avoid this, the VM will ensure that only a limited number of mutators
can execute at the same time. The limit is the same as we use for
determining the VM's mutator thread pool.

In order to test this, we simulate such an embedder by disabling the
mutator pool limit, thereby allowing unlimited number of thread pool
workers.
=> The added test would timeout without without the new limit imposed
   by this CL.

(1) Which has a maximum size adjusted based on TLAB size and new space size.

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

Change-Id: I6d459f85fbeb3e4b1d756b752853157e40097271
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148121
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-05-15 12:43:12 +00:00
Tess Strickland 7aae1f6032 [vm] Relax AssertSubtype to allow non-constant sub and super types.
Previously, AssertSubtype instructions could only be created with a
compile-time AbstractType value for sub_type and super_type. Relax this
so that AssertSubtype instructions can be created with possibly
non-constant Values instead.

Currently, all AssertSubtype uses still have constant sub- and
supertypes, so for now we check at code generation that we indeed
have constants for these values and only handle the constant case. Thus,
there should be no impact on size or speed of the generated code from
these changes. Follow-up work will add code generation for non-constant
sub- and supertypes and add uses the generalized form.

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

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-linux-release-simarm64-try
Change-Id: Ib1512b3e07a016d68a8e0c670ce857b8ac1b2777
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147520
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-15 11:51:32 +00:00
Martin Kustermann 874588a859 [vm/concurrency] Allow thread pool with maximum size to grow in size if workers are blocked in native code
To avoid deadlock scenarios where an application runs N isolates on a
thread pool with T threads (T < N) where all scheduled T isolates will
do FFI call and block. That prevents any other isolates from executing.

To avoid such a scenario we add support for the isolate-group specific
thread pool to dynamically increase the maximum size if a worker is
running a isolate mutator thread, which calls to C which exits the
isolate.
=> While such an isolate is descheduled but still occupies a thread
   pool worker we temporarily incrase the maximum size of the thread pool.

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

Change-Id: Id61c39b06766da11f76d607ac7cbe8a8e623f250
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148120
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-05-15 10:57:09 +00:00
William Hesse a7b672c069 Revert "[vm, gc] Allow for more parallelism in old-space GCs."
This reverts commit ae0740032a.

Reason for revert: This is crashing on mac-release.

Crash logs: https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket.appspot.com/8880254409914739888/+/steps/test_results/0/logs/new_test_failures__logs_/0


Original change's description:
> [vm, gc] Allow for more parallelism in old-space GCs.
>
> Allow work stealing of new-space page when marking roots.
>
> Change-Id: I18fc22934bea26a37341216e88b13d1fb6f83b36
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125767
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=kustermann@google.com,aam@google.com,rmacnak@google.com,asiva@google.com

Change-Id: I84c27cdd73a971f893ec968daaf5893c62c3a2e5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148129
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-15 09:11:06 +00:00
Alexander Aprelev 2472741ba0 [vm] Fix instance hash calculation to accommodate unboxed fields during cross compilation.
Instance hash calculation on host and on target should produce same
results(like when you use simarm_x64/gen_snapshot to produce arm snapshot).
It was not producing same results because of how unboxed fields could be
taking more than one word(on 32-bit arm they are taking two words).
Hash calculation was done in terms of words so simarm_x64/gen_snapshot
saw one word unboxed field, but same calculation saw two words.

The fix is to pay special attention when iterating over unboxed field
during hash calculation and accommodate host and target word size
difference.

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

Change-Id: Ib280736fa458a3954ca1f9994734ad04ee8db80a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148040
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-05-15 01:28:55 +00:00
Ryan Macnak ae0740032a [vm, gc] Allow for more parallelism in old-space GCs.
Allow work stealing of new-space page when marking roots.

Change-Id: I18fc22934bea26a37341216e88b13d1fb6f83b36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125767
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-15 00:44:45 +00:00
Alexander Markov bbe469eabd Reland "[vm/nnbd] Auto-detect null-safety from entry point in kernel compilers"
This is a reland of fd19c8cc25
No changes were made to the original CL.

The following fixes landed separately:
* Flutter tests which use --enable-experiment=non-nullable are
  disabled in https://github.com/flutter/flutter/pull/57235.
* Auto-detection of null-safety mode from dill file in gen_snapshot is
  implemented in https://dart-review.googlesource.com/c/sdk/+/148152.

Original change's description:
> [vm/nnbd] Auto-detect null-safety from entry point in kernel compilers
>
> If --null-safety flag is not specified, tools should infer null safety
> mode from a legacy status of an entry point script.
> This change adds such auto-detection to kernel compilers (front-end
> server and gen_kernel).
>
> Issue: https://github.com/dart-lang/sdk/issues/41206
> Change-Id: If78491d08390c28b98e86857ec7d61520433dee9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148024
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

Change-Id: Ibc185caa6975087a35c89ff69faf3f6c11fcf14c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148201
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-05-14 22:10:45 +00:00
Alexander Markov 85cb6eddf4 [vm/nnbd] Auto-detect null safety mode when bootstrapping from kernel
This change also enables auto-detection in gen_snapshot.

Issue: https://github.com/dart-lang/sdk/issues/41206
Change-Id: If047ab8457e8fa15dc24ec10c0dcfceaf836508a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148152
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-05-14 20:49:06 +00:00
Ben Konyi 499ae5c363 [ VM / DartDev ] Fix issue where --disable-dart-dev and --observe argument order mattered
Prior to this change, if the VM was run with:

`dart --observe=8282 --disable-dart-dev foo.dart`

The custom VM service port would be ignored whereas with:

`dart --disable-dart-dev --observe=8282 foo.dart`

The custom VM service port would be used. This was due to
the value of `--disable-dart-dev` being used during argument parsing
even though the value may not have been parsed yet.

Change-Id: I221fb4c0ad6fdc0ae1855bd60b58c115de00e34b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148153
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-05-14 19:56:35 +00:00
Ryan Macnak a1ad5c7aa5 [vm] Further fix asymmetry in Load/StoreNonPointer.
Bug: https://github.com/dart-lang/sdk/issues/41581
Change-Id: Icee799d1e401eee84d9a337a9124826f91fa5b1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148022
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-14 18:26:03 +00:00
Clement Skau e29407cde2 [VM] Removes parameter type check for sync-yielding function.
Benchmarks:
- RunTime (bigger is better):
  - Iteration.tree.syncstar(ia32): +8%
  - Iteration.concat.syncstar(ia32): +10%
  - Iteration.tree.syncstar(x64): +4%
  - Iteration.concat.syncstar(x64): +5%

Bug: https://github.com/dart-lang/sdk/issues/37753
Change-Id: I9203560b9ceb0f2dcc1583d88ea95b7d88b628d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146780
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-14 17:18:56 +00:00
Alexander Markov d1b9a93363 Revert "[vm/nnbd] Auto-detect null-safety from entry point in kernel compilers"
This reverts commit fd19c8cc25.

Reason for revert: Flutter has tests with --enable-experiment=non-nullable, but dart:ui is not migrated yet and gen_snapshot doesn't detect null-safety from kernel file. This change causes failures in those tests as dill file is now compiled with null-safety enabled due to the auto-detection.

Original change's description:
> [vm/nnbd] Auto-detect null-safety from entry point in kernel compilers
> 
> If --null-safety flag is not specified, tools should infer null safety
> mode from a legacy status of an entry point script.
> This change adds such auto-detection to kernel compilers (front-end
> server and gen_kernel).
> 
> Issue: https://github.com/dart-lang/sdk/issues/41206
> Change-Id: If78491d08390c28b98e86857ec7d61520433dee9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148024
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

TBR=aam@google.com,rmacnak@google.com,alexmarkov@google.com,asiva@google.com

Change-Id: Ie6105552c9d88101a3188f5daec4ee9a9c24a530
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Issue: https://github.com/dart-lang/sdk/issues/41206
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148141
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-05-14 16:40:22 +00:00
Martin Kustermann c4acfb506f [vm/concurrency] Delay notification of Dart_Cleanup() until isolate group has died
It also avoids acquiring a lock when the isolate shuts down but the
group is not empty yet.

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

Fixes b/156067624

Change-Id: I3b58e9ed24ea97c0cd796bd8a386d06075bfc0e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147960
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-05-14 10:35:11 +00:00
Ben Konyi 2063ce7437 [ package:dds ] Added authentication code support
Also fixed issue where not all VM flags were being forwarded to the child
of an implicit DartDev instance.

Change-Id: I4c7bacb1b93ae336b6ed1f80eb621fbeabd8ced9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148021
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-05-14 01:32:26 +00:00
Alexander Markov fd19c8cc25 [vm/nnbd] Auto-detect null-safety from entry point in kernel compilers
If --null-safety flag is not specified, tools should infer null safety
mode from a legacy status of an entry point script.
This change adds such auto-detection to kernel compilers (front-end
server and gen_kernel).

Issue: https://github.com/dart-lang/sdk/issues/41206
Change-Id: If78491d08390c28b98e86857ec7d61520433dee9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148024
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-05-14 00:41:22 +00:00
Ryan Macnak 5ccd3fa3ee [vm, service] Remove use of expectAsync from service tests.
This is broken in Dart 3.

Change-Id: I809830c8d8657ce3ef44ed08da207c50d376b793
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148010
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-13 23:34:03 +00:00
Ryan Macnak 02b3a2a71c [vm, service] Remove service extension test cases that become impossible in Dart 3.
Change-Id: I949ba5b5af4d349d42ad5d6aee2b20bbfa9a2574
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148008
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-05-13 23:34:03 +00:00
Ryan Macnak 60297d4747 [vm] Fix vm/cc/DartGeneratedArrayLiteralMessages.
This was broken by Dart 2. It failed in a way that also triggered UBSAN.

Bug: https://github.com/dart-lang/sdk/issues/39427
Change-Id: Ie7d5f3e7ef6b8af683073a18abf759b750ce2c43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147818
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-13 21:34:57 +00:00
Ben Konyi 444490d640 Reland "[ VM / DartDev ] Run all debugging sessions via 'dart run'"
This is a reland of 604a366065

Original change's description:
> [ VM / DartDev ] Run all debugging sessions via 'dart run'
> 
> Prior to this change, running `dart --observe foo.dart` would result in
> the DartDev flow being bypassed. While `dart foo.dart` will continue to
> bypass DartDev and be run directly, running either `dart --observe
> <vm-flags> foo.dart` or `dart --enable-vm-service <vm-flags> foo.dart`
> will result in the command being implicitly converted to `dart run
> --observe <vm-flags> foo.dart`. This is required for all standalone VM
> instances to run against DDS instead of the VM service directly.
> 
> As usual, the DartDev flow can always be bypassed by providing the
> --disable-dart-dev flag.
> 
> Change-Id: I211cd1ec4b1ec0e75ae0a568a66f1a0fc7b3852f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147342
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

Change-Id: I917d3056322d74766bdf376a3e28871ad5b66cfa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147980
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-05-13 19:58:56 +00:00
Tess Strickland b6b78fcd50 [vm] Ensure line information in DWARF is unsigned.
The DWARF standard specifically states that line number information is
unsigned (with 0 denoting no line number information). However, we
currently use special (negative) token positions in our DWARF
information directly as line numbers. Instead, convert any special token
positions to a line number of 0.

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

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try
Change-Id: Ic26e553d6a6d642b456fe45760650de9c8478d16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147902
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2020-05-13 15:43:11 +00:00
Vyacheslav Egorov 467ba2f3fb [vm/compiler] Include tests for parsing of --print_instruction_sizes_to output
These were supposed to be included into d959f4290e
but were accidentally left behind.

Readding these tests revealed a bug in the main commit - where
async/async*/sync* bodies were not properly disambiguated. There is a
change included here which fixes that.

Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-try,pkg-win-release-try,pkg-mac-release-try
Change-Id: I1fff57c8d7b16ee72dd670f1a309dd756a2b2653
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147580
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2020-05-13 11:37:21 +00:00
Tess Strickland 5932f89b3d [vm] Fix issue with alignment before BSS sections.
We used Align on the assembly_stream_ directly, which
calls StreamingWriteStream::Align and introduces null
bytes into the stream. When running with -Werror, this
will stop builds.

```
.../ios__app_ios_aot.S:2510:1: error: null character ignored [-Werror,-Wnull-character]
<U+0000><U+0000><U+0000><U+0000><U+0000>_kDartVmSnapshotBss:
```

Instead, we should have used AssemblyImageWriter::Align,
which introduces a .balign instruction instead.

Fixes b/156346855.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-mac-release-simarm64-try
Change-Id: If99f66ccd7eee67f86d654e17a639fad7096dc53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147720
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-13 08:24:51 +00:00
Filip Filmar a394be48fc [vm] Fixes Fuchsia dependencies for inspect
This change only affects dart SDK when built from source in the
Fuchsia OS tree, without using the Fuchsia SDK.

The BUILD.gn rules are slightly different for a SDK and a non-SDK build.
My last change (see link below) omitted the non-SDK build flavor, which
led to dart roller break when rolling into Fuchsia.  This change should
make the non-SDK build in Fuchsia work.

Tested:
  (locally on Fuchsia, tried with and without the change to
  third_party/dart):
  fx set workstation.x64 --release --with=//topaz
  fx build -k

See the problem here:
https://dart-review.googlesource.com/c/sdk/+/144480/3/runtime/vm/BUILD.gn

Bug: https://github.com/dart-lang/sdk/issues/41884
Bug: https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=52080
Change-Id: I1bcfff1576be33717ce49d1b714bc4867ba2c736
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147816
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Filip Filmar <fmil@google.com>
2020-05-13 08:12:11 +00:00
David Morgan 964f966c0c Revert "[ VM / DartDev ] Run all debugging sessions via 'dart run'"
This reverts commit 604a366065.

Reason for revert: Breaks google3, see b/156414355

Original change's description:
> [ VM / DartDev ] Run all debugging sessions via 'dart run'
> 
> Prior to this change, running `dart --observe foo.dart` would result in
> the DartDev flow being bypassed. While `dart foo.dart` will continue to
> bypass DartDev and be run directly, running either `dart --observe
> <vm-flags> foo.dart` or `dart --enable-vm-service <vm-flags> foo.dart`
> will result in the command being implicitly converted to `dart run
> --observe <vm-flags> foo.dart`. This is required for all standalone VM
> instances to run against DDS instead of the VM service directly.
> 
> As usual, the DartDev flow can always be bypassed by providing the
> --disable-dart-dev flag.
> 
> Change-Id: I211cd1ec4b1ec0e75ae0a568a66f1a0fc7b3852f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147342
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=bkonyi@google.com,rmacnak@google.com,asiva@google.com

Change-Id: I688a3779e7ccaf85a28dc4d6f5ccf23596109519
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147900
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
2020-05-13 07:13:35 +00:00
Alexander Aprelev 3df9baeb06 [vm] Fix typo in calculation of native wrapper class size in precompiler configuration.
At present there is difference in assembly output from SIMARM/gen_snapshot and SIMARM_X64/gen_snapshot around classes that extend native wrappers(for example, dart:io NativeSocket).

See dartbug.com/41824.

Change-Id: I944901ff4cccde972623c490d1d67d894fb03595
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147808
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-05-12 22:31:39 +00:00
Ryan Macnak 40d876382a [vm] Fix various UBSan failures: AOT.
Bug: https://github.com/dart-lang/sdk/issues/39427
Change-Id: I2594e28a277f1d9f838aa93d546714d4f300b5b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147682
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-12 20:28:11 +00:00
Ben Konyi 604a366065 [ VM / DartDev ] Run all debugging sessions via 'dart run'
Prior to this change, running `dart --observe foo.dart` would result in
the DartDev flow being bypassed. While `dart foo.dart` will continue to
bypass DartDev and be run directly, running either `dart --observe
<vm-flags> foo.dart` or `dart --enable-vm-service <vm-flags> foo.dart`
will result in the command being implicitly converted to `dart run
--observe <vm-flags> foo.dart`. This is required for all standalone VM
instances to run against DDS instead of the VM service directly.

As usual, the DartDev flow can always be bypassed by providing the
--disable-dart-dev flag.

Change-Id: I211cd1ec4b1ec0e75ae0a568a66f1a0fc7b3852f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147342
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-05-12 19:53:11 +00:00
Ryan Macnak 17f3bf9183 [vm] Fix various UBSan failures: ARM.
Bug: https://github.com/dart-lang/sdk/issues/39427
Change-Id: Ie6ba61d699c1ea51310e15b924fb58cb02cf6e1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146989
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-12 19:25:11 +00:00
Ben Konyi c9ab5c4681 [ VM / Service ] Added TimelineStreamSubscriptionsChanged event
The `TimelineStreamSubscriptionsChanged` event is sent when
`setVMTimelineFlags` is invoked, notifying `Timeline` subscribers that
the set of recorded timeline streams has changed.

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

Change-Id: Ic1545eefea8cf3deeefba97bd1ea2695d1c35016
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147681
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-05-12 19:22:41 +00:00
Ryan Macnak 16253c0a54 [vm] Fix LSAN when used without ASAN.
Mostly interesting on Mac, where ASAN does not include LSAN.

Bug: https://github.com/dart-lang/sdk/issues/41811
Change-Id: Icbbe57946a6d3b3406a9e3a6541b6c4958cbfa91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147685
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-12 17:38:19 +00:00
Aske Simon Christensen 14103a366d [vm] Add _allocate and _setAt methods to _TwoByteString.
Also base these and the corresponding methods in _OneByteString on
functions in dart:_internal, so they can be used in other patches.

Change-Id: Ibced31758db2959c111a01cdaa46df2971ae4a6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146784
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-12 17:33:50 +00:00
Tess Strickland db51ed7507 [vm] Relax AssertAssignable to allow dst_type to be non-constant.
Previously, AssertAssignable instructions could only be created with a
compile-time AbstractType value for dst_type. Relax this so that
AssertAssignable instructions can be created with a possibly
non-constant Value instead.

This is only an IL-level change for the instruction. Code generation for
AssertAssignable still requires the dst_type Value to be bound to a
constant and is otherwise unchanged from before, thus this should have
no impact on size or speed of generated code. (Generating the
non-constant case will be done in follow-up work.)

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

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-linux-release-simarm64-try,vm-dartkb-linux-release-simarm64-try,vm-dartkb-linux-release-x64-try
Bug: https://github.com/dart-lang/sdk/issues/40813
Change-Id: I1f984039d8c2695c66161a69a3d80cfbe7110f19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146801
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-05-12 11:22:19 +00:00
Tess Strickland 245a574301 [vm] Make the ELF static symbol table a superset of the dynamic one.
Only the case for unstripped snapshots and debugging information.
Stripped snapshots still have no static symbol table, only the
dynamic one.

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

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-win-release-x64-try
Change-Id: Ibd82334597d34267a3b9e45a673d23c3f9e3fcb0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147182
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2020-05-12 07:21:48 +00:00
Ben Konyi 8e3b9d34be [ VM / Service ] Remove package:path dependency from breakpoint_non_debuggable_library_test
Fixes https://github.com/dart-lang/sdk/issues/41785

Change-Id: Iac4e9c8a348e13d1b38f5df9c65a690b403b1e7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147700
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-05-12 03:02:21 +00:00
Zichang Guo 9a60982089 [dart:io] serialize UnmodifiableListView to Uint8List for file write
Bug: https://github.com/dart-lang/sdk/issues/41029
Change-Id: I5902f01a22787922439f0918b6e845eb004b8984
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139881
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-05-12 00:19:01 +00:00
Vyacheslav Egorov 2497606fed [vm/compiler] Avoid redundant spilling of SIMD values.
There was a code in the register allocator that recognized whether
destination is a spill slot or not by checking if it is one of
different location types. By accident QuadSpillSlot was missing
from that list - and as a result we were emitting redundant moves
when connecting split siblings after register allocation.

Change the code to just ask parent live which spill slot it was assigned
and use that to drive decisions.

https://github.com/dart-lang/sdk/issues/41805

Change-Id: I73e208acd0bf86dceeaad970b8e5cbcb9c3f8eaa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147550
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2020-05-11 20:24:57 +00:00
Vyacheslav Egorov 2018436995 [vm/compiler] Include linear scan tracing code in release builds
Additionally make it possible to filter the output of this tracing
using --print-flow-graph-filter=...

Expose should_filter() setting through CompilerState - to avoid
plumbing FlowGraph or Function through various methods that don't
already have access to either of these two.

Change-Id: Ia1b8bcff5702e869db23ea4407191741662b2417
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147544
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2020-05-11 20:24:49 +00:00
Tess Strickland 7d253a5826 [vm/compiler] Allow SameAsFirstInput() in LocationSummary::set_out().
Originally, the assert here required the location be a machine register,
invalid, or a pair location if always_calls() was true, which meant
that SameAsFirstInput() could not be used.

Extend the assert to allow SameAsFirstInput(), but only if the location
of the first input is a machine register, invalid, or a pair location.
Also make sure any further changes to the first input remain consistent
with this expectation.

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

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try
Change-Id: If43eb5399283d23f62a502edb0a9ce9c82813b3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147101
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-05-11 09:09:07 +00:00
Tess Strickland a6d06b59ec Reland "[vm] Mark snapshots that were compiled directly to ELF.
Since the virtual addresses in ELF snapshots are the same as in
separately saved debugging information, print the virtual address in
non-symbolic frames again when running from a snapshot compiled directly
to ELF."

Storing the relocated address as an extra field in the Image header,
which requires increasing the Image header size on 64-bit platforms,
means Image pages cannot be used reliably as HeapPages as objects no
longer start after kMaxObjectAlignment bytes.

Instead, we return to an older design that just uses the lowest bit
in the BSS offset to store whether the instructions in an Image were
compiled directly to ELF.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-precomp-ffi-qemu-linux-release-arm-try
Change-Id: I3819b0dc2719d69f5e8764ca8be8c6ae7171a7bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146560
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-05-11 08:41:17 +00:00
Tess Strickland 9e14e7da2a [vm] Add correct lower bound for DWARF information in ELF snapshots.
When generating DWARF for assembly snapshots, we use a lower bound
of the start of the isolate instructions section. Use the same bound
when generating DWARF for ELF snapshots as well.

Also avoid generating rows in the line number program for address 0.

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

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try
Change-Id: I3d17e09ff8af3ba6fc70dcd6859d9b298e941ecf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146584
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-05-11 08:41:17 +00:00
Martin Kustermann 518f097266 [vm] Make metrics API expose correct heap metrics in PRODUCT mode
See b/152430908

Change-Id: I89524489ec9868bf5fa40559292e4f82b352cfe3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147362
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-05-09 08:27:48 +00:00
Alexander Aprelev 2319132ff5 [gardening] Skip dds_log_history_size_gigantic_test on windows bots.
Opened dartbug.com/41825 to track it being too slow.

Change-Id: I37b76de494fbbf309ec0e6106bd7ebb2771f7cb1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147401
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-05-09 03:45:45 +00:00
Alexander Aprelev 017b1c46f6 [gardening] Tweak ring_gc_test, ring_gc_sendAndExit_test so they pass on simarm_x64.
Raised dartbug.com/41824 to track test failure.

Change-Id: Ie5596a7d66adc4e6b55b7dd6fe0009da396740e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147400
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-05-09 02:13:26 +00:00
Ben Konyi 755a315dc5 [ package:dds ] Added support for log history in DDS
Added the following RPCs to the DDS protocol:
- getLogHistoryLength
- setLogHistoryLength

Historical logs will be sent to clients when they connect and subscribe
to the Logging stream for the first time. Current default log history
length is 10,000 messages to support applications with chatty logging at
startup.

Change-Id: Ic6cd9c58673fbb7179b6ac0f1f6581cb8ada03fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146444
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-05-08 23:30:36 +00:00
Alexander Markov 4029d01d70 [vm/nnbd] NNBD-related fixes for bytecode mode
* AssertAssignable should not be generated for top types according to
  IsTopTypeForSubtyping().

* Arguments descriptor should be passed when calling field initializer
  from InitLateInstanceField/InitLateFinalInstanceField stubs.
  If interpreter is enabled, InterpretCall stub expects to find
  arguments descriptor in a register. Also, lazy compilation stub
  may save arguments descriptor in a slot visited by GC, so arguments
  descriptor register should contain a GC-safe value.

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

Change-Id: Ia33ed1bc57007d674799fb4453c8ab4841037211
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147383
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-05-08 22:10:06 +00:00
Alexander Aprelev e5dd3933b4 [gardening] Speed up transferable_test by skipping elements comparison.
With element-by-element comparison the test seems to be too slow for reload, kb bots.

Change-Id: I68d923f78ea40bd13a10582c7cc6e456a1e9b13d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147384
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-05-08 20:21:55 +00:00
Ryan Macnak 2a14a62112 Reland "[vm, gc] Set the scavenger's forwarding bit to equal to the pointer tag bit."
Makes some conversions no-ops.

Originally reverted along with other changes for a g3 roll; re-landing with no changes.

Change-Id: Ia267d1f0104a77866432d7172611b91dae9075ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147320
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-08 19:46:06 +00:00
Ben Konyi 5ccbe533ab [ VM / dartdev ] Ignore VM flags in dartdev VM instance
In order to reduce confusion, if a VM instance detects that it will be
running a dartdev snapshot it will ignore all VM flags and print a
warning message to stderr informing users that the flags are being
ignored and that they should be passed immediately after the 'dart run'
command. This will prevent the dartdev snapshot from being run with
incompatible flags in addition to preventing users from accidentally
setting flags for the dartdev VM when they meant to set those flags for
the target process.

As usual, passing --disable-dart-dev will allow for the user to bypass
this behavior and run their dart program directly.

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

Change-Id: I7d5dc3d4ddae8be99994620b5b2c2e4cc492ae5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146984
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-05-08 19:22:56 +00:00
Alexander Aprelev 6b571998d7 [gardening] Fix transferable_test - remove timing assumptions.
Attempts to expect runtime performances lead to flakiness.

Fixes dartbug.com/37520

Change-Id: I6bc548f523b2c2453c7fa90498ebaf4f91ec9f71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147380
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-05-08 18:54:56 +00:00
Alexander Aprelev b2e300bb7b [vm/isolates] Fix race in ring_gc_* tests.
Some isolate might get Run message and start sending data(Tree) to a receiver before that receiver got Run message.

Fixes dartbug.com/41813

Change-Id: Ifdf1a44d3a2f955f5919d3fd63bf97e9b3317388
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147329
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-08 18:30:56 +00:00
Ryan Macnak 5241586246 [vm, gc] Rename HeapPage to OldPage for symmetry.
Change-Id: I282eaf894fad17a731dbfc76873468b04117cebd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147324
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-08 18:28:06 +00:00
Regis Crelier eae248cc41 [VM/compiler] Emit a throw NoSuchMethodError for bad arity rather than aborting compilation.
The bad arity maybe detected after an isolate reload or when using strong mode with a mix of opted in and opted out libraries.
The thrown NoSuchMethodError contains enough information to be useful, but does not mirror the complete invocation (e.g. arguments).

This CL does not fix https://github.com/dart-lang/sdk/issues/37517 where the target is missing after a reload (not just bad arity).

The VM implementation of NoSuchMethodError is cleaned up, but the deprecated constructor 'NoSuchMethodError(...)' is not yet removed, since it is still documented.

Change-Id: I0306971c59cb510d21cb1b1acc3545c8817dfea7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146986
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2020-05-08 18:08:26 +00:00
Ryan Macnak b6ef01ddaf [vm] Fix -Wno-conversion-null errors.
Change-Id: Id4f506f168a40682a6f9176ab6dc8ac4c110b9ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147326
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-08 17:08:49 +00:00
Zachary Anderson 18735d83df [dart:io, windwos] Try a shorter temp directory name first
Windows paths are limited to 260 characters including the null
terminator in most cases. This makes characters in paths
a precious commodity.

Currently creating a temporary directory in Dart will append
a UUID to the user-provided prefix. UUIDs consume 36
characters of a path. If a temporary directory is created
inside of another temporary directory, this adds up to 72
characters or about 28% of the available real estate.

This change first attempts to use a shorter suffix generated
from a random uint32_t using Crypto::GetRandomBytes. If
that fails, then it falls back on using the UUID.

Change-Id: I15a413746316028b39b6ff915b1b2b19cbf62a5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147341
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Zichang Guo <zichangguo@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-05-08 16:47:09 +00:00
Alexander Markov dd2d040ccb [vm] Cleanup flags which disable argument type checks and strong mode types
The following options are removed:
--use_strong_mode_types
--experimental_unsafe_mode_use_at_your_own_risk

The following flags and predicates are removed:

Dart_IsolateFlags::unsafe_trust_strong_mode_types
Isolate::argument_type_checks()
Isolate::can_use_strong_mode_types()
Isolate::should_emit_strong_mode_checks()

Also, everything depending on these flags is cleaned up.

Change-Id: I9328009ad5a42ea2173842386d612c465e3ebec1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147325
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-05-08 15:53:09 +00:00
asiva 6df6dbeb6e [Tests] Skip valid_source_locations_test for ia32 and simarm* configurations
This tests takes too long on these configurations, timesout most of the
time and causes infra issues.

Change-Id: Iddcb61997df3dea5add0da716dca6bfc930f075e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147340
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-05-08 00:28:41 +00:00
Alexander Aprelev 94c2c7c64c [vm/isolates] Skip dart/isolates/ring_gc_* tests.
Opened dartbug.com/41813 to track the fix.

Change-Id: Ic026ffeee47ad9a283ae6314572a15a42b80a249
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147343
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-05-08 00:26:55 +00:00
asiva 03ce33f80c [BUILD] - Initial CL to unfork the NNBD Dart SDK
- Flips the flag from --nnbd to --no-nnbd so that by default it builds
  the NNBD version
- using the --no-nnbd flag results in the SDK being built in a
  directory which has the 'Legacy' suffix added to it
  (e.g: out/DebugX64Legacy)
- the '--enable-experiment=non-nullable' flag still needs to be passed
  in during execution so that CFE runs in that mode. This is different
  from the 'null_safety' flag

Change-Id: I729630a7bd36ea7ae38134f9285b44e93c283c68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138902
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2020-05-07 21:12:47 +00:00
Ryan Macnak 2707880f1b [vm] Fix various UBSan failures.
Bug: https://github.com/dart-lang/sdk/issues/39427
Change-Id: I74e0eee623d88005fb2893d03e284a87daa09260
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146696
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-07 19:40:18 +00:00
Alexander Aprelev 8c79102889 [vm/isolates] Move saved_initial_field_table to isolate group.
This improves performance of spawn isolate since it drops a need to lock isolate group when spawning new isolate.

Change-Id: I867c13c808a3eb356f3d53323bb8aef06541019e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147046
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-05-07 19:13:28 +00:00
Ryan Macnak 9e5dbadc73 [vm] Use consistent signatures for native call wrappers and native function symbolizers.
Bug: https://github.com/dart-lang/sdk/issues/39427
Change-Id: I0d52d935c15f4d01d56e5e99bc4b83b31678a6ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146940
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-07 16:16:08 +00:00
Vyacheslav Egorov 11b9913064 [vm] Fix vm/dart/run_appended_aot_snapshot_test which uses dart2native internals.
It was broken by changes in d959f4290e

TBR=sstrickl@google.com

Change-Id: Ib70e88317b37609c8139f00154707baeeae7b870
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147180
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-05-07 14:24:40 +00:00
Martin Kustermann 9e76548a2c [gardening] Skip isolate tests on android, make them run less in simulator mode
Change-Id: Idaa75301332222a16af3c8d312de57e39074f362
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147121
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-05-07 13:11:57 +00:00
Vyacheslav Egorov d959f4290e [vm/compiler] Disambiguate Code names when emitting instruction sizes info.
Previously the output used scrubbed qualified names which hides some
of the information and causes names of various synthetic functions
collide. We change it to use internal qualified names instead and add
additional information for disambiguation:

- For functions this means adding a prefix for various synthetic
methods;
- For anonymous closures we add their token position;
- For types we prefix type parameters with their owner's name.

We also add a unit test covering parsing of
--print-instructions-sizes-to output.

As part of adding a test dart2native was changed to support passing
extra arguments to gen_snapshot binary.

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

Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-try,pkg-win-release-try,pkg-mac-release-try
Change-Id: I299ab0fb5993c8af9b51246483608d1e65970d67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146581
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2020-05-07 12:39:27 +00:00
Alexander Aprelev 325cd080dd [vm/isolates] Fix race in isolate field table cloning when spawning isolates in aot.
Goes toward fixing dartbug.com/41791

Change-Id: I8b7cc10fc265e91c7313f5392173bcb971205dcc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146960
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-05-06 21:02:33 +00:00
Ryan Macnak 147f0e3d94 [vm] Delay allocating the ObjectIdRing until the first service request or response.
Avoids GC overhead when the VM service is not in use.

Change-Id: Ic2e752c17fdd01045e30dd62e16f20896a9fc64e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146440
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-06 19:19:52 +00:00
Ryan Macnak 9a4b464be0 [vm] Prevent try index from clobbering yield index when encoding pc descriptors.
Bug: https://github.com/dart-lang/sdk/issues/39427
Change-Id: I81beb5b269857e486a7374968fe8ac78d72bb16b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146695
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-06 17:58:22 +00:00
Martin Kustermann 8d1c4c555c [vm/concurrency] Add various tests for lightweight AOT isolates
To enable our tests to spawn a new isolate in a new group, this CL
adds a `{bool newIsolateGroup}` parameter to the internal
`Isolate._spawnFunction` native and moves that native to
`dart:_internal`, thereby allowing runtime/tests/vm/dart/* to access it.

It also adds various tests for lightweight AOT isolates, exercising
GC, communication, spawning, ...

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

Change-Id: I3940c30fb43d2475c58e6be78507da74ce64b60d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145941
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-05-06 12:37:52 +00:00
David Morgan cc29a4e6e4 Upgrade package:path from 1.7.0 (1.7.0 in pubpsec.yaml) to 4b8c83cd5ccfcc8101acd2940ffb5a44d24ec57e (1.7.0 in pubspec.yaml).
R=nbosch@google.com

Change-Id: I389146c4440b35462cc3277eba491aeadb3c0435
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144722
Commit-Queue: David Morgan <davidmorgan@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-05-06 10:38:55 +00:00
Alexander Markov 16fb650d25 [vm/nnbd] Read null-safety mode from snapshots with code
Snapshots which contain code are compiled with a particular null-safety
mode and it is not possible to change their mode at run time.
When running from such snapshot, VM now reads null-safety mode from
the snapshot if it is not specified at the command line.
This avoids the need for embedders to pass null-safety flag
used during snapshot generation also to the runtime, similarly to
other VM flags listed in VM_GLOBAL_FLAG_LIST (such as use_bare_instructions).

In addition, error for incompatibility of kernel libraries with
current null-safety mode is changed from ReportError (which attempts
to throw an exception) to a FATAL, because throwing an exception
crashes when bootstrapping from a kernel file.

Change-Id: I93a791825c25c2da4e33634f1c71736c17928fea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146460
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-05-05 17:25:07 +00:00
Martin Kustermann c01f9fb8a9 [vm/concurrency] Make an isolate group use a custom ThreadPool with maximum size
Our TLAB sizes and maximum new space size constrain the number of
parallel mutator threads we can have. Having too many mutator threads
would cause constant races between threads to acquire TLABs.

In reality we should constrain the number of threads to be at most the
number of cores, since at most that many threads can run in parallel
(i.e. at the same time).

This CL extends the TreadPool implementation to be constrained by a
maximum size. Furthermore it makes each isolate group's have it's own
pool with constrained size and schedule all group member
mutator / message handler tasks on that pool.

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

Change-Id: I095c749adad827ab892f33713a32be594d7606d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145382
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-05-05 12:08:43 +00:00
Ben Konyi 9cfe19d38b [ VM / Service ] Remove _spawnUri RPC from VM service
This code doesn't appear to be used anywhere in the Dart SDK or Flutter.

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

Change-Id: Iad8537f3187caa7b2304ee2ec2aaaa8b6ba2b35c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146480
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-05-05 00:47:37 +00:00
Ryan Macnak 47e33200fb [vm] Remove ObjectLayout::ptr(), which is now a no-op.
Change-Id: I5a066b0c510f580d8e720aba6e532218de165fb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146061
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-05-04 22:54:17 +00:00
Ryan Macnak 60493d58fb [vm] Remove undefined shifts from ReadStream.
Change-Id: I3570739b77d431e412af94c87fa544805f6dbbcb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146028
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-04 22:53:47 +00:00
Ryan Macnak 14dfa1b9ee [vm] Fix gcc build.
Change-Id: I6634dc10fdc8d7523562c0fcc20e3561eb580acf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146023
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-04 21:15:27 +00:00
Zach Anderson bbebad9eca [dart:io] Don't treat a file descriptor as a signal o_o;
Prior to this CL, the signal handler finalizer passes a file descriptor
where a signal number is expected.

This went uncaught for awhile since it is innocuous in most cases.
Clearing a signal handler just involves setting it back to the
default. It is not innocuous where the VM chose to override the
default, for example in the case of SIGPIPE. When setting signal
handlers with the dart:io API, if the finalizer for a _NativeSocket
for a signal handler runs, some time later the VM may be killed by
SIGPIPE instead of getting EPIPE from an IO call.

This CL replaces the call in the finalizer with a new call that
expects a file descriptor, and uses the file descriptor to look
up the signal handler that needs to be cleaned up.

Change-Id: I54caa14a556e434872d12fd9acf8c2fcf767b91e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146080
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-05-04 20:19:18 +00:00
Filip Filmar b161b52331 Use new call to get ComponentContext
Fuchsia OS is making a change in the serving sequence for component
startup, to avoid a race condition in which clients attempt to connect
to services that are not yet exposed but will be.

This change is needed for a smooth transition to that new API.  The
Fuchsia SDK change has already rolled to Dart.

See: https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=50758
Change-Id: Ib1249dcf771e99f542343328918ae55497ddaf71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145700
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Filip Filmar <fmil@google.com>
2020-05-04 17:35:24 +00:00
Ryan Macnak 75c65a4b39 [vm] Switch Zones from arithmetic to geometric growth when they become large.
Avoids failing on Linux from exhausting Page Table Entries before exhausting physical memory or address space.

Change-Id: Idffbd0a2eb8b030f2afabb4c31135fb75deca59f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144669
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-05-04 17:01:44 +00:00
Daco Harkes 018fa4ef46 [vm] Make BSS relocation reusable
Change-Id: I6669a59fc1f36ad1b4d626f115c0ad9bccf69e6f
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145590
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-04 16:17:14 +00:00
Martin Kustermann a94b8ae45d Reland "[vm] Make VM support .dart_tool/package_config.json"
This relands the following CLs

    [vm] Make VM support .dart_tool/package_config.json
    https://dart-review.googlesource.com/c/sdk/+/145462

    [vm] Make Isolate.resolveUri() work for both `.packages` and `dart_tool/package_config.json`
    https://dart-review.googlesource.com/c/sdk/+/145803

    [vm] Skip (newly enabled) isolate tests on simarm* and hot-reload configs
    https://dart-review.googlesource.com/c/sdk/+/145861

    [vm] Remove ../0 postfix from status file entries (test framework does not recognize those multitests)
    https://dart-review.googlesource.com/c/sdk/+/145940

    [vm] - Fix hang when no package config or .packages exist
    https://dart-review.googlesource.com/c/sdk/+/145661

The only change (extra patchset) is to let VM prefer the old/legacy
".packages" format and only use the newer
".dart_tool/package_config.json" if we failed to find a ".packages".

Closes https://github.com/dart-lang/sdk/issues/41739
Closes https://github.com/dart-lang/sdk/issues/41649

Change-Id: I220f808540e6e521d985ae763968f64dbf57fe67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145942
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-05-04 14:51:14 +00:00