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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>