Commit Graph

44 Commits

Author SHA1 Message Date
Alexander Markov 817582a155 [vm/compiler] Cleanup --no-unbox_mints flag and SupportsUnboxedInt64()
Unboxed int64 are supported on all architectures which Dart VM supports.
The only was to disable support for unboxed int64 is to use
--no-unbox_mints flag, which is not used and not tested.
This change cleans up this flag and corresponding compiler predicates.

TEST=ci

Change-Id: Ib667319eaf87f0ded8bf9d9505272a3693a9e63e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191761
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-03-18 17:49:28 +00:00
Ryan Macnak b1c09ecd8f [vm] Make naming more consistent when converting between handles, tagged and untagged pointers.
Currently we have things called XPtr which are not what you get from ptr().

Old world:
handle->raw() returns RawObject* (tagged)
raw_obj->ptr() returns RawObject* (untagged)

After 6fe15f6df9:
handle->raw() returns ObjectPtr
obj_ptr->ptr() returns ObjectLayout*

New world:
handle->ptr() returns ObjectPtr
obj_ptr->untag() returns UntaggedObject*

TEST=ci
Change-Id: I6c7f34014cf20737607caaf84979838300d12df2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149367
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-15 23:32:02 +00:00
Alexander Aprelev fce355b8b0 [vm/fields] Always clone fields when running an optimizing compiler, even when it runs on the mutator thread.
Attempts to run class finalizaton on background thread revealed the problem where during optimization(which could run on mutator thread too) we might need to finalize previously unseen class, load annotatons for it, load and set some constant fields. This could result in updating Fields guarded_cid, requires check during installation of newly produced optimized code. Because mutator thread is currently exempt from cloning and validating fields guards, that could result in invalid optimized code installation.

This CL ensures that fields are always cloned in optimizing compiler even when it runs on mutator thread.

Ability to run multiple optimizing compilers is also needed for dartbug.com/36097.

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

TEST=existing test suite with ltw isolate groups enabled, https://dart-review.googlesource.com/c/sdk/+/176300 mocked up test(still to be improved).

Change-Id: I608f4abff30b468cb9d0ab270221a0ba72c32470
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175341
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-12-17 00:22:13 +00:00
Vyacheslav Egorov 4b5c267dbd [vm/compiler] Support frameless functions
This CL allows register allocator to mark functions as frameless
in AOT bare instructions mode if they don't contain calls (with an
exception for write barrier related calls), don't require
spills and don't use optional or named parameters.

Calls to Write Barrier helper stubs introduce some complexity
on ARM/ARM64, where we need to take into account that return
address needs to be explicitly spilled from LR register. To keep
the code size balance (frame setup vs manual LR spilling on WB
slow path) we allow one instruction with a write barrier
per frameless function.

Flutter Gallery snapshot becomes 800KB smaller (3% reduction), but
APK size for some reason increases by .1%. On a large internal
application effect is much smaller (60K - 0.16% reduction).

Flutter Gallery is disproportionally affected by the change due to
abnormal amount of small getters originating from localizations:
each localized phrase becomes a getter returning a constant on a
localization specific class.

TEST=tested through normal test suite

Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-ffi-android-release-arm64-try,vm-ffi-android-release-arm-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-android-release-arm64-try
Change-Id: I86cb45a57567ee654ead388957ac4e561634ef9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175304
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-12-10 15:51:27 +00:00
Tess Strickland 52930fe2b9 [vm/compiler] Do not perform non-covariant checks in FFI trampolines.
Since they are accessed via closures, dynamic calls are handled via
dynamic closure call dispatchers and so no non-covariant argument
checking remains at this point.

TEST=Existing FFI tests on trybots, also added a few dynamic cast
tests just in case.

Bug: https://github.com/dart-lang/sdk/issues/44343

Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-product-arm64-try,vm-ffi-android-product-arm-try
Change-Id: If8daa2d71de4e9391dd35b31b62b67a8e7e69ffe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174463
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-12-01 16:01:15 +00:00
Alexander Markov 3e77a430b8 [vm/compiler] Verify that intrinsic parameters are boxed
Intrinsic functions (both asm and graph intrinsics) do not expect
unboxed parameters in most cases. This change adds checks to verify
that and avoid generating incorrect code silently, in case parameters
become unboxed.

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

