Commit Graph

16561 Commits

Author SHA1 Message Date
Vyacheslav Egorov ab56c2f841 [runtime/docs] Add custom lexer for shell sessions in runtime wiki.
This was missing from the previous wiki related commit.

TBR=aam@google.com

Change-Id: Ib68ead3bab2841bb8e02cb93fd71bce7515ff335
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134285
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-02-04 09:16:52 +00:00
Vyacheslav Egorov 857b911f3b [vm/docs] Publish "Introduction to Dart VM" source and build tools.
Change-Id: I30068d6492bd6ec4ce42cc50d4a481960a0197fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133985
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-02-04 09:04:32 +00:00
Jens Johansen 18c281c624 [observatory] Allow to say 'break package:foo/file.dart:42'
This CL updates the parsing of "break" statements in the debug console
in observatory, as well as handling that the same script can be a part
of several libraries.

Before one could get stuff like this:
$ break package:front_end/src/fasta/scope.dart:389
Function 'package:front_end/src/fasta/scope.dart:389' not found
$ break scope.dart:389
Script 'scope.dart' is ambiguous

The first one is fixes by this CL: We now allow package uris and thus
no longer think it's a function. In this case it wouldn't have mattered
though, it would just say it was ambiguous, as the last case.
This is caused by the same script being found twice. By using a set
instead of a list, that's fixed too.

Change-Id: I3931c8f2abc0a3a5a77cff516da8767037196bf2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133593
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-02-04 08:57:01 +00:00
Jens Johansen c6aa3a22a7 [vm] [debugger] Fix for not breaking in library with mixin
In the VM, a single script can belong to several libraries because of
mixins.

Previously, when setting a breakpoint, it found the function to set the
breakpoint in by taking the "scripts library" (script.FindLibrary) and
then tried to find a function in that library that matched.
Sometimes it found the "wrong" library and the breakpoint thus wasn't
set.

This CL changes that so it goes though all libraries, finds all maching
libraries and tries all of them.

This solves the issue at hand, but might not solve all corner-cases.

This added test demonstrates the resolved case where before it would
just say that it couldn't add the breakpoint on line 13.

Change-Id: Ie44b0dfb4ea3e8de767d1867ec432b2aef429b76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133592
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-02-04 08:43:21 +00:00
Martin Kustermann 83d7048600 [vm/concurrency] Disable isolate groups in AOT mode
This is a preparation for landing the shared heap CL (it will
temporarily regress the isolate spawning time and memory use).

Once the shared heap CL is in, we can make a follow-up change to actually take
advantage of it by sharing the entire program structure (cl in
preparation by aam@). Once that lands we will enable the isolate groups
in AOT and reduce spawning latency by 10x :)

Regarding testing: We have already made all our isolate related tests in the
SDK run with/without isolate groups (irrespective of the default), so we
should continue to have test coverage in both modes.

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

Change-Id: Ib7e5101dfe8527948cd9ceed09d50051b04fb874
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134280
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-02-04 07:58:01 +00:00
Ben Konyi 8f7d3fca69 [ VM / dart:typed_data ] Change fmaxf/fminf to fmax/fmin for Float64x2.clamp
Fixes https://github.com/dart-lang/sdk/issues/40446

Change-Id: Ic610ecd024a6fc9bab3095ceb049139e21a519f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134242
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-02-04 01:06:19 +00:00
Ben Konyi 30f25ba735 [ VM / typed_data ] Fixed inconsistent results for -Float32x4.zero().clamp and -Float64x2.zero().clamp
The fuzzer found an issue where clamping negative zero would result in
conflicting answers depending on whether or not the clamp operation had
been optimized in JIT mode.

The MINPS and MAXPS instructions will always return the second operand
if the values being compared are -0 and 0, which is the opposite of what
the C implementation of clamp was doing.

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

Change-Id: I3afb725bd0c8643758dbe753d863ba93c86ad747
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134093
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-02-03 21:59:48 +00:00
Alexander Markov e1e2604ff1 [vm/nnbd] Use NNBD flags from AsExpression, IsExpression
This is the VM-specific follow-up to
https://dart-review.googlesource.com/c/sdk/+/133100

