Commit Graph

29 Commits

Author SHA1 Message Date
Alexander Markov c3b5939965 [vm] Remove --limit-ints-to-64-bits option and old _Bigint class
Closes https://github.com/dart-lang/sdk/issues/33306

Change-Id: I7088d8b7143edbe24f5cefe4be037ad2006e0625
Reviewed-on: https://dart-review.googlesource.com/58101
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-06-04 20:10:40 +00:00
Vyacheslav Egorov e67222a92b [vm/compiler] Do not use call->ArgumentAt(0) to access receiver.
If call can have type arguments we can't use call->ArgumentAt(0) to
access receiver, instead we need to use call->ArgumentAt(call->FirstArgIndex()).

This lead to a bug in polymorphic inlining of functions with type
arguments - instead of loading class id from the receiver we would be
loading it from the first argument which contains type arguments.

This CL also cleans up other parts of the compiler that used ArgumentAt(0)
when they needed receiver.

Fixes https://github.com/dart-lang/protobuf/issues/95

Change-Id: I5504f7aff714894ff9fe580710c376f1d1933bfa
Reviewed-on: https://dart-review.googlesource.com/54411
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-05-09 18:01:57 +00:00
Vyacheslav Egorov a06b1d96cb Revert "[VM] Reduce Smi size to 32 bit on 64 bit platforms"
This reverts commit cf78da8a48.

Reason for revert: introduces significant performance regression (~30%) on analyzer benchmarks (warm-analysis) without clearly visible hot-spot.

Original change's description:
> [VM] Reduce Smi size to 32 bit on 64 bit platforms
> 
> This reduces small tagged integers on 64 bit platforms from 63 bits to
> 31 bits plus one tag bit.
> This is a step on the way to compile-time-optional compressed pointers
> on 64 bit platforms.  See more about this at go/dartvmlearnings
> This causes a slowdown for some uses of integers that don't fit in 31
> signed bits, but because both x64 and ARM64 have unboxed 64 bit
> integers now the performance hit should not be too bad.
> 
> This is a reapplication of
> https://dart-review.googlesource.com/c/sdk/+/46244
> It was reverted due to a compilation error on 32 bit
> ARM with DBC.
> 
> R=​vegorov@google.com
> 
> Change-Id: I943de1768519457f0e5a61ef0b4ef204b6a53281
> Reviewed-on: https://dart-review.googlesource.com/51321
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

TBR=vegorov@google.com,erikcorry@google.com

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

Change-Id: I8c5b909ec38663b5f5b05f69ef488c97341f8f3d
Reviewed-on: https://dart-review.googlesource.com/54000
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-05-07 13:56:10 +00:00
Alexander Markov 2786b9ff43 [vm/aot] Add detailed error messages and stack traces for null checks
This CL fixes error message in NoSuchMethodError thrown by null checks
and line numbers in corresponding stack traces (in AOT).

Name of the called function is placed into object pool, and metadata
for null check site is generated in CodeSourceMap.

Size of flutter gallery in release mode:
	  Before	 After
RW	  2165286	 2201642	(+1.68%)
RO	  2122192	 2168224	(+2.17%)
RX	  6871072	 6871072	(+0.00%)
Total	 11163079	11245467	(+0.74%)

Closes https://github.com/dart-lang/sdk/issues/32863

Change-Id: I5ad1190f2ec9452a669863f7dd114ea5f9092d52
Reviewed-on: https://dart-review.googlesource.com/52703
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-04-26 20:33:15 +00:00
Erik Corry cf78da8a48 [VM] Reduce Smi size to 32 bit on 64 bit platforms
This reduces small tagged integers on 64 bit platforms from 63 bits to
31 bits plus one tag bit.
This is a step on the way to compile-time-optional compressed pointers
on 64 bit platforms.  See more about this at go/dartvmlearnings
This causes a slowdown for some uses of integers that don't fit in 31
signed bits, but because both x64 and ARM64 have unboxed 64 bit
integers now the performance hit should not be too bad.

This is a reapplication of
https://dart-review.googlesource.com/c/sdk/+/46244
It was reverted due to a compilation error on 32 bit
ARM with DBC.

R=vegorov@google.com

Change-Id: I943de1768519457f0e5a61ef0b4ef204b6a53281
Reviewed-on: https://dart-review.googlesource.com/51321
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-04-25 12:31:33 +00:00
Alexander Aprelev 23ae4fa098 Revert "[VM] Reduce Smi size to 32 bit on 64 bit platforms"
This reverts commit 0e9a77a360 as it introduces regression in Flutter build: https://build.chromium.org/p/client.flutter/builders/Mac%20Engine/builds/2573/steps/build%20ios_debug_arm/logs/stdio