Change-Id: I71c1499bf8232f241316ae6b3cdeb57dec18fbb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168622
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-10-21 15:50:13 +00:00
Martin Kustermann 13d2937f76 [vm/compiler] Remove too conservative release assert, add boxed-field/unboxed-implicit-getter graph intrinsic support
The initial release assert was added when removing assembler intrinsics
for implicit getters and replacing them with graph intrinsics in:

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

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

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

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

Change-Id: I39717d356e293ed85becd64c8a664465d2abd31d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168100
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-10-17 07:52:24 +00:00
Alexander Markov 13aaaae1b2 [vm/compiler] Introduce AllocateTypedData IL instruction
This is the first step towards optimizing typed data array allocations,
which is useful for e.g. package:vector_math.

Opaque call to a typed data factory constructor is replaced with IL
instruction which doesn't have side-effects and doesn't prevent
other optimizations (e.g. load forwarding) from happening.

Asm intrinsics for typed data factories are replaced with stubs.

Issue: https://github.com/dart-lang/sdk/issues/43228
Change-Id: Icc7d4863f2f94ea5d8bb4620d041f7b6fe664098
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161840
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-09-16 03:16:42 +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
Aske Simon Christensen 14103a366d [vm] Add _allocate and _setAt methods to _TwoByteString.
Also base these and the corresponding methods in _OneByteString on
functions in dart:_internal, so they can be used in other patches.

Change-Id: Ibced31758db2959c111a01cdaa46df2971ae4a6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146784
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-12 17:33:50 +00:00
Vyacheslav Egorov beb7114861 [vm/compiler] Add check to prevent inclusion of compiler headers into AOT runtime
This relands commit b0a71d364c

Cq-Include-Trybots: dart/try:vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-linux-release-simarm-try,vm-kernel-precomp-linux-release-x64-try
Change-Id: I1d32e5d0d44f4e422d188643b548ed81859f7d74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143807
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-04-17 13:11:08 +00:00
Alexander Aprelev c7861f309f Revert "[vm/compiler] Add check to prevent inclusion of compiler headers into AOT runtime"
This reverts commit b0a71d364c as it broke precomp builds.

Change-Id: Ieb776739b8d3e9ac74794e05fc20a793625e5f09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143865
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-04-16 23:51:09 +00:00
Vyacheslav Egorov b0a71d364c [vm/compiler] Add check to prevent inclusion of compiler headers into AOT runtime
#if defined(DART_PRECOMPILED_RUNTIME)
  #error "AOT runtime should not use compiler sources (including header files)"
  #endif  // defined(DART_PRECOMPILED_RUNTIME)

Remove #if defined(DART_PRECOMPILED_RUNTIME) from most compiler sources.

Change-Id: Id175c83fdbea38d9d5e1371ff433e3888f2afe8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143523
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-04-16 22:59:03 +00:00
Samir Jindel c885bdde1d [vm] DBC is obsolete. Remove dead code.
Change-Id: Ica33af158cca53c8e951e4b2582de83660e8a60d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121851
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-27 18:18:29 +00:00
Alexander Markov 60328ca858 [vm] Restore _getHash/_setHash asm intrinsics
These instrinsics were disabled in
https://dart-review.googlesource.com/c/sdk/+/104286/16/runtime/vm/compiler/intrinsifier.cc

Change-Id: Ic380f1c598d2add9f43cd3aeed91494362b56ced
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118642
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-09-25 15:40:52 +00:00
Liam Appelbe e4196ce8c6 [vm] Namespace constants like offsets and sizeofs to use runtime_api.h
Second sub-CL of https://dart-review.googlesource.com/c/sdk/+/100644
The first was here https://dart-review.googlesource.com/c/sdk/+/103487

Now that offsets_extractor is checked in, and we have a big header full
of hard coded constants, the next step is to make sure everything is
using those constants. This is essentially everything in the original
CL, except the new simarm_x64 architecture.

Bug: https://github.com/dart-lang/sdk/issues/36839
Change-Id: I236e4f30aa1df6d92209891c983b792d1835b608
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104286
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-06-10 02:55:25 +00:00
Martin Kustermann 525b43d747 [vm] Decouple intrinsifier code from runtime
This is the next step towards preventing compiler from directly peeking
into runtime and instead interact with runtime through a well defined
surface.