Change-Id: Iaa8728d2e0afebf421f9c65c3b3a48b286af5970
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134200
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-02-03 20:20:26 +00:00
Ryan Macnak 1efba58d22 Reapply "[vm] Initialize large typed arrays only once."
Change-Id: I92eb6c96db97e0951ae34315ad8d744e06064b3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133764
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-02-03 17:22:05 +00:00
Ryan Macnak 24418e6c6d [vm, gc] Remove BumpAllocationScope.
This scope can sneak objects larger than kAllocatablePageSize directly into non-large heap pages.

This scope also holds a heap lock outside of the GC, which is likely to create issues when multiple isolates run on the same heap.

Change-Id: Ic56277c83ffccfe2e1396ed773dd30b8d172bbba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134040
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-02-03 17:22:05 +00:00
Ryan Macnak d9a0359843 [vm, gc] Document safepointing.
Change-Id: I35eca64eb6be8cd72f527644ef8fd644f30287a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134109
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-02-03 16:58:22 +00:00
Martin Kustermann ce27d1a539 [vm] Specialize TTS stubs only for legacy types
This is a follow-up to 62835950d which was using the condition
`type.IsNullable()` for determining whether to generate TTS stubs.

It turns out `type.IsNullable()` is false for legacy types (for whatever
reason, because legacy types are nulable).

Instead we'll change the condition to `type.IsLegacy()`.

Issue https://github.com/flutter/flutter/issues/49893

Change-Id: I4c8a728382c7b7c65ddb6bff41778b384634d83d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134164
Reviewed-by: Teagan Strickland <sstrickl@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-02-03 14:07:55 +00:00
Victor Lima d3b7909769 [vm] Remove flag unbox_numeric_fields
Change-Id: I57899b239fb942650460377ec0a6cecbb48c6926
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133995
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
2020-02-03 12:43:05 +00:00
Aske Simon Christensen 76c6282de6 [vm/aot] Use a global dispatch table for instance calls in AOT.
This is a Dart-tailored implementation of the "row-displacement
dispatch table" technique for closed-world instance calls:

All interface targets in the program are grouped into selectors such
that all targets that could potentially be called from the same call
site have the same selector (currently just grouped by name).

Each selector is assigned a selector offset such that offset + classid
is unique for all selector/classid combinations where the class
implements the selector.

At every instance call site that has an interface target (i.e. where
the static type of the receiver is not dynamic), the selector offset +
receiver classid is computed and used as index into a global table of
entry points.

If the receiver can be null (as determined by the front-end TFA and the
VM type propagation), a null check is inserted before the call.

An arguments descriptor is provided (only) for selectors that need it
(those which have type parameters or optional/named parameters).

The dispatch table calls don't need the monomorphic entry code, so for
functions that are only called via dispatch table calls (i.e. never
called dynamically), the monomorphic entry code is left out.


Some future improvements to the table dispatch implementation are
mentioned in https://github.com/dart-lang/sdk/issues/40188


The table dispatch flag is disabled by default in this commit. A
separate commit enables the flag.

Change-Id: Ic2911742b4a2c9a8d3bc7df60605454cbe4c0714
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126648
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-02-03 11:04:15 +00:00
Aske Simon Christensen de0ed1bd4e [vm] Share implementation of LoadClassIdInstr across architectures.
Also avoid executing the tagging instruction in the Smi case for
some LoadTaggedClassIdMayBeSmi implementations.

Change-Id: I067b06ce404ffbba1981539ed3bfef72c4215e8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133584
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-02-03 11:04:15 +00:00
Mayank Patke ed441e48d0 Update all Slow tests to be Slow, Pass.
Change-Id: I610b272355b045eab80cf941210774fb12d775eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134103
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2020-02-01 00:17:42 +00:00
Liam Appelbe b504faaefc [vm] Stop storing to temp in LoadLateField
Use an expression temp instead.

