Commit Graph

41 Commits

Author SHA1 Message Date
Ryan Macnak 55645786bc Revert "[vm, compiler] Support unboxed parameters for integer intrinsics."
This reverts commit 1d369b5000.

Reason for revert: Failures on Golem

Original change's description:
> [vm, compiler] Support unboxed parameters for integer intrinsics.
>
> TEST=ci
> Change-Id: I7f29471043c049ef1acf7cd4bcb0890db6d33aa4
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192728
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

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

Change-Id: I09e54cd894c0f73bf3af215729567503c156ec3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195165
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-04-13 17:05:47 +00:00
Ryan Macnak 1d369b5000 [vm, compiler] Support unboxed parameters for integer intrinsics.
TEST=ci
Change-Id: I7f29471043c049ef1acf7cd4bcb0890db6d33aa4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192728
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-04-09 00:30:10 +00:00
Ryan Macnak 6a6e08b784 Reapply "[vm, compiler] Convert binary Smi ops to graph intrinsics."
Explicitly disable unboxed parameters for these functions, previously implicitly disabled by virtue of being ASM intrinsics.

TEST=ci
Change-Id: Ic810bb8400e081c5f99a49b5035031bc9edc4bf5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192044
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-03-25 21:54:44 +00:00
Ryan Macnak 5bfb36daa3 [vm, compiler] Use leaf calls for exp and log.
We already do this for the other functions in dart:math.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/45414
Change-Id: Ic1fb1c7cdbbf39eaa4af645219874408988b740b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192522
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-03-22 23:14:25 +00:00
Ryan Macnak c5eaf317b6 Revert "[vm, compiler] Convert binary Smi ops to graph intrinsics."
This reverts commit 051ec30ff0.

Reason for revert: Failures on ARM32 AOT

Original change's description:
> [vm, compiler] Convert binary Smi ops to graph intrinsics.
>
> Keep left shift as an ASM intrinsic because it includes fallbacks to Mint operations on 32-bit architectures that graph intrinsics aren't good at expressing.
>
> This should be close to neutral on performance, but removes a fair amount of redundant code.
>
> TEST=ci
> Change-Id: Ic9c7d3b2d015ebf31972163a58c6bc9a27bad4ca
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187164
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

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

Change-Id: I2a08df5b4aa0269a6237a3d967729c155c88a1c7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192061
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-03-18 22:11:56 +00:00
Ryan Macnak 051ec30ff0 [vm, compiler] Convert binary Smi ops to graph intrinsics.
Keep left shift as an ASM intrinsic because it includes fallbacks to Mint operations on 32-bit architectures that graph intrinsics aren't good at expressing.

This should be close to neutral on performance, but removes a fair amount of redundant code.

TEST=ci
Change-Id: Ic9c7d3b2d015ebf31972163a58c6bc9a27bad4ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187164
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-03-18 20:33:34 +00:00
Tess Strickland 100e12b6cd [vm/compiler] Copy inlined IDs with token positions.
When creating new instructions that inherit a token position that
represents a source location from another instruction, the inheriting
instruction must also have the same inlining ID in order for the source
position represented by the token position to be looked up in the
correct script.

Force this by wrapping both in a single InstructionSource struct which
is taken by instructions which take token positions instead of just a
token position. That way, it's more work to manually transfer the token
position separately from the inlining ID of the instruction than doing
the right thing of transfering both at once.

To ensure this information is kept consistent, we pass InstructionSource
structs through the FlowGraphCompiler all the way down to the
CodeSourceMapBuilder.

This CL also makes the following changes:

* Cache the upper bound of source positions in scripts and use it to add
  a check for if a given real token position is valid for the script
  without iterating over the line starts data for each token position.

* Start inlining intervals appropriately when adding descriptor and
  null check information to the code source map.

Code size changes are minimal on Flutter gallery in release mode
(<0.05% decrease).

TEST=Existing tests on trybots, with manual checking with
--check-token-positions that previous errors are now removed.

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

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-release-x64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-linux-release-simarm64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-ia32-try
Change-Id: I23ced262cb4e9fe9d81356f409e7e8d220d63ee0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173967
Reviewed-by: Régis Crelier <regis@google.com>
2020-12-18 00:42:14 +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
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 e5f1b4bb2c [vm/compiler] Handle unboxed index parameter in ArraySetIndexed/ArrayGetIndexed intrinsics
Fixes https://github.com/dart-lang/sdk/issues/43810