This CL decouples the hand-written intrinsifier code from the runtime:

  * the intrinsifier is split up into a GraphIntrinsifier and AsmIntrinsifier
  * the recognized methods list is moved to a separate .h file
  * all intrinsifier code is moved into dart::compiler namespace
  * the AsmIntrinsifier is only interacting with RT through runtime_api.h

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

Change-Id: I0a73ad620e051dd49c9db7da3241212b3b74ccdd
Reviewed-on: https://dart-review.googlesource.com/c/92740
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-02-13 17:22:56 +00:00
Aart Bik aae0f7997d [vm/compiler] Express control dependence as data dependence.
Rationale:
This provides a more robust way of expressing control
dependences between bounds checks and their uses, while
still allowing for CSE and LICM where possible.
This also fixes the original bug that started this
whole redesign: invalid LICM of checkbound.

Note:
Deals with bounds check, null check still TBD.

Reland of:
https://dart-review.googlesource.com/c/sdk/+/85470

Mini design doc:
runtime/docs/compiler/data_dep_for_control_dep.md

https://github.com/dart-lang/sdk/issues/35139
https://github.com/dart-lang/sdk/issues/34684
https://github.com/dart-lang/sdk/issues/30633

Change-Id: I24b994344ed28c9f5fbf0ed033698be75448df1c
Reviewed-on: https://dart-review.googlesource.com/c/85720
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-12-03 18:07:39 +00:00
Aart Bik ef419f68f9 Revert "[vm/compiler] Express control dependence as data dependence."
This reverts commit 41f3d4326e.

Reason for revert: I hit +2 by accident when I wanted to submit do a dry run

Original change's description:
> [vm/compiler] Express control dependence as data dependence.
> 
> Rationale:
> This provides a more robust way of expressing control
> dependences between bounds checks and their uses, while
> still allowing for CSE and LICM where possible.
> This also fixes the original bug that started this
> whole redesign: invalid LICM of checkbound.
> 
> Note:
> Deals with bounds check, null check still TBD.
> 
> Mini design doc:
> runtime/docs/compiler/data_dep_for_control_dep.md
> 
> https://github.com/dart-lang/sdk/issues/35139
> https://github.com/dart-lang/sdk/issues/34684
> https://github.com/dart-lang/sdk/issues/30633
> 
> Change-Id: Icfbd3ca60662e37046e48b95be7f81d05d94af88
> Reviewed-on: https://dart-review.googlesource.com/c/85470
> Commit-Queue: Aart Bik <ajcbik@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

TBR=vegorov@google.com,kustermann@google.com,rmacnak@google.com,alexmarkov@google.com,asiva@google.com,ajcbik@google.com

Change-Id: Id20699f957681c248851b37d545b330fd4972d7a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/85522
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2018-11-29 03:02:17 +00:00
Aart Bik 41f3d4326e [vm/compiler] Express control dependence as data dependence.
Rationale:
This provides a more robust way of expressing control
dependences between bounds checks and their uses, while
still allowing for CSE and LICM where possible.
This also fixes the original bug that started this
whole redesign: invalid LICM of checkbound.

Note:
Deals with bounds check, null check still TBD.

Mini design doc:
runtime/docs/compiler/data_dep_for_control_dep.md

https://github.com/dart-lang/sdk/issues/35139
https://github.com/dart-lang/sdk/issues/34684
https://github.com/dart-lang/sdk/issues/30633

Change-Id: Icfbd3ca60662e37046e48b95be7f81d05d94af88
Reviewed-on: https://dart-review.googlesource.com/c/85470
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-11-29 01:47:18 +00:00
Martin Kustermann 08a4e020b3 [VM] Get rid of duplicate return-type-cid information from method recognizer
When @pragma('vm:exact-result-type') was introduced, the return types
specified in the recognized method lists were **duplicated** (they were
in the method recognizer macro lists as well as in the dart source code).

This CL removes this duplication by removing the result types from the
method recognizer lists.