Change-Id: Ifa1de272a90448f376bdcac88b0c458c0ddd21b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134088
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-01-31 23:45:42 +00:00
Martin Kustermann 4650e22088 [vm/compiler] Mark Box instructions as non-speculative (since the inputs are always unboxed values and dont need to be checked)
Change-Id: I9f5cd0d1dcbc2164b74783cc7ba12e56c0d7a685
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133998
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-01-31 21:46:42 +00:00
Martin Kustermann 7a6233ad51 [vm] Set Class::is_const() based on final fields instead of generative constructors (which can be shaken by TFA)
This fixes debug assertions in AOT.

Change-Id: Ib688164498ad98d2b7bb4ce574cf6859922df3a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133999
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-01-31 21:38:37 +00:00
Johnni Winther 54c8066f6f [cfe] Add new flags to AsExpression and IsExpression
Change-Id: I31eba9b4ced051a1067945fd68e60a09b1fa6ed7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133100
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-01-31 19:55:22 +00:00
Zichang Guo 0ed9f7179d [vm] seperate error and unknown types for getStdioHandletype
Infer other types as kPipe which is sync with Win platform.

Bug: https://github.com/dart-lang/sdk/issues/40354
Change-Id: I8bf40a143573685833a689ff2c724a421b308234
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133623
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-01-31 17:07:22 +00:00
Martin Kustermann bada62ba7b [vm/reload] Fix crash in scavneger / GC after reload on ia32
If generated code refers to a constant object (which are old and canonical), a pointer
to it will be embedded in the instruction stream on ia32.

If we now reload and morph this constant object and allocate the
morph'ed copy in new space, the become operation will make RX writable
and the slot in the instruction stream gets updated to point to a new
space object and the code gets added to the remembered set.

The next scavenge operation will scan the remembered set as roots, see
the poitner to a new object, move the object and updates the pointer in
the instruction stream.
  => We hit a SEGV trying to write the RX memory

We can avoid this problem by ensuring to morph old+canonical instances
always into old space on ia32.

Change-Id: Id63eb6ee1735bbb661dbeceb1e8d0c6ac92225ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133228
Auto-Submit: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-01-31 16:42:42 +00:00
Martin Kustermann 5ae5aff640 [vm/embedder] Add documentation to Dart_CompileToKernel
Change-Id: Ic858a010f77a05c47430ce13d2bd7ef80535a538
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133990
Commit-Queue: Martin Kustermann <kustermann@google.com>
Auto-Submit: Martin Kustermann <kustermann@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2020-01-31 15:03:42 +00:00
Victor Lima b68d95ec9e [vm] Reland support for real unboxed floating point fields in AOT
Issue https://github.com/dart-lang/sdk/issues/40404

Change-Id: Icfa801ff0640a6b27bb3c13d0b737c40452cbf7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133983
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-01-31 12:56:31 +00:00
Clement Skau 26ada4363a [SDK] Fixes remaining issues with --lazy-async-stacks on.
- Handle bytecode for e.g. dartkb-simarm64 does not have source position.
- Use existing GetCallerSp() instead of working across frames.
- Nit: Adds clarifying comments to test.
- Nit: Updates name of non-async-stack test to clarify flags used.

Tested:
- CQ with --lazy-async-stacks on by default.
- vm/dart/causal_stacks and language_2/vm/causal_async_exception_stack_test with current flags.

Bug: https://github.com/dart-lang/sdk/issues/39525
Change-Id: Ie6581a734cdcafbd4fb641bd86bffc03ed241532
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133063
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-01-31 10:45:21 +00:00
Ryan Macnak 38eed7f6d5 [vm, service] Create a treemap from very large heap snapshots outside of the browser.
Usage:
$ dart runtime/observatory/bin/heap_snapshot.dart http://127.0.0.1:8181/q8Zq2o7rEJc=/
...
Wrote file:///tmp/heap-snapshotZWSNFF/merged-dominator.html