Revert d58b0e2d44

Change-Id: I1c4a9384d4fa8cc809412b1d22409221771acda0
Reviewed-on: https://dart-review.googlesource.com/50600
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2018-04-10 23:39:01 +00:00
Erik Corry 0e9a77a360 [VM] Reduce Smi size to 32 bit on 64 bit platforms
This reduces small tagged integers on 64 bit platforms from 63 bits to
31 bits plus one tag bit.
This is a step on the way to compile-time-optional compressed pointers
on 64 bit platforms.  See more about this at go/dartvmlearnings
This causes a slowdown for some uses of integers that don't fit in 31
signed bits, but because both x64 and ARM64 have unboxed 64 bit
integers now the performance hit should not be too bad.

This reapplies the change reviewed at
https://dart-review.googlesource.com/c/sdk/+/46244

R=kustermann@google.com

Change-Id: I605c21506ec7d4c69fa7049bc419b3ee370685fc
Reviewed-on: https://dart-review.googlesource.com/50202
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Erik Corry <erikcorry@google.com>
2018-04-09 12:45:57 +00:00
Erik Corry b7ade14add Revert "[VM] Reduce Smi size to 32 bit on 64 bit platforms."
This reverts commit 19b4349487.
Reason for revert: Failure on VM test with -hot-reload-test-mode

R=kustermann@google.com

Change-Id: I1c40b537be8c934b1ff34465bca0a35c1376ab71
Reviewed-on: https://dart-review.googlesource.com/49862
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-04-06 12:01:58 +00:00
Erik Corry 19b4349487 [VM] Reduce Smi size to 32 bit on 64 bit platforms.
This reduces small tagged integers on 64 bit platforms from 63 bits to 31 bits
plus one tag bit.
This is a step on the way to compile-time-optional compressed pointers on 64
bit platforms.  See more about this at go/dartvmlearnings
This causes a slowdown for some uses of integers that don't fit in 31 signed
bits, but because both x64 and ARM64 have unboxed 64 bit integers now the
performance hit should not be too bad.

R=kustermann@google.com

Change-Id: I035ed84c29b64f0432cd2d24193eb1c6303c14b0
Reviewed-on: https://dart-review.googlesource.com/46244
Commit-Queue: Erik Corry <erikcorry@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-04-06 10:07:53 +00:00
Vyacheslav Egorov 1911c23cf9 [vm/compiler] Use Isolate::use_field_guards instead of FLAG_use_field_guards.
These two values are not necessarily in sync: FLAG_use_field_guards can be set to
false while kernel-service is running from an app-jit snapshot with field
guards.

This caused major flakiness on kernel opt-counter-threshold bot.

This was a bug introduced by refactoring in d6eb8c6c27.

Change-Id: Icba874d319c1e96df90cae2d81e0bce3e752808b
Reviewed-on: https://dart-review.googlesource.com/38620
Reviewed-by: Erik Corry <erikcorry@google.com>
2018-02-05 17:40:53 +00:00
Alexander Markov e90b2d8461 [VM, AOT] Support double/int mixed operations on x64
This CL extends support of mixed operations in strong-mode AOT
from double/smi to double/int (if underlying code generator supports
conversions from int64 to double).

* MintToDouble instruction is renamed to Int64ToDouble.

* Code generation of Int64ToDouble is implemented on x64.

Issue: https://github.com/dart-lang/sdk/issues/30480
Change-Id: I3142302e80c2785be71d7a8baff42d40f0b5b1b8
Reviewed-on: https://dart-review.googlesource.com/35382
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-01-19 17:03:25 +00:00
Martin Kustermann 84e7bef26d Reland "[VM] Allow the inlining code to inline implicit getters even if a StaticCallInstr is used"
This also changes the implementation of Function::LookupImplicitGetterSetterField to **not** use
token positions for finding the right field, but rather the name.

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

Change-Id: I418c89a1426c33b2bfa8adc00534511657af51f1
Reviewed-on: https://dart-review.googlesource.com/34141
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-01-12 17:18:29 +00:00
Martin Kustermann caaddd7161 Revert "[VM] Allow the inlining code to inline implicit getters even if a StaticCallInstr is used"
This reverts commit 195bd1b36c.