Change-Id: I0bd5fc1ca9b71c141bf6b596813183b380e1a391
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167865
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-10-16 16:59: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
Alexander Markov dd2d040ccb [vm] Cleanup flags which disable argument type checks and strong mode types
The following options are removed:
--use_strong_mode_types
--experimental_unsafe_mode_use_at_your_own_risk

The following flags and predicates are removed:

Dart_IsolateFlags::unsafe_trust_strong_mode_types
Isolate::argument_type_checks()
Isolate::can_use_strong_mode_types()
Isolate::should_emit_strong_mode_checks()

Also, everything depending on these flags is cleaned up.

Change-Id: I9328009ad5a42ea2173842386d612c465e3ebec1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147325
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-05-08 15:53:09 +00:00
Ryan Macnak 160046f44c [vm] Move CID predicates out of RawObject.
When using C++ value types to represent tagged pointers, we cannot use forward declarations for tagged pointers. This helps to break include cycles when attempting to keep IsXYZ predicates as tagged pointer member functions.

class_id.h also seems like a more natural place for these predicates, which were written before there was a class_id.h.

Change-Id: I0677560a794ed084d10f844606e202feb0c3820a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144321
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-04-21 20:09:55 +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
Daco Harkes 4081235ac5 [vm] Support unboxed indices in indexed load and store
Use unboxed indices in FFI loads, eliminating extra boxing and a shift for 1-byte loads.
Speeds up Pointer<Int8,Int64,etc> loads/stores by 20-25% in AOT on x64.

This does not use the unboxed indices in TypedData yet, using unboxed in TypedData without making the bounds checks unboxed makes it slower instead of faster.

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

Change-Id: I2521fcd319cf4ed6891622e8a3c8c1924e9b01f3
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-mac-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137788
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-03-05 17:18:24 +00:00
Victor Lima b951498903 [vm/aot] Allow static methods to have unboxed args and return
Static methods and constructors may receive unboxed parameters.
This change adds a bitmap to the RawFunction object indicating
which parameters are unboxed and their types. Also, the stack frame
bitmap was updated to include new bits for those parameters.

The ArgumentsDescriptor object was updated to store not only the number
of arguments, but also their size, since 32-bit platforms would use two
words for each int64 and double value.

In addition, static methods that return non-nullable integers
and doubles may return these values unboxed.

Dart AOT x64:

TypedData.Uint8ClampedListViewVarBench  +11.73%
DeltaBlue                               +9.32%
Meteor (Intel Xeon)                     +4.64%

Flutter release android-armv8:

velocity_tracker_bench                  -2.32% (less is better)

flutter_gallery_readonlydata_size       +0.18%
flutter_gallery_total_size              +0.13%
flutter_gallery_instructions_size       +0.12%

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

Change-Id: I97e310f8f30213920af2333fbdedf193d03db5c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135313
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-03-05 15:17:04 +00:00
Victor Lima 7a1c91bda9 [vm/precomp] Inline SIMD operations
This CL is responsible for inlining Float32x4 and Float64x2 arithmetic
operations in order to reduce their run-time cost.

Null-checks were required in order to allow the unbox instructions to
be non-speculative.

CheckNullInstr was modified to throw ArgumentError when checking
arguments for those operations.

Change-Id: I18b36d96a36011647480f301eb6dc6bb478f59a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128589
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2019-12-19 15:09:32 +00:00
Samir Jindel dd7760a07d [vm] Support disassembling snapshot code at runtime for JIT and AOT snapshots.
--code-comments should be passed both at compile/training-time and run-time to get
comments in the disassembled instructions.

The required --disassemble-* flags need only be passed at run-time. Flow-graph printing
is not yet supported because we don't save flow-graph like assembly comments.

This functionality is excluded from product builds.

Change-Id: If35fbb08cff6eae40069f916ecec9c6f589c0cad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124989
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-14 14:09:21 +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
Aart Bik 64a42600ea [vm/compiler] Avoid unnessary checks on 64-bit
Rationale:
Follow up from two previous CLs. Use of 64-bit macro
(requested by Martin) and avoid unnessary check on
64-bit platforms (requested by Alex)

https://github.com/dart-lang/sdk/issues/37868
https://github.com/dart-lang/sdk/issues/37895

Change-Id: I80e6825953090f5079377d0452b70e48c5be92a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114550
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-08-26 20:34:22 +00:00
Aart Bik cebb64f249 [vm/compiler] Avoid deopt for non-clamping typed data
Rationale:
The recent introduction of non-SMI deopt to fix the
clamping bug is a bit too restrictive for the other,
truncating operations. In particular, we observed
a unnecessary regression in one of our performance
benchmarks.