Change-Id: I187296b643cdad884209e459f639cfe8bcae6fe4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133861
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-01-31 02:09:17 +00:00
Liam Appelbe 00e481aab0 [vm] Reland the flag flip behind the --nnbd build flag
Bug: https://github.com/dart-lang/sdk/issues/40409
Bug: https://github.com/dart-lang/sdk/issues/40179
Change-Id: Ib84926ef15068d23dcac7b89843c454b8446b28e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134062
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2020-01-30 23:41:19 +00:00
Liam Appelbe bf5278bdd4 Revert "[vm] Set non_nullable_flag() to true"
This reverts commit 61b4bbcb6b.

Reason for revert: Performance regressions

Original change's description:
> [vm] Set non_nullable_flag() to true
> 
> We'll leave the deletion and cleanup of this function until later, so
> that this CL is as easy to rollback as possible.
> 
> Bug: https://github.com/dart-lang/sdk/issues/40179
> Change-Id: Ie583aaabd117ae06ea27a539c3bc904240a0e6bc
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133429
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Liam Appelbe <liama@google.com>

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

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

Bug: https://github.com/dart-lang/sdk/issues/40179
Change-Id: I7e1d81286d769faeacec7dc17612ff18d157f114
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134060
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2020-01-30 20:51:23 +00:00
Zichang Guo 162d6c5634 Revert "[vm] Add support for real unboxed floating point fields in AOT"
This reverts commit 9eb531bde4.

Reason for revert: Bots are red. Some tests are failing.

https://ci.chromium.org/p/dart/builders/ci.sandbox/vm-kernel-precomp-obfuscate-linux-release-x64/6039

https://ci.chromium.org/p/dart/builders/ci.sandbox/vm-kernel-precomp-android-release-arm_x64/957

Original change's description:
> [vm] Add support for real unboxed floating point fields in AOT
> 
> Non-nullable floating point fields (double, Float32x4, Float64x2)
> are fully unboxed in their classes.
> 
> A bitmap for each class was added to the shared class table in order to keep
> track of the pointers of the classes. Since all classes in Flutter Gallery
> have less than 64 fields, the bitmap is represented by a 64 bit integer and
> fields whose offset is more than 64 words are not unboxed.
> 
> The instance sizes and field offsets might change between target and host
> in cross-compilation, since the number of words used to store unboxed fields
> may differ.
> 
> dart-aot Xeon
> 
>   SplayLatency               -4.62%
>   SplayHarderLatency         -4.17%
>   NavierStokes               -2.20%
>   Tracer                      8.72%
>   ParticleSystemPaint         2.90%
>   NBodySIMD                   8.35%
>   NBody                      25.59%
> 
> With hack TFA to make doubles in Rect/Offset/Size classes in flutter non-nullable:
> 
> flutter arm-v8:
> 
>   gallery total size: -1%
> 
>   matrix_utils_transform_rect_perspective   -16.70% (less is better)
>   matrix_utils_transform_rect_affine        -31.82% (less is better)
>   matrix_utils_transform_point_perspective  -24.90% (less is better)
>   matrix_utils_transform_point_affine)      -27.26% (less is better)
>   rrect_contains_bench                      -4.719% (less is better)
> 
> Change-Id: I9ae09c9c3167d99f9efd071a92937aa51093fd1d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131824
> Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Samir Jindel <sjindel@google.com>

TBR=kustermann@google.com,rmacnak@google.com,sjindel@google.com,victoragnez@google.com

Change-Id: Ic73858f6adb7f55c4129d4f46ff4731b378cb634
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134020
Reviewed-by: Zichang Guo <zichangguo@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-01-30 18:13:28 +00:00
Ryan Macnak d67fbe525b [vm, gc] Base the growth policy on usage instead of capacity.
With concurrent sweeping, the amount of capacity freed by a major GC is not known at the time growth is evaluated. This consistently biases the policy into growing more than it would with an accurate capacity from stop-the-world sweeping.

This is more interesting for larger heaps and when there is a tighter memory limit.

