Commit Graph

156 Commits

Author SHA1 Message Date
Ryan Macnak b2a1e758d0 [test] Add regression test for issue 45674.
Fixed by 55645786bc.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/45674
Change-Id: Ibe3872710b98e69c1ac9dd216c424e8b42536331
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195187
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-04-14 18:12:35 +00:00
Alexander Markov 38d05280e5 [vm/compiler] Fix materialization of Float32List
Before value is stored into Float32List, it is converted to 32-bit
float using DoubleToFloat instruction. If allocation sinking
eliminated the allocation of Float32List but we need to deoptimize,
the list is materialized and elements are filled. In such case,
we shouldn't perform double->float conversion as it already happened.

This change also updates the assertion in DoubleToFloatInstr::Canonicalize
which verifies that DoubleToFloat instruction can be used only
in certain cases.

TEST=tests/language/vm/allocation_sinking_arrays_test.dart
Fixes https://github.com/dart-lang/sdk/issues/45547

Change-Id: I9a1bd28a9fc09bccad6aa3c91a7880abd002f7c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193831
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-04-02 01:36:28 +00:00
Ryan Macnak b888aeba16 [vm, compiler] Compute narrow types for unboxed fields even when their static types are wider than the unboxed type.
Fixes range analysis for loads of such fields.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/45524
Change-Id: I3d0bf8b3d988b74efadabcb52d06212745bb1ec3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193745
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-04-01 18:29:12 +00:00
Ryan Macnak 76e41bc4c5 [vm, compiler] Use correct size of Smi when truncating during constant folding.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/45525
Change-Id: I048a90eade678f610f0fd4451b099711a1faa957
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193750
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-04-01 16:19:42 +00:00
Ryan Macnak 2c371ff74e [vm, compiler] Respect --use_slow_path in CheckedSmiOp/Comparison.
TEST=ci
Change-Id: Ib2b1a9b067beb1cbeea2b12355e62a45396697f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192726
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-03-25 17:39:24 +00:00
Tess Strickland bf74cad477 [vm/compiler] Change when parents of local functions are retained.
Now they are only retained if one of the following is true:

* The parent is Future.wait or Future.timeout.
* The local function is a generated body of an async/async*/sync*
  function.
* Symbolic stack traces are enabled.

When a local closure's parent is dropped, the parent name will
be printed as `<optimized out>` in places like exceptions.

Changes in Flutter gallery in release-sizeopt mode:

* ARM7: ROData -1.41%, Isolate snapshot -2.35%, Total snapshot -0.54%,
        Isolate heap -1.38%, Total heap -1.38%
* ARM8: ROData -1.55%, Isolate snapshot -2.34%, Total snapshot -0.65%,
        Isolate heap -1.41%, Total heap -1.41%

TEST=Existing tests on CI.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try, vm-kernel-precomp-dwarf-linux-product-x64-try
Change-Id: I9d05f9e0e30e9f428eff16a15b0f1eeb974419c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190023
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-03-25 13:47:03 +00:00
Alexander Aprelev 6b3abe0a98 [vm/concurrency] Add --experimental_enable_isolate_groups_jit flag, make --enable_isolate_groups AOT only.
Issue b/177800357.

TEST=existing test suite
Change-Id: Id6b113932ab7014b8fa6c105845c5c490b60f5e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181320
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-27 17:11:29 +00:00
Clement Skau 2d36c85ff8 [vm] Removes support for --causal-async-stacks
All existing embedders have been opted into --lazy-async-stacks, the
VM also uses it as it's default in all configurations.

After this CL, any user of --causal-async-stacks will get an error
message when trying to use it.
=> In any such case, please simply remove the flag.

TEST=Exhaustive CQ.

Bug: https://github.com/dart-lang/sdk/issues/37668
Change-Id: Ia440afcf2dba464aa8b8cf381b93bbac8eb9f8dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172564
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-12-01 07:27:14 +00:00
Alexander Markov dea3fa7b8c [vm/compiler] Allocation sinking of arrays and typed data objects
JIT mode: ParticleSystemUpdate +44-52%
JIT mode with null safety: ParticleSystemUpdate +40-44%

In AOT mode a few methods from package:vector_math are not inlined
in ParticleSystemUpdate benchmarks, which prevents allocation
sinking optimization.

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

Change-Id: I28d5816e643e4cfffe4b4fb7db5db5a3aa72499c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164805
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-10-16 20:05:02 +00:00
Nicholas Shahan cdd1260ef0 [tests] Move regression test to run on all backends
This same error recently surfaced on a flutter web target.

