Commit Graph

17722 Commits

Author SHA1 Message Date
Alexander Aprelev feeb7ad461 [vm/concurrency] Add write-lock assertion to Class::SetFields protecting Class fields.
This is follow-up to https://dart-review.googlesource.com/c/sdk/+/168140 which added write-lock to protect Class functions.

Bug: https://github.com/dart-lang/sdk/issues/36097
Change-Id: Idb2070d005c44509fc6701f2eb297b90e7ded581
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168772
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-10-22 19:07:20 +00:00
Alexander Aprelev 37abbb2e3d [vm/concurrency] Introduce program_lock to guard program structure changes.
This CL adds acquisiton of write lock and check for whether write lock is held when updating class functions, primarily populated during class finalization. Read locks will be added in successive CLs, so is extending of the locks coverage to all aspects of program structure changes.

Bug: https://github.com/dart-lang/sdk/issues/36097
Change-Id: I3dba6bc23db4e45599a20717226210f12e7fd2b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168140
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-10-22 13:08:10 +00:00
Tess Strickland b64d20e434 [vm] Print symbol names and offsets in simulator backtraces.
When running the simulator on precompiled mode, source information
is lost, so only the filename is valid with the line and column
information printed as -1.  For each frame, this CL adds the symbol name
of the instructions section and a hexadecimal offset from the start of
the section, which can be used with the native_stack_traces package. The
absolute address of the VM and isolate instructions are also included
at the start of the backtrace.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try
Change-Id: Ie67f914b156ead48fccc3069ced6a26940b80673
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168822
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-10-22 12:58:40 +00:00
Alexander Markov d014a0f59b Remove bytecode mode of Dart SDK build
This change cleans up build.py --bytecode and gn.py --bytecode options.

Change-Id: Ie251e7049ce3f8f9da28d35eda139b60ee23af98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167842
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-10-21 22:43:14 +00:00
Ryan Macnak 584fd79bc8 [vm, gc] Allow immediates in weak tables, and simplify serialization id tracking.
Allow weak tables to contain immediate objects (Smis) by adjusting the sentinel value for an empty entry to a value which is never a valid Smi nor heap object. Immediates go into the old-space table, since they also don't need to be updated after a scavenge.

Remove the clustered serializer's separate Smi id table.

Change-Id: Ia34ebe92be17f6568f0d4e5090e9abf5e77dadb3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168620
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-10-21 21:17:54 +00:00
Ryan Macnak 4364d40585 [vm, gc] Account for card remembering during become.
Bug: https://github.com/dart-lang/sdk/issues/43862
Change-Id: I2587a976d74919cdd6b4fdf2baf68b66a8e88ccd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168623
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-10-21 19:53:44 +00:00
Regis Crelier 0ace625d6d [VM/finalizer] Remove checks from finalizer now performed in CFE.
Also stop passing the class 'being parsed' to finalization methods.

Change-Id: I7c2256c2a8ace468021ba0ba5be10b6bfb839480
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168621
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2020-10-21 19:36:56 +00:00
Alexander Markov 3e77a430b8 [vm/compiler] Verify that intrinsic parameters are boxed
Intrinsic functions (both asm and graph intrinsics) do not expect
unboxed parameters in most cases. This change adds checks to verify
that and avoid generating incorrect code silently, in case parameters
become unboxed.

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

Change-Id: I71c1499bf8232f241316ae6b3cdeb57dec18fbb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168622
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-10-21 15:50:13 +00:00
Johnni Winther 5c51990a80 [cfe] Handle void as return context in sync function expressions
Closes #43174

Change-Id: I6b1cc04cbf2d65d9b877dfabf3e0f535f2491a94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168542
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-21 13:43:03 +00:00
Clement Skau 7f0bd5e811 [VM] Removes _Future's and _StreamImpl's _awaiter.
Changes debugger.cc to use the 'lazy async stack' mechanism for
unwinding async stacks, which means we no longer have to manually
keep track of the caller.

This also allows us to get rid of _asyncStarListenHelper.

Bug: https://github.com/dart-lang/sdk/issues/42457
Change-Id: I536e9da4af275998140ae5f05e3a43e07c77cfc7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167561
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-10-21 12:38:23 +00:00
Anna Gringauze f04bc85e4f Refined scope calculation in expression compiler
- make sure nested blocks scopes are visited
- make sure variable definitions do not leak beyond block scopes
- properly collect scopes for loops, if statements, constructors
- add calculation of fileEndOffsets for blocks
- save block file offsets to dill
  - update binary format version
  - change kernel readers and writers to read and write block offsets
  - change vm readers to read and block offsets for new version
