Commit graph

17470 commits

Author SHA1 Message Date
Liam Appelbe 3ec7ea15ec [vm] Fix some Fuchsia tests
Change-Id: I2a6bedeee059bd461cbc00cc5d13df2bdf3154a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156702
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-08-03 22:24:28 +00:00
Ben Konyi 6a66061703 [ Service ] Add getWebSocketTarget RPC to allow for Observatory to
connect to DDS without relying on a redirect.

Some WebSocket implementations (particularly dart:html's) don't follow
redirects and don't provide the user with the message returned by the
server.

This CL adds 'getWebSocketTarget' as an RPC which returns the
URI that should be used by the client to connect directly to the proper
web socket target. In addition, the "implicit-redirect" forwarding has
been removed.

Change-Id: Iaf88c965f6fedfa6f63c28a08860a3c80388797c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156485
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-08-03 22:06:41 +00:00
Ryan Macnak 6b9b934d84 [vm, gc] Reduce growth rate as the heap size approaches --old_gen_heap_size.
Normally the heap grows in steps proportional to the size of the heap, so it grows faster the closer it gets to memory exhaustion.

The closer the heap size approaches --old_gen_heap_size, the less the heap will grow between GCs. This is useful on systems that respond to low memory conditions by killing processes instead of failing allocations. It is expected the asymptote will be chosen as some fraction of memory available from the OS (hundreds of MB on mobile).

Change-Id: I65cb4ab833e7a965595642312ce551719c0ade50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151635
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-08-03 17:47:11 +00:00
Ben Konyi 501c807266 [ VM / DartDev ] Update argument handling for 'run' command
Previously the help messages for 'dart run' were output by a secondary
VM spawned solely to print the VM's help message. However, this help
message was not consistent with those found for other DartDev commands.

With this change, the 'run' command:

- Uses package:args to create a help message consistent with other
 DartDev commands.

- No longer accepts arbitrary options and is instead restricted to a
 subset of common flags. Passing a VM flag which is not included in
 this subset of commands will result in an argument error if passed
 *after* the 'run' command. Other VM flags can be passed immediately
 following 'dart' and before the DartDev command.

- No longer outputs the VM verbose options when invoked with '--help
 --verbose'. VM verbose options and the original VM help message can
 be viewed by running 'dart --help --verbose'. This makes uncommon
 VM flags used for development less visible to regular users.

- Now properly forwards the subset of VM options accepted by 'run' to
 the VM (e.g., 'dart run --observe --no-pause-isolates-on-exit foo.dart'
 would have ignored '--no-pause-isolates-on-exit').

Change-Id: Ie56b767cc21e6af3630c742458a6c3e9f7418250
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155841
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-07-31 21:41:10 +00:00
Zichang Guo d6d37ed203 Prevent VM crashing from \\?\ prefixed path
"\\?\" prefixed path is not properly supported. Arguments historically
were parsed as a Uri, which converted backward slashes into slashes. It
used to work because Win API is able to handle slashes as separators.
But "\\?\" has a special meaning and should not be changed. '?' is also
invalid char in the URI. So it leads to a crash.

The best solution is to avoid using URI to parse the path. This cl is a
workaround for crashing.

Bug: https://github.com/dart-lang/sdk/issues/42779
Change-Id: I13bcefc820eb578a2707181080eac9c0f1592e4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156364
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-07-31 21:09:40 +00:00
Daco Harkes 9871331450 [vm/ffi] Clarify DynamicLibrary.open behavior
Both dlopen and LoadLibrary have caching behavior and only load the
dynamic library once into the DartVM, even with multiple isolates.

Change-Id: If16791baf28706c61acb1ecdae668485b264a373
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156682
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2020-07-31 15:15:20 +00:00
Tess Strickland d7feab5aaa [vm/compiler] Make BinaryIntegerOpInstr::InferRange().
Instead of putting the same InferRange() in BinaryInt32Op,
BinaryInt64Op, and (currently missing) BinaryUint32Op, just add a base
version in BinaryIntegerOp that's overridden by the caching versions in
BinarySmiOp and ShiftIntegerOp.

Change-Id: I38e4b4869c08101b97201159eee0de972bfc0cbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156681
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-07-31 15:06:15 +00:00
Aske Simon Christensen fda6a1f136 [vm/aot] Fix DominantUse being quadratic in the block size.
This was caused by GetBlock() being called for every use.

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

Change-Id: Ib77d5d9fb69eb815a60b868aa1bf989af5f90e67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156680
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2020-07-31 13:29:40 +00:00
Daco Harkes 9dbe5026dd [vm/ffi] Remove dead code for ia32 AOT
Precompiled mode has never been supported for ia32. Removing dead code.

Change-Id: Ia2de44373f3f494cb22f774369f922e061fc99c7
Cq-Include-Trybots:dart/try:vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156521
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-31 08:09:49 +00:00
Zichang Guo 15494c741b Unify error messages when calling unix sockets on unsupported platforms
Using unix domain sockets on unsupported platforms will throw different
error messages.

Change-Id: I3091c87d74dd4e6fc0a6799b454f3e16b400c0f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155925
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-07-31 01:09:46 +00:00
Aske Simon Christensen 00edd9756b [vm/aot] Delay allocation instructions until right before first use.
Moves AllocateObject and CreateArray instructions down to their
dominant use (use that dominates all other uses) when such a use exists
and the move is not hampered by environment uses (which can happen when
the allocation is inside a try block).

This improves write barrier elimination for inlined constructors, since
it moves the allocation after evaluation of the arguments. Any Dart
calls in an argument would disable elimination after it.

The optimization is particularly effective for Flutter Widget code,
since such code typically contains many nested constructor calls.

Reduces instructions size of Flutter Gallery by about 0.8%.

Change-Id: Ife30850c1a23f0986f85d42c1015f4caa7cf1fa6
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153602
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-30 15:57:33 +00:00
Ben Konyi 8dc4833e86 [ VM/ DDS ] Temporarily disable DDS for beta release
https://github.com/dart-lang/sdk/issues/42727 isn't expected to be fixed
before the next beta release. Disabling DDS temporarily until a proper
fix has been landed.

Change-Id: Ib3233e75a115caa9625f1e96d136b0f6abc5f72e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156343
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-07-30 01:11:51 +00:00
Alexander Aprelev b4a7c68989 [vm/resolve] Use Resolver instead of Lookup in while-loop.
This is another step in refactoring that should help with protecting class functions lookup with locks.

Change-Id: Icd8a4831684b5514079bd7e03a3d2358b992e729
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156300
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-07-29 19:17:15 +00:00
Ben Konyi 45d8bd79f1 [ DartDev ] Launch from snapshot in the current process when possible
Instead of spawning new processes to run a tool for a command, this
change makes it so we run within the current process when possible. In
general, we should avoid spawning any processes when possible from
dartdev unless:

- We need to interact with the child process from dartdev (e.g.,
  analysis server)
- The child needs to interact with the parent process (e.g., DDS)

Change-Id: I9c8cd39de038ab2f3a699165a47bee4c281bda67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156048
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-07-29 17:28:36 +00:00
Alexander Aprelev 3cd8b5ca1e [vm/resolve] Use Resolver instead of Lookup in while-loop.
This is part of refactoring that should help with protecting class functions lookup with locks.

Change-Id: I28d25aa78c0b4d83eb8ceab827b71852a23368b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156162
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-29 15:48:15 +00:00
Martin Kustermann fd959b824e [vm/compiler] Graph intrinsify implicit getters/setters in common cases.
To make implicit getters/setters frameless in common cases we use graph
intrinsics. We do this for boxed as well as unboxed fields. We do this
only for simple cases (e.g. not if field guards or possible boxing are
involved).

It also removes the hand-written assembly intrinsics for the getters,
which avoids bugs if boxing-state of field is not the same as
boxing-state of setter/getter.

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

Change-Id: Id3bd7842ead0278fee61d4a21c8661ce18dbccee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155900
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2020-07-29 14:49:45 +00:00
Martin Kustermann 5b18fa0798 [vm/compiler] Move CheckArrayBoundInstr::Canonicalize to its base class
This ensures redundant bounds checks are eliminated for
GenericCheckBoundsInstr (in addition to CheckArrayBoundInstr which we
already do).

Change-Id: Ie49e63f3e48cd7c90f5616cc1394f4d8a6920699
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156188
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-07-29 13:46:06 +00:00
Ryan Macnak fbc753337f [test] Skip scavenger_abort_test on AOT.
Bots seem much slower than local testing.

Change-Id: If5ce44a0b59b82c8651017f7efe810b8a4c65ef5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156052
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-07-29 00:36:55 +00:00
Ryan Macnak 5a085c6bcb [test] Prevent tree-shaking of fields in scavenger_abort_test.
Change-Id: I427987827200d9311ba94040d673e4d2a8e06d65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156049
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-07-28 21:57:51 +00:00
Ryan Macnak 19e6ae22b2 [vm, gc] Do not FATAL when the scavenger fails to allocate.
With the introduction of paged new-space, it became possible for the scavenger to fail to allocate if old-space could not grow and survivors did not pack after being reordered, and the scavenger would FATAL out. Long before that, the scavenger could fail to allocate the other semispace and FATAL out. Now an allocation failure causes the scavenge to abort, and partial forwarding to be reversed.

Change-Id: Idadfa4d9797aa7afce362bf70343e66b1b1dfeaf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155683
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-28 19:42:09 +00:00
Clement Skau 6ca00d12c0 [VM] Adds Future.wait support for --lazy-async-stacks.
- Makes Future.wait a recognised function, and asserts its chained
future, _future is allocated at a known index in the context.
- Adds logic to locate, extract the chained future during lazy async
stack unwinding.
- Adds tests for the Future.wait async case.
- Minor consistency nits, comments.

This change is similar to a previous CL, adding Future.timeout support:
https://dart-review.googlesource.com/c/sdk/+/152328

Change-Id: I7439750968595d25d7bbac0068ad64fcc891e176
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155420
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-28 05:41:01 +00:00
Ryan Macnak 3a821631fb [vm] Fail gracefully when background compilation runs out of memory.
Bug: https://github.com/dart-lang/sdk/issues/42852
Change-Id: I63ba1cb71dd9ad50b583a19ea3a3859c1d667ccc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156042
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-07-28 00:13:51 +00:00
Ryan Macnak d159c8283d [observatory] Run dartfmt.
Change-Id: I1a54fff6203b62fa195e69a056a57db8ce47d1db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152593
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-07-27 22:42:16 +00:00
Ryan Macnak 3f01c3e588 [vm] Handle all typed data element types in various C APIs.
Change-Id: Ie27989895c1bb4f6fd609523f9fac0a7d4f437a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155360
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-07-27 22:40:46 +00:00
Ben Konyi 49d7eba24e Reland "[ VM ] Print a meaningful error message when a user attempts to run an AOT snapshot with a JIT VM."
This reverts commit a24192e786.

Change-Id: Iea1c6cb6b509ce1493bc502d90592d2ba6fca68f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155480
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-07-27 21:51:03 +00:00
Martin Kustermann 91d460176a [vm/service] Avoid exposing top-level class ids in the service protocol
Instead of using class ids when building field/function service ids, we use names instead
(as we do in some other places already).

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

Change-Id: I55530161af26ee9514aa29a048cf140094cabd95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156004
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-07-27 20:11:56 +00:00
Martin Kustermann 61a944ca6a [vm/compiler] Align BoxInt64 implementation on x64 with arm/arm64 by calling a shared slow path
Change-Id: I3dcdc922e00898e49bf00b985cb2af747005d35f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142623
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-07-27 19:22:03 +00:00
Ben Konyi cb6ed67a73 [ VM ] Fix issue where dartdev's script_uri was being freed prematurely
This was causing flaky failures when initializing DDS as it was invoking
the getVM RPC which in turn sometimes accessed the script_uri after it
had been freed.

Change-Id: I4454b6fa2da3ad6767938ed12b1013223a667af7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155740
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-07-27 19:11:53 +00:00
Tess Strickland 31d4511ad6 [vm/compiler] Fix handling of runtime offsets.
Before this, we had to use PRECOMP_NO_CHECK() for any entries that
involved field offsets that came after NOT_IN_PRECOMPILED() fields,
because the offsets would differ between JIT and AOT. That removed
the check in dart.cc that the offsets match, but that just meant
that precompiled code that used these offsets were wrong.

One possible workaround is to just lift any field definitions whose
offset might be used in precompiled code before any NOT_IN_PRECOMPILED()
defined fields, but this means otherwise unnecessary changes in the
Layout classes.

Instead, just fix the runtime offset generation/retrieval by splitting
the list of offsets into two parts: offsets common to all modes and
offsets only valid in JIT mode.  While this complicates the code that
generates and imports these offsets, it ensures that our code generation
actually uses the right offsets for the target mode.

In addition, by doing this split we can add checks for uses of JIT-only
offsets when in precompiled mode. Adding these checks found some uses of
JIT-only field offsets in code compiled in precompiled mode.  (These
uses may have been benign if the stubs that included the uses were never
called in the precompiled runtime, but now there's explicitly a check
for precompiled mode around these uses.)

Also remove the unused ARRAY_STRUCTFIELD type from offset lists.

Change-Id: I083ab5997d3a5245b5f1487b614b62faee47d405
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155780
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-27 13:44:19 +00:00
Ben Konyi b4943094f0 [ VM / DartDev ] Spawn DartDev isolate with flags matching those used to
generate the snapshot

Change-Id: Ieb7f88b545569887e16edce278561b20ce5e0a21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155545
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-07-24 22:22:57 +00:00
Martin Kustermann f169b57293 [vm] Avoid eager creation of patch classes array in kernel loader
This reduces g3 customer's AOT compilation with gen_snapshot from around
8 GB to 1 GB

Issue https://github.com/dart-lang/sdk/issues/42549
Issue b/161980815

Change-Id: Ic68248458ecb1c5d7b9a1e7e2296a88ebb910b19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155610
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-07-24 15:49:05 +00:00
Johnni Winther 37c8c709bf Move BytesBuilder class and implementation to dart:typed_data.
Change-Id: Ic4fe1944ef4af19732f23c389845b6a74af0bc32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154682
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-07-24 11:37:21 +00:00
Zichang Guo d2f7039e9c [dart:io] Parse scoped IPv6 in constructor of InternetAddress
Bug: https://github.com/dart-lang/sdk/issues/41663
Change-Id: Ic7a140bc335e56550e39bb30390247db668c6101
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147060
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2020-07-24 00:43:35 +00:00
Lasse Reichstein Holst Nielsen 69ba6e5f80 Make FileSystemEntity.absolutePath understand more Windows paths.
Change-Id: I3bd1e885a5bbc118e80e9bce88cb2c216318de93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155126
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Zichang Guo <zichangguo@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2020-07-23 12:05:28 +00:00
Daco Harkes 202e32afeb [vm] Native API: Introduce Dart_FinalizableHandle
Introduces Dart_NewFinalizableHandle which does auto delete itself,
but does not allow accessing the weak referenced object.

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

Change-Id: I24ea732925122c453213c4fa3f629761c352f838
Cq-Include-Trybots:dart/try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-mac-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-nnbd-linux-debug-x64-try,analyzer-nnbd-linux-release-try,front-end-nnbd-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154695
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-23 11:30:39 +00:00
Regis Crelier fc8a6d9f9b [VM/compiler] Dereference TypeRef literal when propagating constants.
This fixes https://github.com/dart-lang/sdk/issues/42753

Change-Id: Ibb179c0cf45c77d5b1f29a75ca2dea88d449ed99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155503
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2020-07-22 23:22:39 +00:00
Ryan Macnak b258585f2f [observatory] Migrate from deprecated isInstanceOf to isA.
Change-Id: Ie68ebbb1ed46b8000fe6c6110774cd031c20aeaf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155280
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-07-22 22:31:59 +00:00
Roland McGrath 1b1a39708c [build] Use frameworks instead of libs
Newer GN doesn't allow `*.framework` elements in `libs`.  It
requires using `frameworks` instead.  The toolchain definitions need
to pass the new substituted variable to the link to make use of the
new required way to express these dependencies.

Bug: fxbug.dev/56683
Change-Id: I62e68a8e5bdfef095b72b38d9d41f757e510012b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155482
Auto-Submit: Roland McGrath <mcgrathr@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-07-22 21:40:39 +00:00
Filip Filmar 3fef522496 Revert "Reland "[vm] Replaces fuchsia.deprecatedtimezone""
This reverts commit e3a682480a.

Reason for revert: Broke time reporting on new
devices.

Original change's description:
> Reland "[vm] Replaces fuchsia.deprecatedtimezone"
>
> This is a reland of 16f09f20b3
>
> The apparent break of internal tests was not caused by this change.
>
> Original change's description:
> > [vm] Replaces fuchsia.deprecatedtimezone
> >
> > (prior attempt was rolled back as it caused downstream tests to time
> > out.  See prior attempt at: See:
> > https://dart-review.googlesource.com/c/sdk/+/149206)
> >
> > 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
> >
> > See:
> >   - https://github.com/dart-lang/sdk/issues/42245
> >   - https://github.com/dart-lang/sdk/issues/39650
> >
> > Fixes #39650
> >
> > Change-Id: I97f6e17e57000f6eec71246aee670bca65b7e1d1
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150662
> > Commit-Queue: Filip Filmar <fmil@google.com>
> > Reviewed-by: Martin Kustermann <kustermann@google.com>
>
> Change-Id: I5da6b0f481af0eb42c3b5e74c920588ac2ef5be9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151862
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Filip Filmar <fmil@google.com>

TBR=kustermann@google.com,kaushikiska@google.com,fmil@google.com

Change-Id: I6e590cf22347f9153e5203b255f37872dbd91fa6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155505
Commit-Queue: Filip Filmar <fmil@google.com>
Reviewed-by: Filip Filmar <fmil@google.com>
2020-07-22 21:36:19 +00:00
Filip Filmar 0884dae36c Revert "Fix the #include path for ICU headers"
This reverts commit 444cb00610.

Reason for revert: The original change broke time reporting on new
devices.  Since this was a touch-up, it will need to change as well.

Original change's description:
> Fix the #include path for ICU headers
> 
> The ICU headers in os_fuchsia.cc have been included with their path
> relative to the dart root directory.  They should instead be included
> relative to the paths mentioned in `-I` directives of the current
> compiler invocation.
> 
> This allows downstreams that have a different directory organization to
> build dart sdk even if they don't exactly replicate the directory
> structure of dart sdk.
> 
> Change-Id: Iec79f261aee5ccc7b74448978fc69244e260400a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154163
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Filip Filmar <fmil@google.com>

TBR=kustermann@google.com,kaushikiska@google.com,fmil@google.com

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

Change-Id: Ib2c22c2bfaabb07001acb707d996d90a18df3fd0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155502
Reviewed-by: Filip Filmar <fmil@google.com>
Commit-Queue: Filip Filmar <fmil@google.com>
2020-07-22 19:45:04 +00:00
Ben Konyi a3815b6590 [ VM ] Fix issue where ExitCodeHandlerEntry could get stuck in an
infinite loop if wait(...) returned an error

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

Change-Id: Ied4cc53dcfbbb6e04179721a00f04a8cd0ef9f29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155282
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-07-22 03:45:35 +00:00
Ben Konyi a24192e786 Revert "[ VM ] Print a meaningful error message when a user attempts to run an AOT snapshot with a JIT VM."
This reverts commit d870a71b20.

Reason for revert: ASAN failures

Original change's description:
> [ VM ] Print a meaningful error message when a user attempts to run an AOT snapshot with a JIT VM.
> 
> Fixes https://github.com/dart-lang/sdk/issues/42482
> 
> Change-Id: I284a5673e30f59b127e69c712df93552cdfcde41
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154834
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

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

Change-Id: I3639ede6987fbb51fb95584685c472abb789970e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155303
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-07-21 23:49:47 +00:00
Ryan Macnak d68d2e9e0a [vm, gc] Account for unbounded number of images pages in the compactor.
Bug: https://github.com/dart-lang/sdk/issues/41974
Change-Id: I23201f28e5d1e2ba298611206fc3eb0a9a989c2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155241
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-07-21 21:57:05 +00:00
Ryan Macnak f3e0e4ad9a Reland "[observatory] Avoid confusion of RSS for the VM's memory usage."
Don't assert that RSS > VM memory as VM memory might not be all resident.

Change-Id: Ie00c3e382d7b219fdb462a6e61d649f4d5276964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155140
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-07-21 20:14:55 +00:00
Ben Konyi d870a71b20 [ VM ] Print a meaningful error message when a user attempts to run an AOT snapshot with a JIT VM.
Fixes https://github.com/dart-lang/sdk/issues/42482

Change-Id: I284a5673e30f59b127e69c712df93552cdfcde41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154834
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-07-21 19:29:15 +00:00
Ryan Macnak 27a5d2d65f [vm, gc] Remove the 'limit shrinkage' heuristic.
This heuristic can cause the heap to consume memory in excess of the growth ratio after the application's memory usage shrinks.

Bug: https://github.com/dart-lang/sdk/issues/18147
Change-Id: I3d4aa0bc4b74d22e974e3cac00ee9e42967e0826
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125000
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-07-21 17:45:34 +00:00
Ben Konyi 157ebfe50f Reland "[ VM / DartDev ] Launch DartDev in an isolate within a single main Dart process"
This reverts commit 7e373831ce.

Change-Id: Ib94d793a5753ec6352cd9a65e35f726a63336368
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154830
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-07-21 16:23:18 +00:00
Martin Kustermann 6e69c116ba [vm] Remove unused {One,Two}ByteString::SetPeer functions.
Change-Id: I8a3229c43b3b0909b98b0a829d11f519b7025d28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155129
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-07-21 15:32:28 +00:00
Tess Strickland 05d021dece [vm/bytecode] Handle function lookup failure due to --no-lazy-dispatchers.
Before, DRT_InterpretedInstanceCallMissHandler expected either
Resolver::ResolveDynamic or InlineCacheMissHelper to return a non-null
function. However, this only happens when lazy dispatchers are enabled.

Now, DRT_InterpretedInstanceCallMissHandler is allowed to return a
null function if lazy dispatchers are disabled, and
Interpreter::InstanceCall checks the result for null. If null, then
lazy dispatchers must be disabled, so Interpreter::InstanceCall
delegates handling the miss to DRT_InvokeNoSuchMethod, which has been
updated to do the same resolution algorithm as
DRT_NoSuchMethodFromCallStub.

Cq-Include-Trybots: luci.dart.try:vm-dartkb-linux-release-x64-try
Change-Id: Ifeb1d787bbfedd823abc8421efe82d62d3cfd193
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154694
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2020-07-21 10:00:41 +00:00
Tess Strickland bb24f76c72 [vm] Reland "Remove non-covariant checks from closure bodies (part 1)"
Also relands the followup CLs:
"Perform non-covariant checks when dynamically invoking callables."
"Use AreValidArguments so that names are checked as well."

Original description of first CL:

This change only affects compilation when running in non-precompiled
mode with --no-lazy-dispatchers enabled.

Instead of always compiling in non-covariant checks, even for closures
not called dynamically, remove the non-covariant checks from the closure
and instead do the non-covariant checks for dynamic calls during the
NoSuchMethodForCallStub fallback by calling
Function::DoArgumentTypesMatch.

Adds two overloads for Function::DoArgumentTypesMatch, one which takes a
function type argument vector and one which takes neither an
instantiator type argument vector or a function type argument vector.
For the versions that are not explicitly passed a type argument vector,
an appropriate one is constructed using the arguments. If there is not
enough information in the arguments, then we fall back to assuming the
empty type argument vector for the instantiator case and instantiating
to bounds in the function type argument case.

Fixes Function::DoArgumentTypesMatch to handle generic functions and to
check arguments appropriately according to the active null safety mode.
For generic functions, the provided or resulting function type vector
has non-covariant checks performed against the type parameter bounds.

This change uncovered one test that was incorrectly passing in strong
mode, see https://github.com/dart-lang/sdk/issues/42688 for details.

Original description of second CL:

The VM only does this when the callable function does not expect dynamic
invocations. Otherwise, performing the checks would be redundant, as the
function body already contains the appropriate non-covariant checks.

Third CL had no additional description.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-try,vm-kernel-reload-linux-release-x64-try, vm-kernel-reload-rollback-linux-debug-x64-try
Bug: https://github.com/dart-lang/sdk/issues/40813
Change-Id: I1a3e9c1865103a8d716e1cad814267caffaaadf2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154688
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-21 10:00:41 +00:00