This reverts commit 09d2025685.
Reason for revert: https://github.com/flutter/flutter/issues/84813
Original change's description:
> [VM/runtime] Handle generic types in intrinsics for type equality and runtimeType comparison.
>
> Generic types with equal class ids and equal type arguments are now considered equal by the intrinsics and a runtime call is avoided.
>
> Fixes https://github.com/dart-lang/sdk/issues/23746
>
> TEST=existing ones
>
> Change-Id: I668db119ac6d2525eac3a4f17a44f36c53b9dbf5
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203143
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Régis Crelier <regis@google.com>
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I4d02f0550d6b4c1409fb16b19664c3d750601ddc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204140
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Storing a persistent handle in [Message] objects instead of the
[Bequest] (which is just a wrapper around a persistent handle) will
allow us to use the same mechanism for sending copies of transitive
object graphs.
Since messages can have maps inside them that need rehashing, we'll
make the persistent handle point to an array of length 2 of the format:
array = [<message>, <array-of-objects-in-message-to-rehash>]
The sendAndExit doesn't use the second part atm (since it preserves
identities and therefore avoids the need for rehashing).
Though sending transitive copies of object graphs will require this
functionality (a follow-up CL which will land with this one).
For ease of reviewing this CL was split out.
Issue https://github.com/dart-lang/sdk/issues/36097
TEST=Refactoring, relying on existing test coverage.
Change-Id: I2afa78b42ef82d46477579623fd54f027136333f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203769
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
This change improves Function::Hash() to take owner class into account
(in addition to function name). This makes hash collisions less likely
to happen.
This change improves time of generating AOT snapshot for a large
Flutter application in Flutter/release mode for arm64:
158s -> 115s (-27%)
b/187020358
TEST=ci
Change-Id: Ie20e2c7a2b9ee42a22c278cbfd25b2bd716c19bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204003
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reduces VM code size by about 69k.
TEST=ci
Change-Id: I44298ed2be6f3b945b19656100ce4d6555741c9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203667
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This reverts commit ddfbe05eee.
Reason for revert: broke ARM32 builds
Original change's description:
> [vm/aot] Emit simple .eh_frame in ARM/ARM64 ELF snapshots.
>
> This allows simpleperf to unwind through AOT compiled frames and
> consequently allows Android tooling to produce useful
> timelines and flamegraphs.
>
> Note: emitted .eh_frame is rather primitive and does not cover all possible
> asynchronous unwinding cases (e.g. tick might arrive before Dart frame was
> fully setup). We will address this in a separate CL.
>
> Additionally, this CL tweaks .eh_frame emitted in assembly snapshots to
> workaround Android-specific unwinding bug in libunwindstack (b/191113792):
> current versions of libunwindstack don't push CFA value when evaluating
> DW_CFA_expression.
>
> TEST=tested manually
>
> Bug: b/184102680,b/190248517
> Change-Id: Iea209b2354cca0753385093f165b0320857104b1
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203771
> Commit-Queue: Slava Egorov <vegorov@google.com>
> Reviewed-by: Tess Strickland <sstrickl@google.com>
TBR=vegorov@google.com,sstrickl@google.com
Change-Id: I57ab5df1d567bb4ddea813024245ef606712a79c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: b/184102680,b/190248517
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203778
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
This allows simpleperf to unwind through AOT compiled frames and
consequently allows Android tooling to produce useful
timelines and flamegraphs.
Note: emitted .eh_frame is rather primitive and does not cover all possible
asynchronous unwinding cases (e.g. tick might arrive before Dart frame was
fully setup). We will address this in a separate CL.
Additionally, this CL tweaks .eh_frame emitted in assembly snapshots to
workaround Android-specific unwinding bug in libunwindstack (b/191113792):
current versions of libunwindstack don't push CFA value when evaluating
DW_CFA_expression.
TEST=tested manually
Bug: b/184102680,b/190248517
Change-Id: Iea209b2354cca0753385093f165b0320857104b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203771
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Generic types with equal class ids and equal type arguments are now considered equal by the intrinsics and a runtime call is avoided.
Fixes https://github.com/dart-lang/sdk/issues/23746
TEST=existing ones
Change-Id: I668db119ac6d2525eac3a4f17a44f36c53b9dbf5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203143
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
Call site attributes metadata is used to pass receiver static type
from kernel AST to the VM. In certain cases, call site metadata is
superseded by the new invocation nodes. This change revises how call
site attributes metadata is generated in call site annotator and
used in the VM for the new invocation nodes.
* When building flow graph for FunctionInvocation,
the decision to generate unchecked calls is now done by
looking only at the function access kind, without taking static
receiver type into account. Call site annotator now verifies that
static receiver type matches function access kind for
FunctionInvocation nodes to make sure nothing is lost during this
transition. Also, flow graph builder asserts that
function access kind is either Function or FunctionType.
* Call site metadata is no longer generated for LocalFunctionInvocation
and FunctionInvocation nodes, as it is no longer used by the VM.
* Call site annotator now verifies that InstanceInvocation nodes
cannot be used for unchecked closure calls. Flow graph builder no
longer recognizes unchecked closure calls for InstanceInvocation
and DynamicInvocation nodes.
* When generating flow graph for DynamicInvocation and DynamicSet,
call site metadata is no longer taken into account (metadata is not
generated by call site annotator for these nodes).
Also, 'this' receiver is not recognized for DynamicInvocation and
DynamicSet nodes as it may potentially violate dynamic call semantics.
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/45340
Change-Id: Ia8c5e547965ac8d7a17908d4be4bd048e5cfb23f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203668
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Adds support for marking external functions as @FfiNative's,
which will be called using fast FFI calls.
Resolution happens by calling out to a new embedder provided
Dart_FfiNativeResolver which the embedder can specify via
Dart_SetFfiNativeResolver.
TEST=vm/cc/DartAPI_FfiNativeResolver
Bug: https://github.com/dart-lang/sdk/issues/43889
Change-Id: I3cfff360b05314499a81444b90f4ea0a1b937b0b
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170092
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reduces VM code size by about 27k.
TEST=ci
Change-Id: I7bce096e7e0263a8f74b36ef7e88ecea915b3fbd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203141
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reduces VM code size by about 20k.
TEST=ci
Change-Id: I32b8f5fe8d6fe80da50da18e14630bc3b77657d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203142
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
The Incremental Kernel Compiler (IKG) will produce kernel files without
metadata.
Right now the VM will make all closure calls dynamic calls if the
call-site attribute metadata is not present. This causes closure code
to run significantly slower due to dyn:call forwarders and the type
checks it will perform.
This change takes - in addition to the metadata - the new
FunctionInvocation.kind into account - which also tells us whether a
function invocation is based on a real function type.
Fixes https://github.com/dart-lang/sdk/issues/46320
Fixes https://github.com/dart-lang/sdk/issues/45421
TEST=vm/cc/StreamingFlowGraphBuilder_TypedClosureCall
Change-Id: Ie1136c3727fc8b5e3e3b9822a1db9479fa9da689
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203302
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Makes (u)int8 and (u)int16 extended to 32 bits in registers on arm64
MacOS. This makes it consistent with iOS. (Now the calling convention
on arm64 MacOS is fully identical to arm64 iOS.)
TEST=runtime/vm/compiler/ffi/native_calling_convention_test.cc
TEST=tests/ffi_2/function_test.dart
Bug: https://github.com/dart-lang/sdk/issues/46305
This CL makes all remaining failing tests pass listed in the bug,
except for tests using `--use-slow-path`.
Change-Id: If0d93bfa774e561f39468d2b63fc9381b7646b18
Cq-Include-Trybots: luci.dart.try:vm-kernel-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203305
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
This change adds a new VM-internal class for sentinel objects.
Previously sentinel objects used class Never.
TEST=existing tests
Issue: https://github.com/dart-lang/sdk/issues/46141
Change-Id: Ibb3361092967132f4f1952d64fe0168659f3075e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202870
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
On MacOS and iOS arm64, non-struct stack arguments are aligned to their
own size rather than word size. However, after a struct, the first non-
struct argument is word-aligned. This is achieved by doing alignment of
the stack also _after_ every argument passed on the stack.
Doing alignment _after_ every argument passed on the stack is a no-op
in all other calling conventions because there all stack arguments are
word-size aligned.
TEST=runtime/vm/compiler/ffi/unit_tests/structPacked/arm64_macos.expect
TEST=tests/ffi_2/function_structs_by_value_generated_test.dart
TEST=tests/ffi_2/function_callbacks_structs_by_value_generated_test.dart
Change-Id: Iffa6625cd40774fc1d2ca9180a42be7200d93a01
Cq-Include-Trybots: luci.dart.try:vm-kernel-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203303
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Expands the test PassStruct9BytesPackedMixedx10DoubleInt32 to see how
the second integer is allocated.
Updates runtime/vm/compiler/ffi/unit_tests/structPacked to have the same
signature.
Fixes the structs by value test generator to output // @dart 2.9 for
legacy mode.
Deletes the copy of the test generator from tests/ffi, the copy did not
run in legacy mode.
TEST=only test changes
Change-Id: I65b7db56225a8e7963493dbccc2f296faca6fee1
Cq-Include-Trybots: luci.dart.try:vm-kernel-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202968
Reviewed-by: Tess Strickland <sstrickl@google.com>
In practice, the Dart stack is usually much deeper than 8 frames, causing a typical tick to chain multiple Samples together. Increasing the number of frames covered by a Sample causes the typical tick to waste less memory on the non-frame portions of linked Samples.
For a run of dart2js compiling hello_world, increasing the frames-per-Sample from 8 to 32 decreases the memory required to represent all the ticks from 11930560 to 6907120 (-42%), with diminishing returns thereafter.
This CL does not make a compensating decrease the default number of Samples in the buffer, so it has the effect of increasing the time range covered by the buffer for deep stacks by ~4x while only increasing memory usage a bit less than 2x.
TEST=ci
Change-Id: I60b17263dcb900fff4198ca6039753828295bf38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202308
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Trying to evaluate an expression on some internal VM stuff one should
get an error, but instead gets a FormatException because the VM sends
invalid json.
This CL fixes that by returning after the error.
A test that previously got the exception is also added.
TEST=Test added.
Change-Id: Idc9332b6ee1eb3e6fc37145b28967056e5df6882
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202766
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
This change replaces generation of old invocation AST nodes
(such as PropertyGet, PropertySet and MethodInvocation) in async
transformers with new nodes (InstanceGet, InstanceSet,
InstanceInvocation, LocalFunctionInvocation).
The old nodes will be deleted eventually.
TEST=existing tests
Issue: https://github.com/dart-lang/sdk/issues/45340
Change-Id: I8c2ead9509cfd2def2f75f9d82dc13b2a9490fdf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202801
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Use separate local blocks for pushing and popping like V8, which makes the traversal order a bit more like BFS and a bit less like DFS.
TEST=ci
Change-Id: I1b965f7490a1306ff3f7fc4391ce424860bf6586
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202800
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Catapult provides more comprehensive stats. Reduces VM code size by about 16k.
TEST=ci
Change-Id: Ica146299f9e9578e06c0ec56ec36d6bef1ac9a86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202864
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reduces VM code size by about 32k.
TEST=ci
Change-Id: Id29619379fc2fd1d0fbe85715863df0bae5bb3df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202866
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Fix the alignment of structs on MacOS arm64 so that it is the same as on
iOS arm64.
This fixes some of the ffi test failures, but not all. I'll follow up
with further CLs. (Having this landed will allow us to see further
failures on the bots.)
Bug: https://github.com/dart-lang/sdk/issues/46305
TEST=runtime/vm/compiler/ffi/unit_tests/struct12bytesFloatx6/arm64_macos.expect
TEST=tests/ffi(_2)/(.*)function(.*)_test.dart
Change-Id: I66d214ecf672734c685ff97316b1666a2859b106
Cq-Include-Trybots: luci.dart.try:vm-kernel-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202940
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Split Dart_New so that most tests run correctly and only the two cases
with redirecting factories (issue 42939) are tracked as
failures.
TEST=new test added
Change-Id: Ib6db815e3c5d1c0139150c9cac546a88deab0ac4
Fixed: 46126
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201361
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reduces VM code size by about 18k.
TEST=ci
Change-Id: Ic0dbdb6a7807a0f0d37333c6f32bed5cb3e7b905
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202543
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This avoids allocating and instantiating the runtime type of closures with identical signatures and instantiators.
This also fixes runtime type equivalence for types (FunctionType and Type).
TEST=all existing ones.
Change-Id: Ic05f2abf1398546d565b98a04cd5f67416840443
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202780
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
This reverts commit 89996356b5.
Reason for revert: b/190457957 reveals that there are still duplicates in the canonical type table.
Original change's description:
> [VM/runtime] Tighten asserts and do not allow duplicate canonical recursive types.
>
> Several improvements in previous CLs should have eliminated duplicate canonical recursive types.
>
> TEST=existing ones
>
> Change-Id: Ic7ef6ea614baa678a9aa99d3f2cae4ceadc71396
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200884
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Régis Crelier <regis@google.com>
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I312a6b84554931bae736584fda043693b6798966
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202767
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
This change adds can_be_sentinel() flag to CompileType and
prevents unboxing of phis which can be sentinel.
This flag means that set of values can potentially contain
Object::sentinel() which is used as a marker for the uninitialized
value of late variables.
TEST=runtime/tests/vm/dart/regress_46141_test.dart
Fixes https://github.com/dart-lang/sdk/issues/46141
Change-Id: I32f19488f54c6f69932584ecec3094e3b78cc0d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201600
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
The only remaining use of the macro was to do a string concat
which might as well be done directly.
TEST=CQ
Change-Id: Idbf2eb823c74afbd249a60649f185397caf8a32e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202680
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
In 64-bit with compressed pointers enabled, we still store identity
hashes in the object header, but the Smi range is reduced.
The 0xffffffff is a Smi in 64-bit architectures, but not if
compressed-pointers are enabled.
This updates the test to use the same maximum value as the corelibraries
could use when setting the identity hash code.
TEST=Fixes vm/cc/AsmIntrinsifier_SetHashIfNotSetYet in compressed-pointers mode
Change-Id: I285a28127767a6a0b606354f3e3f994a15b372b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202480
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This fixes idle GCs never running for the service and kernel isolates.
TEST=--verbose-gc
Change-Id: Iea0b0aa808c757a527724e3d2599c170cb383574
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202362
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Usually the identity hashcode is implemented by returning if present and
otherwise generating a random number, setting the hash code and
returning it.
This works fine in single-mutator environments, though when multiple
mutators might race to install identity hash codes we should ensure only
one of them wins and all others will obtain whatever hash code has been
set by the winner.
This will matter once we start sharing more objects across isolates.
Issue https://github.com/dart-lang/sdk/issues/36097
TEST=vm/cc/AsmIntrinsifier_SetHashIfNotSetYet
Change-Id: Ie760ca9658e6ec0640255361544d6822b07574e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201827
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
In function entry, there are redundant register assignings for constant.
This removes the register assignings.
TEST=Existing test coverage.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try
Change-Id: I08e75118a60f01b0d1a010ef4e2eaa3f5760a4ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202180
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
JSON_JSONStream_DartObject used to elide a JSON string longer
than 1024 into a buffer of 1024 bytes, which was causing memory
issues, including tripping ASAN.
This is fixed by doubling the buffer.
This CL also adds ASSERTs to ensure all buffers used with
`ElideJSONSubstring(..)` are big enough.
TEST=Existing, updated tests.
Bug: https://github.com/dart-lang/sdk/issues/46246
Change-Id: I7ce86429efecd91e768be413fd86f7d3c53c5d52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202244
Auto-Submit: Clement Skau <cskau@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Token position and script reference information are cheap to provide and
make it possible to tie objects to scripts without requiring additional
requests for full objects.
TEST=Existing
Change-Id: I917714149a72a53081fee5626ccad858e86f5313
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201864
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Instead of explicitly listing certain subclasses in some places, instead
allow any AllocationInstr subclass and just reject certain subclasses if
necessary.
Code size different in Flutter gallery (release-sizeopt):
* ARM7: Total -0.12%, instructions -0.14%, readonly -0.11%
* ARM8: Total -0.12%, instructions -0.15%, readonly -0.09%
TEST=Current test suite.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-simarm64c-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-product-x64-try,vm-kernel-linux-release-simarm64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-x64-try,vm-kernel-linux-debug-x64c-try
Change-Id: I4ce42d7185d4b3a83356e5131a5835fa858c4882
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201832
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
With this change, allocation instructions can now be direct inputs to
other allocation instructions, so the redundancy eliminator is extended
to handle this possibility.
Methods for working with instruction input-related slots are added to
subclasses of AllocationInstr, so that the redundancy eliminator can be
written more generically in places, instead of needing to add cases for
new allocation instructions and/or instruction inputs.
Code size different in Flutter gallery (release-sizeopt):
* ARM7: Total -0.30%, instructions -0.41%
* ARM8: Total -0.31%, instructions -0.47%
TEST=Current test suite.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-simarm64c-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-product-x64-try,vm-kernel-linux-release-simarm64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-x64-try,vm-kernel-linux-debug-x64c-try
Change-Id: Idc1aa2a1cb8c0c62f0bcb64aee89a7525dd3d1e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198406
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
The frontend is no longer capable of handling embedded scripts.
TEST=ci
Change-Id: Iea8bb45e701f29648ec2fe15f6be68c4561a6933
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201980
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This adds the providesSymbol method to DynamicLibrary. It returns
whether the library contains a function with the given name.
As per dlsym(3), it is valid for dlsym to return nullptr in a success
case if the symbol actually has a NULL value. So I've changed the logic
to check for dlerror() after we invoke dlsym(), both in the existing
lookup and in the new method.
Closes https://github.com/dart-lang/sdk/issues/46192
TEST=tests/ffi(_2)/has_symbol_test.dart
Change-Id: Ibcb1c051cc0cdd95a104fe86ef2fc76da5bafb5d
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64-try,vm-ffi-android-debug-arm-try,vm-kernel-linux-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-mac-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201900
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
If an IR instruction lazy-deopts it usually continues in unoptimized
code in the same IR instruction after-call.
Though in certain situations we want to continue before-call in
unoptimized code.
Two cases relevant in this CL:
* An instruction gets LICMed: If it lazy-deopts it will continue
at the Goto instruction outside the loop.
* A recognized method which got it's InstanceCall replaced by several
IR instructions. If any of them (except the last one) lazy-deopts
it should re-try the call in unoptimized code (e.g. []=)
In order to faciliate this we add a bit to the [Environment] which
encodes whether the continuation point in unoptimized code is
before-call - if so, we issue corresponding metadata.
Issue https://github.com/dart-lang/sdk/issues/45213
Issue https://github.com/dart-lang/sdk/issues/46070
TEST=runtime/tests/vm/dart{,_2}/regress_46070_test.dart
Change-Id: Ib824081768a2fd6293751a8fe09753e0d8155c87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200644
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
These natives are implemented in kernel_to_il.cc. Now that the bytecode
interpreter has been removed, the RTEs are dead code.
TEST=test/language includes many tests with Map.
Change-Id: I42bb49434f4be0b0a881353f2f24816bfda7a3ed
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-simarm64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201820
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
An UnboxIntegerInstr may have a Redefinition as its input when environments are removed from instructions that !ComputeCanDeoptimize, but the Redefintions may be removed during graph finalization, changing the type attached to the unbox's input from Int to non-Int, and so changing ComputeCanDeoptimize back to true.
TEST=vm/cc/IL_UnboxIntegerCanonicalization
Bug: https://github.com/dart-lang/sdk/issues/46018
Change-Id: I9e89055f07d0f40a374b1e8fd81122763a7a6bd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200906
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
When iterating over isolates in IsolateGroup::RegisterStaticField we need to grab read isolates_lock
to prevent data races as isolates_ list might be being updated.
TEST=generated_stress_test
Fixes https://github.com/dart-lang/sdk/issues/46071
Change-Id: I46b9826a268d38d07b1aeec9362de3e5945642fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201342
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
On IA32 arguments are passed in registers. When a struct is returned
by value, a pointer is passed in on the stack containing the address to
which the return value is written. We did not account for this pointer
in the stack-height calculation.
This problem only surfaced when there are no arguments to the function.
Because if an argument is passed it has a higher stack height than the
pointer for the result being passed in.
Fix in: runtime/vm/compiler/ffi/native_calling_convention.cc
TEST=runtime/vm/compiler/ffi/native_calling_convention_test.cc
TEST=tests/ffi/regress_46127_test.dart
Closes: https://github.com/dart-lang/sdk/issues/46127
Change-Id: Ia78fe07cc7e3a3c8625143d491935a959b4a7895
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-ia32-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201269
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
This CL replaces the KernelConstantsMap (backed by an Array that got
replaced on growing) by an Array that is allocated to be the required
size.
Does not cache the start of the constants table in the constructor
as proposed in [1], because the constants table is null when the
ConstantReader constructor is called in the KernelLoader constructor.
[1] https://dart-review.googlesource.com/c/sdk/+/196925/6..10/runtime/vm/compiler/frontend/constant_reader.cc#b116
Closes: https://github.com/dart-lang/sdk/issues/45903
TEST=vm test suite, including GC tests.
Change-Id: Ie111bedc7eb7fcd627ab700a9906245bc7dd14ce
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-x64c-try,vm-kernel-linux-release-simarm64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try
Fixed: 45903
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200871
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Also make all other Allocate*ABI structs explicitly use the same result
register as AllocateObjectABI for consistency.
TEST=Refactoring, so existing tests.
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-x64c-try,vm-kernel-linux-debug-simarm64c-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm64c-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-nnbd-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try
Change-Id: Iede8ff499ae3e7741e57090c36bc6b5dcc9217b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201184
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
* Rename values and methods like kElementTypePos or element_type() to
corresponding names like kTypeArgumentsPos or type_arguments() (since
the input to CreateArrayInstr is the type arguments vector for the
array, not just the type of the element.)
* Create a AllocateArrayABI struct for the input and output registers of
the AllocateArray stub and use those where applicable.
* Explicitly list what registers are clobbered in the AllocateArray
stubs in their documentation comment.
* Avoid clobbering the type arguments input register in the arm64
version of AllocateArrayInstr, so all input registers are preserved
across all architectures.
TEST=Refactoring, so existing tests.
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-x64c-try,vm-kernel-linux-debug-simarm64c-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm64c-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-nnbd-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try
Change-Id: I3a7c2b6afdd307c26f8d4f97a4c8bd7684e7b242
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201183
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Avoid calling SetTypeTestingStub from PostLoad because it
uses write lock.
Saves ~10-15% on ReadProgramSnapshot on a large Flutter app.
Issue https://github.com/dart-lang/sdk/issues/46116
TEST=ci
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try
Change-Id: If843828661e68f18df19824af204df326bf016a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201180
Auto-Submit: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Currently external data is counted twice on the receiver size: once for
received transferable, second for newly created external typed data.
Ensure new space is collected when allocating external at the limit.
TEST=SendReceiveBytesTransferable with verbose-gc
Change-Id: I129d913f89e098b5d3066ce249ac0c4702e1394d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199842
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This CL adds FFI leaf calls by adding `lookupFunction(.., isLeaf)`
and `_asFunctionInternal(.., isLeaf)`, which generate FFI leaf calls.
These calls skip a lot of the usual frame building and generated <->
native transition overhead.
`benchmark/FfiCall/` shows a 1.1x - 4.3x speed-up between the regular
FFI calls and their leaf call counterparts (JIT, x64, release).
TEST=Adds `tests/ffi{,_2}/vmspecific_leaf_call_test.dart`. Tested FFI tests.
Closes: https://github.com/dart-lang/sdk/issues/36707
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-release-arm64-try,vm-ffi-android-release-arm-try,vm-ffi-android-product-arm64-try,vm-ffi-android-product-arm-try,vm-ffi-android-debug-arm64-try,vm-ffi-android-debug-arm-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-release-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-precomp-nnbd-mac-release-simarm64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-precomp-ubsan-linux-release-x64-try,vm-kernel-precomp-tsan-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try
Bug: https://github.com/dart-lang/sdk/issues/36707
Change-Id: Id8824f36b0006bf09951207bd004356fe6e9f46e
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179768
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This updates RelationalOp and EqualityCompare to use Mint as immediate on ARM.
TEST=ci
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm-try
Change-Id: I2ea68ed4d54ba1dc04953a629ad57e0bc439cec5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200960
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
When building method extractors in a given isolate group, the copy of
the AllocateContext stub in the isolate group should be used. Otherwise,
calls to that stub cannot be turned into PC relative calls when
appropriate.
Also retrieve the closure allocation stub from the object store directly
instead of going through GetAllocationStubForClass, now that closure
allocation is handled via a distinct stub.
Be more specific about the types of the stub objects passed to
GenerateBuildMethodExtractorStub, as they're guaranteed to be Code
objects.
TEST=Existing test cases.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try
Change-Id: I05bc5e8a133834e66af3e1003d8a6597ee11c312
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200868
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This removes the need for passing the flag to use
Dart_ExecuteInternalCommand, which is done in several tests
that otherwise have nothing to do with testing pragmas.
Also adds status file skips for precomp-win targets that currently
crash due to https://github.com/dart-lang/sdk/issues/40579.
TEST=CQ
Bug: https://github.com/dart-lang/sdk/issues/46059, https://github.com/dart-lang/sdk/issues/46061
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-win-release-x64-try,vm-kernel-precomp-nnbd-win-release-x64-try,vm-kernel-win-debug-x64-try
Change-Id: I3024ad9bedb7a74abaaaa1020b7525e5d8b1bd47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200461
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
The same signature (canonical function type) may be shared between different closure functions.
Clean up asserts verifying that members are canonical when updating type test cache.
TEST=existing ones
Change-Id: Ic206409e56d34dfd02d6705af93065fd3b83b8fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199561
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Canonical tables are now rebuilt during serialization.
TEST=ci
Change-Id: I4666ca1ed73a6f84b3546d35b394395623bf5854
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200923
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
This avoids the extra redirection through the closure function, which
does not need to be loaded otherwise during closure calls in this mode,
and thus removes another runtime dependency on the closure function in
bare instructions mode.
In non-bare mode, CODE_REG is populated with the code object for the
function, so caching wouldn't change the number of loads there.
This does not increase the size of closure objects, as there was
already a free word in them due to object alignment.
TEST=Existing tests.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-simarm64c-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-product-x64-try,vm-kernel-linux-release-simarm64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-x64-try,vm-kernel-linux-debug-x64c-try
Change-Id: Ida6e0d277919259a8c0e8dcbfaa101379fd22ff1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195920
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
This was disabled previously due to inconsistent cpu time reading reported by the ios.
It seems to be working correctly now.
TEST=verified flutter application cpu timeline numbers in observatory on physical ios device
Change-Id: Id97a550bbbc96a32b5c2ccf59ca9805ea8cb9ec4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200703
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
CL was made by removing all symbols that don't have Symbols::* usage
and then adding back ones which are constructed via compile-time
concatentation in macros.
TEST=Existing test suite.
Change-Id: I3651808739d90a8d36b162f300b09f02fe2916aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200420
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
When TTSs access type argument vectors we should avoid using
Address/FieldAddress - which only work if offsets are guaranteed to be
within certain instruction encoding limits.
It also fixes Assembler::LoadCompressedFieldFromOffset on ARM64
to not assume (base, offset) is instruction encode-able.
TEST=vm/dart{,_2}/flutter_regress_82278_2_test
Change-Id: I9be316a068f222a6c1897c323111c4b18adb1e7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200222
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Ran into this error when trying to set up a finalizer with an Object
owner. The super class is null in this case.
Change-Id: I27f67a738c72c0b433e367257c638a6d3d2e495f
TEST=ci and manual testing
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199602
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
This should improve performance of lightweight isolates configuration
TEST=ci, perf benchmarks
Change-Id: I98ac9a7e02318d58db3431a6d33f08ab95e607fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199700
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Annotations are evaluated in the CFE and the VM does therefore
not encounter any AST nodes anymore.
TEST=Existing test suite.
Change-Id: Id0ac60cf0d1a8d1667c79541c1de66765778ce90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200183
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
If the type arguments vector gets introduced in subclasses where the
base classes have already many fields we may not be able to load the TAV
in one instruction on ARM64.
Issue https://github.com/flutter/flutter/issues/82278
TEST=vm/dart{,_2}/flutter_regress_82278_test
Change-Id: I164ef42af3afe8267fe23a8a11af9401776eccdb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199481
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
New FunctionInvocation nodes have explicit static type information such
as function access kind and function type. However, an attempt to use
this information revealed that it is less accurate compared to the old
call site attributes metadata
(see https://github.com/dart-lang/sdk/issues/46003 for details).
This change reverts back to using call site metadata when building
flow graph for FunctionInvocation nodes. It fixes regression of
ListCopy benchmark with new invocation nodes.
TEST=benchmarks/ListCopy/dart/ListCopy.dart with new invocation nodes
Issue: https://github.com/dart-lang/sdk/issues/45340
Issue: https://github.com/dart-lang/sdk/issues/46003
Change-Id: I73e5fae49b8056365211989e6e656544c79bcc50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199563
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
It needs to check whether the class the type arguments field is in
has compressed pointers, not whether TypeArguments has compressed
pointers.
Since we need the class to know whether compressed pointers are in
play, remove the version that just takes the offset.
TEST=Existing tests.
Change-Id: Ie6de8e0b2366b86f99a7fda362809dd1e10f99b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199484
Auto-Submit: Tess Strickland <sstrickl@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Instead of specifying FINAL_COMPRESSED and VAR_COMPRESSED, the
macros for defining boxed native slots use the class's
ContainsCompressedPointers() predicate to determine whether a Slot
points to a compressed field.
Also use owner.HasCompressedPointers() when getting a Slot for a
particular Field.
TEST=Refactoring, so just running against the current test suite.
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-x64c-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-linux-debug-x64-try
Change-Id: I4bf25ffa2dbe89dc9a922305820dc4b752f47d13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198044
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
When we switched from allocating closures with AllocateObject to
using AllocateClosure, a couple of places that needed to check for
IsAllocateClosure() were missed. This caused AllocateClosureInstrs to
never have a NotAliased Identity(), which then forced some
AllocateUninitializedContextInstrs to be kept instead of eliminated.
TEST=Checked using benchmarks that saw regressions due to this change.
Change-Id: If63d4cae190453233429b5657cbe177cac265074
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199430
Commit-Queue: Tess Strickland <sstrickl@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Auto-Submit: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
BARRIER_MASK requires 8 low bits and HEAP_BASE requires 32 high bits. Combine them into a single register HEAP_BITS, and use ARM's shifted operands to continue accessing the relevant bits in a single instruction.
TEST=ci
Change-Id: I5a4cd43fec2d19615239ec5cec2ac282d17c461c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198100
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
TEST= removed flags from test. No behavior should change.
Change-Id: I401bfb68c082d1bd405a118d5eca6a47a807945f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199241
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Doing any runtime call inside an `<XXX>Instr::EmitNativeCode()` is dangerous
because doing so almost always would require adjusting the lazy-deopt
environment to ensure the continuation in unoptimized code would have
the right stack state when returning from a runtime call.
=> Going to runtime should almost always happen via a stub call.
To discourage using runtime calls inside `EmitNativeCode()` functions we
remove the `FlowGraphCompiler::GenerateRuntimeCall()` helper method.
The remaining runtime calls used in `EmitNativeCode()`s fall into three
categories:
* StackOverFlowInstr: In this particular case the deopt environment
wouldn't need to be modified.
* leaf runtime calls: Those do not need any metadata (neither deopt
nor stackmaps) - since leaf runtime entries cannot safepoint
* unopt-only runtime calls: Those do not need any metadata (neither
deopt nor stackmaps) - since all slots in unoptimized frames are
GC-able and unoptimized frames cannot be lazy-deoptimized.
We add assertions for the latter to cases with a comment to make it
clear.
Issue https://github.com/dart-lang/sdk/issues/45213
TEST=Only adds assertions.
Change-Id: Idb8badfbe65fff55585959338129405c71908d25
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199042
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Running isolates tests in debug mode is currently very slow due to heap
verification and related code on isolate startup & shutdown.
This CL limits those verifications to only run on the first isolate of
an isolate group.
Issue https://github.com/dart-lang/sdk/issues/36097
TEST=Existing test suite.
Change-Id: I1f329bca9e4c1d56ab60f36ffa8b9cc037b818f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199249
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
-----
Adds a few type traits for operating on (Compressed)ObjectPtr types:
* is_compressed_ptr<T>::value is true for compressed pointer types and
false for uncompressed pointer types.
* is_uncompressed_ptr<T>::value is false for compressed pointer types
and true for uncompressed pointer types.
* base_ptr_type<T>::type is ObjectPtr for uncompressed pointer types and
CompressedObjectPtr for compressed pointer types.
Note: If DART_COMPRESSED_POINTERS is not enabled, all pointers are
uncompressed and the above traits function accordingly. That means
that is_compressed_ptr<T>::value is always false,
is_uncompressed_ptr<T>::value is true for all object pointers, and
base_ptr_type<T>::type is ObjectPtr for all object pointers, even if
they contain Compressed in the name.
-----
The following changes have been made to the VISIT_* macros:
* VISIT_NOTHING: no change.
* VISIT_FROM: takes only a field name now, and retrieves the type of
the field to determine which base pointer type to use for from().
Note that VISIT_FROM must now come _after_ the declaration of the
field, since it retrieves the type from the declaration.
* VISIT_TO: takes only a field name now, and retrieves the type of the
field to determine which base pointer type to use for to().
* (removed) VISIT_TO_LENGTH: Instead, VISIT_TO creates a to() method
that takes an optional length argument (defaults to 0).
* (new) VISIT_FROM_PAYLOAD_START: takes the object pointer type of the
payload elements and creates a from() that returns the beginning
element of the payload. Note that a payload element must be a single
object ptr to use this macro.
* (new) VISIT_TO_PAYLOAD_END: takes the object pointer type of the
payload elements and creates a to() which takes a non-optional length
argument and returns the last element of the payload. Note that a
payload element must be a single object ptr to use this macro.
If one of the {COMPRESSED_,}VARIABLE_POINTER_FIELDS macros are used,
then VISIT_TO_PAYLOAD_END should not be, as those macros already
include a use of it.
-----
In addition, each Untagged<Class> class now has a static constexpr bool
field kContainsCompressedPointers. This field is false for
UntaggedObject, and for other Untagged<Class> classes, it is either
inherited from the parent class or set during VISIT_FROM and the new
VISIT_FROM_PAYLOAD_START macro.
VISIT_TO and the new VISIT_TO_PAYLOAD_END macro double-check at compile
time that the type retrieved or provided is a compressed type if
kContainsCompressedPointers is true, and uncompressed if false.
If the elements of a payload are not object pointers, but rather
a composite object that contains object pointers, then
VISIT_FROM_PAYLOAD_START/VISIT_TO_PAYLOAD_END cannot be used. Instead,
use DEFINE_COMPRESSED_POINTERS(type), where type is the type of one of
the object pointers in the composite object, to appropriately define
kContainsCompressedPointers.
Note that this field will always be false when DART_COMPRESSED_POINTERS
is not defined.
-----
For classes, a static constexpr ContainsCompressedPointers() predicate
is created, based on the associated untagged class's field.
For instances of Class, there is an instance predicate
Class::HasCompressedPointers() that returns whether instances of a given
class object contain compressed pointers.
Change all calls to InitializeObject and Object::Allocate to pass in
the result of the appropriate predicate.
TEST=Refactoring, so current tests on CI, especially on x64c trybots.
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-x64c-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-linux-debug-x64-try
Change-Id: Ifb61f72885bd8b951167becbccf8ec3337a922b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196931
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
When generating snapshot with loading units trace
deferred pools for code objects as well - otherwise
we might miss code references from one deferred
unit to another unit (e.g. if the only remaining
reference to some code object in the root unit is
actually from a deferred unit).
Fixes a bunch of issues with deferred libraries (Crash -> Pass):
- language_2/deferred/split_constants_canonicalization_test/1
- vm/dart_2/deferred_isolate_test
- vm/dart_2/deferred_loading_and_weak_serialization_references_test/0
- vm/dart_2/deferred_loading_and_weak_serialization_references_test/1
- vm/dart_2/deferred_loading_call_modes_test/2
Fixes issue https://github.com/dart-lang/sdk/issues/45917
TEST=ci
Fixed: 45917
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm-try
Change-Id: Iccd3efcab6a5396d4b6f70968d9176ff18d7147c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198405
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Now AllocateClosureInstr takes the closure function as a Value* instead
of as a const Function&, a new kFunctionReg is added to
AllocateClosureABI, and the AllocateClosure stub sets the closure
function internally instead of initializing it to null and requiring it
to be set post-allocation.
A convenience method known_function() is added to AllocateClosureInstr
which returns either the closure function, if known at compile time,
or null otherwise.
TEST=More refactorings, so just passing current tests.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-simarm64c-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-product-x64-try,vm-kernel-linux-release-simarm64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-x64-try,vm-kernel-linux-debug-x64c-try
Change-Id: If843b401e0f282b191dd60b1c6c73c01f1d5bc70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198285
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Also create a subclass of AllocationInstr, AllocateClosureInstr,
which is used when allocating closures.
Followup CLs add inputs to this instruction and to the AllocateClosure
stub, starting with the closure function. Adding these inputs allows
the related field to be set within the stub, instead of using
StoreInstanceField manually at each closure allocation point.
Since this CL only adds the initial stub/instruction implementation,
the overhead on snapshots is minimal: just the addition of the new
stub to each isolate.
-----
This CL also adds virtual and non-virtual methods to assembler_base.h
revolving around field loads and stores and attempted inline object
allocation, to ensure all architectures have these methods.
It also adds LoadFromSlot/StoreToSlot/StoreToSlotNoBarrier, which
appropriately calls one of the other methods based on whether the slot
is compressed or not and whether it is a boxed or unboxed field.
With these additions, the AllocateClosure stub generator can be defined
in an architecture-independent way.
TEST=Basically a refactoring, so check using current test suites.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-simarm64c-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-product-x64-try,vm-kernel-linux-release-simarm64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-x64-try,vm-kernel-linux-debug-x64c-try
Change-Id: I71f5691307679f8d5e3604007699de4706f86eb8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198284
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Instead of trying to lazily create artificial nodes when needed for
WeakSerializationReference (WSR) targets in all cases, create them
eagerly for targets in reachable WSRs, since those are guaranteed
to be needed.
Those for unreachable WSRs are still lazily created as needed, since the
WSR won't even be accessed by the clustered snapshot writer unless the
unreachable WSR is part of another unreachable object that has an
artificial node created.
This rework avoids some issues seen on upcoming CLs where the artificial
nodes for WSR targets weren't getting correctly generated.
-----
Also extend the v8 snapshot profile writer tests to check the sizes of
the text and data sections in ELF snapshots. That means the v8 snapshot
profile writer tests check up to three different measures, from most
precise to least precise, depending on the output mode:
* If writing an ELF snapshot directly: the sum of the sizes attributed
to the text and data section symbols are checked to be exactly the
same as the sum of the sizes of the objects in the profile.
* If writing an ELF snapshot either directly or via assembly: the sum
of the sizes of the text and data sections are checked to be the same
as the sum of the sizes of the objects in the profile. If using an
assembler that merges text and data sections, then account for the
padding between the sections using an approximate check.
* For all: Check that the size of the snapshot as a whole is
approximately equal to the sum of the sizes of the objects in the
profile, accounting both for possible padding and for the global
header information and non-data/non-text sections like the dynamic
symbol section.
TEST=vm/data{,_2}/v8_snapshot_profile_writer_test
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-mac-release-simarm64-try
Change-Id: I66e0e7fdb5bb98045621bf516f150a4723e08147
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198942
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
This flag allows dumping timings of various precompiler passes.
TEST=precompiled dart2js with --print-precompiler-timings
Change-Id: I54d6fdf26c25a0e43ae4f2717e833e09e9321d81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198407
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
To avoid accidental code that calls stubs without emitting proper
(deopt-id, deopt-env) metadata, we enforce that it's always present for
stub calls and add another GenerateNonLazyDeoptableStubCall for cases
where it's intentionally omitted.
The environment has in many cases been still emitted before, due to the
usage of `pending_deoptimization_env` though we make code pass it
explicitly (just as the deopt-id). We may want to consider deprecating
this `pending_deoptimization_env`.
Issue https://github.com/dart-lang/sdk/issues/45213
TEST=Existing test suite.
Change-Id: I93f1d5ba4d74da5f9afa4b526ad57b9d032ca99e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197164
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
The "RunWithMutatorsStopped" wrapper is used in places where the invoked
callback can cause deoptimization of code. It should therefore ensure
it's running with a "deopt safpoint operation scope" to ensure mutators
are stopped at well-defined places that allow lazy-deopt.
Issue https://github.com/dart-lang/sdk/issues/45213
TEST=Existing code base, will add "fuzzer"-like test to nightly/weekend builders.
Change-Id: Icb9a4183c13fab0f084e481c10dfc56a0308126a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197162
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
The optimizing compiler can insert box instructions at various places
during the optimization pipeline. There is no guarantee that a box
instruction will get a proper (deopt-id, deopt-env) assigned to it - in
many places it will not.
Furthermore StoreInstanceField's into "unboxed fields" might cause
box allocations to happen. Those stores might also not have deopt
information associated with them.
In general we require stackmaps when allocation slow paths go to runtime
and cause GC. If GC throws OOM we theoretically would also need deopt
information in order to populate correct catch-entry state. Though OOM
is uncommon and the VM could decide to ignore the top-frame - if it's
missing deopt information - since box allocations aren't something
users are in control of (as opposed to user-allocated objects inside
try/catch).
=> This CL makes box allocations go to a runtime entry that doesn't
support lazy-deopt. While being in those runtime entries the mutators
will also not participate in "deopt safepoint operation" requests.
Issue https://github.com/dart-lang/sdk/issues/45213
TEST=Existing test suite.
Change-Id: I1b61f77e3166da82efad08bb49bc1756576d220c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196928
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
This extends the existing safepoint operation mechanism by allowing to
perform two different operations:
* "gc safepoint operations": All mutators are stopped at places where
it's safe to GC. It therefore requires stackmaps to be available for
all optimized mutator frames.
* "deopt safepoint operations": All mutators are stopped at places
where it's safe to GC, but also safe to lazy-deopt mutator frames.
It therefore requires deopt-id/deopt-info to be available for all
optimized mutator frames.
Mutators can be asked to block for any of those two safepoint operations.
If a mutator is at a place where its safe to GC it will respond to "gc
safepoint operations" requests, if a mutator is additionally at a place
where it's also safe to lazy-deopt it will respond to "deopt safepoint
operation" requests.
Depending on how the runtime was entered (which is tracked via the
[Thread::runtime_call_deopt_ability_] value) - the mutator might
participate in both or only in gc safepoint operations.
During the start of a "deopt safepoint operation", the safepoint handler
will request all threads to stop at a "deopt safepoint". Some threads
might first want to initiate their own "gc safepoint operation"
(e.g. due to allocation failure) before they reach a "deopt safepoint".
We do allow this by letting the safepoint handler own a "deopt safepoint
operation" but still participate in other thread's "gc safepoint
operation" requests until all mutators are checked into places where
it's safe to lazy-deopt at which point the "deopt safepoint operation"
also owns a "gc safepoint operation".
In order to facilitate this, the Thread's safepoint_state will be
extended to consist of the following bits:
* AtSafepoint
* SafepointRequested
* AtDeoptSafepoint
* DeoptSafepointRequested
* BlockedForSafepoint
Issue https://github.com/dart-lang/sdk/issues/45213
TEST=vm/cc/SafepointOperation_*
Change-Id: Icdc2827718f6780818f99b829a5e806d6bb5b130
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196927
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
As a pre-requisite of partitioning our safepoints into "gc only
safepoints" and "lazy-deopt'able safepoints" we'll let mutators keep
track of whether a runtime call into the VM is deoptable.
A mutator is lazy-deopt'able except for one particular case: When the
mutator calls into the VM from a place where no deopt-id/deopt-env
gets recorded (e.g. StoreInstanceField's box allocation goes to
runtime).
If a mutator is in the VM in a non-lazy-deopt'able state, it cannot call
out to the embedder, transition from "vm" to "native" state, ...
A future change will make new non-lazy-deopt'able runtime entries taking
advantage of this CL.
Issue https://github.com/dart-lang/sdk/issues/45213
TEST=Existing test suite & tests in future CLs.
Change-Id: I30dbee02dc839b2ba9632b20ffa233aff4d58f64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196922
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
For yielding functions (async, sync*, async*) we need to look for
annotations on the outer function instead of the synthetic inner
function associated with the handler frame.
Fixes https://github.com/dart-lang/sdk/issues/45673
TEST=runtime/observatory{,_2}/tests/service{,_2}/notify_debugger_on_exception_yielding_test.dart
Bug: https://github.com/dart-lang/sdk/issues/45673
Change-Id: I8b1718b3614852f6f8db98811177b21fe587fea1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198408
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
'''
> git cl lint
runtime/vm/compiler/frontend/kernel_to_il.cc:2614: \
Declaration has space between type name and * in \
TargetEntryInstr *null_ftav [whitespace/declaration]
'''
TEST=Built and ran some existing tests.
Change-Id: I8095a0ea93cce9b57ce4e4965476b1e0a66e7ff0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198402
Auto-Submit: Clement Skau <cskau@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
This is a reland of 8a21ab195a
Original change's description:
> [VM/runtime] Refactor the representation of type parameters in the VM.
>
> This introduces a new VM internal class 'TypeParameters' representing the declaration of a list of type parameters, either in a class or function.
> The reference to (or use of) a type parameter is still represented by the existing 'TypeParameter' class.
>
> Fixes https://github.com/dart-lang/sdk/issues/43901
> Fixes https://github.com/dart-lang/sdk/issues/45763
>
> TEST=existing ones and a regression test
>
> Change-Id: I1fde808bf753cc1cb829f2c4383c1836651cee80
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189942
> Commit-Queue: Régis Crelier <regis@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
This fixes https://github.com/dart-lang/sdk/issues/45911
TEST=existing ones and a regression test
Change-Id: I709d38b1df3d73fe3c9796d5aca3cbbdcf77fd38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198380
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This reverts commit 8a21ab195a.
Reason for revert: Test failure: http://b/187227619
Original change's description:
> [VM/runtime] Refactor the representation of type parameters in the VM.
>
> This introduces a new VM internal class 'TypeParameters' representing the declaration of a list of type parameters, either in a class or function.
> The reference to (or use of) a type parameter is still represented by the existing 'TypeParameter' class.
>
> Fixes https://github.com/dart-lang/sdk/issues/43901
> Fixes https://github.com/dart-lang/sdk/issues/45763
>
> TEST=existing ones and a regression test
>
> Change-Id: I1fde808bf753cc1cb829f2c4383c1836651cee80
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189942
> Commit-Queue: Régis Crelier <regis@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
TBR=rmacnak@google.com,alexmarkov@google.com,regis@google.com,sstrickl@google.com
Change-Id: If12caa1a84cb6d1c1b8225589f3c994d25abb120
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198282
Reviewed-by: Michal Terepeta <michalt@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Michal Terepeta <michalt@google.com>
This introduces a new VM internal class 'TypeParameters' representing the declaration of a list of type parameters, either in a class or function.
The reference to (or use of) a type parameter is still represented by the existing 'TypeParameter' class.
Fixes https://github.com/dart-lang/sdk/issues/43901
Fixes https://github.com/dart-lang/sdk/issues/45763
TEST=existing ones and a regression test
Change-Id: I1fde808bf753cc1cb829f2c4383c1836651cee80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189942
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Previously constants were referenced via there relative binary offset,
i.e. a constant reference saying 42 meant at byte offset 42 relative to
the start of the constant table in the binary. This was done to be able
to (on the VM side) read the needed constants lazily. It meant, though,
that constants had to be stored in a map, mapping from the byte position
to the constant.
This change adds a level of indirection when needing the lazy reading,
but lets the constant references reference the constant number instead
so that a constant reference saying 42 means constant number 42,
i.e. constants can be stored in a list instead of in a map.
This is done on the dart side, but the VM still stores it in a map.
The level of indirection is a tabel next to the constant table where
each entry has constant size (4 bytes) from which one can read the
relative byte offset into the constant table from the constant number,
thus still being able to read needed constants lazily.
This CL also cleans up a leftover where for instance double constants
had their textual representation saved as a string in the string indexer
(and thus the output dill) even though they were never referenced.
File size changes:
* Platform: increses 7,816 bytes.
* Compile of dart2js (including platform): decreases 71,424 bytes.
Speed changes:
* Adding `UserTag`s to the code and looking at observatories cpu profile
on a `pkg/kernel/test/binary_bench.dart --golem AstFromBinaryLazy`
run of a compile of dart2js reading the constant table has gone
from ~10% to ~5%.
* Doing statistics on
`pkg/kernel/test/binary_bench.dart --raw AstFromBinaryLazy` run of a
compile of dart2js says -6.28169% +/- 4.97269%.
* Golem runs has nothing above the noise level.
It does say "AstFromBinaryLazy (Intel Xeon) -4.006% (0.4 noise)" and
"AstFromBinaryEagerP50 (Intel Core i5) -8.929% (0.6 noise)" though.
TEST=All tests running the VM tests this.
Change-Id: I07ead457527a4477de803ee55ba742f5557413d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196925
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
We once relied on making Symbols etc unreachable in the compiler's heap to remove unused ones from the snapshot, but we have since moved to using reachablity during snapshotting.
TEST=ci
Change-Id: I6a95bd71582deedc271441e4b6732201b2293c5b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197442
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
BreakpointLocation token_pos and end_token_pos are populated when
breakpoint is resolved and are read when vm needs to see if a
function has breakpoints.
Since the breakpoint is resolved once and token positions are
populated with real values only once using simple atomics is sufficient
to resolve data race.
Fixes https://github.com/dart-lang/sdk/issues/45877
TEST=service[_2]/break_on_function_many_child_isolates_test.dart on tsan
Change-Id: I92066d094ca3a86c80f0de648debea05ccde5e49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197561
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Retrieve CodeBreakpoint::ToCString() while we hold on to the CodeBreakpoint, before BreakpointLocation potentially deleted with terminated isolate.
GroupDebugger::NotifyCompilation(func) might be called several times for a given function when multiple isolates in a group race to compile it. Debugger needs to handle this scenario gracefully, ensure that already resolved breakpoints won't get resolved again.
TEST=observatory_2/tests/service_2/break_on_function_many_child_isolates_test
Fixes https://github.com/dart-lang/sdk/issues/45516.
Change-Id: Ieebab86103b1999a13daff7b7bbc87ffa778ec82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197520
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Also creates LoadFromOffset/StoreToOffset variants across all
architectures (was missing in some) that take the register to
load to/store from, the memory address, and the size to load/store.
Fixes LoadFromOffset on X64 to use MOVSXD when the size is kFourBytes.
Creates slots for the data field of TypedDataBase/Pointer objects
and replaces the StoreUntagged instruction with uses of
StoreInstanceField instead to create uses of the new version of
the instruction.
BUG=https://github.com/dart-lang/sdk/issues/42793
TEST=Tests that involve FFI pointers or TypedData constructors.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-simarm64c-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-product-x64-try,vm-kernel-linux-release-simarm64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-x64-try,vm-kernel-linux-debug-x64c-try
Change-Id: I2c96e83bb086aa93c56b834e809e7141a32cfc35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196924
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
We might interrupt Object._objectHashCode(obj) helper to serve a
vm-service request between checking for unset hash code and setting
a new hash code. While serving this request we might set the hash
code of [obj] (e.g. when generating heap snapshot or in
Instance::PrintJSONImpl). Later Object._objectHashCode will call
Object_setHash, which (on 64-bit platforms) assumes that
hash field in the object header is set to 0 and uses bitwise-or
to initialize it. This leads to a mismatch between hash code that
the first invocation of _objectHashCode will return and the
value stored in the header (because we OR non-zero value set
by vm-service with a value which _objectHashCode intended to
use as a hash).
This CL changes Object_setHash to avoid overwriting or mangling
the hash value if it was already set.
We also fix hash code generation in vm-service to ensure that we
only generate values which are valid Smis because the rest of the
code expects that.
TEST=pkg/front_end/test/incremental_compiler_leak_test.dart
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm64-try
Change-Id: Ica913af8bc1cfef0ad60a9e7504531ee4de53015
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197400
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
current_context_var is special cased in the liveness analysis and never
pruned even though it does not have uses by instructions. The lack of
pruning caused the assert to fire. This CL adds the special casing to
this assert as well.
Closes: https://github.com/dart-lang/sdk/issues/45855
TEST=tests/language/vm/regress_45855_test.dart
Change-Id: Ica74a43bd2449dd994639c686253449146216458
Fixed: 45855
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197541
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Returning 'false' from a RPC handler in service.cc results in the VM
shutting down due to an UNIMPLEMENTED error. Since we always return
'true', even in the case of RPC errors, and the TODO to handle 'false'
returns is over 6 years old, RPC handlers should just have a void
return.
Example: invoking getSourceReport on an AOT VM should just return a RPC
error, but 'false' was being returned from GetSourceReport causing the
VM to shutdown.
Fixes https://github.com/flutter/devtools/issues/2955.
TEST=Existing service tests
Change-Id: I344c2f4cf849d27f08f59e8c61fb4c17c32719d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197241
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
This makes the AOT CodeRelocator more precise by removing some
heuristics which allows writing more precise tests as well.
Follow-up to:
https://dart-review.googlesource.com/c/sdk/+/195682
TEST=vm/cc/CodeRelocator_*
Change-Id: I36e55f4c8db0bd88dc5e3a58fc2f12d889dae2a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197383
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Some 64-bit microarchitectures store only the low 32-bits of targets as part of indirect branch prediction, predicting that the target's upper bits will be the same as the call instruction's address. This leads to misprediction for indirect calls crossing a 4GB boundary. Ask mmap to place our generated code near the VM binary to avoid this.
Cf. https://chromium-review.googlesource.com/c/v8/v8/+/2726500
TEST=ci
Change-Id: If99850c50383751fcde1b71e38019c78ff97a787
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197104
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Previously, Code objects of invisible functions were retained
in order to omit frames corresponding to such functions from stack
traces when stack trace is printed.
This change drops Code objects of invisible functions. That also
means that frames corresponding to such functions are no longer
skipped in binary DWARF stack traces.
In order to account for that, DW_AT_artificial attribute is added to
generated DWARF debug information to mark invisible functions.
Stack trace decoding now looks at this attribute and skips those
frames when symbolizing stack trace.
Flutter gallery in release-sizeopt mode:
Heap size of snapshot objects -4.2% (arm), -4.4% (arm64).
A large application in --dwarf_stack_traces mode:
Number of discarded Code objects increased from 72.4% to 83.7%
(out of all Code objects).
Heap size of Code objects -37.4%.
Heap size of all snapshot objects -5%.
TEST=tests/standalone/dwarf_stack_trace_invisible_functions_test.dart
Issue: https://github.com/dart-lang/sdk/issues/44852
Change-Id: Ib804852aba1e083670f1d9b9d66cbaab7dcdcff9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196583
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>