- add missing fileOffsets and fileEndOffsets on functions for
  late fields
- add missing fileOffsets and fileEndOffsets on functions for
  extensions
- add errors on failures to find scope
- find libraries for private fields correctly
- add more expression compilation tests
- add test to verify fileOffsets and fileEndOffsets are set for
  SDK summary (will add full dill tests later)

Closes: https://github.com/dart-lang/sdk/issues/40278
Related: https://github.com/dart-lang/sdk/issues/34942

Change-Id: I5bc1bb645543045b689d8d61069ee77dc4ee9025
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167541
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-10-20 01:44:52 +00:00
Regis Crelier 037cff952c [VM/assembler] Use correct operand size in FieldAddress on arm64.
This change prevents the scaled addressing mode to be wrongly applied by the assembler.

Let's illustrate with an example:

__ ldr(R1, FieldAddress(R1, target::Type::nullability_offset()), kUnsignedByte);

Let's assume that target::Type::nullability_offset() == 57 (it is currently 61, but will be 57 in a forthcoming CL).
FieldAddress substracts 1 and builds an Address with offset 56.
The default operand size passed to Address is kDoubleWord, i.e. a scaling factor of 3.
Because 56 == (56 >> 3) << 3, the scaled addressing mode is chosen with a scaled offset of 7, which would be correct for a kDoubleWord access, but not for a kUnsignedByte access.

It is important to specify the same operand size in the instruction as in FieldAddress:
__ ldr(R1, FieldAddress(R1, target::Type::nullability_offset(), kByte), kUnsignedByte);

Change-Id: I46cf2b6ac103b2acec723189c88e211567b795af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167900
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2020-10-19 18:54:37 +00:00
Tess Strickland fe2f9aca21 [vm] Move dynamic checks into DartEntry::InvokeCallable.
DartEntry::InvokeCallable (and DartEntry::InvokeClosure) are only called
for dynamic invocations. Instead of making it the responsibility of the
caller to check the callable function if it can't receive dynamic
invocation, move the call to DoArgumentTypesMatch into
DartEntry::InvokeCallable.

Since all current callers of these and related functions already have a
handle on the current thread, thread it through instead of retrieving it
via Thread::Current().

Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try
Change-Id: I5f9260b0edace5b4017aa235a980a802405a2f1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168020
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2020-10-19 13:14:37 +00:00
Martin Kustermann 13d2937f76 [vm/compiler] Remove too conservative release assert, add boxed-field/unboxed-implicit-getter graph intrinsic support
The initial release assert was added when removing assembler intrinsics
for implicit getters and replacing them with graph intrinsics in:

  https://dart-review.googlesource.com/c/sdk/+/155900

Normally if the return value of a implicit field getter is unboxed, the
field itself must be unboxable. That is true, though just because we can
unbox a field doesn't mean we always will:

The unboxing field bitmap - which e.g. the GC uses - only allows 64-bits.
Classes with more fields might have some fields boxed even though they
could theoretically be unboxed.

Closes https://github.com/flutter/flutter/issues/67803

Change-Id: I39717d356e293ed85becd64c8a664465d2abd31d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168100
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-10-17 07:52:24 +00:00
Alexander Markov d966612cc3 Remove remaining bytecode benchmarks
Change-Id: I7baca41921a2f657dc658b9c3585832109b74a1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167880
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-10-16 20:21:32 +00:00
Alexander Markov dea3fa7b8c [vm/compiler] Allocation sinking of arrays and typed data objects
JIT mode: ParticleSystemUpdate +44-52%
JIT mode with null safety: ParticleSystemUpdate +40-44%

In AOT mode a few methods from package:vector_math are not inlined
in ParticleSystemUpdate benchmarks, which prevents allocation
sinking optimization.

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

Change-Id: I28d5816e643e4cfffe4b4fb7db5db5a3aa72499c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164805
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-10-16 20:05:02 +00:00
Alexander Aprelev a7c612e187 [vm/resolution] Wrap few Class::Lookup.*FunctionUnsafe() methods in Resolver::Resolve.*() methods.
Add "Unsafe" suffix to those Class::Lookup* methods to indicate they will need program
structure protection locking.