Change-Id: If4c093cde85887105e93ab46469b1c3b2ea55d03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162243
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-09-14 21:13:37 +00:00
Tess Strickland 9329995dd8 [vm] Add a separate invoke field dispatcher for dynamic closure calls.
Adds TODO comments in appropriate places for future work that will move
non-covariant type checks out of the closure body. Instead, the VM will
perform them in the invoke field dispatcher (or NoSuchMethodFromCallStub
if --no-lazy-dispatchers is used) when a dynamic call is detected.

This change has minimal negative effects on the code size. Here are the
code size change percentages for the Flutter Gallery in release mode:

* ARM7
  * Instructions: +0.0391%
  * ROData: -0.0040%
  * Total: +0.0239%
* ARM8:
  * Instructions: No change
  * ROData: +0.0015%
  * Total: +0.0004%

All other code size benchmarks are also <0.01% increase.

Bug: https://github.com/dart-lang/sdk/issues/40813
Change-Id: I4bf145803bb9e2d4ba5c22c12b6fd3bb5368441d
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-dartkb-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151826
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-02 13:16:19 +00:00
Robert Nystrom 2034061433 Migrate language_2/vm to NNBD.
Change-Id: I313a57ed7c7ea2ada75065f55a7367376f6bdae5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152183
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2020-06-25 20:39:23 +00:00
Alexander Markov 32d4ac903b [vm/aot/tfa] Fix crash while getting static type context for signature shaking
Fixes https://github.com/flutter/flutter/issues/56479

Change-Id: I3e308382bf64b1b1aa39174c2095ee7a465907a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146980
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-05-07 00:56:02 +00:00
Alexander Markov d2ae466056 [vm/aot] Update references from types to mixin applications after deduplication
CFE may use anonymous mixin application classes in types after
applying LUB (Least Upper Bound) algorithm in conditional expressions,
and then those types can spread via type inference.

After anonymous mixin application classes are deduplicated, all
references to removed mixin applications from types should be
updated to point to the remaining mixin application.

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

Change-Id: I7860b2868cb153d125fec363c1653b7aa16521e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145501
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-04-29 23:54:08 +00:00
Alexander Markov 99f619907e [vm/aot/tfa] Fix tracking of parameters in async_op closures
Issue: https://github.com/flutter/flutter/issues/51828
Change-Id: I9b99c74eda66f180261f4cb25361b8fe8eaef561
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141340
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-03-27 15:47:11 +00:00
Leaf Petersen 7aace6fa60 Make StackTrace generally not nullable in migrated NNBD library.
Bug: https://github.com/dart-lang/sdk/issues/40130
Change-Id: I13aba0c2a3fa5b1c3d3995f075ffd38f03aca897
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139880
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2020-03-19 23:31:30 +00:00
Leaf Petersen 5e9be81d5e Make all CastErrors be TypeErrors.
This makes CastError implement TypeError, and changes all test
expectations to look for TypeError.  A followup CL will deprecate
CastError.

Bug: https://github.com/dart-lang/language/issues/787
Bug: https://github.com/dart-lang/sdk/issues/34097
Change-Id: I7102c6260901317572d2df08c4be9c4c48197688
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138670
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-03-11 23:31:06 +00:00
Alexander Markov 82236bd6ab [vm] Fix incorrect inference of non-nullability from 'is' checks
Fixes https://github.com/dart-lang/sdk/issues/40792
Fixes https://github.com/dart-lang/sdk/issues/40795

Change-Id: I0af455040e05265a025b1a424c1aac30f3476f95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137426
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-02-27 03:35:34 +00:00
Clement Skau 9c05fde96b [Cleanup] Removes deprecated --gc_at_instance_allocation.
The flag only appears in two tests and a comment.
Flag was removed in https://dart-review.googlesource.com/c/sdk/+/83120

Change-Id: I2a5d828c8ec7909a3d16579f9a9771176aabb65e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136974
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-02-26 15:00:26 +00:00
Clement Skau 250f0e83ea [Cleanup] Removes deprecated --enable-inlining-annotations; updates annotation.
The --enable-inlining-annotations flag was removed a while ago and the uses
were attempted removed in https://dart-review.googlesource.com/c/sdk/+/99148
but was later reverted in https://dart-review.googlesource.com/c/sdk/+/109320.

This removes the two last cases of this flag.

Change-Id: I157dd7bce0a49ab01100fa6f48d96eeefdb06b45
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136969
Reviewed-by: Teagan Strickland <sstrickl@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-02-25 12:09:10 +00:00
Clement Skau 26ada4363a [SDK] Fixes remaining issues with --lazy-async-stacks on.
- Handle bytecode for e.g. dartkb-simarm64 does not have source position.
- Use existing GetCallerSp() instead of working across frames.
- Nit: Adds clarifying comments to test.
- Nit: Updates name of non-async-stack test to clarify flags used.

