After dab60b485c we decide to use shared
slow path for BoxInt64Instr based on FLAG_use_bare_instructions.
However, even in --use_bare_instructions mode we might be compiling
something before VM isolate stubs are replaced with isolate-specific
stubs. In such case we shouldn't use shared slow path as
BoxInt64Instr::EmitNativeCode generates PC-relative call to the stub.
This change fixes the assertion
../../runtime/vm/compiler/backend/il_arm.cc: 4650: error: expected: !stub.InVMIsolateHeap()
version=2.8.0-edge.dab60b485ca4544d58970d9be299d5aaf78cf9e5 (Thu Dec 19 17:29:12 2019 +0000) on "linux_simarm"
thread=28698, isolate=isolate(0x5640171cd800)
pc 0x000056401446060c fp 0x00007ffec2747190 dart::Profiler::DumpStackTrace(void*)
pc 0x00005640141d23b2 fp 0x00007ffec2747270 dart::Assert::Fail(char const*, ...)
pc 0x00005640145fa85d fp 0x00007ffec2747300 out/DebugSIMARM_X64/gen_snapshot+0xa1285d
pc 0x00005640145b35b6 fp 0x00007ffec2747470 dart::FlowGraphCompiler::VisitBlocks()
pc 0x00005640145bfd94 fp 0x00007ffec27474a0 dart::FlowGraphCompiler::CompileGraph()
pc 0x000056401454aa07 fp 0x00007ffec2747af0 dart::PrecompileParsedFunctionHelper::Compile(dart::CompilationPipeline*)
pc 0x000056401454cf3f fp 0x00007ffec2747d00 out/DebugSIMARM_X64/gen_snapshot+0x964f3f
pc 0x000056401454765e fp 0x00007ffec2747da0 dart::Precompiler::CompileFunction(dart::Precompiler*, dart::Thread*, dart::Zone*, dart::Function const&)
pc 0x0000564014470016 fp 0x00007ffec2747de0 out/DebugSIMARM_X64/gen_snapshot+0x888016
pc 0x000056401446d72c fp 0x00007ffec2747e70 dart::ProgramVisitor::VisitClasses(dart::Visitor<dart::Class>*)
pc 0x000056401446d9f3 fp 0x00007ffec2747f00 dart::ProgramVisitor::VisitFunctions(dart::Visitor<dart::Function>*)
pc 0x000056401453e474 fp 0x00007ffec27480c0 dart::Precompiler::DoCompileAll()
pc 0x000056401453e245 fp 0x00007ffec27484b0 dart::Precompiler::CompileAll()
pc 0x00005640149c60eb fp 0x00007ffec2748570 Dart_Precompile
pc 0x00005640141a7a5f fp 0x00007ffec27486f0 dart::bin::main(int, char**)
-- End of DumpStackTrace
in debug mode.
Change-Id: I5095e8def7b3d8067423455f32bce5aea1e0c381
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129141
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
BoxInt64Instr::MakeLocationSummary pretended that it is using shared
slow path, but it was not actually used in --no-use-bare-instructions mode.
As a result, BoxInt64Instr slow path pushed only live registers, but
stack map was generated for all registers. This caused various crashes,
mostly in GC.
The fix is to correctly create LocationSummary with kCallOnSlowPath
instead of kCallOnSharedSlowPath if we're not going to use shared
slow path (if --no-use-bare-instructions is specified).
Fixes https://github.com/dart-lang/sdk/issues/39853
Fixes https://github.com/dart-lang/sdk/issues/39854
Change-Id: Iaba7cd7d88143f2621a007c8559b932bb171de4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129004
Reviewed-by: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This change stops seting unbox_numeric_fields flag to false in AOT.
It also sets the speculative mode to be non speculative for store
unboxed fields instructions in AOT, since unboxing is done based on TFA.
Change-Id: Ic7a6391f8569e22eea13128251d83d109b06083c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127884
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This CL is responsible for inlining Float32x4 and Float64x2 arithmetic
operations in order to reduce their run-time cost.
Null-checks were required in order to allow the unbox instructions to
be non-speculative.
CheckNullInstr was modified to throw ArgumentError when checking
arguments for those operations.
Change-Id: I18b36d96a36011647480f301eb6dc6bb478f59a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128589
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
index to fix VMs coverage issue
This CL fixes the VM not always reporting coverage for mixin usages
properly.
* When asking the VM for coverage you can do it in one of two ways
* Ask the VM for coverage for everything; or
* Ask the VM for coverage for a specific script
* Asking the VM for coverage for everything works perfectly fine.
The VM goes through everything and reports coverage correctly.
* Asking the VM for coverage for a specific script (which is, at least
now, what the flutter tools does) doesn't work in the simple mixin
case described at http://dartbug.com/39779: The VM goes through the
libraries, asking for the list of scripts they "know about",
and checks for matches against what you asked for.
In this case, when asking for 'master.dart', the library for
'lib.dart' says no when it shouldn't --- because of the way the mixin
transformation works the content is actually in lib.dart.
This CL updates the content of the field 'sourceReferences' on Library
to fix the issue.
Fixes#39779
Change-Id: I0c38a323c81d1784ade704837b67ece549fc95d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128585
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
In the current compiler pipeline, PushArgument instructions can
end up outliving the calls to which they are an argument in some
circumstances. For example, the PushArgument is left in the graph
if it also appears in the environments of interleaving instructions.
When the dead code eliminator calculates liveness of a definition,
it ignores appearances in PushArgument instructions. Instead, it
looks for uses of the definition either directly or via
PushArgument in the arguments of calls and environments of other
instructions in the graph. An separate pass run before DCE
removes environments from instructions, so a definition used only
in PushArguments that have outlived their calls is considered dead.
The current DCE removes dead definitions but leaves PushArgument
instructions be. For orphaned PushArguments of dead definitions,
this means after DCE they now reference definitions no longer in
the graph.
This change instead checks the definitions referenced by
PushArgument instructions for liveness. If a PushArgument
references a dead definition, then the DCE removes the PushArgument
instruction, as its call must have already been removed (else
the definition would still be live), and environments, and thus
environmental uses, have already been removed from the graph.
Bug: https://github.com/dart-lang/sdk/issues/39767
Change-Id: I74c8e92a0d93f2aae42f8ff6f06ee70899b2f794
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128403
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Teagan Strickland <sstrickl@google.com>
If the dst_type of an AssertAssignable is a type parameter, the AssertAssignable
implementation will load the value of the type parameter using
the (instantiator or function) type arguments. It will then call the
type testing stub (TTS) of that type.
If the TTS is not exhaustive (e.g. because `T = X<..>` wher `X` is
implemented), it can fall back to the slower SubTypeTestCache implementation.
Right now the STC fallback will get the loaded value of the type
parameter for `dst_type` instead of the type parameter. Doing so is
incorrect.
=> This CL ensures we preserve dst_type = TypeParameter for the STC
fallback.
Issue https://github.com/dart-lang/sdk/issues/39716
Change-Id: Id5b318ed4940b4d749f6ab8b4c2a4efc295d9dde
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127888
Auto-Submit: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
There's just one case where we can't get the offset for Instructions
from somewhere else, and that's when we reset active_instructions_ to
instructions_ in Code::Enable(). Thus, we add a caching field for the
uncached offset to RawCode, but only when the active_instructions_
field is added (when not running in the precompiled runtime).
We also output the unchecked offset in snapshots for Code objects so
we can recalculate the entry point cache on loading. (For full JIT
snapshots, we output both the cached offset and the offset for
active_instructions_.)
Bug: https://github.com/dart-lang/sdk/issues/38451
Change-Id: I78572ec83d1574b00820df148bccb57e5c79eaaa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125400
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Teagan Strickland <sstrickl@google.com>
This reverts commit 20ec71d447.
Reason for revert: Performance regressions and seemingly broken TypedData.* benchmarks.
Original change's description:
> [vm/compiler] Fix TypeTestingStub -> SubtypeTestCache fallback code if dst_type = TypeParameter
>
> If the dst_type of an AssertAssignable is a type parameter, the AssertAssignable
> implementation will load the value of the type parameter using
> the (instantiator or function) type arguments. It will then call the
> type testing stub (TTS) of that type.
>
> If the TTS is not exhaustive (e.g. because `T = X<..>` wher `X` is
> implemented), it can fall back to the slower SubTypeTestCache implementation.
>
> Right now the STC fallback will get the loaded value of the type
> parameter for `dst_type` instead of the type parameter. Doing so is
> incorrect.
>
> => This CL ensures we preserve dst_type = TypeParameter for the STC
> fallback.
>
> Issue https://github.com/dart-lang/sdk/issues/39716
>
> Change-Id: Idea2405efbdc01c031ee68dbb345820e721533eb
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127640
> Commit-Queue: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Régis Crelier <regis@google.com>
TBR=vegorov@google.com,kustermann@google.com,regis@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I79f2d7db8747743a778126088e375bb4d268c91a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128020
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
When trying to inline SIMD shuffle operation in InlineSimdOp
(inliner.cc), FunctionEntry instruction was created and inherited
deopt_id and environment from call. Inheriting environment also
added FunctionEntry into env_use_list of other instructions.
If inlining didn't actualy happen due to invalid mask argument,
created FunctionEntry still left in the env_use_list.
Later optimization passes (for example AllocationSinking) may crash
while trying to update environment uses of instructions.
Fixes https://github.com/dart-lang/sdk/issues/39520
Change-Id: I6bdb7c6f7a7947259ea5ad097d05eebe5d73269b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127802
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
If the dst_type of an AssertAssignable is a type parameter, the AssertAssignable
implementation will load the value of the type parameter using
the (instantiator or function) type arguments. It will then call the
type testing stub (TTS) of that type.
If the TTS is not exhaustive (e.g. because `T = X<..>` wher `X` is
implemented), it can fall back to the slower SubTypeTestCache implementation.
Right now the STC fallback will get the loaded value of the type
parameter for `dst_type` instead of the type parameter. Doing so is
incorrect.
=> This CL ensures we preserve dst_type = TypeParameter for the STC
fallback.
Issue https://github.com/dart-lang/sdk/issues/39716
Change-Id: Idea2405efbdc01c031ee68dbb345820e721533eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127640
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
The nullability of runtimeType must be consistent with the nullability of
a class DeclarationType. Currently, it is always kLegacy. However, this
needs to be set to kNonNullable when the NNBD experiment is enabled.
Note that the nullability of the null instance remains kNullable.
Change-Id: I4ba974c2551c3a7fbd190b02175804090f9b48b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125721
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
Arguments to simd type constructors were being checked in the bootstrap
natives entrypoint but not elsewhere. Checking for null in Dart code
ensures that we don't accidentally miss these checks in AOT.
The changes to sdk_nnbd are required in order to ensure the number of
arguments passed to native code match the number of arguments from the
non-NNBD implementation (we needed to remove the implicit type args
parameter).
Fixes https://github.com/dart-lang/sdk/issues/39518
Change-Id: Iaf7d8790c154f1e85db613b6dc84004c8013df9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126905
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
We eagerly add objects into the global object pool while generating
code. However code generation can be aborted and retried at any point
due to various reasons (branch distance or speculative inlining). Such
bailouts and retries would leave dead global pool entries behind.
This CL avoids this by switching to a accumulate&commit scheme for
populating global object pool.
This solution is not entirely clean because we sometimes perform
nested code generation (i.e. to create allocation stubs) which
means that we can't always commit accumulated entries into the
global pool at the same indices as we expected them to be - meaning
that commit can fail and we have to retry compilation.
We try to minimize amount of retries by pregenerating some stubs
ahead of the main code generation.
Change-Id: I5bd3f70272cf49189b754f3a9a2c31d2e6165353
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126343
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>