This allows to localize program structure protection locking inside of those Resolver methods.

Bug: https://github.com/dart-lang/sdk/issues/36097
Change-Id: Ie5b0a190f6d3256448f2e528fa8ee52421e1639a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167960
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-10-16 19:22:52 +00:00
Alexander Markov e5f1b4bb2c [vm/compiler] Handle unboxed index parameter in ArraySetIndexed/ArrayGetIndexed intrinsics
Fixes https://github.com/dart-lang/sdk/issues/43810

Change-Id: I0bd5fc1ca9b71c141bf6b596813183b380e1a391
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167865
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-10-16 16:59:42 +00:00
Martin Kustermann c0129418be [gardening] Lower threshold for number of trace events in flaky/time-sensitive test
Issue https://github.com/dart-lang/sdk/issues/43713

Change-Id: I6884d08ff08e0e44efcb14b009d9289dba8909ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168021
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Auto-Submit: Martin Kustermann <kustermann@google.com>
2020-10-16 16:27:42 +00:00
Robert Nystrom 0e88702d1b Opt the verbose_gc_to_bmu tool out of null safety.
Change-Id: I67ee7afa11366ebe0a299ba5ed06047fe38e6605
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167864
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-10-16 00:18:31 +00:00
Alexander Markov 07a2e99c68 Remove bytecode modes from DartFuzz
Change-Id: Ied5b9ec9c0f326b62df456dce810fcdcb0a4f4d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167841
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-10-15 19:01:37 +00:00
Martin Kustermann 32dfefbea1 [vm/compiler] Fix incorrect write-barrier elimination
If there is a GC-triggering instruction between array allocation and
store into array we cannot omit the barrier. This worked for stores
where the receiver is a direct array allocation, but not if it's a phi.

Closes https://github.com/dart-lang/sdk/issues/43786
Closes https://github.com/dart-lang/sdk/issues/43770

Change-Id: I28de29cf85842a9d3ae3189bb8e6426969fe4279
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167570
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-10-15 10:40:43 +00:00
Ryan Macnak 37ed87b038 [vm, service, observatory] Bang Bang (My Type System Shot Me Down).
Port the service tests and Observatory to Dart 3.

Change-Id: I8a8b20d8f90acd3b5f741c93f10ba99971aa0c52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154825
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-10-14 18:16:27 +00:00
Martin Kustermann ed2658211e [vm/concurrency] Add store-release/read-acquire barriers for Class::{state_bits_,functions_,fields_}
Issue https://github.com/dart-lang/sdk/issues/36097

Change-Id: I7e1fc63066ce813bc317afa8ad1a58394cea6afa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166856
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-10-13 18:54:18 +00:00
Alexander Markov 8d8f57065d [gardening] Reduce number of samples expected in service/get_cpu_samples_rpc_test, take 2
Now fixing runtime/observatory_2/tests/service_2/get_cpu_samples_rpc_test.dart
in addition to runtime/observatory/tests/service/get_cpu_samples_rpc_test.dart,
which was fixed in https://dart-review.googlesource.com/c/sdk/+/167043.

This test has been failing on vm-kernel-precomp-win-release-x64 bot as
it was getting only 3-10 samples, while expecting >10.
The expectation doesn't look reliable as we cannot guarantee that
profiler would collect enough samples.
Changed the expectation to >0 samples, in an attempt to make this test
less flaky.

Change-Id: Ifbe1b0a4d5ea56bc1b29ef9cbf15df0710187c07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167147
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-10-12 23:23:02 +00:00
Leaf Petersen 745f112ef6 Opt out some files from null safety.
Opt an initial batch of files under samples, samples-dev,
utils, and runtime/tools/dartfuzz out of null safety in preparation
for switching the flag on by default.

Change-Id: Icdfd52a5a969e678a7205903332f73fe3841c223
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166960
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
2020-10-12 22:15:42 +00:00
Daco Harkes 9d36be8868 [vm/ffi] Make callback SaveArguments platform agnostic
Separated out from:
https://dart-review.googlesource.com/c/sdk/+/140290/18.
Issue: https://github.com/dart-lang/sdk/issues/36730.