For a very large dart2js compile
Max Heap Capacity: 13.057 -> 11.861 GB
     Compile Time:    545 -> 472 seconds

For dart2js self-compile
Max Heap Capacity: 1.343 -> 1.385 GB
     Compile Time:  43.4 -> 43.5 seconds

Bug: https://github.com/dart-lang/sdk/issues/21364
Change-Id: If047e22a9cd9da6b34c8e499a39fde97427a69b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133660
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-01-30 17:54:08 +00:00
Martin Kustermann 62835950d1 [vm/nnbd] Disable usage of specialized type testing stubs for NonNullable/NNBD types
The following issue can happen:

  When we performa a type-test against a type parameter the TTS stub for
  the type parameter will call the TTS stub for the type argument of the
  parameter (by loading it from the instantiator type arguments).

  The (instantiated) type argument does not yet have a specialized TTS but
  rather the lazy TTS stub, which will got to the runtime.

  The runtime will instantiate the type parameter using the instantiator tav,
  which will give it a non-nullable 'String!'. Though the NNBD mode used
  for instnatiation is kLegacy, which means the instantiation will
  actually return 'String*'.

  Now we generate a specialized TTS and install it on 'String*'.

  => The original 'String!' will still have the lazy TTS installed and we
     will therefore always go to runtime.

Example:

  This code is massively slowed down after 61b4bbcb6b "[vm] Set non_nullable_flag() to true"

    main(List<String> args) {
      args = args.toList();
      while (args.isNotEmpty) {
        args.removeAt(0);
      }
    }

  The embedder creates the List<String> when calling main. The embedder
  API uses effectively `ObjectStore::string_type`, which is initialized,
  after 61b4bbcb6b to 'String!' (which might be a bug because we do
  have a specific `ObjectStore::non_nullablestring_type`).

=> For now we disable lazy specialization of non-nullable types - which
   makes us fall back to subtype test cache searches in this case (which is
   significantly slower).

See b/148528639

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

Change-Id: I715fe2a9ee22932ae2d949b5cef93d6afb3176d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133981
Reviewed-by: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-01-30 16:41:58 +00:00
Alexander Markov c307d38af8 [vm/nnbd] Draft support for TypeRefs in CheckInstantiatedNullability
TypeRefs which are used to represent recursive types are now skipped
and removed when we need to change nullability of  type after
instantiation. This change assumes that we only need to change
nullability of a top-level type and not inner types.

Change-Id: I5e92493991f0e2a1ebeb16535ef9d507054017b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133841
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-01-30 16:38:58 +00:00
Victor Lima 9eb531bde4 [vm] Add support for real unboxed floating point fields in AOT
Non-nullable floating point fields (double, Float32x4, Float64x2)
are fully unboxed in their classes.

A bitmap for each class was added to the shared class table in order to keep
track of the pointers of the classes. Since all classes in Flutter Gallery
have less than 64 fields, the bitmap is represented by a 64 bit integer and
fields whose offset is more than 64 words are not unboxed.

The instance sizes and field offsets might change between target and host
in cross-compilation, since the number of words used to store unboxed fields
may differ.

dart-aot Xeon

  SplayLatency               -4.62%
  SplayHarderLatency         -4.17%
  NavierStokes               -2.20%
  Tracer                      8.72%
  ParticleSystemPaint         2.90%
  NBodySIMD                   8.35%
  NBody                      25.59%

With hack TFA to make doubles in Rect/Offset/Size classes in flutter non-nullable:

flutter arm-v8:

  gallery total size: -1%

  matrix_utils_transform_rect_perspective   -16.70% (less is better)
  matrix_utils_transform_rect_affine        -31.82% (less is better)
  matrix_utils_transform_point_perspective  -24.90% (less is better)
  matrix_utils_transform_point_affine)      -27.26% (less is better)
  rrect_contains_bench                      -4.719% (less is better)

