Commit Graph

13143 Commits

Author SHA1 Message Date
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
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
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
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 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 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
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
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
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
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
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
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
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
Alexander Markov baf740ee92 [vm/nnbd] Remove obsolete --null-safety option
Option --null-safety was replaced with --sound-null-safety
(in https://dart-review.googlesource.com/c/sdk/+/153660).
This change cleans up obsolete option from the VM and kernel compilers.

Issue: https://github.com/dart-lang/sdk/issues/41853
Change-Id: I605703bd5bf526391b21704b842bb9e6ca452061
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155020
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-07-20 23:09:29 +00:00
Alexander Markov e75dca3d2e Revert "[observatory] Avoid confusion of RSS for the VM's memory usage."
This reverts commit 7aa9c226ce.

Reason for revert: service/vm_test failed on multiple vm-kernel-precomp-* bots.

Original change's description:
> [observatory] Avoid confusion of RSS for the VM's memory usage.
> 
> Separate the attributes of the process from the attributes of the VM.
> 
> Bug: b/154912152
> Change-Id: Id0dec4cd311bbd1daeb3b3f52834f26f402e64b5
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154703
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

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

Change-Id: I93b34aeb3a89347f1e43de96270d853ba5d92ce3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: b/154912152
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155080
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-07-20 21:46:22 +00:00
Ryan Macnak 7aa9c226ce [observatory] Avoid confusion of RSS for the VM's memory usage.
Separate the attributes of the process from the attributes of the VM.

Bug: b/154912152
Change-Id: Id0dec4cd311bbd1daeb3b3f52834f26f402e64b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154703
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-07-20 20:45:21 +00:00
Alexander Markov 50179444a3 [vm] Fix assertion when setting unboxing info for field accessor
This assertion was failing when AOT-compiling any app
(even 'hello world') with null safety using DebugX64 VM.

Change-Id: I260ed6897470f169f0a6444499f167dfd2e99f1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154832
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-07-20 18:52:42 +00:00
Ryan Macnak c5a94db091 [vm] Initial implementation of deferred loading.
(Assignment of libraries to loading units is already done in the kernel generation step.)

After compiling and before serializing, we walk the program and for each Code we assign its Instructions, CodeSourceMap and CompressedStackMap to the loading unit of that Code's defining library. Deduplication may cause Instructions, CodeSourceMaps and CompressedStackMaps to belong to more than one loading unit; in this case the objects are assigned to the root loading unit. Later they can be more precisely assigned to the dominating loading unit.

All objects except some Instructions, CodeSourceMaps and CompressedStackMaps belong to the root loading unit's snapshot. This snapshot is written like an unsplit snapshot, except that when serializing Code, we will write a reference to a stub or null when the Code's Instructions, CodeSourceMap or CompressedStackMap belongs to a non-root loading unit. The snapshots of non-root loading units contain these deferred objects and references to the corresponding Code objects to patch. The types of objects we defer (Instructions, CodeSourceMaps and CompressedStackMaps) usually represent 70+% of the snapshot size.

Bare instructions mode must be disabled when splitting because we cannot have PC-relative calls between loading units. Later we can re-enable this for calls within loading units.

Broken: Compactor probably crashes we can now have an unbounded number of image pages and the compactor assumes a fixed number.

Embedder's guide:

At compile-time, gen_snapshot should be passed --loading_unit_manifest with a path, which will enable splitting and output a mapping from loading unit ids to snapshot output paths.

At runtime, sometime during isolate startup, an embedder should call Dart_SetDeferredLoadHandler, probably near an existing call to Dart_SetLibraryTagHandler. The callback is given a loading unit id, and should eventually call Dart_DeferredLoadComplete[Error].

Bug: https://github.com/dart-lang/sdk/issues/41974
Change-Id: Ib597eb87c8cd634416d5ee1f00629c5550aebb00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152427
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-07-17 19:29:47 +00:00
Martin Kustermann b425ef8413 [vm/compiler] Do not try to optimize Float{32,64}List if we do not support unboxed doubles (i.e. --no-use-vfp)
Issue https://github.com/dart-lang/sdk/issues/42745

Change-Id: I63d70a0954aa06b5e4e6f7cfd9fee9d3a847f45a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154696
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-07-17 18:10:16 +00:00
Alexander Aprelev 7e373831ce Revert "Reland "[ VM / DartDev ] Launch DartDev in an isolate within a single main Dart process""
This reverts commit bc4cb123a8.

Reason for revert: breaks crossword simarm tests https://ci.chromium.org/p/dart/builders/ci.sandbox/vm-kernel-precomp-linux-debug-simarm_x64/2619

Original change's description:
> Reland "[ VM / DartDev ] Launch DartDev in an isolate within a single main Dart process"
> 
> This CL changes how DartDev is run and how the run command handles executing a Dart program (will port additional commands in a separate CL). Rather than using DartDev to spawn a child process to run user code, the VM will instead launch a DartDev isolate after doing some VM options processing. DartDev will communicate information like exit codes and script/arg pairs with the VM via isolate ports. Once DartDev runs to completion and notifies the VM that a script should be run, the VM will move on to spawning another isolate with user code and continue executing in the same VM process.
> 
> By moving DartDev into an isolate within the same process that user code will eventually run in we're able to resolve the following issues that arose due to signal handling and IPC issues:
> 
> VM hangs when --enable-vm-service is supplied and there are compile time errors (https://github.com/dart-lang/sdk/issues/42630)
> Dart daemon spinning in exit code handler / zombie Dart processes (https://github.com/dart-lang/sdk/issues/41978)
> Signal handling in children of 'dartdev run' is problematic (https://github.com/dart-lang/sdk/issues/42092)
> 
> This reverts commit 3849b5061c.
> 
> Change-Id: I4fd3ba33840771a9f284d733c4a25fac6cde64ca
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154706
> Reviewed-by: Siva Annamalai <asiva@google.com>

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

Change-Id: I649d94c668417f2edbfd7039fa5c876e10dc32fe
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154800
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-07-17 04:37:48 +00:00
Ben Konyi bc4cb123a8 Reland "[ VM / DartDev ] Launch DartDev in an isolate within a single main Dart process"
This CL changes how DartDev is run and how the run command handles executing a Dart program (will port additional commands in a separate CL). Rather than using DartDev to spawn a child process to run user code, the VM will instead launch a DartDev isolate after doing some VM options processing. DartDev will communicate information like exit codes and script/arg pairs with the VM via isolate ports. Once DartDev runs to completion and notifies the VM that a script should be run, the VM will move on to spawning another isolate with user code and continue executing in the same VM process.

By moving DartDev into an isolate within the same process that user code will eventually run in we're able to resolve the following issues that arose due to signal handling and IPC issues:

VM hangs when --enable-vm-service is supplied and there are compile time errors (https://github.com/dart-lang/sdk/issues/42630)
Dart daemon spinning in exit code handler / zombie Dart processes (https://github.com/dart-lang/sdk/issues/41978)
Signal handling in children of 'dartdev run' is problematic (https://github.com/dart-lang/sdk/issues/42092)

This reverts commit 3849b5061c.

Change-Id: I4fd3ba33840771a9f284d733c4a25fac6cde64ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154706
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-07-17 00:54:11 +00:00
Alexander Aprelev d6eb87bbcc Revert "[vm] Remove non-covariant checks from closure bodies (part 1)" as it broke language_2/vm/no_such_args_error_message_vm_test.
This reverts commit 556f0fb5c8 and fixes merge conflict.

Revert "[vm] Perform non-covariant checks when dynamically invoking callables." as a collateral.

This reverts commit 7a6287bb92.

Revert "[vm] Use AreValidArguments so that names are checked as well." as a collateral

This reverts commit 90c683018f.

Change-Id: Iee2c5e91c39d19dca7a1e640c103443c95e6c4f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154705
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-07-16 23:25:54 +00:00
Ryan Macnak 3844e74adb [vm, compiler] Fix bypassed EnsureIsNewOrRemembered in CreateArrayInstr slow path.
If inline bump-pointer allocation fails, allocation stubs must check whether the allocation result from the runtime is old and ensure it is in the remembered set if so to make write barrier elimination safe. CreateArrayInstr would directly call the runtime entry if inline bump-pointer allocation failed without performing the remembered check. This CL changes the slow path to call the AllocateArray stub instead, matching every other allocation slow path.

Bug: https://github.com/dart-lang/sdk/issues/42489
Change-Id: Ic502e43683607e1d0f85154f0e3a8c3ea11deefa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154623
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-16 20:52:54 +00:00
Martin Kustermann f955b82a92 [vm/compiler] Support unboxing of return values of getters
This CL adds support for unboxing of return values of getters and
therefore completes the work on unboxing support for normal members
(closures are still missing).

As with existing unboxing support for methods and setters, we utilize
TFA information to proof a getter will always return non-nullable
int/double.

We then make such a getter return unboxed int/double. If there are
dynamic calls to the getter a dyn:get:* forwarder will be created
which performs boxing of the return value.

Overall this reduces RX by eliminating BoxInt64 instructions. It
sometimes increases metadata due to more dyn:get:* function objects.

=> On our main size benchmark targets show no significant change.

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

Change-Id: If7450ef7e5e3fc9c2e0eaa6b86ffa817699a7e17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154329
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2020-07-16 20:26:04 +00:00
Ben Konyi 3849b5061c Revert "[ VM / DartDev ] Launch DartDev in an isolate within a single main Dart process"
This reverts commit ffe258d2d4.

Reason for revert: Failures on bots

Original change's description:
> [ VM / DartDev ] Launch DartDev in an isolate within a single main Dart process
> 
> This CL changes how DartDev is run and how the run command handles executing a Dart program (will port additional commands in a separate CL). Rather than using DartDev to spawn a child process to run user code, the VM will instead launch a DartDev isolate after doing some VM options processing. DartDev will communicate information like exit codes and script/arg pairs with the VM via isolate ports. Once DartDev runs to completion and notifies the VM that a script should be run, the VM will move on to spawning another isolate with user code and continue executing in the same VM process.
> 
> By moving DartDev into an isolate within the same process that user code will eventually run in we're able to resolve the following issues that arose due to signal handling and IPC issues:
> 
> VM hangs when --enable-vm-service is supplied and there are compile time errors (https://github.com/dart-lang/sdk/issues/42630)
> Dart daemon spinning in exit code handler / zombie Dart processes (https://github.com/dart-lang/sdk/issues/41978)
> Signal handling in children of 'dartdev run' is problematic (https://github.com/dart-lang/sdk/issues/41978)
> 
> Change-Id: I1c6b1425831b691ad20284716aa80f817dbaf607
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152588
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

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

Change-Id: Idb1d24a4524bdc3ccfb199a82710f3c0d9db539a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154702
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-07-16 19:50:57 +00:00
Tess Strickland 90c683018f [vm] Use AreValidArguments so that names are checked as well.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try
Bug: https://github.com/dart-lang/sdk/issues/40813
Change-Id: I36e7150a4450be52e563df459eb47abb69d59281
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154686
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-07-16 19:27:14 +00:00
Ben Konyi ffe258d2d4 [ VM / DartDev ] Launch DartDev in an isolate within a single main Dart process
This CL changes how DartDev is run and how the run command handles executing a Dart program (will port additional commands in a separate CL). Rather than using DartDev to spawn a child process to run user code, the VM will instead launch a DartDev isolate after doing some VM options processing. DartDev will communicate information like exit codes and script/arg pairs with the VM via isolate ports. Once DartDev runs to completion and notifies the VM that a script should be run, the VM will move on to spawning another isolate with user code and continue executing in the same VM process.

By moving DartDev into an isolate within the same process that user code will eventually run in we're able to resolve the following issues that arose due to signal handling and IPC issues:

VM hangs when --enable-vm-service is supplied and there are compile time errors (https://github.com/dart-lang/sdk/issues/42630)
Dart daemon spinning in exit code handler / zombie Dart processes (https://github.com/dart-lang/sdk/issues/41978)
Signal handling in children of 'dartdev run' is problematic (https://github.com/dart-lang/sdk/issues/41978)

Change-Id: I1c6b1425831b691ad20284716aa80f817dbaf607
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152588
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-07-16 19:03:24 +00:00
Tess Strickland 7a6287bb92 [vm] Perform non-covariant checks when dynamically invoking callables.
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.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-dartkb-linux-release-x64-try
Bug: https://github.com/dart-lang/sdk/issues/40813
Change-Id: I27b5f4067247c6b1b76ba57951a1d91455c2eeb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154463
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-16 16:24:03 +00:00
Tess Strickland 556f0fb5c8 [vm] Remove non-covariant checks from closure bodies (part 1)
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.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-dartkb-linux-release-x64-try
Change-Id: I5030a46b356778448b51a243f16406eacf1c04bf
Bug: https://github.com/dart-lang/sdk/issues/40813
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153202
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-16 14:54:04 +00:00
Daco Harkes 2a9516a8fe [vm] Output all mismatching fingerprints instead instead of one
Change-Id: Ice341078f1511a97b98f9f56be9f00833051fc21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154466
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-16 09:22:03 +00:00
Alexander Markov 47b080de23 [vm/nnbd] Do not check if NNBD experimental flag is enabled for non-null assertions
Flutter engine does not pass experimental flags to the VM, so VM should
not rely on experimental flag to decide if non-null assertions
should be enabled.

Change-Id: I5c6a70a84f06053960f37891d2018ed9172adfdd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154562
Reviewed-by: Jonah Williams <jonahwilliams@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-07-15 21:10:06 +00:00
Ryan Macnak 0cc2d9685a [vm] Fix --use-bare-instructions=false on simarm_x64.
Bug: https://github.com/dart-lang/sdk/issues/41974
Change-Id: Ib7918b75f123d7d7121b7bac11b4bd7dfc861025
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154482
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-07-15 21:00:56 +00:00
Liam Appelbe 6fc75e6a2b [vm] Add tests and packages to the Fuchsia package
Also, delete some unnecessary files from build/fuchsia, and add an async
dispatcher to os_fuchsia.

Change-Id: I477e58d54330e83b2c7b6463395a1212707f8ab7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154162
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2020-07-15 20:44:06 +00:00
Martin Kustermann 06183779d7 [vm/compiler] Make the compiler use dyn:* selectors when calling getters
We already make the callsites use dyn:* selectors for normal method
calls as well as setters, this is doing the same thing for getters.

Once callsites use dyn:get:* various pieces in runtime need to be
adjusted to accomodate for that (e.g. NSM handling, etc).

A follow-up CL will then start actually generating dyn:* getters in
certain situations.

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

Change-Id: If219603bc0b8eb119edd08b211a8897d21ec0fb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154320
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2020-07-15 12:38:04 +00:00
Alexander Markov ab7b33d50b [vm/nnbd] Faster type tests for non-nullable Object
FfiCall.Handlex* benchmarks improved 290x-1708x in JIT mode with null
safety.

Change-Id: Iaed1d3ecacb929910c05b98fa951ba20612018f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154344
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-07-15 00:55:03 +00:00