If multiple threads want to obtain metadata they might both evaluate and
possibly cache the result of evaluation. Since the kernel loader
initialy adds metadata mappings (the value being kernel offsets) we use
the existing `IG->program_lock()` which the kernel loader already holds.
Issue https://github.com/dart-lang/sdk/issues/36097
TEST=Tests using --enable-isolate-groups with JIT sharing.
Change-Id: I3b618f196abe9f7b584e4135a72a0017399ff2d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175301
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This CL makes use of the now included constant constructor coverage
in the dill file.
It works like this:
* When the CFE evaluates constants, every constant constructor
invocation evaluated saves the reference to the constructor in the
`Source` (from the Components uri to source table) for the callers
Library.
* This data is loaded into the VM in a "raw" format.
* When a request for coverage comes in, the VM - on top of the normal
coverage processing - goes through all scripts to find constant
constructor coverage for the requested script and offset. Note that
all scripts must be checked because library A can have evaluated a
constructor from library B - so even if only coverage for library B
was requested, library A has to be checked.
For all constructors found the start and end position is reported as
covered. Note that this does not mark any initializes and there are
(at least currently) no good way of marking which initializes were
evaluated (because it has to be stable across edits even when the
`advanced invalidation feature` is enabled).
* Note that the reason for the coverage to work on references - as
hinted above - is because we want it to be stable across hot reloads
even if/when advanced invalidation is enabled. This means, that
library A cannot record "positional coverage" for library B because
library B might get (for instance) new comments that will make any old
offsets invalid. By using references we always lookup in the current
world and use the correct offsets.
https://github.com/dart-lang/sdk/issues/38934
TEST=Existing test suite, new tests for the new coverage added.
Change-Id: I29531247a4b91a99d9a459cfdefbb9798e9c948f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175246
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Remove the use of Fields, which have since the metadata mechanism was introduced come to require global registration.
Retain some sloppiness matching of declarations by name instead of identity for the sake of hot reload.
TEST=ci
Change-Id: Ifa4cc7724096c606f994b057b7838e124ceb3626
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175141
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
The layout of WeakProperty is defined in C++ instead of Dart. Add missing recognition of its accessors so the compiler can use direct field access instead of always going through natives. Compare LinkedHashMap.
Change the sentinel for WeakProperty lists to object null so that no special constructor is needed.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/44333
Change-Id: I8686383053c2c345c972b6615b514a1381e79fda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175001
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
We serialize all changes to patchable call state to ensure we always
make progress (e.g. transition from Monomorphic -> Polymorphic).
Only if the miss handler actually needs to patch the patchable call do
we stop mutators - if it only updates ICData we don't have to do that.
=> In the future we might introduce a more clever mechanism to avoid
stopping mutators.
The CL also moves some locks from Isolate to IsolateGroup to ensure
all mutators use the same lock, since they operate on shared data
structures.
Issue https://github.com/dart-lang/sdk/issues/36097
TEST=Existing isolate tests that --enable-isolate-groups.
Change-Id: I4a11a8b8bb65581c6aba11cdf73acdea0f24a502
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174469
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
With lightweights isolates enabled we need to ensure to update entries
in MetamorphicCache in sequence with mutual exclusion.
This CL adds appropriate locking for the MegamorphicCache.
Right now this is safe in AOT because the entire SwitchableCallMiss
handler runs with stopped mutators. A future CL will relax this. That
future CL will also move the megamorphic mutex from Isolate to
IsolateGroup, since the megamoprhic caches are shared within an isolate
group.
Issue https://github.com/dart-lang/sdk/issues/36097
TEST=CL is purely a refactoring.
Change-Id: I30305b04027d2bf9b4d5f6b1700bf158d38bdba7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174467
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Dart mutator threads cause update to runtime type feedback information
(e.g. ICData, MegamorphicCache). With multiple lightweight isolates
sharing JITed code, they will share the type feedback as well. That also
means multiple mutators can try to update type feedback at the same time
with the same (or different) feedback.
This means we can run into situations where we're trying to update type
feedback with information that's already there.
=> At a minimum we want to avoid adding duplicate entries to the ICData,
so we have to guard against that.
Since the actual backing store to ICData is immutable, we have two
choices:
* Let each thread read the current backing store, make a
copy-on-write, add the new entry and update ICData with new backing
store.
=> This can lead to an successful update being visible for a short
period and then disappearing.
* We can can ensure mutual exclusion when updating the backing store
of ICData, thereby making read+grow+write appear atomic.
=> This requires taking a lock but ensures we never hit the same
IC miss multiple times.
=> We take the latter approach for now.
Issue https://github.com/dart-lang/sdk/issues/36097
TEST=CL is purely a refactoring.
Change-Id: Ic3b2de61e25de0210323edd732424cc7d1178771
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174465
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Since they are accessed via closures, dynamic calls are handled via
dynamic closure call dispatchers and so no non-covariant argument
checking remains at this point.
TEST=Existing FFI tests on trybots, also added a few dynamic cast
tests just in case.
Bug: https://github.com/dart-lang/sdk/issues/44343
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-product-arm64-try,vm-ffi-android-product-arm-try
Change-Id: If8daa2d71de4e9391dd35b31b62b67a8e7e69ffe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174463
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
This reverts commit 5370c56c80.
Reason for revert: Failures on
dartk-android-product-arm
dartk-android-product-arm
dartkp-linux-release-arm-qemu
like this:
sizeof(ScriptLayout) got 64, Script_InstanceSize expected 56
../../runtime/vm/dart.cc: 160: error: CheckOffsets failed. Try updating offsets by running ./tools/run_offsets_extractor.sh
sizeof(ScriptLayout) got 64, AOT_Script_InstanceSize expected 56
../../runtime/vm/dart.cc: 160: error: CheckOffsets failed. Try updating offsets by running ./tools/run_offsets_extractor.sh
Original change's description:
> [VM] Read and report constant constructor coverage from dill
>
> This CL makes use of the now included constant constructor coverage
> in the dill file.
>
> It works like this:
> * When the CFE evaluates constants, every constant constructor
> invocation evaluated saves the reference to the constructor in the
> `Source` (from the Components uri to source table) for the callers
> Library.
> * This data is loaded into the VM in a "raw" format.
> * When a request for coverage comes in, the VM - on top of the normal
> coverage processing - goes through all scripts to find constant
> constructor coverage for the requested script and offset. Note that
> all scripts must be checked because library A can have evaluated a
> constructor from library B - so even if only coverage for library B
> was requested, library A has to be checked.
> For all constructors found the start and end position is reported as
> covered. Note that this does not mark any initializes and there are
> (at least currently) no good way of marking which initializes were
> evaluated (because it has to be stable across edits even when the
> `advanced invalidation feature` is enabled).
> * Note that the reason for the coverage to work on references - as
> hinted above - is because we want it to be stable across hot reloads
> even if/when advanced invalidation is enabled. This means, that
> library A cannot record "positional coverage" for library B because
> library B might get (for instance) new comments that will make any old
> offsets invalid. By using references we always lookup in the current
> world and use the correct offsets.
>
> https://github.com/dart-lang/sdk/issues/38934
>
> TEST=Existing test suite, new tests for the new coverage added.
>
> Change-Id: I925963d1a9b9907efe621c72deb7348fa3be5ae8
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171949
> Commit-Queue: Jens Johansen <jensj@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
TBR=vegorov@google.com,bkonyi@google.com,jensj@google.com
Change-Id: I5187e6749d59ded250ec0933a94db0536485b70a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174470
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This CL makes use of the now included constant constructor coverage
in the dill file.
It works like this:
* When the CFE evaluates constants, every constant constructor
invocation evaluated saves the reference to the constructor in the
`Source` (from the Components uri to source table) for the callers
Library.
* This data is loaded into the VM in a "raw" format.
* When a request for coverage comes in, the VM - on top of the normal
coverage processing - goes through all scripts to find constant
constructor coverage for the requested script and offset. Note that
all scripts must be checked because library A can have evaluated a
constructor from library B - so even if only coverage for library B
was requested, library A has to be checked.
For all constructors found the start and end position is reported as
covered. Note that this does not mark any initializes and there are
(at least currently) no good way of marking which initializes were
evaluated (because it has to be stable across edits even when the
`advanced invalidation feature` is enabled).
* Note that the reason for the coverage to work on references - as
hinted above - is because we want it to be stable across hot reloads
even if/when advanced invalidation is enabled. This means, that
library A cannot record "positional coverage" for library B because
library B might get (for instance) new comments that will make any old
offsets invalid. By using references we always lookup in the current
world and use the correct offsets.
https://github.com/dart-lang/sdk/issues/38934
TEST=Existing test suite, new tests for the new coverage added.
Change-Id: I925963d1a9b9907efe621c72deb7348fa3be5ae8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171949
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
All existing embedders have been opted into --lazy-async-stacks, the
VM also uses it as it's default in all configurations.
After this CL, any user of --causal-async-stacks will get an error
message when trying to use it.
=> In any such case, please simply remove the flag.
TEST=Exhaustive CQ.
Bug: https://github.com/dart-lang/sdk/issues/37668
Change-Id: Ia440afcf2dba464aa8b8cf381b93bbac8eb9f8dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172564
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
An address containing an object header is sometimes interpreted as a object slot due to array truncation and concurrent marking/sweeping. Always accessing it as a word assuages TSAN that it won't be subject to tearing, and allows for the removal of TSAN suppressions from header access. In turn, this will allow TSAN to verify some acquire/release header accesses.
TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/44091
Change-Id: I7bf6449bf7dfeabd9db76e4bb37456e3be2d5124
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172861
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Followup CL to f085fd0f just to ensure there's no similar
lingering bugs in Script::GetSnippet by having it and GetLine
use the same helper to find the right indices.
Also removes the TokenPosition version of GetSnippet, which had
no callers.
TEST=Edited vm/cc/Script to add cases for Script::GetSnippet.
Bug: https://github.com/dart-lang/sdk/issues/44263
Change-Id: I18d9115f8334ced77ff3a5f398dacf8754a9d7b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174124
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
To prevent unoptimized compilations of functions from modifying
ICData objects, we'll ensure to populate the ICData with the right
information when it's created.
Furthermore this moves out resolution related code from ICData which
really doesn't belong there.
TEST=Refactoring of already tested code.
Issue https://github.com/dart-lang/sdk/issues/36097
Change-Id: I4b71118c02687a047077f2709c188b5d8a825de2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173968
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
The `ICData::AddTarget()` is always used directly after allocation of an
ICData (if needed). We'll remove it and add a `ICData::NewForStaticCall()`
which guarantees the ICData is correctly initialized from the start.
This avoids mental overhead of needing to think about whether
`AddTarget()` needs locking or not.
TEST=Refactoring of already tested code.
Issue https://github.com/dart-lang/sdk/issues/36097
Change-Id: I3529dd881887afb281c83b72117bdb9247a8dff0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173760
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
There's a case where String::SubString() can be called with a negative
length in the original code: if the desired line is not the first line
and is empty.
Since last_char_idx doesn't get updated by either a '\r' or \n',
last_char_idx will be the position before the last line terminator,
line_start_idx will be the start of the line, and thus the calculated
substring length will be either -1 (for '\n' or '\r' line terminators)
or -2 (for '\r\n' line terminators).
Refactor the code into two loops: the first to look for the line,
looping on a possible start index, and then if found, the second to find
the end index starting from the start index. This ensures that, when the
line is found, the the end index is >= the start index and thus the
substring call will succeed.
Fixes https://github.com/dart-lang/sdk/issues/44263
TEST=Edited vm/cc/Script to also verify Script::GetLine() no longer
crashes on such input.
Fixed: 44263
Change-Id: Ifca9d5d4984c24a6c40bd64f3ceaca06c7197444
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173965
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Also check in UpdateTypeTestCache for a mismatched result when
an otherwise matching entry has been added when isolate groups are
enabled.
TEST=Ran existing tests on trybots for each supported architecture.
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-simarm64-try,vm-kernel-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-ia32-try
Change-Id: I78f3ab3e7d433eeb7a501b98beb883cce0266784
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173723
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
As part of making lightweight isolates work in JIT, we will need to
ensure that whenever a new isolate is spawned it will get it's initial
global field table populated.
In order to achieve this we make the isolate groups initial field table
the authoritive place where we
a) register initial static field values
b) serializer reads them from, deserializer writes them to
This allows us to also remove the `FieldLayout::initial_saved_value_`
that was present for both static and non-static fields. In reality this
initial saved value is only meaningful for static fields though it was
kept in memory as well as (de)serialized even for non-static fields.
The one place where it was actually used for non-static fields was
incorrect and should instead use `null`.
The removal of this field results in net removal of code in this CL.
Issue https://github.com/dart-lang/sdk/issues/36097
TEST=Internal refactoring, relying on existing test coverage.
Change-Id: I088a87e2ea159bac7fa7f1f360da553d752e6569
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173263
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
As part of making lightweight isolates work in JIT, we will need to
ensure that whenever a new static field is loaded, it will get a new
slot on every isolate and the possibly initial static value is set in
all isolates's field state.
In order to achieve this we first move field registration out of
Field::New*() - to the place where the field is created and the initial
static field value is known.
In a future CL we will make a field registration be performed on all
isolates in a group.
TEST=CL is internal refactoring, existing test coverage.
Issue https://github.com/dart-lang/sdk/issues/36097
Change-Id: I802ae55b841be173733dbd0ad3dbffeebd5c1889
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173260
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This disables field unboxing in JIT with enabled lightweight isolates because currently unboxed generated code won't behave correctly if another isolate updates field unboxed state: for that guarded_cid updates would require stopping all isolates, getting to a safepoint.
Use of field guards(guarded_cid, is_nullable) in optimized compiler is concurrent-safe because each optimized compiler operates on its own clones of fields, which are checked for consistency with latest(mutator) state just before optimized code is installed.
Use of field guards in optimized generated code is safe because vm is brought to a safepoint and optimized code is deoptimized as soon as field guards are invalidated.
Use of field guards in generated unoptimized code outside of unboxed fields(transition to boxed from previously unboxed field is not safe which is why field unboxing is disabled) and use of field guards in unoptimized compiler is safe because transitions through guarded_cid and is_nullable makes less and less optimistic assumptions about the field state.
Issue https://github.com/dart-lang/sdk/issues/36097.
TEST=existing test suite
Change-Id: I00d37a49df483814c846b17c9c49e0dc6ce701e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172860
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
This option enables NNBD strong mode type checks and required parameter
checks even in NNBD weak mode. It is useful for testing partially
migrated code which cannot use sound null safety yet.
TEST=runtime/tests/vm/dart/strict_null_safety_checks_in_weak_mode_test.dart
Change-Id: I899e83d260fbed5b0fc5c1dcf0e42831d021bbe8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169963
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
This is a reland of 42c76fd910
Main issue was due to the parameter order of the invoke field dispatcher
not matching the argument order described by its saved arguments
descriptor. There's no reason for it not to, so now it does.
Also fixes some issues with stack trace tests that failed due to
increased deduplication of closures by forbidding deduplication for
those tests.
TEST=Run on trybots of all architectures as well as flutter engine
trybot, new test added for downstream issues seen after initial landing.
Original change's description:
> [vm/compiler] Move AssertAssignables out of closure bodies.
>
> This CL moves the final set of checks out of closure bodies and into
> dynamic closure call dispatchers. It also adds stubs for checking top
> types and null assignability for types only known at runtime.
>
> Fixes https://github.com/dart-lang/sdk/issues/40813 .
>
> Changes in Flutter gallery in release mode:
>
> * arm7: -3.05% total, +0.99% vmisolate, -0.89% isolate,
> -1.20% readonly, -4.43% instructions
> * arm8: -3.20% total, +0.99% vmisolate, -0.88% isolate,
> -1.18% readonly, -5.05% instructions
>
> TEST=Run on trybots of all architectures, includes test adjustments where needed.
>
> Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-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: Ifb136c64339be76a642ecbb4fda26b6ce8f871f9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166622
> Commit-Queue: Tess Strickland <sstrickl@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Régis Crelier <regis@google.com>
Change-Id: Ic5ec59cf355f7779bb82db798d97d762ba1e5556
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-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,vm-kernel-precomp-linux-product-x64-try,vm-kernel-linux-product-x64-try,flutter-engine-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172644
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This reverts commit 42c76fd910.
Reason for revert: Failures in flutter/google3. Initial hypothesis is related to product mode and instruction deduplication.
Original change's description:
> [vm/compiler] Move AssertAssignables out of closure bodies.
>
> This CL moves the final set of checks out of closure bodies and into
> dynamic closure call dispatchers. It also adds stubs for checking top
> types and null assignability for types only known at runtime.
>
> Fixes https://github.com/dart-lang/sdk/issues/40813 .
>
> Changes in Flutter gallery in release mode:
>
> * arm7: -3.05% total, +0.99% vmisolate, -0.89% isolate,
> -1.20% readonly, -4.43% instructions
> * arm8: -3.20% total, +0.99% vmisolate, -0.88% isolate,
> -1.18% readonly, -5.05% instructions
>
> TEST=Run on trybots of all architectures, includes test adjustments where needed.
>
> Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-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: Ifb136c64339be76a642ecbb4fda26b6ce8f871f9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166622
> Commit-Queue: Tess Strickland <sstrickl@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Régis Crelier <regis@google.com>
TBR=kustermann@google.com,regis@google.com,sstrickl@google.com
Change-Id: Iaf79acddcf18fb3699a894950b31515d6f759349
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172643
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
This CL moves the final set of checks out of closure bodies and into
dynamic closure call dispatchers. It also adds stubs for checking top
types and null assignability for types only known at runtime.
Fixes https://github.com/dart-lang/sdk/issues/40813 .
Changes in Flutter gallery in release mode:
* arm7: -3.05% total, +0.99% vmisolate, -0.89% isolate,
-1.20% readonly, -4.43% instructions
* arm8: -3.20% total, +0.99% vmisolate, -0.88% isolate,
-1.18% readonly, -5.05% instructions
TEST=Run on trybots of all architectures, includes test adjustments where needed.
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-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: Ifb136c64339be76a642ecbb4fda26b6ce8f871f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166622
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
This CL extends SubtypeTestCache entries with an additional slot that
contains the type being checked, to allow for future uses where
different runtime types can flow through a single checkpoint. This
change is separated from those future uses to determine the impact of
these changes only.
Thus, most SubtypeTestCache checks require the type as an additional
argument, and now the destination type register in TypeTestABI is now
untouched in SubtypeTestCache checks. Since there are currently no plans
for a dynamic InstanceOf test, the one argument SubtypeTestCache is left
unchanged.
Until we add cases in later CLs where the type can differ at the same
AssertAssignable instruction, we could check the type last since it is
currently guaranteed to be the same each time. However, we instead check
it after the instance, which is when it should be checked once we have
AssertAssignable instructions with types only known at runtime. This
avoids having to change it later, but also ensures the measured impact
of these changes can be compared to the impact of later changes.
In addition, this CL also unifies most of the code used by
GenerateInstanceOf (and also GenerateAssertAssignable via
GenerateInlineInstanceof on IA32). This is possible since register use
changes in the helper functions has eliminated the need to push the
instantiator and function type argument registers from TypeTestABI on
non-X64 architectures. By unifying these methods, we ensure that all
architectures appropriately set TypeTestABI::kDstTypeReg when necessary.
TEST=Existing tests on all architectures, change in object_test.cc.
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-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: I5d56de156e175758b3299ef1c776b848ac11f779
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172503
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Since the transition from Source based to Kernel based frontend to the
Dart VM, we have not supported callable redirecting factories. This has
caused all removed code in this CL to be unused and untested!
The support for reifing redirection related information would mainly be
used by embedder / dart:mirrors. Right now its not used by anyone and
the kernel support was never implemented.
I suggest we remove the unused and untested code until a decision has
been made that we actually want to support it - in which case it can be
properly implemented, possibly by re-using some of the deleted code in
this CL.
TEST=CL removes unused code, no test result changes.
Change-Id: I7ed45c85b4efcc1e81ce44cbe08bb555e52101b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166853
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Adds a @pragma("vm:recognized", <kind>) to all recognized methods, where
<kind> is one of "intrinsic", "graph" or "other", corresponding to the
kind of recognized method.
When running in debug mode, it is checked that all recognized methods
are marked with the correct kind of pragma, and that all methods marked
with the pragma are in fact recognized.
This enables kernel-level analyses and optimizations to query whether
a method is recognized by the VM.
TEST=Asserts that check the correspondence both ways, covered by test
suite, in particular the various CompileAll tests that compile all code.
Change-Id: I12f3305c72a93ecb1aefae2d66e3d9a7dae23b44
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168951
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Use of PositionalCount() and PositionAt() as indices in the arguments
array must account for the type arguments if present. Otherwise, we'll
either skip checking the last positional argument (in the former case)
or check against the wrong arguments (in the latter case).
In nosuchmethod_forwarding_arguments_test.dart, add cases that check for
the above mistakes.
In require_named_args_strong_test.dart, use the more specific
throwsTypeError or throwsNoSuchMethod checks instead of the generic
throwsError to ensure the correct error is thrown.
TEST=Changed tests to add extra cases for failures that can happen.
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try
Change-Id: If5e6c310d36d244bb0650ded54e32e583732584e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171947
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
This is a reland of ade333dd54
Original change's description:
> [wasm] Remove dart:wasm
>
> I'm not entirely sure why I had to modify a random set of fingerprints
> in runtime/vm/compiler/recognized_methods_list.h, but when I did a debug
> build it had some fingerprint errors.
>
> Change-Id: Ib0a0cccb37f2efba509e2b37b6eabe790fa933c4
> TEST= Deleting stuff, so not really necessary
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170620
> Commit-Queue: Liam Appelbe <liama@google.com>
> Reviewed-by: Liam Appelbe <liama@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
Change-Id: I0d1388f6312358cc62bb32f5ac7b88a3187223c9
TEST= Deleting stuff, so not really necessary
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171940
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
This reverts commit ade333dd54.
Reason for revert: This broke both the Flutter HHH and Google3 bots. It looks like some co-ordination is required between the Google3 and Flutter engine build changes for this CL to land.
Original change's description:
> [wasm] Remove dart:wasm
>
> I'm not entirely sure why I had to modify a random set of fingerprints
> in runtime/vm/compiler/recognized_methods_list.h, but when I did a debug
> build it had some fingerprint errors.
>
> Change-Id: Ib0a0cccb37f2efba509e2b37b6eabe790fa933c4
> TEST= Deleting stuff, so not really necessary
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170620
> Commit-Queue: Liam Appelbe <liama@google.com>
> Reviewed-by: Liam Appelbe <liama@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
TBR=rmacnak@google.com,liama@google.com
Change-Id: I244d7b3549845dd71719176a62b6ec3a4c4b5f86
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171860
Reviewed-by: Siva Annamalai <asiva@google.com>
I'm not entirely sure why I had to modify a random set of fingerprints
in runtime/vm/compiler/recognized_methods_list.h, but when I did a debug
build it had some fingerprint errors.
Change-Id: Ib0a0cccb37f2efba509e2b37b6eabe790fa933c4
TEST= Deleting stuff, so not really necessary
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170620
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>