Commit Graph

423 Commits

Author SHA1 Message Date
Alexander Markov 5167ec93fc [vm] Remove Class::NumOwnTypeArguments()
Calculation of Class::NumTypeArguments() is reimplemented so that it does
no require separate calculation of Class::NumOwnTypeArguments().
Number of own type arguments is no longer stored in Class, and has_pragma
bit is moved into state_bits.

This simplifies overall calculation and does not require to keep both
num_type_arguments and num_own_type_arguments. This also allows us to add
up to 15 more flag bits to Class.

Change-Id: Iac7a751145fea7adb673ab9369eeb8eea5c5794d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105544
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-06-11 00:57:46 +00:00
Alexander Markov 04670fb47a [vm] Cleanup Dart 1 code in ClassFinalizer::AllocateEnumValues
Change-Id: Ifb3592d2bf71eab94fe294c829983578cb919328
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105120
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-06-06 17:41:27 +00:00
Alexander Markov 9dcb026b26 [vm] Replace cycle_free and type_finalized bits with class loading state
This change renames Class::is_cycle_free to Class::is_declaration_loaded
and under the hood replaces cycle_free and type_finalized bits with
class loading state enum.

Also, added new assertions to check is_declaration_loaded().

Change-Id: Ib43e12731d0dc782e273be8e55912494e102cd79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104920
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-06-05 01:05:51 +00:00
Matthew Dempsky 4ce3aa7af1 [vm] Replace ^= assignments with = where possible
Change-Id: I04ac2e9c4b8bb654b7c660e728be3867aa4e1513
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100923
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Matthew Dempsky <mdempsky@google.com>
2019-05-01 00:04:44 +00:00
asiva a8f3a5dae6 [VM] Ensure a class is type finalized before finalizing it.
Fix for https://github.com/dart-lang/sdk/issues/36486

Change-Id: Ic04bb71c3bebfa2cf02c02d419b82d2a0e5ed6fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99206
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2019-04-12 00:16:17 +00:00
Martin Kustermann dbfd00f44d [vm/compiler] Add new optimization pass which inlines typed data accesses
Based on the unified typed data layout, we can now inline accesses to
typed data interface classes if there are no 3rd party implementations
of those interfaces.

Example: If a receiver is of type Uint8List and we call `[]` or `[]=` we
will inline the byte access.

Instead of changing the existing inliner / call specializer we add this
as an extra pass: If the inliner / call specializer infer that the
receiver type is e.g. internal typed data then it will perform the
inlining itself using more optimized LoadIndexed instruction.

=> Only if those existing optimization passes have not been able to inline
   the access will we, later on in the compilation pipeline, run a
   specialized pass which will inline the accesses using LoadUntagged +
   LoadIndexed (which is slightly less efficient than using only LoadIndexed
   for internal typed data).

As a first step this is only done for AOT.

For ease of writing tests matching certain IR graphs this CL also adds a
IR pattern matcher.

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

Cq-Include-Trybots: luci.dart.try:vm-canary-linux-debug-try, vm-dartkb-linux-debug-x64-try, vm-dartkb-linux-release-x64-try, vm-kernel-asan-linux-release-x64-try, vm-kernel-checked-linux-release-x64-try, vm-kernel-linux-debug-ia32-try, vm-kernel-linux-debug-simdbc64-try, vm-kernel-linux-debug-x64-try, vm-kernel-linux-product-x64-try, vm-kernel-linux-release-ia32-try, vm-kernel-linux-release-simarm-try, vm-kernel-linux-release-simarm64-try, vm-kernel-linux-release-simdbc64-try, vm-kernel-linux-release-x64-try, vm-kernel-optcounter-threshold-linux-release-ia32-try, vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-android-release-arm-try, vm-kernel-precomp-bare-linux-release-simarm-try, vm-kernel-precomp-bare-linux-release-simarm64-try, vm-kernel-precomp-bare-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-product-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-obfuscate-linux-release-x64-try, vm-kernel-precomp-win-release-simarm64-try, vm-kernel-precomp-win-release-x64-try, vm-kernel-reload-linux-debug-x64-try, vm-kernel-reload-linux-release-x64-try, vm-kernel-reload-rollback-linux-debug-x64-try, vm-kernel-reload-rollback-linux-release-x64-try, vm-kernel-win-debug-ia32-try, vm-kernel-win-debug-x64-try, vm-kernel-win-product-x64-try, vm-kernel-win-release-ia32-try, vm-kernel-win-release-x64-try