Change-Id: I9ae09c9c3167d99f9efd071a92937aa51093fd1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131824
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2020-01-30 13:45:08 +00:00
Teagan Strickland 5d5ebb58e9 [vm] Add VM and isolate instructions start to DumpStackTrace.
Change-Id: Iba1f5948f5de9d22e7276fdc08a4f4fda59285bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133582
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Teagan Strickland <sstrickl@google.com>
2020-01-30 09:18:25 +00:00
Alexander Markov de2ce18841 [vm/nnbd] Fix nullability and bounds of type parameters
Nullability of declared type parameters is changed to be undetermined or
non-nullable in opted-in libraries depending on the bound.
This fixes sharing of type arguments vectors with superclasses.

Also, while reading bounds of type parameters we may create new
TypeParameter types with different nullabilities, derived from
declared type parameter types. When those derived type parameters
are created, original type parameters may not have bound yet, so
derived type parameter types were getting null bounds.
This change fixes bounds of those derived type parameter types after
bounds of all type parameters were constructed.

Change-Id: I4bf50b383142ae70f194d103501bcbd10bf792e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133745
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-01-29 23:16:08 +00:00
Filip Filmar 5c42f91362 Revert "[i18n] Replaces fuchsia.deprecatedtimezone"
This reverts commit c063f5d0c3.

Reason for revert: release blocker

Original change's description:
> [i18n] Replaces fuchsia.deprecatedtimezone
>
> The FIDL library fuchsia.deprecatedtimezone is going away.  There are
> different and better ways to obtain the same functionality.
>
> Fixes #39650
>
> Change-Id: If4e4234568c276d3cd2be34863f00165b6e97e0e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129005
> Commit-Queue: Filip Filmar <fmil@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

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

Change-Id: I0a74a537c4269075eb13282c5738a30b263c706e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133747
Reviewed-by: Filip Filmar <fmil@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Filip Filmar <fmil@google.com>
2020-01-29 21:10:40 +00:00
Victor Lima b18b27706c [vm] Avoid inlining dynamic calls for simd operations
Dynamic invocation forwarders have the same recognized kind
as the method they are forwarding to.
That causes us to inline the recognized method and not the
dyn: forwarder itself.
It is not safe for user-implementable types. This is triggered
in some of the existing tests when unboxed integer fields are
allowed in AOT.

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

Change-Id: Id518c6b13ccd08998ec78384e55c97c64546098a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133561
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-01-29 11:58:40 +00:00
Martin Kustermann 9eb09b64be [vm/concurrency] Add locking for any access to [FixedCache].
The [FixedCache] will be accessible by multiple isolates within an isolate
group as well as the GC, so we add locking around it's accessors.

This is a preparation step for the shared heap.

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

Change-Id: Ief113419b3f7a69eda02084ce36cef0e25984315
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133580
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-01-29 11:46:50 +00:00
Martin Kustermann 37d562d2a4 [vm/async] Ensure --lazy-async-stacks also works inside custom zones with error handlers
Issue https://github.com/dart-lang/sdk/issues/37668

Change-Id: Ib7fb8299fbc8b7f73e154414f37451a488297a67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133583
Auto-Submit: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2020-01-29 11:17:50 +00:00
Alexander Aprelev 7131264848 [vm/isolates] Disallow sending of function types.
Fixes dartbug.com/37294

Change-Id: Ia39790f4ed7ef25988b0ce2849d10429027bbf92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132805
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-01-29 03:30:52 +00:00
Ryan Macnak 52da0b14f1 Revert "[vm] Initialize large typed arrays only once."
This reverts commit 6fcee199af.

Reason for revert: Wrong size logic

Original change's description:
> [vm] Initialize large typed arrays only once.
> 
> Previously large (>256k) typed arrays would be initialized 3 times:
>  - The OS initializing the new virtual memory to zero
>  - Object::InitializeObject initializing to object null
>  - TypedData::New reinitializing to zero
> 
> Change-Id: I432944919ab68aecb2038bba245594bbbaed9093
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130928
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

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

Change-Id: I92818954ddd715f295c1cbe413733236970a991e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133661
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-01-29 00:18:34 +00:00
jonahwilliams 96ff3276f4 [vmservice] allow fallback on port bind failure
Work towards https://github.com/flutter/flutter/issues/46724