Reason for revert: Crashes in release-precomp.

Change-Id: Iee7206fee27c2434a4e5355ca6101e9595ad102d
Reviewed-on: https://dart-review.googlesource.com/34060
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-01-10 23:19:46 +00:00
Martin Kustermann 195bd1b36c [VM] Allow the inlining code to inline implicit getters even if a StaticCallInstr is used
We have devirtualization logic which turns [InstanceCallInst]s to
[StaticCallInstr]s (which are subject to different optimizations).

This makes the inlining decisions done in dart-aot-v2 a little
bit closer to dart-aot.

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

Change-Id: If7961ad8f05ac2544f04044d05541a86a8074984
Reviewed-on: https://dart-review.googlesource.com/34000
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-01-10 22:11:49 +00:00
Alexander Markov d8f27c3841 [VM] Enable optimizations based on strong mode types
Strong mode types are queried from:

* Return types of interface targets of instance calls.
* Return types of static calls.
* Types of instance and static fields.
* Types of local variables (for initial types of phis).

The strong mode types are used to specialize int and double operations
and optimize 'is' checks.

https://github.com/dart-lang/sdk/issues/30480
Change-Id: I2302509f396eacfcab8ed41e3f50e8c74dd662fd
Reviewed-on: https://dart-review.googlesource.com/30386
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-12-19 19:23:22 +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
Martin Kustermann bf9dd5342f [VM] Inling recognized methods even without speculation in some cases
Change-Id: I40df1c7f89952463a15fc43f24cd8925047717cf
Reviewed-on: https://dart-review.googlesource.com/17446
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-11-01 15:11:24 +00:00
Martin Kustermann 239f45b5ca [VM] Combine use_speculative_inlining/inlining_blacklist into SpeculativeInliningPolicy
Change-Id: I20a1354842d825ed1df0a19de57405a6d4041bd8
Reviewed-on: https://dart-review.googlesource.com/17444
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-11-01 11:06:00 +00:00
Alexander Markov 55ff4a61c0 [VM, Compiler] Handle corner cases when optimizing IS using static types
This CL fixes optimization of 'x is T' using static (strong mode) types
in the following cases: T = Object, dynamic, Null or non-instantiated
generic type.

Issue: https://github.com/dart-lang/sdk/issues/30480
Change-Id: I6149cbdc2e4173f2ce18e7b0e019c1d44b728e19
Reviewed-on: https://dart-review.googlesource.com/14501
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2017-10-19 16:57:05 +00:00
Alexander Markov b9e61477ed [VM, Compiler] Enable inlining of static calls to recognized methods
Previously, a lot of recognized instance methods were inlined
only if they are called using InstanceCall instruction.
This CL enables inlining of such methods even if they are called
using StaticCall instruction. Such static calls may appear as the
result of devirtualization of instance calls.

Fixes slow-down of Flutter gestures/velocity_tracker benchmark when
devirtualization is enabled without --experimental-strong-mode.
(The slow-down was caused by inline heuristics rejecting to inline
several methods as their speculative bodies contain non-inlined
calls to recognized methods.)

Issue: https://github.com/dart-lang/sdk/issues/30480
Change-Id: Id0ec0669d0e3fe05aa708baec4a468892dbe7f8e
Reviewed-on: https://dart-review.googlesource.com/13200
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-10-11 22:32:47 +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
Alexander Aprelev ce427ac14f Revert "Revert "Introduce StaticCallNode::kNoRebind and use that in implicit closures.""
This reverts commit ade37f931e.

This re-lands RebindRule change with fixes for the "-mdebug--hot-reload" test failures.

Original commit is reverted in patch set 1.
Fixes are in following patch sets.

Bug:
Change-Id: I49375af9b891323fe05c670d77cbf880964aae54
Reviewed-on: https://dart-review.googlesource.com/9361
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2017-09-28 19:43:32 +00:00
Dmitry Stefantsov ade37f931e Revert "Introduce StaticCallNode::kNoRebind and use that in implicit closures."
This reverts commit 97393fd961.

TBR=aam@google.com

Change-Id: I8fc5f644e994faa20aa8b5c54f8d6227a054e39d
Reviewed-on: https://dart-review.googlesource.com/9220
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2017-09-28 08:44:48 +00:00
Alexander Aprelev 97393fd961 Introduce StaticCallNode::kNoRebind and use that in implicit closures.
Change-Id: I6219462fed278dbb90361c2084eed886c9245097

