Also ensure the number of parent type arguments is appropriately
adjusted in the returned FunctionType when partially instantiating
a FunctionType, and that free parent type arguments are _not_
included in types built while reading constants.
Since the number of parent type arguments is now cached there, we
no longer need to also cache them in ClosureData. We can also remove
the parent walking in Function::NumParentTypeArguments().
Previously, a FunctionType where the component types did not use
parent type parameters was considered instantiated. This CL changes
it so that FunctionType with free parent type parameters are never
considered instantiated. This is necessary because otherwise,
when instantiating the parent type parameters, a FunctionType that
does not use its parent type parameters will be used unchanged
instead of creating a copy with fewer parent type parameters.
Because of this, places where IsInstantiated was used to simply
check for generic parent functions (namely, for implicit closure
creation) has been appropriately weakened to check
!HasGenericParent() instead.
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
Change-Id: Ifb4a0a1273d8d01908cdf4ffc3c4c28a1c33ffa0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190021
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Unfortunately, we never capitalized on having it (e.g. original plan was
to use it for writing tests, among other things) and continuing to
maintain it does not make sense.
TEST=ci
Change-Id: I02b2c35149298a295aa0de75916d48434d4a3ea9
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,pkg-linux-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190220
Auto-Submit: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
When going from Int64 through another representation back into Int64
you can discard a conversion if and only if it does not lose some
bits on the way. Previously we were checking for truncation flag, but
this is incorrect because it does not actually tell us anything about
about whether or not bits are going to be lost.
Instead, we should be checking the range of the source value.
In addition to fixing potential correctness issues, this CL actually
improves quality of code generated for Uint8 loads because it removes
a redundant chain of Int64->Uint32->Int64 conversions that follows
the load (which compiled 2 two redundant moves).
Issue https://github.com/dart-lang/sdk/issues/40308
TEST=vm/cc/IL_IntConverterCanonicalization
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try
Change-Id: Ifef0943a50d414bde41b2194e30b58ad3a8c106c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187921
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
#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>
Rationale:
The range analysis carefully computes ranges on Smis such
that the results are valid for both JIT and AOT. So the
IsRedundant() tests between the speculative and non-speculative
bounds checks can be shared. This does not only reduce the
amount of code, but also improves actual bounds check elimination.
https://github.com/dart-lang/sdk/issues/37687
Change-Id: I883a16d4be4d3704cad3e42264e1f36a5afc3b89
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112167
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Martin Kustermann <kustermann@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>
Rationale:
With the new induction variable bounds in place, this
is the first very low hanging fruit. When a loop bound
matches the array bounds check, it is redundant. This
removes AOT non-speculative bounds checks for the first
time. More improvements to follow!
Change-Id: I5dac885a1ef6fdb64b5844a0617d2fe9d800d9d6
Reviewed-on: https://dart-review.googlesource.com/c/87940
Commit-Queue: Aart Bik <ajcbik@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Rationale:
Replacing the simple induction analysis in the range analyzer
with the new framework for finding induction variables removes
a lot of code and even saves some memory in the IR (for phis).
Note that this is only the first phase, i.e. using the new
framework for the same behavior in the range analyzer. In the
second phase, the new framework will be fully exploited to
compute more accurate ranges in many more cases.
Change-Id: Iae5bd5a155ef8592558b5bdb2388c5aa9da64e59
Reviewed-on: https://dart-review.googlesource.com/c/84500
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
This CL corrects handling of overflows in range analysis to
account for wrap-around (which happens with new integer semantics).
* If there is an overflow while doing computations in range
analysis, the resulting range is approximated as full int64 range.
* For symbolic range boundaries 'symbol + offset', offset is checked
to stay within [kMinInt64 - kSmiMin, kMaxInt64 - kSmiMax] in order
to guarantee that overflow doesn't occur.
Issue: https://github.com/dart-lang/sdk/issues/31920
Change-Id: I2c16adbe3597e9b718ed2f6ce7210426fcc9e6a6
Reviewed-on: https://dart-review.googlesource.com/39423
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
New folder structure (nested under vm/):
- compiler/
- jit/ - JIT specific code
- aot/ - AOT specific code
- backend/ - all middle-end and back-end code (IL, flow graph)
- assembler/ - assemblers and disassemblers
- frontend/ - front ends (AST -> IL, Kernel -> IL)
compiler/README.md would be the documentation root for the compiler
pipeline
Bug: https://github.com/dart-lang/sdk/issues/30575
Change-Id: I2dfd9688793bff737f7632ddc77fca766875ce36
Reviewed-on: https://dart-review.googlesource.com/2940
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>