Commit Graph

11 Commits

Author SHA1 Message Date
Ryan Macnak 571908fbec [vm, compiler] Make UnboxedConstant more like Constant.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/45555
Change-Id: Ib396b0281d4e138cc252baacaac18e42057d7bb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194502
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-04-21 22:45:31 +00:00
Vyacheslav Egorov 4e027fae97 [vm/compiler] Force unboxing of int phis on 64-bit platforms
More specifically on 64-bit platforms, when other heuristic fail:

- in AOT mode unbox all int typed phis.
- in JIT mode unbox all non-Smi int typed phis i.e. mixed
  Mint/Smi phis.

This brings treatment of int phis closer to how we treat other
boxed phis.

This considerably improves AOT code quality for loops which
our current conservative heuristic does not currently hit,
for example:

  void foo(int start, int end) {
    for (var i = start; i < end; i++) {
    }
  }

Code like this would use a boxed Phi previously which does not make
sense.

In JIT mode to really benefit from aggressive unboxing we
might need to shift from over-reliance on Smi operations, e.g.
when phi is unboxed we want to cascade that through and unbox
operations which are performed on it transitively. This requires
much more sophisticated algorithm and is outside of scope for this
change.

In AOT we in general treat all arithmetic operations as operations
over 64-bit int values so unboxing phis makes more sense.

As a result of this change we see small improvement in code size:

  flutter_gallery_app_so_gzip_size -0.2392%

TEST=ci


Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try
Change-Id: Iae9a16f353e53f649da4e665d2812ad47099a674
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187860
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-03-11 22:20:51 +00:00
Alexander Markov 7588ed86de Remove bytecode mode from the VM
Change-Id: Ief167b7ffc128105a03cc225ab750234c9a6a7a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169147
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-10-28 17:42:35 +00:00
Alexander Markov cae620386e [vm/bytecode] Update Inliner_List_generate unit test in bytecode mode
Flow graph slightly changed in bytecode mode after
https://dart-review.googlesource.com/c/sdk/+/153388.
So unit test should be updated accordingly.

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

Change-Id: I095c40831436083b63a7bb0d1d95500e1b1077e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153680
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-07-14 18:28:10 +00:00
Martin Kustermann 142e15c2af [vm/compiler] Use unboxed index/length for GenericCheckBoundInstr on 64-bit architectures
flutter-release:

  * flutter_app_so_size: -0.47%
  * flutter_app_so_brotli_size: -0.48%
  * flutter_app_so_gzip_size: -0.57%

flutter-release-sizeopt:

  * flutter_app_so_size: -0.45%
  * flutter_app_so_brotli_size: -0.64%
  * flutter_app_so_gzip_size: -0.65%

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

Change-Id: If63b71e5d52f6ddb55fe05668a6480eb00a13303
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150300
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-06-22 19:55:36 +00:00
Alexander Markov 48fbdf8408 [vm/compiler] Fix vm/cc/Inliner_List_generate on simarm and dartkb
Fixes https://github.com/dart-lang/sdk/issues/42402

Change-Id: Id0403c1974d71f21f6f5dcfad8ffebe4f41f2e91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151782
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-06-19 16:02:43 +00:00
Alexander Markov 411272691c [vm/compiler] Add extra call specialization pass during inlining
After constant propagation is performed on the callee function body
during inlining, there are extra opportunities for specializing
calls. Unspecialized calls are not inlined, so it is important to
specialize those calls during inlining to open further opportunities
for inlining.

With this extra pass inliner is able to inline get:length after
specializing inlined List.generate constructor, and eliminate
bounds check from the initialization loop.

This change improves micro-benchmark creating 100,000 lists using

      List<int>.generate(1000, (int x) => x, growable: false);

in AOT mode on x64 from 308ms to 167ms.

This makes it on par with pre-NNBD fixed-size list initialization:

  var result = List<int>(1000);
  for (var i = 0; i < 1000; i++) {
    result[i] = i;
  }

In fact, after all optimizations final flow graph (and generated
code) for List.generate and explicit loop become very similar.

This change has no effect on Flutter gallery size in release mode.

Issue: https://github.com/dart-lang/sdk/issues/42283
Change-Id: I3566386608733226e1c11cb5d6892cd869e564d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151466
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-06-18 15:46:40 +00:00
Martin Kustermann 5f627b7a54 [vm/compiler] Fix inliner bug which did not emit an explicit unboxing instruction for the value
The StoreIndexedInstr have been changed to require their value to be
unboxed. Even though SelectRepresentations will insert an unboxing
instruction, we want to manually create the unbox instruction to ensure
it is marked as truncating.

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

Change-Id: I31e2204c6ecacd0d27ac9b6fd71974c84b882ef2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110912
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-07-30 11:51:27 +00:00
Teagan Strickland 0bcb607868 [vm/compiler] Reland "Fix receiver redefinition type for poly inlining."
In cases where the same target function is used for multiple
CID ranges, we only perform the inlining once. However, if the
CID range used for the initial inlining is a single CID, we will
set the type of the redefinition to that CID.

Detect this case and clear the concrete type associated with
the redefinition if it was given one.

Change-Id: I9f9bdd7c21e0dc1ac537f8facece0010630bd9aa
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-debug-x64-try,vm-kernel-win-release-ia32-try,vm-kernel-win-product-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105221
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-06-06 13:22:09 +00:00
Ben Konyi 664a3f04b3 Revert "[vm/compiler] Fix receiver redefinition type for poly inlining."
This reverts commit cf2e2e88e1.

Change-Id: I9f1e787b95dea4b678bae68678304cc8998f6698
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104944
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-06-04 23:19:20 +00:00
Teagan Strickland cf2e2e88e1 [vm/compiler] Fix receiver redefinition type for poly inlining.
In cases where the same target function is used for multiple
CID ranges, we only perform the inlining once. However, if the
CID range used for the initial inlining is a single CID, we will
set the type of the redefinition to that CID.

Detect this case and clear the concrete type associated with
the redefinition if it was given one.

Change-Id: I3c27c46c71e10e71624ce3b969cb741eb9b2915f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104781
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-06-04 16:51:36 +00:00