Revert "Revert "Introduce inline cache reload rule attribute to static call AST node and ICData.""

This reverts commit 162283c2f3.

This re-lands the change with original revert in Patch set 1, actual bug fix in next patch set.

Bug:
Change-Id: I6219462fed278dbb90361c2084eed886c9245097
Reviewed-on: https://dart-review.googlesource.com/8760
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-09-28 03:26:22 +00:00
Alexander Aprelev 162283c2f3 Revert "Introduce inline cache reload rule attribute to static call AST node and ICData."
This reverts commit 68a727fa5c.

Revert "Fix ICData::New() invocation. Follow-up to 68a727fa5cf5."

This reverts commit ac06b1c8ea.

Revert "Fix last ICData::New() invocation. Follow-up to 68a727fa5cf5."

This reverts commit da26ffc4de.

Bug:
Change-Id: Ia2d4e6a3c3a3a329982c90aded11e72bf25a9a34
Reviewed-on: https://dart-review.googlesource.com/8402
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2017-09-26 02:08:17 +00:00
Alexander Aprelev 68a727fa5c Introduce inline cache reload rule attribute to static call AST node and ICData.
Reload rule describes how inline cache has to be processed during hot reload, whether it should
be updated, reset or preserved.

Bug: dartbug.com/30639
Change-Id: I40b63ade786456ec48d4fa205a076654c2996bce
Reviewed-on: https://dart-review.googlesource.com/7586
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-09-25 20:18:58 +00:00
Alexander Markov 26c08fb53a [VM, Compiler] Add null checks to AOT call specializer
This CL inserts CheckNull instructions into appropriate places where
calls to int and double operators are specialized in AotCallSpecializer.
These checks are required for correctness.

Also, this CL adds tranformation of CheckedSmiComparison into int64
RelationalOp/EqualityOp instructions during canonicalization, as more
accurate type information may become available at later compilation
stages. This optimization counters early insertion of CheckedSmiComparison
instructions performed by AotCallSpecializer speculatively, without
sufficient knowledge of types (with sufficient knowledge it would insert
int64 operations at the first place).

Issue: https://github.com/dart-lang/sdk/issues/30480
Change-Id: I150cd25bd5d9b4c9fc1c2e7d175025760ca9702d
Reviewed-on: https://dart-review.googlesource.com/6348
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2017-09-19 21:44:24 +00:00
Alexander Markov 691845c4dc [VM, Compiler] Optimize certain operations using strong mode types
This CL is a draft implementation of optimizing 'is', int and double
operators using statically known strong mode types in Dart VM AOT.
As of now, not all cases are handled and null checks are not inserted
(required for correctness). The new logic is added under
--experimental-strong-mode flag.

The primary reason for submitting this code is to keep up with ongoing
refactoring of Dart VM compiler.

Issue: https://github.com/dart-lang/sdk/issues/30480
Change-Id: Ia441fa3e346a184a1e5c87d0749aec652e2cde0a
Reviewed-on: https://dart-review.googlesource.com/4144
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-09-08 16:50:32 +00:00
Vyacheslav Egorov d6eb8c6c27 [VM, Compiler] Deduplicate JIT and AOT call specializing passes and rename them.
Originally these passes were a single confusingly named flow_graph_optimizer
pass, they later were completely split by duplicating flow_graph_optimizer
twice as jit_optimizer.cc and aot_optimizer.cc and tweaking them in few
places.

Duplication has been done in anticipation that these passes will diverge
considerably, however simple diffing reveals that in 2 years they have
not actually diverged much at all.

Diffing also reveals numerous bugs and inconsistencies between jit_optimizer
and aot_optimizer.

It does not make sense to keep these files duplicated so this change merges
them back together - extracting most of their common behaviour into
CallSpecializer base class.

The separation is not entirely clean - for simplicity we introduce
the knowledge about precompiled_mode into CallSpecializer base class.

You can look for FLAG_precompiled_mode and FLAG_use_field_guards in the
call_specializer.cc to see where base class has to be aware about both AOT and
JIT mode.

This change also renames XyzOptimizer to XyzCallSpecializer because the main
optimization these classes were doing was specialization of calls based on
type feedback or inferred types.

Bug: https://github.com/dart-lang/sdk/issues/30575
Change-Id: I0b062c4b7549d08b1bee9303d92a3fb549f54e21
Reviewed-on: https://dart-review.googlesource.com/3640
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2017-09-07 16:52:54 +00:00