Background:

on the latest versions of iOS today, we have to use mdns to discover the observatory port and authentication code. For a variety of reasons this can fail, leaving us with no way to connect.

An alternative approach is to specify the observatory port and disable the authentication code. If binding to this port fails, however, we would still like to attempt connecting with mdns.

Overview:

This adds a new flag to the dart SDK, --enable-service-port-fallback. This amends the behavior of the vmservice with a specified port. After failing to bind 3 times to a non-zero port, update the port selection to 0.

Results:

Tested locally two dart VMs with the same specified port:

```
jonahwilliams@jonahwilliams0:~/Documents/engine/src/out/host_debug_unopt$ ./dart --enable-service-port-fallback --observe=8080 example.dart
Observatory server failed to start after 1 tries
Falling back to automatic port selection

vm-service: isolate(2785434094928835)  'main' has no debugger attached and is paused at exit.  Connect to Observatory to debug.
Observatory listening on http://127.0.0.1:45663/62A5IHjmv9E=/
```
Change-Id: I582ab402a457330928e5b490f9718fcd52b56720
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133434
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
2020-01-28 23:36:14 +00:00
Ryan Macnak 6fcee199af [vm] Initialize large typed arrays only once.
Previously large (>256k) typed arrays would be initialized 3 times:
 - The OS initializing the new virtual memory to zero
 - Object::InitializeObject initializing to object null
 - TypedData::New reinitializing to zero

Change-Id: I432944919ab68aecb2038bba245594bbbaed9093
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130928
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-01-28 21:22:20 +00:00
Liam Appelbe 61b4bbcb6b [vm] Set non_nullable_flag() to true
We'll leave the deletion and cleanup of this function until later, so
that this CL is as easy to rollback as possible.

Bug: https://github.com/dart-lang/sdk/issues/40179
Change-Id: Ie583aaabd117ae06ea27a539c3bc904240a0e6bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133429
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2020-01-28 16:47:58 +00:00
Victor Lima 14f7e334d3 [vm] Add checks to parameters of math functions before inlining
Make sure to inline functions such as sqrt only when the parameters
are double.

Change-Id: I1a11dc09e804f157f57d9d04b7b9f2aa830ab2a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133236
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-01-28 14:16:37 +00:00
Ryan Macnak 40f23c735f [vm, docs] Describe which VM service features are available in which VM modes.
Change-Id: Icafc5cbea40eb74caf5be26def5641ce3dd855d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133427
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-01-28 01:14:48 +00:00
Ryan Macnak ea089033d7 [vm, gc] Use the compactor for the GC of last resort.
Change-Id: I858ff7b93321c8810d3ebe19e7cd18108f91764a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95963
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-01-27 22:26:17 +00:00
Ryan Macnak 155c0d1b92 Reapply "[vm, gc] Sweep non-executable large pages concurrently."
Wait for the concurrent sweeper to visit processing large pages before visiting the card tables during a scavenge.

Bug: https://github.com/flutter/flutter/issues/48360
Bug: b/147582727
Change-Id: Iaec22f05e22d9ded75017aa1d8463c1be64858aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131703
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-01-27 19:43:09 +00:00
Liam Appelbe 93c5134a69 [vm] Add nullability variations for snapshot singletons
This fixes snapshot_test.cc in legacy mode.

Bug: https://github.com/dart-lang/sdk/issues/40169
Change-Id: Ibb47634be296b3b9159af9fe0500d64f9d279b60
Fixes: https://github.com/dart-lang/sdk/issues/40169
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133148
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-01-27 18:27:39 +00:00
Victor Lima 3fa4194008 [vm] Update offsets
Make the offsets extracted reflect changes in classes that have
fields that do not exist in product mode, since it affects the
entity size.

Change-Id: I0ec277663ba3ddc956ca651ccc0395e39ba185f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133229
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
2020-01-27 15:59:56 +00:00