https://github.com/dart-lang/sdk/issues/37868
https://github.com/dart-lang/sdk/issues/37895

Change-Id: Iabf59db5c50b775a717c6e961efb3a5f4b6a964e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114447
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-08-26 19:04:32 +00:00
Aart Bik 1523fbd96e [vm/compiler] Fixed bug with clamping on 32-bit arch
Rationale:
Feel the power of value-guided fuzzing that, in combination
with new types, founds this issue in the graph intrinsifier.
The deopt on the speculative code for Smi was missing.

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

Change-Id: I9f310f62eb6cf1cdb3e39685caed5b7792024565
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113203
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-08-15 21:05:02 +00:00
Aart Bik ebc180be95 [dart/vm] Fix bug on missed exception in AOT
Rationale:
The regression test in this CL should throw
with a NoSuchMethod on null. However, before
the fix, AOT did not throw at all.

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

Change-Id: I4037b163092caf78d313815624fd3b20c20f88ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109550
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-07-19 22:43:31 +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 119f937418 [vm/compiler] Make StoreIndexedInstr take unboxed values and make LoadIndexedInstr produce unboxed values
Currently the LoadIndexedInstr will mostly box resulting values which
might be untagged right after it to do binary int64 arithmetic on the
values.

Similarly StoreIndexedInstr takes only boxed values as inputs. Though
tight code using int64s will need to box just so the StoreIndexedInstr
unboxes it again.

To avoid the extra tagging/untagging we make the load return unboxed
values which can be optionally tagged afterwards if need be.

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

Change-Id: I7e82107c2047e41699854e1534934a7cb9da691d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99149
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-04-26 10:34:19 +00:00
Martin Kustermann a3c19d4ffc [vm/compiler] Move inlining/intrinsics pipeline passes to compiler_pass.h
This makes it easier to maintain since all of them are in one place.

Change-Id: If55a9fb4a703aee36889c3fbdb8dded9f6233cb9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99467
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-04-25 10:55:40 +00:00
Vyacheslav Egorov 9e81e4bfe5 [vm/compiler] Move BlockBuilder from graph_intrinsifier.cc to a header.
This helper class can be used for building IL in SSA form. It was
previously used to build intrinsic IL, but it can also be used to
build IL for tests.