Change-Id: I2082110cf77fc3b97d1a541cb153abb8c17990d0
Reviewed-on: https://dart-review.googlesource.com/c/84220
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-11-22 11:53:27 +00:00
Vyacheslav Egorov ddbe22190c [vm/compiler] Refactor representation of stores and loads in IL.
Make StoreIntanceField and LoadField instructions use a single uniform
abstraction: Slot (used to be called NativeFieldDesc), which represents
either a real Dart field (i.e. a field that has a corresponding Field object)
or a native VM field that does not have a corresponding Field object.

This refactoring eliminates raw stores/loads that were just using offsets
before - now we always know what kind of slots we are accessing and
this yields better aliasing information.

Change-Id: I2f48332d58258219565bd961764e8cc9dd4d75ce
Reviewed-on: https://dart-review.googlesource.com/c/74582
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-11-16 17:57:29 +00:00
Ryan Macnak 97940e77a4 [vm, compiler] Remove use of StoreIntoObject for arrays from hand-written assembly.
- Convert _List.[]= and _List._setIndexed to graph intrinsics.
 - Remove _GrowableList.add intrinsics (dead since Dart 2).

Eliminates need to shuffle registers at the assembler level when introducing card-remembering.

Change-Id: Ia94ae3229a5eb90215ac74ab624db843a0cda01c
Reviewed-on: https://dart-review.googlesource.com/c/82380
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-11-01 16:30:28 +00:00
Aart Bik 914065d80b [vm/compiler] Use loop framework for register allocator
Rationale:
Rather than relying on a separate loop detector, rely
on the new loop framework, which avoids code duplication
and ensures any improvement in loop detection/handling
will benefit this phase too. Note, most of the time, the
same loops are discovered with a few exceptions (which
is okay, since this is "just" heuristic usage). This CL
also simplifies loop detection a bit.

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

Change-Id: I1a1b19b99a698c74822473d2a1fe370287c1ade4
Reviewed-on: https://dart-review.googlesource.com/c/80523
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-10-22 19:29:30 +00:00
Martin Kustermann 06f9a9e354 [VM] Introduce function and osr entrypoints to the VM's IR
Similar to how we treat catch entry instructions, this cl adds new
function and osr entry instructions. The [FunctionEntry] and
[OsrEntry] - just like [CatchBlockEntry] - have now their own initial
definitions. The [GraphEntry] has only initial definitions for
constants.

Explicit phis are inserted for all parameter / special parameter
instructions if necessary.

Future work is:

  a) Minimize parallel moves due to the phis on parameters
  b) Cleanup frame setup: Move it entirely into FunctionEntry/CatchEntry
    (instead of the split version we have now)

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

Change-Id: Iefa0280a709716f748d6fb0523b8d0f4d8de1fec
Reviewed-on: https://dart-review.googlesource.com/c/74782
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-10-15 13:02:51 +00:00
Ryan Macnak b8760fed67 [vm, compiler] Remove ASTs and AST flow graph builder.
Change-Id: I4d3c6500577d5285ced327954040dab42ba92341
Reviewed-on: https://dart-review.googlesource.com/c/78823
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-10-10 18:00:21 +00:00
Martin Kustermann 14cf3717f2 [VM] Do not generate fall-through code if the intrinsic is exhaustive (handles all cases)
Change-Id: I71053fa14b59227fa33274cbfb6880d3e2394898
Reviewed-on: https://dart-review.googlesource.com/73621
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-09-10 15:12:22 +00:00
Vyacheslav Egorov 7558644bd6 [vm/compiler] Move compiler state (CHA, deopt id) from Thread to a special class
Also move deopt id computation logic into a separate class and add a comment
explaining while deopt ids are incremented by 2.

Change-Id: Ife489be7d10c7198a8e7adf9e97e0c516d78ea55
Reviewed-on: https://dart-review.googlesource.com/72685
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-09-03 16:01:24 +00:00
Vyacheslav Egorov c5f933fdf7 [vm/lib] String._identityHashCode should be the same as String.get:hashCode
On 64-bit platforms we use a field in the header to cache results of
Object.get:_identityHashCode. The very same field is also used to
cache String.get:hashCode result. Which means that their implementations
must be the same.

Fixes https://github.com/flutter/flutter/issues/20122