Change-Id: I5f2e01a55f46b473f64478b05679f65b9fd7c4c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98662
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-04-05 15:51:34 +00:00
Ryan Macnak cf32584870 [vm] Support compiling static field initializers and dynamic invocation forwarders from a compilation trace.
Clean up creating static field initializers.

Change-Id: I914263f532be1d1a7216d3b5e35d05c4f0fdf167
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97547
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-03-28 00:48:30 +00:00
Martin Kustermann d445d29fa3 [VM] Define layout of _*ArrayView/_ByteDataView in C+++
This removes the 3 fields from the classes in Dart and instead describes
the layout in C++ via a RawTypedDataView class (as already do with
normal RawTypedData). The existing "semi" TypedDataView handle class is
changed to be a real handle class.

This decreases performance of some microbenchmarks due to field guards
not being used anymore (before the JIT could add a field guard to view classes
guarding that only normal typed data is used as backing store (and not e.g. external
typed data)

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

Change-Id: I7a0022b843a4c0fa69f53dedcc4c7bd2117cdc37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96806
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-03-15 21:24:15 +00:00
Aart Bik 6483f5238f [dart/vm] be more flexible with precomputed constants
Rationale:
The problem was that we were evaluating field
initializers while still loading the constant
table. This hit two asserts (1) having pending
potential_natives() when entering codegen and
(2) not being able to evaluate constants
since the table has not been loaded yet. The
solution is to simply postpone enum field
initialization (forced to avoid hot reload
issues) while loading the constant table
until right after the table is ready.

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

Change-Id: I5060476e5b3b49e555cfc507fb398ef0144b44d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96844
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-03-13 23:38:26 +00:00
Ryan Macnak e48ad45fbd [vm, interpreter] Enable field guards.
Bug: https://github.com/dart-lang/sdk/issues/36131
Change-Id: I8aa538bc96d10d14322c875228dbd7a97ddf114b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95491
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-03-07 00:19:40 +00:00
Ryan Macnak d253642f25 [standalone] Fix isolate messages for processes that a creating an AppJIT snapshot.
The standalone embedder was sorting classes in the main isolate, but not child isolates, causing the CIDs to diverge.

Also fix a few isolate tests.

Bug: https://github.com/dart-lang/sdk/issues/33128
Bug: https://github.com/dart-lang/sdk/issues/36000
Change-Id: Ic21acb02eb623ae177ed242aa21b0e243775e369
Reviewed-on: https://dart-review.googlesource.com/c/93923
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-02-21 22:39:39 +00:00
Daco Harkes 7d46d4b5cb [vm / library] Foreign function interface prototype
Prototype for `dart:ffi` on Linux/MacOS x64 in JIT mode.
`dart:ffi` is experimental and its API is likely to change in the future.
Progress and design decisions are tracked in https://github.com/dart-lang/sdk/projects/13


issue: https://github.com/dart-lang/sdk/issues/34452
Change-Id: Ifa4566388e42c8757f154741d11e303465ef305d
Cq-Include-Trybots: luci.dart.try:vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-mac-release-simarm64-try, vm-kernel-precomp-win-release-x64-try, vm-kernel-mac-debug-x64-try, vm-kernel-asan-linux-release-x64
Reviewed-on: https://dart-review.googlesource.com/c/80124
Reviewed-by: Samir Jindel <sjindel@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
2019-02-13 12:42:47 +00:00
Alexander Markov a0516965b4 [vm] Load top-level functions and variables lazily
LoadKernel part of startup: 409ms -> 196-210ms.
FinishTopLevelClassLoading: 15ms

Change-Id: If47f06fe235a70ed08e6a3d75e8f871edae5e45c
Reviewed-on: https://dart-review.googlesource.com/c/92155
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2019-02-07 18:12:34 +00:00
Alexander Markov b59d5a2be9 [vm] Relax assertion about duplicated direct implementors
When mixin application is transformed, mixin is added to the end of
interfaces list. This may cause assertion failure if the same class
is used as mixin and mentioned among implemented interfaces.
This CL relaxes that assertion for mixins as this duplication is very
rare and seems harmless.

Note that it would not be valid to remove duplicated interface/mixin
from the list of interfaces, as it would break dart:mirrors in this case:
dart:mirrors needs to reflect duplicated interface/mixin both in
ClassMirror.superinterfaces (which is populated from the
list of interfaces without last element) and ClassMirror.mixin (the last
element in the list of interfaces).

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

Change-Id: I9b986f7759a76cb6f963ebd837e9ea26f6242f8e
Reviewed-on: https://dart-review.googlesource.com/c/91961
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-02-05 00:35:02 +00:00
Alexander Markov 569ee07f91 [vm] Cleanup class finalization checks
Change-Id: If262b5fd271ce8fa0aaa49959f808792f66578cd
Reviewed-on: https://dart-review.googlesource.com/c/90580
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-02-04 21:00:49 +00:00
Ryan Macnak 169331abb1 [vm] Misc timeline tweaks.
- Move compiler pass events to a new CompilerVerbose stream
 - Remove serialization phase events
 - Add class name to class finalization event (lost along with finalization events in recent cleanups of finalization)
 - Add event for kernel loading

Change-Id: Ie72bced978400ea174c1551c961baa55c691b019
Reviewed-on: https://dart-review.googlesource.com/c/90883
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-01-25 18:37:05 +00:00
Régis Crelier 38a7f0097f [vm/finalizer] Stop background compiler before sorting classes.
Prevent background compiler from adding deferred classes or canonicalizing
new types while classes are being sorted and type hashes are modified.
This should fix issue #34627 and its duplicate #35690.


Change-Id: I3e52602e77ad6b80b58f5292721c01eea22abfb0
Reviewed-on: https://dart-review.googlesource.com/c/90300
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-01-18 23:08:21 +00:00
Ryan Macnak 06a1e6e9e3 [vm] Enable timeline on Fuchsia even in product mode.
On Fuchsia, the timeline is accessed without involving the service isolate or vm-service.

Change-Id: Ia0d4e1ca252604e8fcef466a31e3d2a8b0912251
Reviewed-on: https://dart-review.googlesource.com/c/90100
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-18 00:06:10 +00:00
Ryan Macnak 07f95e7761 Revert "[vm] Enable timeline on Fuchsia even in product mode."
This reverts commit 3f7b371f2c.

Reason for revert: Some modes failing to find new constant?

Original change's description:
> [vm] Enable timeline on Fuchsia even in product mode.
> 
> On Fuchsia, the timeline is accessed without involving the service isolate or vm-service.
> 
> Change-Id: I0d2351dcadcfc47835732235e1b8fafa8212f883
> Reviewed-on: https://dart-review.googlesource.com/c/89880
> Reviewed-by: Zach Anderson <zra@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

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

Change-Id: Ic03a78d14821e0361d54587f1f7510bc9ebfef1c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/89942
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-17 00:39:39 +00:00
Ryan Macnak 3f7b371f2c [vm] Enable timeline on Fuchsia even in product mode.
On Fuchsia, the timeline is accessed without involving the service isolate or vm-service.

Change-Id: I0d2351dcadcfc47835732235e1b8fafa8212f883
Reviewed-on: https://dart-review.googlesource.com/c/89880
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-16 22:55:51 +00:00
Alexander Markov 13a689f0fd [vm] Remove unnecessary class finalization
Change-Id: I4c51328af5f32fdb3c3065293e82993220b57b9d
Reviewed-on: https://dart-review.googlesource.com/c/88745
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-01-08 23:56:23 +00:00
asiva 2427a69e14 [VM/Runtime] Refactoring sources to enable interpreter only builds.
The interpreter only build of the Dart VM should not be including any
sources from the 'compiler' directory.
First part of restructuring sources to enable an interpreter only build
of the VM
- Move CompileClass from compiler.cc file to class_finalizer.cc

Change-Id: I8743c6537ed2d63e6991d78949f858a1ae506121
Reviewed-on: https://dart-review.googlesource.com/c/87987
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-01-07 18:49:17 +00:00
Martin Kustermann f205292227 [VM] Bare instructions - Part 4: Add --use-bare-instructions flag to AOT compiler & runtime
This is the final CL which adds a new --use-bare-instructions flag to
the VM.

If this flag is set during AOT compilation, we will:

  * Build one global object pool (abbr: GOP) which all code objects
    share. This gop will be stored in the object store.  The PP register
    is populated in the enter dart stub and it is restored when
    returning from native calls.

  * Gets rid of the CODE_REG/PP slots from the dart frames. Instead the
    compiled code uses the global object pool, which is always in PP.

  * Starts emitting pc-relative calls for calls between two dart
    functions or when invoking a stub.
    Limitation: We only emit pc-relative calls between two code objects
    in the same isolate (this is because the image writer is writing
    instruction objects for vm-isolate/main-isolate seperately)

  * We do compile-time relocation of those static calls after the
    precompiler has finished its work, but before writing the snapshot.
    This patches all the instruction objects with pc-relative calls to
    have the right .text distance.

  * We emit a sorted list of code objects in ObjectStore::reverse_code_table,
    which will be used by the AOT runtime to go back from PC to Code
    objects (where all metadata, e.g. stack maps, catch entry moves, pc
    descriptors are available).

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

Change-Id: I6c5dd2b1571e3a889b27e804a24c2986c71e03b6
Reviewed-on: https://dart-review.googlesource.com/c/85769
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-12-14 16:03:04 +00:00
Régis Crelier cb8c0ab8f5 [vm] Remove MixinAppType VM class and VM code supporting type resolution.
In Dart2, mixin application classes are generated by kernel and type resolution
is performed by kernel. In Dart1, using the VM parser, these tasks were done
during class and type finalization.

Change-Id: I927b1446d906ffd76ed9591c96e0d974df09f3bf
Reviewed-on: https://dart-review.googlesource.com/c/87025
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-12-13 20:18:36 +00:00
Ryan Macnak 30896b87f1 [vm] Fix crash when enum initialization hits a stack overflow.
Give the compiler more headroom.

Have the simulators and interpreters distinguish between the true stack limit and the limit for trigger an overflow exception.

Bug: https://github.com/dart-lang/sdk/issues/35224
Bug: https://github.com/flutter/flutter/issues/25041
Change-Id: I048d73b649b4ce1f3d9b5a33d898ee9cfe54f6ca
Reviewed-on: https://dart-review.googlesource.com/c/86821
Reviewed-by: Aart Bik <ajcbik@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-12-10 23:40:21 +00:00
Régis Crelier 5f36c5f9d8 [vm] Delete BoundedType class in VM.
In Dart2, type bounds checking is either performed by the common front-end or
by explicitly generated code, but not by type finalization or runtime anymore,
as it was done in Dart1.
Consequently, the class BoundedType is not needed anymore, and malbounded or
malformed types are not seen by the runtime either.

Change-Id: I5d6e4c68d153d6730fa7ff7f6d9dcfa611299c16
Reviewed-on: https://dart-review.googlesource.com/c/86687
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2018-12-10 23:15:27 +00:00
Ryan Macnak 4463aa0038 Revert "[vm] Fix crash when enum initialization hits a stack overflow."
This reverts commit e59312dafa.

Reason for revert: Broken arm and arm64 simulators

Original change's description:
> [vm] Fix crash when enum initialization hits a stack overflow.
> 
> Give the compiler more headroom.
> 
> Have the KBC and DBC interpreters distinguish between the true stack limit and the limit for trigger an overflow exception.
> 
> Bug: https://github.com/dart-lang/sdk/issues/35224
> Bug: https://github.com/flutter/flutter/issues/25041
> Change-Id: I85e72e1d3cceb70858c53567a4c8d3635e42165b
> Reviewed-on: https://dart-review.googlesource.com/c/86684
> Reviewed-by: Régis Crelier <regis@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=rmacnak@google.com,regis@google.com,ajcbik@google.com

Change-Id: I923cca32d34de37b761196f536873aaf81dcbc92
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/35224, https://github.com/flutter/flutter/issues/25041
Reviewed-on: https://dart-review.googlesource.com/c/86782
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-12-10 18:52:10 +00:00
Ryan Macnak e59312dafa [vm] Fix crash when enum initialization hits a stack overflow.
Give the compiler more headroom.

Have the KBC and DBC interpreters distinguish between the true stack limit and the limit for trigger an overflow exception.

Bug: https://github.com/dart-lang/sdk/issues/35224
Bug: https://github.com/flutter/flutter/issues/25041
Change-Id: I85e72e1d3cceb70858c53567a4c8d3635e42165b
Reviewed-on: https://dart-review.googlesource.com/c/86684
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-12-10 18:29:43 +00:00
Ryan Macnak 4191437ccc Revert "[vm] Fix crash when enum initialization hits a stack overflow."
This reverts commit 67b5c878b3.

Reason for revert: Failures on KBC and ASAN.

Original change's description:
> [vm] Fix crash when enum initialization hits a stack overflow.
> 
> Also, give the compiler more headroom.
> 
> Bug: https://github.com/dart-lang/sdk/issues/35224
> Bug: https://github.com/flutter/flutter/issues/25041
> Change-Id: I51b24cdd79ac790c0ee951e14738a6e7b6f65647
> Reviewed-on: https://dart-review.googlesource.com/c/86584
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Aart Bik <ajcbik@google.com>

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

Change-Id: I1d4c2297154f93f16d2e33756713b30ebe024901
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/35224, https://github.com/flutter/flutter/issues/25041
Reviewed-on: https://dart-review.googlesource.com/c/86683
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-12-07 21:08:33 +00:00
Ryan Macnak 67b5c878b3 [vm] Fix crash when enum initialization hits a stack overflow.
Also, give the compiler more headroom.

Bug: https://github.com/dart-lang/sdk/issues/35224
Bug: https://github.com/flutter/flutter/issues/25041
Change-Id: I51b24cdd79ac790c0ee951e14738a6e7b6f65647
Reviewed-on: https://dart-review.googlesource.com/c/86584
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2018-12-07 19:54:41 +00:00
Ryan Macnak 0177ee1d64 [vm] KernelLoader::FinishLoading can sometimes trigger nested class finalization.
Bug: assertion failure on DBC after d6373525f7
Change-Id: Ia47f13ef55dfac02c0b0c3a74b8f67f3d2671417
Reviewed-on: https://dart-review.googlesource.com/c/86102
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-12-04 23:53:35 +00:00
asiva 0ca1c57593 Reland "[VM] Remove unused flags"
This is a reland of 1a4cff1bd4

Original change's description:
> [VM] Remove unused flags
> 
> Remove the following flags which are always ON
> --strong
> --reify_generic_functions
> 
> and these flags which are not applicable anymore
> --error-on-bad-override
> --error-on-bad-type
> --enable-type-checks
> 
> Change-Id: I6e1aeb68e663953f4ae49ca94ea0daa87b661900
> Reviewed-on: https://dart-review.googlesource.com/c/79431
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Régis Crelier <regis@google.com>

Change-Id: Ib4452c22fb05eed38820708abb648939e03b1df0
Reviewed-on: https://dart-review.googlesource.com/c/84923
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-11-20 17:25:42 +00:00
Siva Annamalai f6c41ac3bc Revert "[VM] Remove unused flags"
This reverts commit 1a4cff1bd4.

Reason for revert: The precompiled arm bot failed a test.

Original change's description:
> [VM] Remove unused flags
> 
> Remove the following flags which are always ON
> --strong
> --reify_generic_functions
> 
> and these flags which are not applicable anymore
> --error-on-bad-override
> --error-on-bad-type
> --enable-type-checks
> 
> Change-Id: I6e1aeb68e663953f4ae49ca94ea0daa87b661900
> Reviewed-on: https://dart-review.googlesource.com/c/79431
> Commit-Queue: Siva Annamalai <asiva@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Régis Crelier <regis@google.com>

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

Change-Id: Ib0fe4f33c044047ef1cb31bca9d38591176b7d40
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/84883
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-11-20 07:32:11 +00:00
asiva 1a4cff1bd4 [VM] Remove unused flags
Remove the following flags which are always ON
--strong
--reify_generic_functions

and these flags which are not applicable anymore
--error-on-bad-override
--error-on-bad-type
--enable-type-checks

Change-Id: I6e1aeb68e663953f4ae49ca94ea0daa87b661900
Reviewed-on: https://dart-review.googlesource.com/c/79431
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-11-20 06:41:06 +00:00
Régis Crelier 61eea1f416 [VM runtime] Remove unused UnresolvedClass VM class.
Type resolution will be simplified in a later CL.

Change-Id: Ia610a5d06d381511ca48993dcc1cafbf205ca997
Reviewed-on: https://dart-review.googlesource.com/c/84552
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2018-11-16 00:09:29 +00:00
Martin Kustermann d91e0ad3d7 [VM] Make method extractors call a stub for creation of tear-off closure
Issue https://github.com/dart-lang/sdk/issues/33274

Change-Id: I7ec37a57c968baa9a3099379cbecb306cd06b464
Reviewed-on: https://dart-review.googlesource.com/c/72780
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-10-23 15:51:37 +00:00
Martin Kustermann 70d5cf8578 [VM] Rehash constant tables after cid-renumbering during app-jit training
When sorting classes during app-jit training we permute the class ids.

This makes canonical hash codes which depend directly (or indirectly) on
class ids change.  We already clear out the cached canonical hash codes
in type-related instances in the heap.

Though the cid renumbering makes the non-cached canonical hashcodes of
other objects, such as canonical Instance and Array objects, also change.

This means any data structures which use canonical hash codes of
type related objects or Instance/Array objects need to re-hash.

-> This CL makes us rehash the constant tables after cid renumbering.

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

Change-Id: Icfb5add3f14e2c62c5bca94f296133121ad0bc55
Reviewed-on: https://dart-review.googlesource.com/c/80801
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-10-19 10:03:41 +00:00
Samir Jindel a66cae48fc [vm/aot] Dynamic invocation forwarders in AOT.
Significant improvements to several benchmarks, including Tracer, Sudoku and DeltaBlue,
see internal dashboard for details.

Flutter Gallery code size +0.7%.

Change-Id: I5df30bbfdd83a54e739ef6b64044141a80688d75
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try, vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/77805
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2018-10-09 17:23:43 +00:00
asiva af57d2a0eb [VM] Remove dead code associated with flag '--error-on-bad-override'
- Remove all dead code associated with flag '--error-on-bad-override' which is currently running only under !FLAG_strong which is not valid anymore
- Not removing the flag from flag_list for now as it is used in a number of tests and removing it from all these places would be a big change, it would be a NOP flag
- removed some dead code in 'loader.dart' which was invoked from the tag handler

Change-Id: I5474b51b4dee7471e80b4081e55b996f1d75612f
Reviewed-on: https://dart-review.googlesource.com/c/78382
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-10-08 04:44:24 +00:00
Zach Anderson a1951238f3 [vm] Remove name conflict checks from class finalization
These should already be done in the front-end.

Change-Id: I87cb90d14ada46df1ff79f56d4c038c1513610e2
Reviewed-on: https://dart-review.googlesource.com/76701
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-10-01 16:41:21 +00:00
Zach Anderson 34425a870e [vm] Set implicit function accessor when the functions are created
Rather than during class finalization.

before:
$ ./out/ReleaseX64/run_vm_tests GenKernelKernelLoadKernel
GenKernelKernelLoadKernel(RunTime): 35558

after:
$ ./out/ReleaseX64/run_vm_tests GenKernelKernelLoadKernel
GenKernelKernelLoadKernel(RunTime): 27650

Change-Id: I2a89f75c3082d7e8fbe20f4e832a609cffae43d8
Reviewed-on: https://dart-review.googlesource.com/76420
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-09-25 19:14:41 +00:00
Samir Jindel cbd17b535f Re-land "[vm/precomp] Use @pragma("vm:exact-result-type") to specify method behavior."
We need to block interrupts while evaluating pragmas to prevert reentrant class finalization.
Original revision is in patchset 0.

Change-Id: I872cec4eaf4ca85567c9657c458ed39c8b2e30de
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try, vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/73160
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-09-11 18:14:51 +00:00
asiva cd3ddede99 Move flags strong/sync-async/reify-generic-functions back to global vm flags (they are not set as isolate specific flags).
Change-Id: I4d5cba4f5ac657a0834e3755312147cff1fbc001
Reviewed-on: https://dart-review.googlesource.com/71426
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-09-07 21:22:13 +00:00
Martin Kustermann 2aca81450d [VM] Fix crash in x64-JIT: Disable exactness tracking for fields with FutureOr<> type
Closes https://github.com/dart-lang/sdk/issues/34238

Change-Id: I0cb00737b3d3aad5fa6ea6359272bd43f89dbad9
Reviewed-on: https://dart-review.googlesource.com/71244
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-08-23 09:09:52 +00:00
Vyacheslav Egorov 8629563009 [vm] Fix few issues with field exactness tracking.
- Don't add dependency on fields that are either unitialized or already marked
as non guarded (guarded cid is kIllegalCid in the first case and kDynamicCid
in the second case).
- Exit early from FieldStore if guarded_cid is kDynamicCid (or we are storing
null into a nullable field).
- Don't track exactness of fields which have function type type.

Also move logic for starting to track fields into class_finalizer because we
need resolved field types to make our decisions.

Change-Id: I164b42abe3108a70b0769f4c78d92459b4e78883
Reviewed-on: https://dart-review.googlesource.com/70620
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-08-20 14:08:04 +00:00
Zach Anderson 707040bfa0 [vm] Adds targets for gen_snapshot that include the interpreter
As the interpreter matures it will hopefully be merged into the regular
jit configuration, but for now we make a separate configuration for it.

Change-Id: Ie287ffccadbf34243d64d90ee43cf5d429966082
Reviewed-on: https://dart-review.googlesource.com/69420
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-08-10 22:05:55 +00:00
Martin Kustermann 6e81d74fcc [VM] Optimize generation of type testing stubs in JIT mode.
This CL introduces, similar to RawClass::direct_subclasses_, a
RawClass::direct_implementors field which is kept up-to-date.

The generation of type testing stubs uses this cached
reverse-relationship information for faster cid-range calculation (time
spent in type testing stub generation is decreased by an order of
magnitude).

This CL also enable type testing stubs for any instantiated type.

This seems to improve

  * analysis-server-cold-analysis by 6%
  * analysis-server-warm-analysis by 11%

as well as other non-analysis benchmarks in JIT mode.

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

Change-Id: If01ee06ac08251b2ed27f79d6b82ad7354c8336e
Reviewed-on: https://dart-review.googlesource.com/66576
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-07-28 20:22:05 +00:00
Régis Crelier 1eacd27b8e [VM runtime] Type bounds do not need to be checked during type finalization in
strong mode, since bound checks are explicitly emitted where needed.

Change-Id: Iddd937f1a0b7b6bae4ef275b0c671bc59d490ca3
Reviewed-on: https://dart-review.googlesource.com/62721
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2018-06-27 22:52:14 +00:00
Régis Crelier 008aa729c5 [VM interpreter] Support implicit getters and setters without compiling them.
Change-Id: I1e61cd79f66efe55c963d970e27f81a9d4084600
Reviewed-on: https://dart-review.googlesource.com/61860
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-06-26 20:24:38 +00:00
Ryan Macnak 8da46d35f5 [vm] Move heap-related code to its own subdirectory (cf. compiler).
Remove some dead includes.

Change-Id: I31f3e739e5ee46dcbba5d6a2f091491b46402943
Reviewed-on: https://dart-review.googlesource.com/60146
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-06-20 00:39:49 +00:00