Change-Id: I71a749ffe946c74033f7f047486f32746e93d79f
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-win-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166849
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-10-12 21:12:22 +00:00
Alexander Aprelev 9e79e0f5c3 [vm/win] Use Utils::StrDup instead of strdup to avoid deprecated warnings
Change-Id: Ic0f85bc1724e2ffab2cb29792306bef3e80e6aad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167142
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-10-12 20:24:22 +00:00
Alexander Markov 4902ec5975 [gardening] Reduce number of samples expected in service/get_cpu_samples_rpc_test
This test has been failing on vm-kernel-precomp-win-release-x64 bot as
it was getting only 3-10 samples, while expecting >10.
The expectation doesn't look reliable as we cannot guarantee that
profiler would collect enough samples.
Changed the expectation to >0 samples, in an attempt to make this test
less flaky.

Issue: https://github.com/dart-lang/sdk/issues/43713
Change-Id: I3a8a3854f3828d39eb409b1b540f29a34fe9e6b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167043
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-10-12 19:17:02 +00:00
Alexander Aprelev 340f78eab3 [vm/io] Add a test for nonblocking ssl certification evaluation.
This is follow-up to a6dafabb88.

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

Change-Id: I4da732ab08235a1f549d45c7fa5fb87db672e2aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166701
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-10-12 15:06:52 +00:00
Martin Kustermann d97dd024e5 [vm] Remove unused Class::RemoveFunction function
Change-Id: Ia5001d04c41e3463428e3f33b50f880f0627bde1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166852
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-10-12 14:28:22 +00:00
Tess Strickland 3efea83597 [vm] Add explicit tests of variable length encoding.
While failures to encode and decode correctly would likely cause the
failure of many other tests, due to the use of these methods in areas
like snapshot, PC descriptor, and stack map creation, explicitly test
the integer VLE methods with specific unit tests.

Change-Id: If403ff4dfcaf28051af45f16075504797705561e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166847
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2020-10-12 11:07:21 +00:00
Alexander Markov e9aa232066 Remove remaining tests for bytecode mode
Change-Id: I9690bd8a9bdcf16963424c64c1b80628e50fa28a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166922
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-10-09 22:30:19 +00:00
Daco Harkes d650ea90c4 [vm/ffi] Fix alignment of Uint64 fields in structs on some ABIs
Affected ABIs: ia32 Linux, ia32 Android, ia32 MacOS, and arm32 iOS.

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

Change-Id: I35f719abb69bb46d99f647d66847e3d5874d9371
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166843
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-10-09 16:32:08 +00:00
Tess Strickland 45a46ca2b8 [vm] Add (S)LEB128 encoding/decoding to BaseWriteStream.
Unlike cfc8e6de, this does _not_ replace the default variable length
encoding for {Read,Write}Streams, but insteads adds separate
{Read,Write}{S,}LEB128 methods to the appropriate classes. If we later
find the cause of the issues that led to the revert of cfc8e6de, it'll
be easy to switch over then.

Note that WriteLEB128 asserts that the value is non-negative if used
with a signed type (since negative values suggests that SLEB128 should
be used instead for minimal encoding).

Also removes the various other encoding and decoding methods for
(S)LEB128 across the codebase and changes those clients to use
{Read,Write}Streams instead.

Other cleanups:

* Various constant-related cleanups in datastream.h.

* Adds DART_FORCE_INLINE to ReadStream::ReadByte and uses it in the
  default variable length decoding methods for retrieving bytes
  from the stream instead of managing current_ by hand.

* Creates a canonical empty CompressedStackMaps instance and uses
  that instead of the null CompressedStackMaps instance in most cases.
  The only remaining (expected) use of the null CompressedStackMaps
  instance is for the global table in the object store when no global
  table exists (e.g., in JIT mode before any snapshotting).

* Moves CompressedStackMapsIterator from code_descriptors.h to an
  Iterator class within CompressedStackMaps in object.h (similar to
  PcDescriptors::Iterator), to limit friend declarations and because it
  conceptually makes more sense as part of CompressedStackMaps.

* Removed CompressedStackMaps::PayloadByte, since existing clients
  (CompressedStackMaps::Iterator, StackMapEntry in program_visitor.cc)
  are better served by just operating on the payload buffer directly
  (with appropriate NoSafepointScopes).