Tested:
- CQ with --lazy-async-stacks on by default.
- vm/dart/causal_stacks and language_2/vm/causal_async_exception_stack_test with current flags.

Bug: https://github.com/dart-lang/sdk/issues/39525
Change-Id: Ie6581a734cdcafbd4fb641bd86bffc03ed241532
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133063
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-01-31 10:45:21 +00:00
Martin Kustermann 9520235bfe [vm/async] Ensure all service tests run with both, --causal-async-stacks/--lazy-async-stacks
Running all existing tests with/without lazy async stacks ensures that
the existing functionality for --lazy-async-stacks does not regress.

There are still a few smaller things to be done in the debugger for lazy
async stacks.

This CL also ensures:

   * The inner closure, i.e. AsyncClosure/AsyncGenClosure, is not
     inlined if FLAG_lazy_async_stacks is on.

   * Fixes a crash in dartkb mode, when the function of the Bytecode
     object is null.

   * Does a simple integration of the lazy async stacks in debugger.cc -
     to ensure a stack is returned via vm-service.

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

Change-Id: Ibc1e887a457e2c456ae65d9ed5fa92434f122a32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131825
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-01-16 12:47:03 +00:00
Martin Kustermann 5aa86eb123 [vm/concurrency] Run all isolate related tests with/without enabling isolate groups
Issue https://github.com/dart-lang/sdk/issues/36097

Change-Id: I0b7eca744bc49ab5ba09da3ce2a9286b1ed3c70f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126340
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2019-11-27 17:23:31 +00:00
Aart Bik e12a7e0ca2 Fix for OSR assert (debug) or crash (release)
Rationale:
Rename traverses blocks in DOM order, not in execution order.
As a result, blocks that are directly entered from the entry
should introduce synthetic phis during OSR with non-empty stack
to make sure incoming stack values are merged properly.

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

Change-Id: Ic35961169aa535657333c2ab14fbd2c4e1f0783f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125489
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-11-18 22:33:05 +00:00
Aart Bik 29ff784ecb [dart/compiler] Loop analysis and BCE improvements
Rationale:
Loop analysis did not take outer indices used as bounds
(triangular loops) into account to enhance analysis. This
left some obvious BCE optimizations on the table (mainly AOT).

Observed improvements (performance and code size):

About 5-15% performance on golem benchmarks:
   mainly armv7, and TypedData*Bench

Minor overall code size reduction on flutter gallery (arm32,arm64)

Comparing ./orig32.json (old) to ./new32.json (new)
Old   : 6614912 bytes.
New   : 6600336 bytes.
Change: -14576 bytes.

Comparing ./orig64.json (old) to ./new64.json (new)
Old   : 6459216 bytes.
New   : 6458736 bytes.
Change: -480 bytes.

Similar on velocity_tracker_bench (arm32,arm64)

Comparing orig32.json (old) to new32.json (new)
Old   : 804280 bytes.
New   : 794552 bytes.
Change: -9728 bytes.

Comparing orig64.json (old) to new64.json (new)
Old   : 705520 bytes.
New   : 705312 bytes.
Change: -208 bytes.

Change-Id: Ifc3b3a378ae6fd98743c48944a86a9e90ce4da5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117200
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-11-18 19:51:13 +00:00
Samir Jindel 6c5033acac Re-land "[vm/async] Don't add an <asynchronous gap> marker along sync-async calls."
Original change is in patchset 1.

The issue was that the expected "_Closure.call" frame is not always present.

Change-Id: I91116861e785a72536dde300f4771de4f6fa9d3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124988
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-14 15:29:16 +00:00
Régis Crelier b5110a59a9 Revert "[vm/async] Don't add an <asynchronous suspension> marker along sync-async calls."
This reverts commit f4d930997b.

Reason for revert: Different tests are failing on different bots.

Original change's description:
> [vm/async] Don't add an <asynchronous suspension> marker along sync-async calls.
> 
> This fixes `package:stack_trace` in the sync-start case of async/async* calls.
> 
> Change-Id: I5c41a35283439f533ab19c9fd1cc542931de4b43
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124560
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=kustermann@google.com,sjindel@google.com

Change-Id: Ib3e1b303613f0393dac6b1b81e8d1ffb322052b8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124800
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-11-11 19:03:54 +00:00
Samir Jindel f4d930997b [vm/async] Don't add an <asynchronous suspension> marker along sync-async calls.
This fixes `package:stack_trace` in the sync-start case of async/async* calls.

