In order to avoid generating type testing stubs for too many types in
the system - and thereby potentially cause an increase in code size -
this change introduces a smarter way to decide for which types we should
generate optimized type testing stubs.
The precompiler creates a [TypeUsageInfo] which we use to collect
information. More specifically:
a) We collect the destination types for all type checks we emit
(we do this inside AssertAssignableInstr::EmitNativeCode).
-> These are types we might want to generate optimized type testing
stubs for.
b) We collect type argument vectors used in instance creations (we do
this inside AllocateObjectInstr::EmitNativeCode) and keep a set of
of used type argument vectors for each class.
After the precompiler has finished compiling normal code we scan the set
of destination types collected in a) for uninstantiated types (or more
specifically, type parameter types).
We then propagate the type argument vectors used on object allocation sites,
which were collected in b), in order to find out what kind of types are flowing
into those type parameters.
This allows us to extend the set of types which we test against, by
adding the types that flow into type parameters.
We use this final augmented set of destination types as a "filter" when
making the decision whether to generate an optimized type testing stub
for a given type.
Issue https://github.com/dart-lang/sdk/issues/32603
Measured impact on flutter HEAD-HEAD-HEAD with TTS Part 1 - 4 applied (2018-04-03):
* stock build benchmark: around 4% improvement
* gallery app.so size: -2.68% (13987348 -> 13612928)
* gallery memory: no sigificant changes:
- SubtypeTestCache: - 10kb
- ObjectPool: + 6 kb
- Type: no change (probably due to wasted alignment slot before)
- TypeParameter: + 4 kb (can get rid of the field here later)
* gallery AOT compile-time: measured +1.3%, inside flakiness range
Change-Id: I12a398d18f970ba2db741913bb47b0f36ae38d58
Reviewed-on: https://dart-review.googlesource.com/48640
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
The changes include:
* Make AssertAssignableInstr no longer have a call-summary, which
helps methods with several parameter checks by not having to
re-load/re-initialize type arguments registers
* Lazily create SubtypeTestCaches: We already go to runtime to warm up
the caches, so we now also create the caches on the first runtime
call and patch the pool entries.
* No longer load the destination name into a register: We only need
the name when we throw an exception, so it is not on the hot path.
Instead we let the runtime look at the call site, decoding a pool
index from the instructions stream. The destination name will be
available in the pool, at a consecutive index to the subtype cache.
* Remove the fall-through to N=1 case for probing subtypeing tests,
since those will always be handled by the optimized stubs.
* Do not generate optimized stubs for FutureOr<T> (so far it just
falled-through to TTS). We can make optimzed version of that later,
but it requires special subtyping rules.
* Local code quality improvement in the type-testing-stubs: Avoid
extra jump at last case of cid-class-range checks.
There are still a number of optimization opportunities we can do in
future changes.
Issue https://github.com/dart-lang/sdk/issues/31798
Change-Id: I4dc5a8a49f939178fe74d44736ef69e4b9088e46
Reviewed-on: https://dart-review.googlesource.com/46984
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
This CL starts building type testing stubs specialzed for [Type] objects
we test against.
More specifically, it adds support for:
* Handling obvious fast cases on the call sites (while still having a
call to stub for negative case)
* Handling type tests against type parameters, by loading the value
of the type parameter on the call sites and invoking it's type testing stub.
* Specialzed type testing stubs for instantiated types where we can
do [CidRange]-based subtype-checks.
==> e.g. String/List<dynamic>
* Specialzed type testing stubs for instantiated types where we can
do [CidRange]-based subclass-checks for the class and
[CidRange]-based subtype-checks for the type arguments.
==> e.g. Widget<State>, where we know [Widget] is only extended and not
implemented.
* Specialzed type testing stubs for certain non-instantiated types where we
can do [CidRange]-based subclass-checks for the class and
[CidRange]-based subtype-checks for the instantiated type arguments and
cid based comparisons for type parameters. (Note that this fast-case migth
result in some false-negatives!)
==> e.g. _HashMapEntry<K, V>, where we know [_HashMapEntry] is only
extended and not implemented.
This optimizes cases where the caller uses `new HashMap<A, B>()` and only
uses `A` and `B` as key/values (and not subclasses of it). The false-negative
can occur when subtypes of A or B are used. In such cases we fall back to the
[SubtypeTestCache]-based imlementation.
Issue https://github.com/dart-lang/sdk/issues/31798
Change-Id: Ic1853977bf55d815755b0d652ec8e20e51efb4cf
Reviewed-on: https://dart-review.googlesource.com/44788
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
This CL:
* Adds a field to [RawAbstractType] which will always hold a pointer
to the entrypoint of a type testing stub
* Makes this new field be initialized to a default stub whenever a
instances are created (e.g. via Type::New(), snapshot reader, ...)
* Makes the clustered snapshotter write a reference to the
corresponding [RawInstructions] object when writing the field and do
the reverse when reading it.
* Makes us call the type testing stub for performing assert-assignable
checks.
To reduce unnecessary loads on callsites, we store the entrypoint of the
type testing stubs directly in the type objects. This means that the
caller of type testing stubs can simply branch there without populating
a code object first. This also means that the type testing stubs
themselves have no access to a pool and we therefore also don't hold on
to the [Code] object, only the [Instruction] object is necessary.
The type testing stubs do not setup a frame themselves and also have no
safepoint. In the case when the type testing stubs could not determine
a positive answer they will tail-call a general-purpose stub.
The general-purpose stub sets up a stub frame, tries to consult a
[SubtypeTestCache] and bails out to runtime if this was unsuccessful.
This CL is just the the first, for ease of reviewing. The actual
type-specialized type testing stubs will be generated in later CLs.
Issue https://github.com/dart-lang/sdk/issues/31798
Change-Id: I174a11b3b812799f399a60af799144c2ba3c26ec
Reviewed-on: https://dart-review.googlesource.com/44787
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
This is leftover from Dartium's debugger. It was paired with Dart_SetIsolateEventHandler, which has already been removed.
Bug: https://github.com/dart-lang/sdk/issues/32801
Change-Id: I9a7ced082fae36654fb8f1a5fad70d2cc0b4d053
Reviewed-on: https://dart-review.googlesource.com/49828
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Use of this API was removed from Tonic because it did not correctly handle microtasks.
Change-Id: Ifff8a16c61f8df1c0a75b5da37e37f82fdf7bc49
Reviewed-on: https://dart-review.googlesource.com/25511
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
In strong mode, type of an expression used in AssertBoolean is already
checked and known to be 'bool' (either at compile time, or by additional
type checks inserted by CFE). So, AssertBoolean instruction should
only ensure that the value is not null.
AOT snapshot size of flutter_gallery:
Before:
Instructions(CodeSize): 7357472
Total(CodeSize): 11898596
After:
Instructions(CodeSize): 7297024
Total(CodeSize): 11833828
Issue: https://github.com/dart-lang/sdk/issues/32718
Change-Id: If5da3d5275b2fb45f240f333d8f4408d67fb8bef
Reviewed-on: https://dart-review.googlesource.com/49760
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
- Fix leak of IsolateReloadContext.
- Fix leak kernel compilation request arguments.
- Fix leak kernel compilation result errors in reload harness.
- Fix leak of class table when a schema changes but there are no instances.
- Fix leak of kernel::Reader during inlining bailout.
Bug: https://github.com/dart-lang/sdk/issues/32187
Bug: https://github.com/dart-lang/sdk/issues/28349
Change-Id: I9ccc65e018c30a3254e928a43b9727ae8d9314d6
Reviewed-on: https://dart-review.googlesource.com/49547
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Before this CL, if initializing from a dill file, and then,
at a subsequent call to computeDelta asks for the full Component,
the sources from the originally loaded libraries was missing.
This also meant that some fileUris were missing.
This can basically break Flutter.
This CL introduces tests that catch this, fixes the issue and bumps the
kernel version to force recompilation in Flutter.
Change-Id: I9f62962db017cec232855377835103ffc324820b
Reviewed-on: https://dart-review.googlesource.com/49642
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This reverts commit deed9b0653.
Reason for revert: Debug Windows failures
Original change's description:
> [vm, reload] Fix leak when shape changes but there are no instances.
>
> Fix leak of reload context when used by the test harness.
>
> Bug: https://github.com/dart-lang/sdk/issues/28349
> Change-Id: I2d1bda5537befddbd1e615b355654a9fefc08273
> Reviewed-on: https://dart-review.googlesource.com/49321
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
TBR=bkonyi@google.com,rmacnak@google.com
Change-Id: I6f351645e1c9af4c2cbf1bbffdc339b68a11dbd5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/28349
Reviewed-on: https://dart-review.googlesource.com/49620
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Before, the part-URI was serialized as a file-URI and conflated with
source location information. The part-URI is the URI in the following
declaration in a Dart source file:
part "URI";
This is different from what we normally call a file-URI. A file URI
is used to point to the source location of the part declaration, not
the URI in the part declaration.
Furthermore, the field was serialized using writeUriReference which
only works for URIs that are in the uriToSource map on a Component.
Although this might seem like a safe optimization, it doesn't work
if the uriToSource map is omitted or if a part declaration refers to
a missing file.
Finally, due to the confusing use of fileUri, LibraryPart was
mistakenly implementing FileUriNode and annotations were stripped
of source locations if the source for the part were omitted from
uriToSource.
The partUri field is now an unresolved string that can be resolved
against either the parent library's import- or file-URI to obtain
either version as needed.
Change-Id: I255cb4eeaf89928292ab32a2f6be9ead6cc8cee1
Reviewed-on: https://dart-review.googlesource.com/49500
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
This has long been replaced with --pause_isolates_on_start.
Change-Id: Ibf5850473b0d2090ec8ff244897a214149fb250c
Reviewed-on: https://dart-review.googlesource.com/48882
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Updated version of dart-lang/observatory_pub_packages in DEPS
Updated generated pubspec.yaml file after removing web_components from
third_party/observatory_pub_packages
This should fix part of issue https://github.com/dart-lang/sdk/issues/32539
Bug: 32539
Change-Id: I3d48fd59f1fedc9d64a652cde7d0229c0a7ace28
Reviewed-on: https://dart-review.googlesource.com/48804
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Restoring console state when backgrounded causes SIGTTOU to be raised by
tcsetattr, which has the affect of suspending the process instead of
allowing it to complete. Blocking SIGTTOU results in tcsetattr failing
gracefully and the process running to completion.
Change-Id: I605dccbdbf311697881e5729e4fd64f1d60ed6b1
Reviewed-on: https://dart-review.googlesource.com/48823
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
This change enables building a gen_snapshot that targets Fuchsia during
an SDK build that targets the host (Mac, Linux).
Change-Id: I4cfbcbe4e26e4be7108fc40c96122fe9a2fb4c19
Reviewed-on: https://dart-review.googlesource.com/48683
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
Hide private class _Future and map it to core lib class Future.
In Dart 2, show dynamic as type argument(s) of raw generic types.
Change-Id: I70b0e1707bc767d04838ac12d16b3ad15623f51f
Reviewed-on: https://dart-review.googlesource.com/48502
Reviewed-by: Siva Annamalai <asiva@google.com>
They are necessary for performing type-checks.
Change-Id: Ie30f0617488730d920c00229fb2ec358cc8d6c4b
Reviewed-on: https://dart-review.googlesource.com/48421
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Made modifications to the original VM flow graph builder so the token
position for the top frame of the overflow stack is the same as the
token position of the method (before we pointed to the opening '{' or
'=>').
Change-Id: I5c878fc238898e2fea197ea80ed4e320adca9439
Reviewed-on: https://dart-review.googlesource.com/48448
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This CL adds tree shaking transformation into TFA transformer, replacing
simple DropMethodBodiesVisitor. In addition to removing bodies of
unreachable members, tree shaker is able to remove unused classes, typedefs
and member declarations, and replace unreachable calls with 'throw'.
Total(CodeSize) of flutter_gallery in --release mode
before: 11,671,369
after: 11,499,694
https://github.com/dart-lang/sdk/issues/30480
Change-Id: I966cf222eb9725b7a75dd193ac479436b9b9b4c3
Reviewed-on: https://dart-review.googlesource.com/46942
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
You can't use it in a way that would require Phi in the SSA form
because SSA construction does not support generating phi-functions
for the expression stack.
Change-Id: I57a029412cbdd796ecfd3cdbd0ec68e0dbca2356
Reviewed-on: https://dart-review.googlesource.com/47740
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
This reverts commit ae130bc187.
Reason for revert: snprintf doesn't like positional format strings on Windows.
Original change's description:
> [ VM / Dart 2 ] Fixed StackTraceFormat test to expect file URIs in stacks generated by the Dart frontend.
>
> Change-Id: I26f09e094e934485575e55a6a60a8fccfbd94aa7
> Reviewed-on: https://dart-review.googlesource.com/47520
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
TBR=bkonyi@google.com,rmacnak@google.com,zra@google.com,asiva@google.com
Change-Id: Idbc15d59bcc7ff3534010f6c93cebdcc89c935fc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/47640
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
The source-based pipeline was simply iterating the token script of a
[Script] to generate a list of (line, [token positions]) tuples.
The kernel-based pipeline is not based on the source (and therefore also
not based on the token stream). Instead it's based on information from
two places:
a) The .dill file constains a delta-encoded list of line start file
offsets. This line starts array is attached to [Script] objects via
[RawScript.line_starts_].
b) It scans the *entire* isolate's program structure (i.e. libraries,
classes, functions and fields) and does abstract interpretation
of the kernel blob (ast) and saves the encountered token positions
on the side. Afterwards the token positions are merged together
with the line-starts from a) which then produces the list of (line,
token positions) tuples.
This CL changes b) to only do the abstract interpretation of
functions/fields which are relevant for the [Script] we are generating
the list of (line, [token position]) tuples for.
Nonetheless, b) will still iterate over the entire isolate's program
structure to find all possible elements belonging to a specific
[Script]. This is a separate issue which should be handled.
On one example it reduces time to get the coverage from ~ 35 seconds to 9.5
seconds (baseline from dart-v1 is around 6.5 seconds).
Issue https://github.com/dart-lang/sdk/issues/32562
Change-Id: I64cda28666c732938379cdf4b2ac62a2371cb3b7
Reviewed-on: https://dart-review.googlesource.com/47080
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Since the kernel reading helpers have been extended to not only work
with a kernel blob in C heap, but also work based on a [TypedData]
buffer in the VM heap, access to the [TypedData] buffer is on the hot
path now.
This hot path is slowing things down considerably, in particular due
to NoSafepoingScope's.
This CL removes a critical NoSafepoingScope when accessing the
[TypedData] in read-only mode. It also allows passing in the [Thread]
directly, to avoid TLS lookups.
Issue https://github.com/dart-lang/sdk/issues/32603
Change-Id: I91955bea5cd4eddbbd21c5d3bc6813504c2cece9
Reviewed-on: https://dart-review.googlesource.com/47222
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
During SSA construction in strong mode, types of local variables are
propagated (assigned) to phis which are 'loaded' from slots corresponding
to those local variables.
It is incorrect if phi was stored in a different local variable with a more
specific type and then reloaded.
After this change, type is propagated from local variable to phis only if
phi was created for this local.
Fixes https://github.com/dart-lang/sdk/issues/32597
Change-Id: I7d86c2ef79d14895c9b4c3651d0234b3f9c66173
Reviewed-on: https://dart-review.googlesource.com/47200
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Add Dart_IsSnapshot and Dart_IsKernel to the embedding API.
Change-Id: I7d4e1d145557e8f11dbc3c143767ad38b3615a4a
Reviewed-on: https://dart-review.googlesource.com/46360
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Some embedders, i.e. tonic, sometimes call Dart_ShutdownIsolate after encountering a fatal error without calling Dart_ExitScope.
Change-Id: Iedba50b6d87acd277812ca6a476964c007b5416a
Reviewed-on: https://dart-review.googlesource.com/46840
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Dart_LoadKernel is only used in Flutter engine and dart_runner, where it is always used as Dart_LoadKernel(Dart_ReadKernelBinary). These uses should be replaced with Dart_LoadScriptFromKernel.
Dart_LoadLibraryFromKernel is needed for loading split kernel files and implementing IsolateMirror.loadUri.
Change-Id: Ib505350eff53ec889406747f8f99393ebbdb4c7d
Reviewed-on: https://dart-review.googlesource.com/46220
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Translate assert statements in async functions. The translation of
the condition subexpression can produce a sequence of statements that
have been hoisted out of it. These need to be guarded so they are
executed only when asserts are enabled.
For this purpose, we introduce an AssertBlock. The semantics of the
assert block:
assert { s0; ...; sn; }
is the same as:
if (assertsEnabled) { s0; ...; sn; }
where assertsEnabled is a more primitive nullary expression that is
true iff. assertions are enabled. We chose not to encode this using a
construct like assertsEnabled because (1) we would have to support it
appearing as an arbitrary expression which we don't currently need
and (2) it requires deeper pattern matching to detect and skip the
guarded code when desired.
The translation is more complicated because if there is a message
subexpression in an assert, it is conditionally evaluated only if the
assert's condition is false.
Fixes https://github.com/dart-lang/sdk/issues/28498
Change-Id: I0912a57104ede3160533e49f65b6fb79b76f1500
Reviewed-on: https://dart-review.googlesource.com/46442
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This CL changes:
* package:kernel/clone.dart: To not clone file offsets if the
file-uri we copy from is unknown.
* package:kernel/binary/ast_to_binary.dart: To not write out file
offsets if the file-uri is not written/indexed (which happens if
the file uri is not in the `Program.uriToSource` map).
* It reverts the file renaming part of 60a2cfa219 which
fixed the name collision problem only partially (it missed to
rename `runtime/lib/double.dart`, which is not possible because
there's already a `double_patch.dart` file).
Instead of renaming, we solve the problem by mangling the names as follows:
.../sdk/lib/core/double.dart -> dart:core/double.dart
.../runtime/lib/double.dart -> dart:core/runtime/lib/double.dart
.../runtime/lib/double_patch.dart -> dart:core/runtime/lib/double_patch.dart
* It changes the test to ignore any negative token positions. The vm
service does not just expose `-1` token positions for places where
there is no source, but also e.g. `-9` (which means TokenPosition::kMethodExtractor),
this was one reason why the appjit test failed.
* It changes the test to try to force-compile everything (unsure if that works).
Issue https://github.com/dart-lang/sdk/issues/32489
Change-Id: Ia9f42ca9d56d987e3041175add549bb7a133f269
Reviewed-on: https://dart-review.googlesource.com/46341
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
This reverts commit 60a2cfa219.
Change-Id: I6d83653c72d5e8576952a631d23be5be5d9c71f6
Reviewed-on: https://dart-review.googlesource.com/46384
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
The lower profiler period should only be needed on older ARM hardware.
Change-Id: I737aee2385f74a5026d9d8155ea8e33c94d92422
Reviewed-on: https://dart-review.googlesource.com/46361
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Change-Id: Ic9a180cbb758cf8fe51369d904fa4b51fd1b8e27
Reviewed-on: https://dart-review.googlesource.com/44480
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
This makes sure we can distinguish e.g. 2 different timeline.dart files
(from runtime/lib/timeline.dart and sdk/lib/developer/timeline.dart)
This CL also fixes the owner of constructors to be patch classes, if
the constructors come from a patch.
This CL also adds a service/valid_source_locations_test, which loops
over libraries/classes/fields/functions and obtains source locations for
them, including line numbers. This ensures that if there is a source
location attached to a member, we can use it's token position to get to
the line number.
This CL also changes package:kernel's [Cloner] to clone fileOffsets (and
not just fileEndOffsets). This is important for mixin resolution, where
we copy members into mixin application classes.
Issue https://github.com/dart-lang/sdk/issues/32489
Change-Id: I4fea5cd646d81f47e1c4ede1e86d477ba6de3e82
Reviewed-on: https://dart-review.googlesource.com/46141
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Static field initializers are not added as members of their owning class, so they must be pre-emptively given a patch class to avoid the meaning of their kernel/token position changing during a reload. Member functions and fields have their owner changed to patch class only when the class is changed during a reload.
Curiously, this was originally done in the C++ front end before hot reload: https://codereview.chromium.org//1317753004
Bug: https://github.com/dart-lang/sdk/issues/32497
Change-Id: I236c188a4b9e05a1e3c011d27e123979db1ca2e5
Reviewed-on: https://dart-review.googlesource.com/46124
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
This simplifies figuring out what went wrong from just
debugging output in some cases.
Change-Id: Ie7a775c57fb691d6bd3ca1c70a04fb6cbe9e0875
Reviewed-on: https://dart-review.googlesource.com/43060
Reviewed-by: Jens Johansen <jensj@google.com>
Before this fix, Object::extractor_parameter_types() and Object::extractor_parameter_names()
were initialized in Object::FinalizeVMIsolate(), which was called after
reading VM snapshot. So VM snapshot reader was registering nulls in place
of these VM objects in Deserializer::AddVMIsolateBaseObjects().
As a result, all references to Object::extractor_parameter_names()
were replaced with nulls while reading a snapshot.
The fix is to move initialization of those objects to Object::InitOnce().
Change-Id: I5f68853d9de23c94eb901080d9677100a6856c0c
Reviewed-on: https://dart-review.googlesource.com/45747
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This reverts commit be62fff82f.
Reason for revert: See https://github.com/dart-lang/sdk/issues/32465
Original change's description:
> Reland "[VM runtime] Switch intrinsics from old to new Bigint implementation."
>
> The change was reverted (thanks Slava) because gen_snapshot was failing to
> find the core lib class _BigIntImpl on flutter.
> The PR https://github.com/flutter/engine/pull/4735 fixed that issue on flutter.
>
> Change-Id: Id6863d79f7fdb17f0076b63b0168394d5e95ec8d
> Reviewed-on: https://dart-review.googlesource.com/44660
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
TBR=alexmarkov@google.com,regis@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I412f5143442ca6ad43784b037c01fcf9bb42c348
Reviewed-on: https://dart-review.googlesource.com/45800
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
This reverts commit 3da9c349d4.
Reason for revert: Broke the build on vm-kernel-precomp-linux-release-simarm
Original change's description:
> [vm/simarm] Fix VRECPS/VRSQRTSQS instruction implementation.
>
> This instruction handles 0.0 and infinity operands
> specially because otherwise it produces NaN where it
> should produce appropriate infinity or zero.
>
> Fixes https://github.com/dart-lang/sdk/issues/24399
> Fixes https://github.com/dart-lang/sdk/issues/26675
>
> Change-Id: I0741d0daa8b92b4dcd780b1453c9ec449552b1fd
> Reviewed-on: https://dart-review.googlesource.com/45382
> Reviewed-by: Zach Anderson <zra@google.com>
TBR=whesse@google.com,vegorov@google.com,alexmarkov@google.com,zra@google.com
Change-Id: I413be56fdce8afa0e2faa6ed2b16ef0f68b795b0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/45683
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
Parameter types in application isolate could be modified during
execution, so it is incorrect to de-duplicate them with
read-only objects from VM isolate.
Fixes crash in pkg/front_end/tool/incremental_perf.dart
benchmark running from appjit snapshot. This crash appears after
https://dart-review.googlesource.com/c/sdk/+/45747 is applied.
Change-Id: I42a2007d02e04e0720c7e5d15224fcb6994bc515
Reviewed-on: https://dart-review.googlesource.com/45752
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
As tests/language_2/tearoff_dynamic_test.dart shows, it is perfectly
valid to take a tear-off of an instance method from null, and then call
hashCode from such tear-off.
The implementation of hashCode for closures, Closure::ComputeHash()
was calling Instance::Cast(receiver) which asserts for null.
This code is revised to allow null receiver.
Change-Id: I85cc7abf25aab99590b53403904e8bac25328308
Reviewed-on: https://dart-review.googlesource.com/45749
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
The whereType method silently does the wrong thing without methods,
so make it throw until we turn them on everywhere.
Change-Id: Id934c8bdb4f682dbc3560d78fbca580e37297e2d
Reviewed-on: https://dart-review.googlesource.com/45744
Reviewed-by: Nate Bosch <nbosch@google.com>
Add `typeArguments` to Invocation.
Add constructors to Invocation, making it less necessary for users to create their own implementations.
Add tests.
Add Symbol.unaryMinus and Symbol.empty constants.
Change-Id: I70cb3265f9413617cf57fce1297e393a29eeb26a
Reviewed-on: https://dart-review.googlesource.com/40741
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
A reused type argument vector that is longer than necessary needs to be
shortened to the correct length upon type canonicalization.
The runtime call comparing two instance runtime types also needs to consider
reused vectors.
Add regression test.
Change-Id: Ib3b9620409b9cff313f270c4f3fb7051fecbb604
Reviewed-on: https://dart-review.googlesource.com/45340
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Change-Id: I5d073d1c678dc313e79193074c6491085c093596
Reviewed-on: https://dart-review.googlesource.com/45381
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
The ARM simulator has assertions that there are no duplicates in the
[Redirection::list_] but the code does not guarantee this, since
multiple threads can add the same add [Redirection] entries for the same
native concurrently.
This CL guards the modification of [list_] with a [Mutex] and ensures
there's no duplicates.
This issue caused flakiness on the debug-simarm configuration.
Change-Id: Ia84a08e6e6f851a6047bae047ffb990044fb4a4b
Reviewed-on: https://dart-review.googlesource.com/45281
Reviewed-by: Erik Corry <erikcorry@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
See issue #31470
The performance numbers from the example in that issue improved as follows:
Before:
Set.first 2669 ms
Set.last 15509 ms
HashSet.first 2845 ms
HashSet.last 22053 ms
After:
Set.first 1244 ms
Set.last 1422 ms
HashSet.first 1075 ms
HashSet.last 4552 ms
Bug: http://dartbug.com/31470
Change-Id: I8afc91ad8835ac18bcc37737570c7f4be0bb6e8a
Reviewed-on: https://dart-review.googlesource.com/44782
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Corry <erikcorry@google.com>
These instructions will soon be used for for smaller (32 bit) Smis.
Also fix broken ubfiz instruction in ARM64 assembler.
This reland fixes the disassembler test that used Stop
instructions which disassemble differently on Mac
because constants have higher addresses.
Originally reviewed at
https://dart-review.googlesource.com/c/sdk/+/43668
Fix assembler test on Mac
R=kustermann@google.com
Change-Id: I61f8626184af495f18a74b5fef07bad02b6615e9
Reviewed-on: https://dart-review.googlesource.com/45240
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Erik Corry <erikcorry@google.com>
This reverts commit a5f173f165.
Reason for revert: Some test failures.
Original change's description:
> [VM] Support some 32bit instructions in 64bit assemblers.
>
> These instructions will soon be used for for smaller (32 bit) Smis.
>
> Also fix broken ubfiz instruction in ARM64 assembler.
>
> R=kustermann@google.com
>
> Change-Id: I9068a1c4281047dbd7c1c447fc32ac0e92c89e9d
> Reviewed-on: https://dart-review.googlesource.com/43668
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
TBR=vegorov@google.com,kustermann@google.com,erikcorry@google.com
Change-Id: I0991712936d903f2cb1f3851c919ed6171a96711
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/44981
Reviewed-by: Erik Corry <erikcorry@google.com>
Commit-Queue: Erik Corry <erikcorry@google.com>
These instructions will soon be used for for smaller (32 bit) Smis.
Also fix broken ubfiz instruction in ARM64 assembler.
R=kustermann@google.com
Change-Id: I9068a1c4281047dbd7c1c447fc32ac0e92c89e9d
Reviewed-on: https://dart-review.googlesource.com/43668
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
In the VM, TypeRef (extending AbstractType) did _not_ implement
error(), meaning that callong error() on such a type would call it in
AbstractType which basically just says `UNREACHABLE();`.
This fixes the issue.
Change-Id: I6cb9ebe8f814296db8383c187c880f367b096312
Reviewed-on: https://dart-review.googlesource.com/44420
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
This broke ARM on a non-standard compiler.
Change-Id: Idf4e7d5ea9072e6e07d796dc676ec3e7afd6f235
Reviewed-on: https://dart-review.googlesource.com/44786
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Not only does it speed the two methods a bit up, it will also allow us to use the assembler
before all of the stubs are initialized.
Issue https://github.com/dart-lang/sdk/issues/31798
Change-Id: Ic14743ecd9d11ca4cbc5208cacad30beee0982ef
Reviewed-on: https://dart-review.googlesource.com/44500
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Change-Id: I9a2e07de692127069d8098e3a0ea45846a3f45ae
Reviewed-on: https://dart-review.googlesource.com/43672
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
The change was reverted (thanks Slava) because gen_snapshot was failing to
find the core lib class _BigIntImpl on flutter.
The PR https://github.com/flutter/engine/pull/4735 fixed that issue on flutter.
Change-Id: Id6863d79f7fdb17f0076b63b0168394d5e95ec8d
Reviewed-on: https://dart-review.googlesource.com/44660
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Passes bodies are moved into compiler_pass{.cc,.h}.
Invoking a pass is just INVOKE_PASS(Name) now, instead of putting a bunch of
if-s and calls in compiler.cc or precompiler.cc.
We also consolidate ability to print IL and enable-disable passes under a
single flag --compiler-passes, e.g.
--compiler-passes=-Inlining,-CSE disable inlining and CSE passes
--compiler-passes=Inlining+ print IL after Inlining pass and all
subsequent passes
Change-Id: I90ff54b04a54f20099f5bf38dd45b16b8e3c4781
Reviewed-on: https://dart-review.googlesource.com/43968
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
The VM uses normally strong mode types for LoadField instructions.
Though for certain fields we have known class-ids which we attach to the
Field instructions.
Before we had a case where the strong mode type was dynamic, but we had
a very specific cid for the Field. Though when using the [CompileType]
afterwards via [CompileType()->ToAbstractType()] it was returning
`dynamic`.
We should use CompileType::ComputeRefineType() to get the most specific
one of those two.
Issue https://github.com/dart-lang/sdk/issues/31798
Change-Id: Ib0b7a596449cba0bc53e118ee603b2039aa312b3
Reviewed-on: https://dart-review.googlesource.com/43422
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Clear out generic-covariant-{impl,interface} on parameters which are
statically checked on call site. If all call sites are this-dispatches then
we are guaranteed to not need the checks.
Issue https://github.com/dart-lang/sdk/issues/31798
Change-Id: I5452a1c9eb3c3e36c1dfc978327bfdcb256cc003
Reviewed-on: https://dart-review.googlesource.com/43421
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
With the [_table] field being `dynamic` we were unable to eliminate
checks for the [_isModifiedSince] method, since there is a dynamic call
site.
This CL adds a type to [_table] so [_isModifiedSince] does not need to
perform any checks (via package:vm/transf.../no_dynamic_invocations_annotator.dart)
Issue https://github.com/dart-lang/sdk/issues/31798
Change-Id: If773c4b63fab62d1ccdd2e783aa16c19f780000a
Reviewed-on: https://dart-review.googlesource.com/43423
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Move the code deciding whether instance needs to be handled specially
into AddConstObject, instead of having it spread around - this ensures
uniform handling.
Fixes https://github.com/flutter/flutter/issues/14891
Bug: 14891
Change-Id: I92b6383f37f6b6cf2e917013d17e8ae7ee977150
Reviewed-on: https://dart-review.googlesource.com/44300
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This reverts commit 9ba8c08953.
Reason for revert: broke Flutter, to reproduce build Flutter engine with HEAD dart and try running animation benchmark in release or profile mode in --preview-dart-2, gen_snapshot would crash. Similarly this also breaks Flutter tests in --preview-dart-2 mode.
Original change's description:
> [VM runtime] Switch intrinsics from old to new Bigint implementation.
>
> Change-Id: I43dfbdf76267bb96d1b1ce4aeb695d02bb18b7f8
> Reviewed-on: https://dart-review.googlesource.com/44025
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Régis Crelier <regis@google.com>
TBR=alexmarkov@google.com,regis@google.com
Change-Id: I926cc72e1ed89d8631e33ebcc8198853c05a08dc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/44065
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
(Strip out platform dill files and the kernel service dill file from a
product build)
After fixing the issue of using 'is_product' which is not present in the
flutter build environment.
Change-Id: I49dd68e63b1f6d7ac0981b28bf2b08618551ae2e
Reviewed-on: https://dart-review.googlesource.com/44024
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Added Montgomery reduction in new Bigint implementation to support faster crypto (modPow).
Change-Id: Ic6872c9809485db27d0175c1d1f348232250b682
Reviewed-on: https://dart-review.googlesource.com/43300
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
Canonicalizer should not remove Redefinitions that have no uses before LICM
happens. Even though Redefinition itself has no uses it might be still
dominating uses of the original value - is we expect RenameUsesDominatedByRedefinitions
that is run before LICM to normalize the graph by routing those uses
through Redefinition.
Fixes https://github.com/dart-lang/sdk/issues/32322
Bug: 32322
Change-Id: Ice310aaf8ab62cd6d3ec575876c12e8634a91dce
Reviewed-on: https://dart-review.googlesource.com/44040
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
* Introduce --tfa option in gen_kernel and 'useGlobalTypeFlowAnalysis'
parameter in compileToKernel(), which is used in Flutter's frontend
server.
* Split entry_points_extra.json into 2 parts: common to all embedders
and specific to a standalone VM (entry_points_extra_standalone.json).
* Extract generation of entry points JSON files into a separate .gni
file, introduce action to generate entry points JSON using
gen_snapshot instead of dart_bootstrap (required for Flutter), and
action to copy checked-in extra entry points file.
Issue: https://github.com/dart-lang/sdk/issues/30480
Change-Id: Ie0af9d7128d7fc0e3a9d623fd3c1589e87c83f5c
Reviewed-on: https://dart-review.googlesource.com/43884
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Zach Anderson <zra@google.com>