* WriteStreams no longer allocate their initial space on construction,
  but rather on the first write, so no allocation is performed by
  constructing a never-used WriteStream.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-mac-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-ubsan-linux-release-x64-try,vm-kernel-tsan-linux-release-x64-try,vm-kernel-precomp-ubsan-linux-release-x64-try,vm-kernel-precomp-tsan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-asan-linux-release-x64-try
Change-Id: Ice63321abaa79157fbe9f230a864c8bba0e6dea9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166421
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-10-09 10:08:16 +00:00
Ryan Macnak 4182cbe1a3 Remove use of set_sources_assignment_filter
The sources assignment filter is considered a misfeature of gn
and is planned for removal (see discussion at [1]).

Convert dart BUILD.gn rules to manually filter the files that
are build using explicit `if` expressions. Remove obsolete call
to set_sources_assignment_filter() to filter '*_test.*' files
as no such files are present in the variables used to build the
`sources` value.

[1]: https://groups.google.com/a/chromium.org/g/gn-dev/c/oQcYStl_WkI/m/roukYTxSDAAJ

Bug: gn:125
Change-Id: I591fbb746cf694f7d2a5a330f81652380acf5c11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166629
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-10-08 20:08:59 +00:00
Alexander Markov d77fff7307 [vm/nnbd] Add separate Snapshot::Kind for core snapshots
Core snapshots should be agnostic to the sound null safety mode
(so they can be used both in weak and strong modes), and snapshot
writer verifies that.

Snapshot::kFull was previously used both for core snapshots and
app snapshots on ia32. However, app snapshots are not guaranteed to
be agnostic, which appeared as failures on a few test on ia32.
Also, VM should be able to detect null safety mode from app snapshots,
even if they do not contain code, but null safety mode was not
written into features string of kFull snapshots.

In order to disambiguate core snapshots, a new Snapshot::Kind is
added. Snapshot::kFullCore works exactly as Snapshot::kFull, except
for verification of agnostic null safety and snapshot features string
omitting null safety mode. All snapshots except kFullCore now have
null safety mode included into their features string.

Fixes https://github.com/dart-lang/sdk/issues/43626
Issue https://github.com/dart-lang/sdk/issues/43613

Change-Id: I8cd3b049ef4e428dd5e1ce666d4c7aa3b596d70c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166308
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-10-08 19:59:15 +00:00
Alexander Markov 5c19b4abcd [vm] Handle errors from RegExp engine
Bug: b/72146178
Change-Id: I2d05a004690b4d3e0b3e79786a967e27fddaacb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166582
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-10-07 22:34:24 +00:00
Ryan Macnak 6c31582031 Copy Dart 2 version of Observatory and service tests.
Change-Id: If47aa98918b0166dba781a0008c23b991d46fe1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165420
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-10-07 22:20:25 +00:00
Ryan Macnak 6bcdcb5c68 [vm] Don't allocate on the Dart heap when printing stack traces.
Bug: https://github.com/dart-lang/sdk/issues/43642
Bug: b/169880355
Change-Id: Ib067eb8c8183367442cffa5b0975d5264ccc3017
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166244
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-10-07 17:09:37 +00:00
Alexander Markov 0e9b2b8a36 [vm/compiler] Fix assertion when assigning type to a Phi in ComputeSSA
Fixes https://github.com/dart-lang/sdk/issues/43682

Change-Id: I6b123ac5ba153b1f4177148341619419c3058684
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166304
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-10-07 16:30:17 +00:00
Ben Konyi f474b1697e [ Service ] Include flags and options with custom handlers in getFlagList
RPC response

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

Change-Id: I7fa98dd2218d182e80f682a2fd6a3a4150509dfb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166260
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-10-07 15:23:25 +00:00
Paul Berry e933e91aaa Reland "Flow analysis: promote to non-nullable on initialization"
This is a reland of 6a1c54ec30

Original change's description:
> Flow analysis: promote to non-nullable on initialization
>
> When flow analysis encounters a variable declaration of the form `T? x
> = expr;`, if the type of `expr` is `T`, then the variable is
> immediately promoted to type `T`.
>
> Fixes #43099.
>
> Change-Id: Ia206fe0d50e2fdd9bdf637e13c85633d8490dbcc
> Bug: https://github.com/dart-lang/sdk/issues/43099
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163841
> Commit-Queue: Paul Berry <paulberry@google.com>
> Reviewed-by: Bob Nystrom <rnystrom@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>