This move required introducing a constant that describes offset
of the last parameter from SP value on entry (kLastParamFrom

This CL also changes the meaning of ParameterInstr(index, SPREG) to be
[SP + index + kLastParamSlotFromEntrySp], where previously it was
something like [SP + (index - 1) + kLastParamSlotFromEntrySp].

Change-Id: Ib75ecb3a94f9cde74d6f91028d3cbea8f5e4bc42
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98336
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-04-03 15:42:56 +00:00
Martin Kustermann 592aee4838 Revert "Reland "Temporary revert of two changes which potentially caused performance regressions in Flutter.""
The change was already reverted and I accidentally relanded this.

Change-Id: I62ff3367db7aaaf3a470727fdb587830a23fe53c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98566
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-04-03 12:50:57 +00:00
Ben Konyi debd918696 Reland "Temporary revert of two changes which potentially caused performance regressions in Flutter."
This is a reland of 49c94d3600

It appears that the major regressions were introduced not by the typed data unification
changes but rather by 3fd124db1f "[vm] Repair the resolver abstraction." which got
reverted in e979895efb "Revert "[vm] Repair the resolver abstraction."


Original change's description:
> Temporary revert of two changes which potentially caused performance regressions in Flutter.
>
> Revert "[vm] Re-number class ids for internal/external typed data and typed data views"
>
> This reverts commit a062221b76.
>
> Revert "[vm] Unify internal/external/view typed data into new RawTypedDataBase class"
>
> This reverts commit 94362f1af0.
>
> Change-Id: I7189c976aa86cdcf0a3802631bff754baf3ca2cc
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98521
> Reviewed-by: Ben Konyi <bkonyi@google.com>

Change-Id: I758775ccc426a02bce538d07ea04d9c67e8933d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98562
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Auto-Submit: Martin Kustermann <kustermann@google.com>
2019-04-03 12:04:23 +00:00
Ben Konyi d63d0b4bcd Revert "Temporary revert of two changes which potentially caused performance regressions in Flutter."
This reverts commit 49c94d3600.

Reason for revert: Relanding

Original change's description:
> Temporary revert of two changes which potentially caused performance regressions in Flutter.
> 
> Revert "[vm] Re-number class ids for internal/external typed data and typed data views"
> 
> This reverts commit a062221b76.
> 
> Revert "[vm] Unify internal/external/view typed data into new RawTypedDataBase class"
> 
> This reverts commit 94362f1af0.
> 
> Change-Id: I7189c976aa86cdcf0a3802631bff754baf3ca2cc
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98521
> Reviewed-by: Ben Konyi <bkonyi@google.com>

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

Change-Id: I5c5be67fcec05434283153cb2592ba41afd1f41f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98505
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-04-02 23:53:42 +00:00
Ben Konyi 49c94d3600 Temporary revert of two changes which potentially caused performance regressions in Flutter.
Revert "[vm] Re-number class ids for internal/external typed data and typed data views"

This reverts commit a062221b76.

Revert "[vm] Unify internal/external/view typed data into new RawTypedDataBase class"

This reverts commit 94362f1af0.

Change-Id: I7189c976aa86cdcf0a3802631bff754baf3ca2cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98521
Reviewed-by: Ben Konyi <bkonyi@google.com>
2019-04-02 23:53:12 +00:00
Martin Kustermann 94362f1af0 [vm] Unify internal/external/view typed data into new RawTypedDataBase class
This moves the length field as well as an inner pointer to the start of
the data into the RawTypedDataBase class.  The inner pointer is updated
on allocation, scavenges and old space compactions.

To avoid writing more assembly the typed data view factory constructors
will be generated using IL, which will update the inner pointer. This
required adding new IR instructions and changing the existing
UnboxedIntConverter instruction.

This is the foundation work to de-virtualize calls on the public typed
data types, e.g. Uint8List.


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: I1aab0dd93fa0f06a05299ab4cb019cf898b9e1ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97960
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-03-30 14:02:50 +00:00
Alexander Markov fc7d25e0e3 Revert "[vm] Add data field to TypedData"
This reverts commit d1085e80be.

Reason for revert: performance regressions.

Original change's description:
> [vm] Add data field to TypedData
> 
> This is the first step towards unification of TypedData and
> ExternalTypedData.
> 
> Issue: https://github.com/dart-lang/sdk/issues/34796
> Change-Id: I8aec72030e251f9cd9f00fc5073f8e42b83a8d17
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/79430
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

TBR=vegorov@google.com,kustermann@google.com,rmacnak@google.com,alexmarkov@google.com,regis@google.com

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

Issue: https://github.com/dart-lang/sdk/issues/34796
Change-Id: Ia11d8c3af0af29d49c3dbf36a3fe7041fbf9aae3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97166
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-03-18 18:53:36 +00:00
Alexander Markov d1085e80be [vm] Add data field to TypedData
This is the first step towards unification of TypedData and
ExternalTypedData.

Issue: https://github.com/dart-lang/sdk/issues/34796
Change-Id: I8aec72030e251f9cd9f00fc5073f8e42b83a8d17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/79430
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-03-15 19:47:45 +00:00
Vyacheslav Egorov ed5bc9c538 [vm] Fix AssertAssignable strengthening sometimes using wrong deopt_id.
For some reason this code used deopt_id from the environment attached
to the AssertAssignable instruction, rather than deopt_id from the
instruction itself.

Under certain conditions this deopt_id is -1 which usually does
not cause any problems because no other code uses it.

Compiler is now changed in a way that only sets Environment::deopt_id_
for outer environments and innermost environment always has deopt_id_ set
to DeoptId::kNone.

This bug manifested itself as a very rare crash on lib_2/convert/chunked_conversion_utf8_test.dart
test on optcounter bot.

This change also converts an assertion that verifies that deoptimization target
always exists into a FATAL to make such crashes more informative.

TEST=runtime/tests/vm/dart/licm_and_assert_strengthening_test.dart

Change-Id: Ib58237b0f4ae279dcf9d88cac031156e88bf4828
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96657
Auto-Submit: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2019-03-13 12:13:12 +00:00
Dan Field eb73f132c1 [vm] Add macro for fallthrough annotations
Internal builds in Google are catching this as an error.

I'm guarding it because I assume we might support building using other
compilers.

Change-Id: I665099cace9c6a40d737c471dd1b0fdb326fea39
Reviewed-on: https://dart-review.googlesource.com/c/91162
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-02-15 01:12:01 +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