Change-Id: I98eef9eddf833c0d7c4c6f452728fe48e232efdc
Reviewed-on: https://dart-review.googlesource.com/68042
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-08-02 11:24:25 +00:00
Aart Bik 2a396d5315 [vm/intrinsics] Intrinsify 64-bit int typed data.
Rationale:
With limited integers, signed/unsigned 64-bit int typed
data is just a bit pattern, no need to sign/zero extend
these into bigger ints on load. This enables more
intrinsification of indexed stores/loads.

Note:
Still TBD, inline these indexed operations too.

Performance:
About 10x improvement on micro benchmarks.

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


Change-Id: I640c324a7d91e57fb4edc025e0dd456ad34fe906
Reviewed-on: https://dart-review.googlesource.com/60403
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2018-06-15 18:09:40 +00:00
Ryan Macnak ade0e93090 [vm] Normalize external string finalizers.
- Remove a level of indirection when accessing code units.
 - Require a finalizer when constructing an external string.

Change-Id: I3f65246bf0ac50ffad900e2c338623a7684a9d3d
Reviewed-on: https://dart-review.googlesource.com/54300
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-06-04 23:44:39 +00:00
Vyacheslav Egorov 19cf8d1768 [vm] Rewrite Intrinsifier::InitializeState to be data driven.
The expanded form takes long time to compile in release mode (>200s)
this reduces compilation time of intrinsifier.cc by a factor of 20x.

Bug: https://github.com/dart-lang/sdk/issues/33023
Change-Id: Idff9d8a46a5335eb7a722c3eee02dc2258b16283
Reviewed-on: https://dart-review.googlesource.com/53421
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-05-04 10:43:15 +00:00
asiva b64f2acfb9 Revert "[VM] Improve code generation for uint32"
Please see issue https://github.com/dart-lang/sdk/issues/33008 for more
details on the regression caused by this commit.

This reverts commit 9741c220f3.

It also effectively reverts

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

which were follow up CLs to the main commit.

Change-Id: Iac399c620a312ab3c3b27a3cba4e681742bcfe33
Reviewed-on: https://dart-review.googlesource.com/53164
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2018-05-01 00:25:01 +00:00
Erik Corry 9741c220f3 [VM] Improve code generation for uint32
Simplify by no longer using the signed unboxed int32 type on
64 bit platforms.

R=vegorov@google.com

Change-Id: Ic8eab7308f2ce01e5618344f50f72b95ce13a0dc
Reviewed-on: https://dart-review.googlesource.com/52762
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-04-29 12:41:43 +00:00
Alexander Markov c60199cf86 [vm/kernel/aot] Tree shaking based on results of TFA, take 2.
This is a re-landing of

https://github.com/dart-lang/sdk/commit/06ebf884db61b97a60b1578560678329cd51bf61

after the fix was submitted separately at

https://github.com/dart-lang/sdk/commit/e3b9c2860e46f9d673ffc3129ede2a11c6125d06

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

Issue: https://github.com/dart-lang/sdk/issues/30480
Change-Id: I2d3a10acb9b5af0184b3d1504acb2f4ebebfff8a
Reviewed-on: https://dart-review.googlesource.com/48440
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-03-27 23:39:24 +00:00
Alexander Markov 7386d7b5ec Revert "[vm/kernel/aot] Tree shaking based on results of TFA"
This reverts commit 06ebf884db.

Reason for revert: buildbot failures.

Change-Id: Ie6b33061cad80ae3b20b773cc435d64a755620fc
Reviewed-on: https://dart-review.googlesource.com/48263
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-03-23 22:57:19 +00:00
Alexander Markov 06ebf884db [vm/kernel/aot] Tree shaking based on results of TFA
This CL adds tree shaking transformation into TFA transformer, replacing
simple DropMethodBodiesVisitor. In addition to removing bodies of
unreachable members, tree shaker is able to remove unused classes, typedefs
and member declarations, and replace unreachable calls with 'throw'.

Total(CodeSize) of flutter_gallery in --release mode
before: 11,671,369
after:  11,499,694

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

Change-Id: I966cf222eb9725b7a75dd193ac479436b9b9b4c3
Reviewed-on: https://dart-review.googlesource.com/46942
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-23 22:21:39 +00:00
Martin Kustermann cf1de7d46c [VM] Replace hand-written assembly prologues with IR
As part of the prologue changes we get rid of the empty context as well.

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