Bug: https://github.com/dart-lang/sdk/issues/43099
Change-Id: I7530bb0f7c24674a7b500558b89d50b35e045aca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166305
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-10-07 13:14:55 +00:00
Alexander Markov 34e8b4229e [tests/nnbd] Mark test as slow in debug mode, add diagnostics
Issue: https://github.com/dart-lang/sdk/issues/43613
Change-Id: I12fe82b3dc2eced6e0c582ecc487ef140e5edc40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165365
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-10-07 02:01:23 +00:00
Alexander Markov 447a66a326 [vm/compiler] Fix LoadField canonicalization for typed data
Fixes https://github.com/dart-lang/sdk/issues/43679

Change-Id: I20002208d7c25fad39c3e7d7698b8614322a9e61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166128
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-10-06 18:41:03 +00:00
Tess Strickland df79bd7c53 [vm] Unify the concrete implementations of ImageWriter::WriteText.
Instead of having two similar concrete implementations of WriteText
that differ mostly in the output format, abstract out the parts that
differ and create a single, non-virtual WriteText that calls the
abstracted-out methods as appropriate.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-mac-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-win-release-x64-try
Change-Id: Ic728cd4d3376af32780d428efba19cd36e73c3ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164562
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-10-06 17:10:05 +00:00
Tess Strickland 1b50200abd [vm] Simplify symbol naming/address retrieval.
Before, picking a symbol name for a Code object when generating
assembly required adding a placeholder entry in the Dwarf object,
because the Dwarf object separately used a SnapshotTextObjectNamer
to determine the appropriate symbol name to use in relocations.

Instead, now the ImageWriter subclasses are entirely responsible for
creating the symbol name for a given Code object, and that name is
passed when adding the Code object to the Dwarf object.

For Elf output, we eagerly create symbols for sections and Code objects
again in the appropriate symbol table, and so looking up the start of a
given section or Code object can be done simply by asking for the
corresponding symbol's address, removing special case methods and other
workarounds.

We also clean up the generated static and dynamic symbol tables by
only generating local symbols for Code objects and BSS sections (these
are local in assembly output also), and only adding global symbols to
the dynamic symbol table.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-mac-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-precomp-win-release-x64-try
Change-Id: Ie40c0c836681e98f345483136bb6860e5588ef30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166002
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-10-06 17:10:05 +00:00
Tess Strickland fca36cae39 [vm] Merge ImageHeader into InstructionsSection.
Before, we only wrapped the Instructions payloads in an
InstructionsSection in precompiled snapshots with bare instructions mode
enabled. This CL changes that to always add an InstructionsSection
wrapper in precompiled snapshots, even when not in bare instructions
mode, and moves all the information from the old ImageHeader object into
the InstructionsSection object instead. Note that in non-bare mode, the
InstructionsSection has no payload, and the Instructions objects follow
the InstructionsSection object instead of being contained by it.

This CL also wraps all implementations of AssemblyImageWriter and
SnapshotTextObjectNamer methods in a single DART_PRECOMPILER ifdef
block, since we only generate assembly in precompiled mode.  This
removes the need for the smaller DART_PRECOMPILER ifdef blocks scattered
across the AssemblyImageWriter method implementations.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-mac-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-precomp-win-release-x64-try
Change-Id: I3676fb5c6675845463707acbbb4759a465cfa342
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165563
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-10-06 17:10:05 +00:00
Tess Strickland 72cfc5c638 [vm] Clean up handling of payload-containing objects.
This CL adds a new PAYLOAD_SIZEOF specification to
runtime_offsets_list.h which defines InstanceSize methods given an
method name to invoke to get the header size (i.e., the size of
the object portion before the payload).

It uses this new specification to create appropriate InstanceSize()
methods for objects written to read-only sections of snapshots,
instead of needing separate size calculations for SIMARM_X64.

It adds more methods to Instructions to avoid special casing for bare
instructions mode. It also removes the special casing for SIMARM_X64,
serializing all read-only objects in the same manner even when not
in a crossword situation.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-mac-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-win-release-x64-try
Change-Id: Ie3e4009f4bc03688998c32281e42fa22a255731d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165501
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-10-06 07:59:33 +00:00
Ryan Macnak 8434b038fc Do not run service tests with obfuscation.
Change-Id: I046bd3ab6e3b819fd0087e73983d9fd834d5151b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166123
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-10-05 21:59:52 +00:00