Change-Id: I5c41a35283439f533ab19c9fd1cc542931de4b43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124560
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-11 16:36:43 +00:00
Alexander Markov fa43799461 [vm/bytecode] Check number of type arguments in non-generic closures
Fixes https://github.com/dart-lang/sdk/issues/39283

Change-Id: I5a5fdf158c6a7ce068be36754ea0487cb754584b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124470
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-11-08 17:16:37 +00:00
Aart Bik 74433e70da [vm/compiler] fix assertion bug in SSA builder
Rationale:
Our "front-end" may leave CreateArray on stack
in control-flow-collection (viz. BuildMapLiteral()
and BuildListLiteral()).

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

Change-Id: I423a431aa9fac985996fb09df6a98c46aed3d696
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122960
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-10-25 20:11:17 +00:00
Alexander Markov c19adc6355 [vm,aot] Fix handling of exported extensions in TFA tree shaker
Fixes https://github.com/flutter/flutter/issues/42845

Change-Id: If4734c16a46f74547f9fc92e4d4e26a969a9f809
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121861
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-10-16 21:07:26 +00:00
Aart Bik cf60eb48b9 [vm/compiler] reduced regression test size
https://github.com/dart-lang/sdk/issues/38741

Change-Id: Ief99230c19dd55fb300f94049f320f276461c86c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121409
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-10-11 21:15:20 +00:00
Aart Bik 9515301418 [vm/compiler] fix bug on need for check
Rationale:
When the static class type does not match information found
in ICData, we require a check on a mismatch. However,
unused data should not be considered

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

Change-Id: If7717bfbce2f2a09014ce3e7cdcbf34816102b9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121141
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-10-11 16:45:52 +00:00
Ryan Macnak 8a5e2a688b [vm, compiler] Consistently produce OutOfMemoryErrors for large variable-length object allocations.
Bug: https://github.com/dart-lang/sdk/issues/38575
Change-Id: I3f93488511519ac1dca04f91465efad3d2a0c66d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118886
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-09-30 20:19:03 +00:00
Aart Bik 5f32afdd4c [vm/compiler] patch up push arguments in environment
Rationale:
My great friends PushArguments again! During OSR, the replacement
of a lost PushArgument (due to having this on the expression stack
while OSRing) must also be reflected in the environment. Why? This
is used for the stack depth bookkeeping. Note that I added some logic
for this less-than-obvious assumption in the flow graph checker to
make sure we don't fall into this trap again (currently only for
instance methods, since the IR is not clean for the others, that
is yet TBD). With regression test!

https://github.com/dart-lang/sdk/issues/38412
https://github.com/dart-lang/sdk/issues/38577
https://github.com/dart-lang/sdk/issues/38602

Change-Id: I8e4ff67e3e0926ff3ee6b6ac0af05f7ea0dc5ea1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118913
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-09-30 20:05:53 +00:00
Aart Bik 78bd9f17a1 [vm/compiler] keep stack depth per block in stack IR
Rationale:
This simplifies finding the proper stack depth while
traversing the entries in the DOM tree during OSR.
Also enables asserting stack integrity on all paths
(OSR and non-OSR) more rigidly.

https://github.com/dart-lang/sdk/issues/38459
https://github.com/dart-lang/sdk/issues/38436
https://github.com/dart-lang/sdk/issues/38434

Change-Id: I3bc43def081013357e9a765e9e03fffe4c72dc6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118473
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-09-24 21:33:01 +00:00
Aart Bik 95d7749f48 [vm/compiler] OSR on non-empty stack integrity
Rationale:
Leaving a push argument on the stack in slightly more
complex flow graphs (try-catch, loop back, conditinals)
required a bit more bookkeeping. This CL also introduces
more integrity checks to make sure the stack is as
expected at each block and instruction.

Note:
Fuzzer is regression test for new feature.

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

Change-Id: I8f7e605937d76c1a429df601e69380111737dd94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116545
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-09-13 00:58:24 +00:00
Aart Bik 2305d9f3a6 [vm/compiler] Better be ready for OSR in field init
Rationale:
OSR was happening in a field initializer, but the kernel
binary flow graph builder assumed this never happened.
With regression test.

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

Change-Id: I91243b4422cac76ec7ee2460d466bd0e1cf608ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116558
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-09-10 22:17:22 +00:00
Aart Bik d9a9346c3f [vm/compiler] Fix truncating logic
Rationale:
The representation mask should not be used to
do the truncation, which is more subtle around
the sign bit. With regression test.

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