Change-Id: I707e23c631bcfbbad6c91c4963d0c10f7a0be625
Reviewed-on: https://dart-review.googlesource.com/25320
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-12-13 16:04:34 +00:00
Vyacheslav Egorov cc35ba4a1e [vm] Split _List&_GrowableList []= into checked and unchecked parts
This allows us to avoid going into runtime even if strong mode is
enabled: type checking is handled in the []= operator itself and
_setIndexed does not need to check types and thus can be intrinsified.

This CL also removes inline type checking done in ia32 version,
not other platform had it.

# Performance Impact

Mostly noticable on Dart v2 AOT configuration where AOT compiler
did not inline []=:

Richards  +26.27%
Meteor  +33.63%
BuildTableInterpolation +68.98%
DeltaBlueClosures +46.43%
StarryStrings +22.08%
NavierStokes  +94.81%
JsonParseCustomReviver  +45.22%
DeltaBlue +56.44%
BuildTableBufferWithCodes +84.40%
JsonParseDefaultReviver +46.13%
BuildTableBuffer  +125.8%
BuildTableIdiomatic +125.8%
StringBuffer  +127.3%
StringIdiomatic +127.2%
JsonObjectRoundTrip +95.42%
JsonStringifyFinancialOnce  +125.7%
JsonRoundTrip +96.01%

Bug:
Change-Id: Ie6d33ac55b5a0c0909ca06e0c88a60d8e0d2604e
Reviewed-on: https://dart-review.googlesource.com/26800
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2017-12-07 13:09:55 +00:00
Martin Kustermann 3347b700df [VM] Add support for skipping a prologue range of blocks (for inlining heuristics)
Issue https://github.com/dart-lang/sdk/issues/31495

Change-Id: I876f4e064cfd21f5c3e99b531ff69776eba99635
Reviewed-on: https://dart-review.googlesource.com/25060
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-12-01 00:03:56 +00:00
Régis Crelier f91f67a5be [VM] Emit type checks for incoming function arguments in strong mode.
Change-Id: Icd64913f0fc6ba54a0b8517bf05ae4babfae3bdc
Reviewed-on: https://dart-review.googlesource.com/19287
Reviewed-by: Siva Annamalai <asiva@google.com>
2017-11-18 00:31:35 +00:00
Kasper Lund 1db8615e29 Avoid just truncating to the nearby int in double.hashCode.
Preserves the property that doubles and ints that are equal
share the same hash code, but gives different doubles a much
higher chance of having different hash codes.

BUG=https://github.com/dart-lang/sdk/issues/2884

Change-Id: Ia97164087db568f26ffbbd6854ed9c19f81e9611
Reviewed-on: https://dart-review.googlesource.com/15140
Commit-Queue: Kasper Lund <kasperl@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-10-23 06:47:20 +00:00
Vyacheslav Egorov 552d09715d [VM] Cleanup SIMD related IL instructions.
This CL unifies 31 diverse Simd instructions into a single flexible SimdOp instruction.

These instructions were not different enough to warrant being implemented 
as separate IL instructions. The separation did not bring any benefit but
instead we payed the price with considerable amounts of duplicated code 
across the pipeline.

Main motivation for this refactoring is to reduce the surface of our IL.

Bug:
Change-Id: Ie8e39fecd2a51cb8edffdfe9c22e76835f912a9b
Reviewed-on: https://dart-review.googlesource.com/10120
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-07 13:25:13 +00:00
Vyacheslav Egorov 8a179fb953 [VM, Compiler] Move compiler to a separate folder.
New folder structure (nested under vm/):

- compiler/
-   jit/         - JIT specific code
-   aot/         - AOT specific code
-   backend/     - all middle-end and back-end code (IL, flow graph)
-   assembler/   - assemblers and disassemblers
-   frontend/    - front ends (AST -> IL, Kernel -> IL)

compiler/README.md would be the documentation root for the compiler
pipeline

Bug: https://github.com/dart-lang/sdk/issues/30575
Change-Id: I2dfd9688793bff737f7632ddc77fca766875ce36
Reviewed-on: https://dart-review.googlesource.com/2940
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2017-09-04 15:15:18 +00:00