Retrieval of local names only works in JIT as it relies on availability of LocalVarDescriptors.
For example, for this
```
import 'dart:isolate';
foo() {
final x = RawReceivePort();
RawReceivePort().sendPort.send(() => print("$x"));
}
main() {
foo();
}
```
error message says
```
Unhandled exception:
Invalid argument(s): Illegal argument in isolate message: (object is a ReceivePort)
<- field x in foo.<anonymous closure> (from file:///usr/local/google/home/aam/p/d/dart-sdk1/sdk/s1.dart)
```
Bug: https://github.com/dart-lang/sdk/issues/52957
TEST=ci
Change-Id: I684014fd19ea82829e7df17a8a67d386551a5a82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/314501
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
This is already skipped for AOT and is unfixable after the DropTransitiveUserDefinedConstants optimizations.
This is already skipped for reload and is unfixable for issues related to 40442.
The non-reload JIT case isn't very interesting since each kernel constant will be loaded only once anyway.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/27003
Bug: https://github.com/dart-lang/sdk/issues/44862
Change-Id: I0676a96426142600f4ed9ec638b344a858aab7dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/314480
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
regress_45684_test.dart makes use of the debugger, which isn't supported
in AOT.
TEST=N/A
Change-Id: I454aa92d1ce33638380e6fd02654dc5f925c2bf1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/314820
Reviewed-by: Dan Chevalier <danchevalier@google.com>
The underlying storage is only intptr_t.
TEST=ci
Change-Id: Ibb687707eb4935d71080193e55ec4366c5b9c8e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/314320
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
a) Remove 2 fields in our object representation:
* PatchClass::library_data_
* Library::kernel_data_
=> This saves O(#libraries + #patch-classes) which can amount up to
10+ MB for big apps, as we save not just the slots but the
[ExternalTypedData] objects they used to reference.
Instead we'll compute the KernelLibraryData when we need it by making a
[TypedDataView] of sub parts of the component.
b) We make a kernel binary be represented by a single [ExternalTypedData].
Whenever we need a sub-part of a kernel binary (e.g. one for each
component for concatinated kernels, or one for a library inside a
component) we use proper [TypedDataView]s for that.
c) As we sometimes need to create a view of only a particular library
within a component we need to find start/end of a library based on
index.
=> We store the library index instead of the library offset on
Library/PatchClass.
=> We can easily derive the start/end of a library from it's index by
looking at the kernel component encoding.
d) We make the [Reader] object work purely based on a pointer - instead
of making it have if/else when reading bytes (either from pointer or
from a view).
e) We make the [KernelProgramInfo] store the kernel_component and
various TD views into it.
TEST=ci
Change-Id: Ibe160881ff48635e834c3d647a977a144b5d0565
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313561
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Creation of AppJit snapshot will not include the source of [Script]
objects (see `UntaggedScript::snapshot_to`). As a result there's no
point in letting the CFE embed the sources into the kernel if we
only use it to create an AppJit snapshot.
This is also in line with build rules for our dart-sdk, where we do the
kernel compilation separately, see utils/application_snapshot.gni:
```
template("application_snapshot") {
...
# Build the kernel file using the prebuilt VM to speed up the
# debug and simulator builds.
prebuilt_dart_action(target_name + "_dill") {
...
args = [
...
"--no-embed-sources",
...
]
[[[
}
...
}
```
TEST=ci
Change-Id: I4e17e49dc21af6102d62c2278dbd6ebbe387f7e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313560
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Insert CheckNull instructions if in AOT mode prior to checking the
index for being within the bounds in inlined indexing operations.
If we're in --sound-null-safety mode, they'll be canonicalized away
since the indices won't be nullable anyway.
Fixes https://github.com/dart-lang/sdk/issues/52910.
TEST=corelib{,_2}/list_removeat_test and
co19_2/LibTest/core/String/codeUnitAt_A03_t01 on
vm-kernel-precomp-linux-release-x64-try
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-x64-try
Change-Id: I37212e94c7c5032c75709e3f0bb91734cbc705cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313507
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
When running with `--no-sound-null-safety` turned on, it turns out null
is unboxed as an Mint in some cases without checking for null first.
Before, tests would fail because unboxing it would give a really
large int that was unlikely to be acceptable to subsequent range
checks and the like.
However, since 2f63ace, that memory is now zero-initialized, and zero is
more likely to be an acceptable value, so tests either fail for
unexpected reasons or, worse, unexpectedly succeed.
As a stopgap until the appropriate checks are emitted, we initialize
the contents of null with its address as an ObjectPtr like we used to.
TEST=corelib{,_2}/list_removeat_test on dartkp-* configurations.
Issue: https://github.com/dart-lang/sdk/issues/52910
Change-Id: If456d503c86202616f4f566a402118e9c41194ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313500
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
set_pointer_offsets_length() sets a part of the state_bits bitfield,
so we need to move this check before it's called.
Fixes https://github.com/dart-lang/sdk/issues/52923
TEST=vm-linux-debug-ia32 builds
Cq-Include-Trybots: luci.dart.try:vm-linux-debug-ia32-try
Change-Id: I9f4ec78b03a6b7b2d45f13e9cc277411dcc90493
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313480
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
** KernelProgramInfo
The VM can load multiple kernel files into an isolate. Each kernel file
is represented as a [KernelProgramInfo] object. Loading a kernel blob
will result in a tree of objects
Library
- TopLevelClass
+ Field
+ Function
+ Class
+ Field
+ Function
+ ... closure functions ...
The entire tree belongs to one [KernelProgramInfo] object. There are
two exceptions
* after a hot-reload we inject [PatchClass]es (as owners of
old [Field]/[Function] objects) that identify the old kernel data
* expression evaluation functions will get a special data array with
information about the expression evaluation kernel data
=> We attach the [KernelProgramInfo] to the root of the tree, namely
the [Library]
=> We introduce `{Field,Function,Class,Library}::KernelProgramInfo()`
that will get that object - by walking up the chain.
=> We introduce `UntaggedPatchClass::kernel_program_info_` field that
allows saving the old [KernelProgramInfo] (on which the old
[Field]/[Function] objects are based upon) in the [PatchClass].
=> We include the [KernelProgramInfo] in the expression evaluation
data array.
** Scripts
A [Script] object should represent a .dart source file. It contains the
source, line offsets, etc. of that dart source file. The contents of a
dart source file may be used by many classes/libraries or even many
kernel blobs (e.g. via our copying mixin application).
When we build a tree like above, we'll attach a reference to a
[Script] object to [Class] objects. But members of a class may come from
a different script, in which case we inject an intermediary [PatchClass]
that references that other script.
When the compiler frontend loads kernel, builds flow graph, etc we walk
down the kernel binary (the tree above) - all belonging to the same
[KernelProgramInfo] object, but sub-parts may belong to different
[Script]s.
=> We use the existing [ActiveClass] class that keeps track of the
current class & member inside the class we're operating on.
=> Whenever we need the script we get it from the active member
function/class.
** Misc
We make kernel related classes (e.g. [KernelReaderHelper]) independent
of [Script].
We make the [Script] objects hold on to the [KernelProgramInfo] they are
based upon (e.g. for lazy source reading). But since a given [Script]
doesn't belong to a particular kernel blob (multiple kernel blobs may
contain information about the same script) we don't expose this in the
public API.
=> In the future we could have a unique [Script] object per url (instead
of having several as we do now)
TEST=ci
Change-Id: I7bd698f497b0bd8ab8e546540bb1dad5b5a6dd48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313381
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Goals of this CL, a followup to 2f63acea22:
* Ensure that X::New() depends on the initialization guarantees of
Object::Allocate<X>(...):
* Ptr fields are guaranteed to be initialized to Object::null().
* Non-Ptr fields are guaranteed to be zero-initialized.
In cases where the only uses of the allocated object before return
was to perform unnecessary field assignments, X::New() just simply
returns the result of Object::Allocate<X>(...).
Otherwise, the old now-unnecessary assignments have been changed
into ASSERTs so that they will be checked in DEBUG mode.
* Ensure that NoSafepointScopes are entered in X::New() only when
necessary (e.g., to ensure fields used to calculate to(...)
are properly set before being seen by pointer visitors as the GC
may run when outside a NoSafepointScope).
In particular, the often occurring pattern:
auto& result = X::Handle();
{
auto raw = Object::Allocate<X>(...);
NoSafepointScope no_safepoint;
result = raw;
}
...
has been replaced with:
const auto& result = X::Handle(Object::Allocate<X>(...));
* If a handle was allocated, the only uses of that handle before
returning must be performed under a NoSafepointScope, and the same
operations can be done directly on the object pointer, then do so
and remove the unnecessary handle allocation.
Notable changes outside the above:
* Swapped ObjectPool::EntryType::{kImmediate,kTaggedObject} so that
kImmediate has value 0, since Object::Allocate<ObjectPool>(len)
zero-initializes the payload and without this change,
ObjectPool::New() must set the entry types manually.
* Removed the old static ArrayPtr cached_array_ field on
SubtypeTestCache as well as SubtypeTestCache::{Init,Cleanup} and
instead added Object::empty_subtype_test_cache_array().
* Removed the no-arg Closure::New() method, which is never used.
* Inlined the no-arg Script::New() method into its only caller,
one of the other Script::New() overloads.
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/52876
Change-Id: I079b4c9f73c7d2c0146c30cf2cd570b91a1ecf36
Cq-Include-Trybots: luci.dart.try:vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-linux-release-x64-try,vm-aot-linux-product-x64-try,vm-aot-linux-release-x64-try,vm-aot-linux-debug-x64-try,vm-ffi-qemu-linux-release-riscv64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313120
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
- Don't need to repeatedly verify function fingerprints for each isolate.
- Fix test detecting when it runs under debug mode or a simulator.
Change-Id: Iace0ebc274d4c01561a4b563a420e80535b1ff59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313243
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
GCC (used in the RISCV64 build) and clang (used to build other
architectures) have different views of what's visible in the return type
position for an external template method definition. Thus, move the
use into the definition body via constexpr if, which works for both.
TEST=dart-sdk-linux-riscv64-try
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-riscv64-try
Change-Id: Id7adfd93764ff11d99d3ded4893739b90bb25676
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313123
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
This was originally added for kbc in [0]. But it seems this is unused
in the kernel frontend.
For performance reasons we may want to implement this at some point
properly but until then let's remove the dead code.
[0] https://dart-review.googlesource.com/c/sdk/+/112680
TEST=ci
Change-Id: Ic4f4edd976c625316f77822a4067763ab31ea3ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313122
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
There have been multiple cases in the past where using Object::null()
as the initializer, even for non-Ptr fields, has caused nondeterministic
snapshot creation. In particular, this can happen if a non-Ptr field
is only used in some versions of an object but not others, and thus
there is no reason to worry about what the value of the field is during
runtime. Only when snapshotting can it become relevant that the field
value is a portion of the address of Object::null(), which can vary
over different runs.
Instead of initializing the entirety of allocated objects (outside
of a few rare cases) with Object::null(), only initialize the portion
of the object corresponding to object pointer fields (in most cases,
between from() and to() inclusively) to Object::null() and initialize
the rest of the object to 0.
With this change, the only special casing in Object::InitializeObject
that remains is to skip initialization for TypedData and Arrays when
the memory is guaranteed to be zero initialized and to initialize the
contents of Instructions objects with the break instruction, not 0.
Note that this behavior does not occur in the following cases, which
all involve copying an arbitrary object:
* Object::Clone(), which zero-initializes the contents of the object
in all cases. However, the contents of the original object are then
copied over before the thread can reach a safepoint.
* Inside the ObjectGraphCopier, which uses the old initialization
behavior. This is safe, as any GC-important fields are immediately
copied over, and the rest of the contents are eventually copied over
before the caller receives the root of the copied object graph.
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/52876
Change-Id: Ib09fc562a8b6af97b509b493eb2d64109230ec35
Cq-Include-Trybots: luci.dart.try:vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-linux-release-x64-try,vm-aot-linux-product-x64-try,vm-aot-linux-release-x64-try,vm-aot-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312900
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
TEST=Loaded the timeline in DevTools on a debug build with the recorder
set to ring, endless, and startup. Recorded traces on a debug build with
the recorder set to systrace, file, and perfettofile. Ran the
vm/cc/TimelineRingRecorderRace test on ASAN and TSAN.
Issue: https://github.com/flutter/flutter/issues/129258
Change-Id: I39920ac3e4a70e5714915fcd554ae171ed82504a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312721
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
TEST=Recorded traces using the file recorder on ASAN and TSAN builds.
Change-Id: I2251a8373d952d6e3ef1803e9a79de85522f518a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312720
Reviewed-by: Ben Konyi <bkonyi@google.com>
Makes the TSAN skips apply to
`test.py -mrelease --sanitizer=tsan`
and not just
`test.py -n vm-tsan-linux-release-x64`.
Also makes the timeouts agree.
Change-Id: I10315e754a4ebb3020f3c2f6cecfac6b77e77a9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311828
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
The timeout multipiler for linux-arm64 was originally 4, then lowered to
1 (see [0]), then increased again to 2 (see [1]).
Though it seems that service tests are still flakily timing out, so
let's try restoring the original multilier.
[0] https://dart-review.googlesource.com/c/sdk/+/306662
[1] https://dart-review.googlesource.com/c/sdk/+/307972
Also special case `ia32` in timeout calculations due to not using
an AppJIT trained `kernel-isolate` snapshot and therefore being
very slow, especially in ia32-debug mode.
Issue https://github.com/dart-lang/sdk/issues/52589
TEST=ci
Change-Id: Iab8c768866aec9e77bb83c7a3242cc5de8fb4e2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312905
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
This is a revert of b6bbfff8c0c6c44cdab0d7d78 which temporarily disabled
this.
Turns out that a non-TSAN gen_snapshot would - when emitting code via
`Assembler::TsanLoadAcquire` - use an incorrect `Thread`-offset:
It calculated the offset via `Thread::OffsetFromThread`. That function
took a `dart::RuntimeEntry*` and tried to find its offset.
We happen to have the following leaf runtime entries:
#define LEAF_RUNTIME_ENTRY_LIST(V)
...
V(void, MsanUnpoison, void*, size_t)
V(void, MsanUnpoisonParam, size_t)
V(void, TsanLoadAcquire, void*)
V(void, TsanStoreRelease, void*)
...
It loops over all runtime entries and finds the first one that has the
identical `dart::RuntimeEntry::function_` pointer.
Though all 4 of them are `nullptr` at `gen_snapshot` time, so when
searching for offset for
`Thread::OffsetFromThread(kTsanLoadAcquireRuntimeEntry)`
it looked for the first runtime entry with `nullptr` function pointer -
which turned out to be `MsanUnpoison` (instead of `TsanLoadAcquire`).
=> The obvious fix is to use the `dart::RuntimeEntry*` pointer for
comparison instead of it's `function_` member.
TEST=ci
Issue b/287638965
Change-Id: I85c06674927978ef8561e9e7bdfab4823c0a8e1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312902
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
This assertion hits flakily due to races between compilers
(e.g. mutator vs background compiler or multiple mutators racing
with itself).
The discovered races are benign, so we just going to remove
the assertion.
Closes https://github.com/dart-lang/sdk/issues/52806
TEST=ci
R=kustermann@google.com
Change-Id: I8c4202bd76acea0fbf3724f19dbbc69958937afc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312903
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
This reverts commit 83616c9b56 as it was
not needed for flutter roll, which landed anyway.
TEST=ci
Change-Id: I38a85ab117cabd98420bc88e698a481b094d7345
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312886
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Auto-Submit: Alexander Aprelev <aam@google.com>
The adjustments to g3 build rules that allow running non-TSAN
gen_snapshot targeting TSAN AOT runtime aren't quite fleshed out yet.
So we temporarily let `gen_snapshot` detect whether to target TSAN by
whether it is itself compiled in TSAN (instead of via
`-DTARGET_USES_THREAD_SANITIZER`)
TEST=ci
Issue b/287638965
Change-Id: I2cd744f959d8302ba81cb1feceedee2756e02656
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312901
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
This may simplify some g3 build rules as it allows passing this define
whenever we compile under TSAN - instead currently it can only be passed
if DART_PRECOPMILER is also passed.
TEST=ci
Change-Id: I73e51243716373cdeca7559b344408bb206e22ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312801
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Not all methods that create FfiTrampoline functions set this, and if not
set, it'll default to a byte from the address of Object::null() due to
Object::InitializeObject, which can break the determinism of the build.
Fixes b/290012924.
TEST=ci
Change-Id: I71ee2eb937b288ec3c6e6a0534e9d870511cf968
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312266
Commit-Queue: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Tess Strickland <sstrickl@google.com>
The VM has two parts related to TSAN: compiler & runtime.
So far both parts used self-detection whether running with TSAN. This
implies that if AOT runtime runs under TSAN that the AOT compiler then
also has to run under TSAN (which is slow).
We separate the two by making the compiler use
`TARGET_USES_THREAD_SANITIZER`. It will be auto-detected by-default
except when `DART_PRECOPMILER` is set. In the precompiler case we
require the build rules to pass in whether the target runs under
TSAN or not.
Issue b/287638965
TEST=ci
Change-Id: Ib333a8a69ed2d7bdca7596014a0d25b103af25b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312480
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
The CFE may return super-bounded types (types that are a strict
supertype of the rare type) for certain type positions like the right
hand sides of `is` and `as` checks, so we can't assume that all types
involving a given class is a subtype of its rare type. Note that this is
only for uses that do not involve instantiation, as all instances of a
class must have runtime types that are a subtype of its rare type.
Keeping this in mind, here are the changes being made in this CL.
-----
In the flow graph builder when producting unoptimized code, we
previously assumed that if the checked type is not equal to the rare
type, then the code can't use _simpleInstanceOf, which only performs
class ID checks. However, if the checked type is a supertype of the
rare type, we can, because any instance is guaranteed to be a subtype of
the checked type.
Note that this didn't cause incorrect behavior, just more work than
needed in some cases.
-----
In the generation of optimized type testing stubs, we assumed that the
null type argument vector (TAV) is a possible instance TAV for any
instance. However, if the rare type for a class has a non-null TAV, then
no instance of that class can have a null TAV and we can skip the null
check. (We keep it in the DEBUG case, but just to immediately trigger
a breakpoint if seen.)
Again, no incorrect behavior caused here previously, just an unnecessary
check that we now remove in some cases.
------
Also when generating optimized type testing stubs, when checking for the
null TAV prior to instance type argument checks, the code assumed that
it was possible to have to check type arguments if the checked type was
a super type of the rare type for the instance's class. However, that's
backwards: if the checked type is a super type, then the runtime type of
any instance of the class is guaranteed to be a subtype and we shouldn't
be checking type arguments at all.
Thus, add an ASSERT that checks this, and instead only generate the code
that goes to the runtime if the null TAV is seen, as the runtime type of
the instance is the rare type and the rare type is guaranteed to not be
a subtype of the checked type.
Again, the previous version of this wouldn't have caused incorrect
behavior either, because the VM should never generate type arguments
checking in the type testing stub if the checked type is a supertype of
the class's rare type. Thus, that branch in the code generation was
just dead code.
-----
TEST=vm/cc/TTS, ci (especially DEBUG bots)
Issue: https://github.com/dart-lang/sdk/issues/52848
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-x64-try,vm-linux-debug-x64-try
Change-Id: I86d159693d6218f88dd1f04dd34cba702744b4d2
Fixed: 52848
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312500
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
OSError has a destructor so we need to be careful when
using it with Dart_ThrowException which does not
invoke destructors.
Fixes https://github.com/dart-lang/sdk/issues/52816
TEST=standalone/regress_52715_test with ASAN
R=sstrickl@google.com
Cq-Include-Trybots: luci.dart.try:vm-aot-asan-linux-release-x64-try
Fixed: 52816
Change-Id: I8933c1ae41991586571bc76c35ec7dfc28bab7f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312301
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
It's not supported, as it would prevent the value from being
garbage collected, defeating the purpose of Finalizer.
Not sure if an exception is worth it, so added the assert
as suggested in the bug tracker.
TEST=vm/dart{,_2}/finalizer/finalizer_attach_checks_token_test
Bug: #52731
Change-Id: Id7b457ca1a95e71c1a43d2d2c8569c35659952b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311020
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Without this, compiling with MSVC fails with the error:
```
error C2397: conversion from 'int' to 'uint8_t' requires a narrowing conversion
```
TEST=vm-msvc-windows builds
Cq-Include-Trybots: luci.dart.try:vm-msvc-windows-try
Change-Id: I157b8ac9f6f6aaaf31b71d2c0a5f5469d6dc21ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312262
Auto-Submit: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Previously, Class::RareType() returned a Type where the type arguments
were null (e.g., all dynamic). However, this is an invalid type for
classes that have at least one type parameter with a bound that is not a
top type, and could mean that comparisons (such as subtyping) against
the "rare" type could return incorrect answers.
Instead, use TypeParameters::defaults() to get the canonicalized
instantiated to bounds type argument vector and use that instead.
TEST=ci
Cq-Include-Trybots: luci.dart.try:vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-linux-debug-x64-try,vm-linux-release-x64-try
Change-Id: Iea591e93102f53713265b481476f9670cfb81c93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312261
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
If we are generating a SubtypeTestCache for a known type that only
needs instantiator type arguments to be fully instantiated, then
don't store and check against the unneeded function type arguments.
TEST=vm/cc/STC, vm/cc/TTS, ci
Change-Id: I370adf820168079322b8a87811057670a47ee6b3
Cq-Include-Trybots: luci.dart.try:vm-tsan-linux-release-x64-try,vm-reload-rollback-linux-release-x64-try,vm-reload-linux-release-x64-try,vm-linux-release-x64-try,vm-aot-tsan-linux-release-x64-try,vm-aot-linux-release-x64-try,vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-linux-debug-x64-try,vm-mac-debug-arm64-try,vm-aot-mac-release-arm64-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-linux-debug-ia32-try,vm-linux-release-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311382
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This reverts commit 1cbb5debeb.
Reason for revert: ../../runtime/vm/compiler/aot/precompiler.cc: 3113: error: expected: api_uses_.HasKey(*entry)
Original change's description:
> [vm] Improve Class::Hash by also hashing its library
>
> Class::Hash previously only hashed class name. This could cause
> hash collisions for top-level classes which have the same name.
>
> Function::Hash uses Class::Hash, so it could also
> suffer from hash collisions among top-level functions.
>
> This change adds hashing of library URI when calculating
> Class::Hash / Function::Hash.
>
> TEST=ci
>
> Change-Id: I8bed681ecb8b8a6b0fceb99866c551ff19a36ab7
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311930
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
Change-Id: I0ec3746d2756cd681695cf4b4304733783df7192
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312060
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Class::Hash previously only hashed class name. This could cause
hash collisions for top-level classes which have the same name.
Function::Hash uses Class::Hash, so it could also
suffer from hash collisions among top-level functions.
This change adds hashing of library URI when calculating
Class::Hash / Function::Hash.
TEST=ci
Change-Id: I8bed681ecb8b8a6b0fceb99866c551ff19a36ab7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311930
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
The main contribution of this CL is unification of disparate
handling of various functions like `Future.timeout`,
`Future.wait`, `_SuspendState.createAsyncCallbacks` and
`_SuspendState._createAsyncStarCallback` into a single
`@pragma('vm:awaiter-link')` which allows Dart developers
to specify where awaiter unwinder should look for the next
awaiter.
For example this allows unwinding to succeed for the code like this:
Future<int> outer(Future<int> inner) {
@pragma('vm:awaiter-link')
final completer = Completer<int>();
inner.then((v) => completer.complete(v));
return completer.future;
}
This refactoring also ensures that we preserve information
(including Function & Code objects) required for awaiter
unwinding across all modes (JIT, AOT and AOT with DWARF stack
traces). This guarantees users will get the same information
no matter which mode they are running in. Previously
we have been disabling awaiter_stacks tests in some AOT
modes - which led to regressions in the quality of produced
stacks.
This CL also cleans up relationship between debugger and awaiter
stack returned by StackTrace.current - which makes stack trace
displayed by debugger (used for stepping out and determinining
whether exception is caught or not) and `StackTrace.current`
consistent.
Finally we make one user visible change to the stack trace:
awaiter stack will no always include intermediate listeners
created through `Future.then`. Previously we would sometimes
include these listeners at the tail of the stack trace,
which was inconsistent.
Ultimately this means that code like this:
Future<int> inner() async {
await null; // asynchronous gap
print(StackTrace.current); // (*)
return 0;
}
Future<int> outer() async {
int process(int v) {
return v + 1;
}
return await inner().then(process);
}
void main() async {
await outer();
}
Produces stack trace like this:
inner
<asynchronous suspension>
outer.process
<asynchronous suspension>
outer
<asynchronous suspension>
main
<asynchronous suspension>
And when stepping out of `inner` execution will stop at `outer.process`
first and the next step out will bring execution to `outer` next.
Fixes https://github.com/dart-lang/sdk/issues/52797
Fixes https://github.com/dart-lang/sdk/issues/52203
Issue https://github.com/dart-lang/sdk/issues/47985
TEST=ci
Bug: b/279929839
CoreLibraryReviewExempt: CL just adds @pragma to facilitate unwinding
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-dwarf-linux-product-x64-try
Change-Id: If377d5329d6a11c86effb9369dc603a7ae616fe7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311680
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Currently every invocation of a dart function will set and later on
reset the stack limits. Doing so requires acquiring locks.
Similarly because we have async ffi callbacks (another way to invoke
dart code) the logic was duplicated there.
Though the stack limit never changes for a given [OSThread]. Isolates
can run on different [OSThread]s throughtout its lifetime. But an
isolate always has to be entered on a native thread before it can
execute dart code.
=> We initialize the stack limit when we scheduling an isolate on a
thread and re-set it when unscheduling it.
=> That centralizes the place to one where we have to deal with stack
limits and avoids repeated acquiring of locks on each embedder dart
function invocation.
TEST=ci
Change-Id: Ia59ba8f92b93c58a990010ec75dfcd879aea2c43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311960
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
The makes it possible to run just these tests with `test.py vm/gc/`.
Change-Id: Ied4aa0b2fb045c19b1aced68f58a1ef195a5df8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311145
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Currently the generational and incremental barriers cannot both apply for the same store because the former only applies for old->new stores and the latter only applies for old->old stores. Marking through new-space will cause the incremental barrier to apply to all stores.
TEST=ci
Change-Id: I40d492cc8b5b2fff8d5d4bc8625d45f2e6a2d488
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309830
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
The [PatchClass] no longer needs to refer to a original [Class] and a
patched [Class] objects: Since the CFE does handling of patches the VM
only has a single [Class] object, so those two fields are always the
same.
=> Change `PatchClass::{origin_class,patched_class} -> `PatchClass::wrapped_class`
We also remove the `Field::Origin()` / `Function::origin()` methods
as they return the same as the `Owner()` would return.
TEST=ci
Change-Id: Iec0849f6ffc2026760dad89a9bcf07e9469bc8b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311840
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This splits `Dart::InitializeIsolate()` into
* `Dart::InitializeIsolateGroup()` that sets up an `IsolateGroup`
=> This is only done at isolate group creation time when the very
first isolate is created.
* `Dart::InitializeIsolate()` that sets up an `Isolate`.
=> This is done for every isolate.
This is purely refactoring / code cleanup.
TEST=ci
Change-Id: Ica906444f79fe49849b9e11e96f7c89184cb9d09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311603
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Handle::data_ready_ contains bytes which are ready to be sent to Dart
side. Not all code paths fully drain this buffer and delete it
before destroying the handle, for example directory watch implementation
was prone to leaking data_ready_ when subscription was cancelled.
This CL switches the code to use unique_ptr to hold on to data_ready_
which makes sure that it is deleted when Handle is destroyed.
The code would benefit from holding all OverlappedBuffer instances
through unique_ptr but that is a much larger refactoring which
we leave for a later date.
Fixes https://github.com/dart-lang/sdk/issues/52715
TEST=standalone{,_2}/regress_52715_test
Bug: 52715
Cq-Include-Trybots: luci.dart.try:vm-win-release-x64-try,vm-win-debug-x64-try,vm-aot-win-release-x64-try,analyzer-win-release-try
Change-Id: Ie8d728b823de7e8f9de1489898e270580c2af269
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311841
Commit-Queue: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Auto-Submit: Slava Egorov <vegorov@google.com>
When Isolate is just starting up and no TLABs are yet present
we were setting interval_to_next_sample_ to -1 which caused
every old space allocation to be sampled.
This CL properly initializes the interval to sampling_interval_
instead.
TEST=vm/cc/DartAPI_HeapSampling_CorrectSamplingIntervalForOldSpaceAllocations
Change-Id: Ieb29234379d3afa4716ebdf3591f9fc0cbcaef71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311844
Commit-Queue: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Auto-Submit: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Root cause is that `Function::Hash()` depends on the owner class
id. This causes two issues
a) Issue with reload:
During reload the reloader code will change `Function::owner()`
from a `Class` to a `PatchClass`. This in return will cause a change in
the function's hash, which means we won't find the function in the
closure cache anymore.
b) Issue with app-jit:
As part of app-jit we re-number class ids. This re-numbering would also
render the closure cache as invalid - as the function hash code would
change. So instead the closure cache was cleared entirely. While this
works for AOT, in app-jit we may serialize closure functions and their
code. Though at app-jit runtime we then fail to find the functions in
the closure function cache (as it was cleared during snapshoting)
(This will surface by us triggering an optimizing compile of a function
in the background compiler which will try to make a new `Function`
object for a closure, even though the app-jit snapshot already has one)
To fix these issues we make the `Function::Hash()` stable across reload
* we use `Function::Owner()` instead of `Function::owner()` (the
former will always return the actual class, the ladder can return
the `PatchClass`)
* we avoid re-hashing the closure cache by making `Function::Hash()`
use the name of the class instead of the class id
* we clear out the closure cache array during AOT snapshoting, as this
is not used in AOT runtime.
Closes https://github.com/dart-lang/sdk/issues/52803
TEST=Fixes various issues on CI.
Change-Id: I352d0a768df0f29d504cdd80e3533cbedc437b9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311744
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
This adds FileUriConstantExpression, a subclass of ConstantExpression, to support correct file offset of annotations for augmentations and patches.
The FileUriExpression is used to carry the file uri of the expression
before constant evaluation.
TEST=general/patch_annotations
Change-Id: I0dc8a0cb97dd530fd1960785d38c2d5e4883c3dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311660
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
More details about the design:
https://docs.google.com/document/d/1QDjyY_6wOTOgURwpeYMKU9qEz0gKxx2MUrdruC6Kp6c/edit?usp=sharing
Change-Id: Ie3985d86dca7f5010044ca46c33ca177588c0f69
Bug: #37022
CoreLibraryReviewExempt: Reviewed by vm and api groups. web and wasm groups not affected because FFI isn't on those platforms.
TEST=async_void_function_callbacks_test.dart, ffi_callback_metadata_test.cc, other front end tests
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305900
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Hashes of functions depend on the class ids, so cache of the closure
functions should be cleared when class ids are sorted.
This is safe to do because at that point all compiled code is cleared.
TEST=ci
Change-Id: Iaf3a66d1026611fc0a3df3903cb4e09e6d6c4c17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311723
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Previously, inliner was able to inline closure calls only when closure
was allocated in the current function (or in a function which was
inlined so far). This is not true for local functions declared in outer
functions (they are allocated at declaration site).
Now, when calling local functions, target of closure call is always
known regardless of where the function is declared, so calls to local
functions can be inlined.
TEST=runtime/tests/vm/dart/inline_local_functions_il_test.dart
Fixes https://github.com/dart-lang/sdk/issues/52695
Fixes https://github.com/dart-lang/sdk/issues/15558
Change-Id: I0e51dbaf63a6d4427bff366b40414ca5fac3d418
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311465
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
These checks convert what would likely be a segfault into a breakpoint
instead, but they're heavyweight enough on certain tests to cause
timeouts. Remove them as issues here are easily debugged without them.
Fixes https://github.com/dart-lang/sdk/issues/52787
TEST=vm/dart/regress_48523 on debug reload bots
Change-Id: Icf9ea6191eb82c254d9a01fbc9f8ba6255602084
Cq-Include-Trybots: luci.dart.try:vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311621
Auto-Submit: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
The main difference from the previous harness is that it
allows auto updating the expectations instead of
maintaining them manually.
This relands 0c1b2722ed with
changes to harness which fix issues on Windows.
Note: some amount of AOT failures are expected and should just
be approved. They will be fixed with the last CL in the series.
TEST=ci
Cq-Include-Trybots: luci.dart.try:vm-win-release-x64-try
Change-Id: I7ae84769ed54bc447ebf71acc68ba9d0b6717bac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311604
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Auto-Submit: Slava Egorov <vegorov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
This reverts commit 0c1b2722ed.
Reason for revert: Failures on AOT (stack expectations unmet) and Windows (parse errors due to Windows paths) trybots.
Original change's description:
> [vm] Rename tests causal_stacks -> awaiter_stacks and improve harness.
>
> The main difference from the previous harness is that it
> allows auto updating the expectations instead of
> maintaining them manually.
>
> TEST=ci
>
> Change-Id: I80e303d3ecbcc834ac94fa089cabe4f8834cc661
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311400
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Slava Egorov <vegorov@google.com>
Change-Id: I7311bf08403f4167f88f6204fde1a6fdee353f7d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311600
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
The main difference from the previous harness is that it
allows auto updating the expectations instead of
maintaining them manually.
TEST=ci
Change-Id: I80e303d3ecbcc834ac94fa089cabe4f8834cc661
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311400
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
The name is more accurately reflects what this stack trace
contains: despite what causal implies it does *not* actually
reflect the stack which initiated the async operation. Instead
it contains the chain of listeners which will run when
the async operation completes - its awaiters.
TEST=ci
Change-Id: Ie7309c9b1c39246e0fd4c14f7b9c515bcdfbbe10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311384
Reviewed-by: Derek Xu <derekx@google.com>
No need to pass parameter explicitly because it is always
equal to the field.
TEST=ci
Change-Id: I04d86786d5278ad4ab4ce6c67e61b1fc94f692d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311383
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Effectively it is true for all environments where
debugger is actually present.
TEST=service tests
Change-Id: I0592e83004271ca32c107f4347f7bd82172b0a62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310622
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
We no longer rewrite suspendable function into closures nested
inside the original function, so the whole synthetic async breakpoint
machinery is not needed.
Refactor `Breakpoint` class to make one-shot and per-closure
separate properties of breakpoint, which allows creating
one-shot-per-closure breakpoints.
TEST=existing service tests
Change-Id: I208afe13f36efa40f5746e44867bd24684cf5f03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310601
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Described case no longer happens: either function
is marked as not-inlinable from the very beginning
or graph construction bails out entirely.
TEST=ci
Change-Id: I7e345dc948370050bd6e03a327f1fd1054fc8240
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311401
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
If these checks fail, then a `SubtypeNTestCache` stub has been called
with a `SubtypeTestCache` that uses a different number of inputs
than the stub expects, which could lead to unexpected false negatives
or false positives, so catch it early.
TEST=vm/cc/TTS, ci
Change-Id: Ia9c48aad4c35872cad32b7b6f3eead3ee9e59680
Cq-Include-Trybots: luci.dart.try:vm-mac-debug-arm64-try,vm-linux-debug-x64c-try,vm-linux-debug-x64-try,vm-linux-debug-simriscv64-try,vm-linux-debug-ia32-try,vm-aot-linux-debug-simriscv64-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311380
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Some of the service tests contain LINE_*
constants which match line numbers of `// LINE_*`
comments in the body of the test. Previously
we would manually maintain these constants,
which is rather tedious.
This CL adds a scripts for updating the
constants automatically.
TEST=manually tested the tool
Change-Id: I3a5cdbd4cae2ab6eaec51c9bb5f48b351bfbbd7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310602
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
This field is now only used when reloading to check assignability
during `ProgramReloadContext::ReloadPhase4CommitFinish()` (via
`PostCommit()` -> `InvalidateWorld()` -> `InvalidateFields`).
However, the method `DeoptimizeDependentCode()` is called near the
start of the actual reloading process in `Reload` prior to the
commit/rollback phases. This calls `DeoptimizeTypeTestingStubs()`, which
walks the heap and resets the contents of all `SubtypeTestCaches`
(`STC`s).
That means that the `STC` information isn't actually kept between
different reloads, so all this does is cause a number of `STC` objects
to be allocated during reload whose backing arrays are not used
post-reload for anything and so are unnecessary garbage.
That, and the creation of the `STC`s during `InvalidateFields` creates
all-input `STC`s, as they don't just check assignability to a given field type but also for checking elements of `RecordTypes`. That means
the per-field `STC`s contain way more information needed to check for
valid assignments to the corresponding field type, even if the `STC`
was used between reloads.
This CL removes the unnecessary field and changes `InvalidateFields`
so that the `STC`s used during reload are instead lazily allocated once
per `FieldInvalidator` object and now both the `STC` and its backing
array are now garbage post-field invalidation.
TEST=reload ci
Change-Id: I3ffa199551ba69f0afd4eba6303c6ff73d7473a3
Cq-Include-Trybots: luci.dart.try:vm-reload-linux-debug-x64-try,vm-reload-linux-release-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-reload-rollback-linux-release-x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-product-x64-try,vm-aot-linux-release-x64-try,vm-linux-release-x64-try,vm-linux-debug-x64-try,vm-aot-dwarf-linux-product-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311220
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
The round default value used in f7e26c50 means that we allocate
a new backing array shortly before hitting the cap, and once we
hit the cap the max load factor for the new backing array is only ~49%.
Instead, given a desired maximum, calculate an appropriate default
value that ensures the cap is only hit shortly before the array reaches
the max load factor that causes reallocation.
TEST=ci
Change-Id: I4c4fc3f5726aea3b260cf288cd00f886c2a1bd96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311280
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Without this, when building on Windows using MSVC, we get `error C3493:
'kCacheArrayReg' cannot be implicitly captured because no default
capture mode has been specified`.
TEST=vm-msvc-windows builds
Change-Id: Iebc443ce887dd32b186d51695cbc0bfd95d09f35
Cq-Include-Trybots: luci.dart.try:vm-msvc-windows-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311320
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
This also lowers the threshold for converting from a linear cache
to a hash-based cache from 100 to 30 on non-IA32 architectures.
(IA32 still goes to runtime if there's a hash-based cache.)
For SubtypeTestCache benchmarks above this threshold, we see an
improvement varying from ~50-100% to ~700-800% on all architectures,
from lowest number of checks (50) to highest (1000).
For SubtypeTestCache benchmarks below this threshold, no major
changes are seen: generally <5% improvement or <5% regression per
check at most.
TEST=vm/cc/TTS
Change-Id: I83aa7c085ab5a411e944ec660d6b8eba7a788ee0
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-simriscv64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-linux-product-x64-try,vm-aot-linux-release-simarm64-try,vm-aot-linux-release-simarm_x64-try,vm-aot-linux-debug-x64c-try,vm-aot-tsan-linux-release-x64-try,vm-aot-mac-release-arm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-aot-dwarf-linux-product-x64-try,vm-linux-release-ia32-try,vm-linux-debug-x64c-try,vm-linux-debug-x64-try,vm-linux-debug-simriscv64-try,vm-linux-release-simarm64-try,vm-linux-release-simarm-try,vm-mac-release-arm64-try,vm-mac-release-x64-try,vm-tsan-linux-release-x64-try,vm-reload-rollback-linux-release-x64-try,vm-reload-linux-release-x64-try,vm-ffi-qemu-linux-release-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308941
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>