Change-Id: I9745f6d73f4761eb6210e0b60b2b0504994f5cbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115607
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-09-05 21:13:43 +00:00
Aart Bik 622747502e [vm/interpreter] Enforce consistent interpreter/compiler unboxing view
Rationale:
Both the interpreter and compiler had some logic on when fields
could be unboxed. Rather than duplicating this logic, this CL
uses the same methods to get a more consistent view of unboxing.
Note that this add a slight overhead to the interpreter, but
only a slight. We could avoid this by duplicating the logic
to enforce consistency, but this has the danger of getting
similar issues in the future.

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

Change-Id: Icf0c1ad518d75c63e9da72e1f75eaf1cf903587f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115301
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-09-04 00:52:27 +00:00
Aart Bik d1c9a2b06f [vm/compiler] Improve DIV and MOD performance
Rationale:
Mostly an AOT 64-bit improvement of DIV and MOV by constant
on X64_64. Also a few minor supporting optimizations
that were missed. With unit tests.

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

Change-Id: I2f12d6a24bbe983324521d7d4d778f20b34d18a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114901
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-08-29 20:32:10 +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
Martin Kustermann 48f8454960 [vm] Force raw variables created during scope building to be on the stack
Fixes https://github.com/dart-lang/sdk/issues/37984

Change-Id: I9aa283becbb836d4a0480f954aaa6d387bbc1fdc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114511
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-08-26 13:58:35 +00:00
Aske Simon Christensen 88c0c11612 Remove constant-update-2018 flag from tests.
Change-Id: I85d3d0180bb7f5973ad2da946a3519c553fc7f92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113991
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2019-08-22 11:00:54 +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 b0968395f1 [vm/compiler] Minor heuristic change to reduce code size
Rationale:
Inlining constant constructors/mixin is practically always
profitable. So the heuristics have been changed to at least
consider these even at higher depth (note that they are of
course still subject to actual heuristics while inlining).

This brings back flutter gallery size to where it was
before mixins were introduced.

head:

VMIsolate(CodeSize): 4737
Isolate(CodeSize): 2005123                     101%
ReadOnlyData(CodeSize): 2212408                103%
Instructions(CodeSize): 7006928                100%
Total(CodeSize): 11229196                      101%

improved heuristic:

VMIsolate(CodeSize): 4737
Isolate(CodeSize): 1985691
ReadOnlyData(CodeSize): 2152880
Instructions(CodeSize): 6987616
Total(CodeSize): 11130924

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

Change-Id: I28de0fa6c92a785bbc47e9fa09ed55ae68593c0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112758
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-08-12 23:17:43 +00:00
Aart Bik 193985777d [vm/compiler] Propagate call type to load indexed
Rationale:
AOT's TFA sometimes knows a bit more about the result
type of a call that is later recognized as an indexed
load. This CL preserves that type for later use, improving
decision on operations that consume this load.

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

Change-Id: I5f88e03b68b4f7aec6e39a8ca94f243c2796730d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112028
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-08-06 19:28:29 +00:00
Aart Bik 361d27e20b [dart/vm] Fix bug in parallel move/register allocator
Rationale:
Another one bites the dust due to fuzzing! The attached
small reproducer assert failed in debug and crashed
in release due to "any" allocation in the parallel move.

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

Change-Id: Ie9044cb7fa86dfdb1ba312599f57db76bec47611
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110540
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-07-30 20:42:05 +00:00
Teagan Strickland f822dfa3ea Reland "[vm/compiler] Implement new inlining pragmas."
This change introduces two new pragmas:

* `@pragma('vm:never-inline')`
* `@pragma('vm:prefer-inline')`

These replaces the old way of specifying AlwaysInline or NeverInline
annotations when the (now removed) --enable-inlining-annotations flag
was used.

Bug: https://github.com/dart-lang/sdk/issues/36571
Change-Id: Iee152c1d67abde8d58c58fa967449d36e77c8c93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110440
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2019-07-30 12:01:06 +00:00
Aart Bik 1ac0a36fcb [dart/vm] Fix division-by-zero bug in range analysis
Rationale:
The attached test, a simplified version from a case found
by fuzzing, yielded the range [4,4] for the left hand side
of the division but [25,0] (sic!) for the right hand side.
This reverse range caused the logic in the TRUNC evaluation
to pass the >= 1 test but introduce the division by zero
in the compiler code. The true culprit, however, was
the reason for [25,0] which was due to a difference
in C++ and Dart shift right semantics. This CL fixes
the bug and adds some sanity assert to find more of
such cases.

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

Change-Id: I60e07428435d99589e1177c113ef5e24e1611d0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110420
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-07-25 00:00:39 +00:00