Measures inlines (and skipped opportunities) during SSA and records them within the metric framework.
This can hopefully be used as a signal into the effectiveness of changes to the global analysis phase.
Change-Id: I9da5bad5792db8b089dbfc8725664ec13d32ab1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255200
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
This reverts commit 4c7110332e.
Reason for revert: Still breaks the same tests, see b/242715525
Original change's description:
> Reapply "Avoid computing the URI scanner tables at runtime."
>
> This reverts commit 855e1cd975.
>
> The blocking issue in internal test code is assumed fixed.
>
> Change-Id: I74e0be130d149a45f77dc90c354916308b76b741
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255248
> Commit-Queue: Lasse Nielsen <lrn@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Auto-Submit: Lasse Nielsen <lrn@google.com>
TBR=lrn@google.com,kustermann@google.com
Change-Id: I391d2eb6dd9ae7367f656eaaaa7f9aeb1c31e0f7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255254
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
Reviewed-by: Ilya Yanok <yanok@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
When casting down from `anyref` or `eqref`, an intermediate
`ref.as_data` instruction is needed. However, this instruction traps on
`null`, so for nullable casts, explicit null handling is required.
Change-Id: I835f1b59d291f848a008c855843f286f0d11d5fb
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255242
Reviewed-by: Joshua Litt <joshualitt@google.com>
Auto-Submit: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
This reverts commit d0a60d67c9.
Reason for revert: Slow path transition seems to occur earlier than I expected
Original change's description:
> [vm] Allocate old in object-graph-copy's slow path.
>
> If we have reached the slow path, the message's subgraph is very likely to be large.
>
> TEST=ci
> Change-Id: Ie8a18c78936ae8a53f30dd61da3650e684c09dfa
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249081
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
TBR=kustermann@google.com,rmacnak@google.com
Change-Id: I61faddd37e424a742427ae7c270cdb8b0a13c418
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255300
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Default value of `dependencies` should be `const {}` (and narrow field type) so that VM can devirtualize calls to the `_CompactLinkedHashSet` when iterating.
Change-Id: I112d9cd9a3cd060a38e292bc1a3c54a8a2847dfe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252301
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
This reverts commit 855e1cd975.
The blocking issue in internal test code is assumed fixed.
Change-Id: I74e0be130d149a45f77dc90c354916308b76b741
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255248
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Auto-Submit: Lasse Nielsen <lrn@google.com>
This results in 2+ MB savings when running analyzer in JIT mode on
flutter.
TEST=ci
Change-Id: I4c110846c0fd64476538605f4ccf195781f72c55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255251
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Adds the Fuchsia ABI to the ABI unit tests.
Adds an ABI test for the FFI callback on who's return the stack is/gets
corrupted from bug:
https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=105336
TEST=tools/test.py ffi_unit
Change-Id: I3c9bb9941e4883384dfba787bb6dacb4c8cdc141
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255122
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
This CL prevents treeshaking of members that have type `Finalizable`, `Future<Finalizable>` or `FutureOr<Finalizable>`.
All `Finalizable` members are kept. Even the ones which are not
members of `Finalizable`s. This is in line with the logic to keep
all `Finalizable` arguments/variables alive.
Moreover, this CL adds AOT tests to the FFI transformer tests so that
we catch differences between AOT/JIT in the future.
Closes: https://github.com/dart-lang/sdk/issues/49643
TEST=pkg/vm/test/transformations/ffi_test.dart
TEST=pkg/vm/testcases/transformations/ffi/finalizable_member.dart
Change-Id: I14003314b9f23692fee30d1c3eef1bdcd27ed1ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254904
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Relatedly, remove the --nominal-types and --runtime-types options and
eliminate the instruction and type wrappers that abstracted over these
options.
Rename instructions to the names in the latest WasmGC working draft.
Change-Id: Icd0e4bbcf444d5a3cea1f88f4e3bf8dd2926f70f
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254902
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Long ago the compiler had logic for reading sources via an http
connection. This is not a supported use case and there is no need to
keep this around anymore.
Change-Id: Ic59c154def264a52d9310133f76b153c9972899c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251701
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Builds on top of https://dart-review.googlesource.com/c/sdk/+/228660, introduces vm:vm:always-consider-inlining that tell inliner not to give up inlining of a function.
HashMap constructor got prefer-inline pragma to accommodate shift in inlining away from where it used to be inlined due to large size of inlined HashMap, greater than FLAG_inline_getters_setters_smaller_than heuristic.
Notable performance changes:
JIT (x64)
===
ListCopy.List.of.fixed.100 27.37%
ListCopy.List.of.fixed.2 16.31%
AOT (x64)
===
Empty -9.978%
InstantiateTypeArgs.Instantiate1 -8.262%
...
ListCopy.List.of.fixed.2 13.73%
ListCopy.spread.num.2 15.51%
ListCopy.List.of.2 15.08%
MapCopy.Map.String.of.Map.100 55.62%
MapCopy.Map.Thing.of.Map.100 56.06%
flutter release
===
flutter_gallery_apk_size (Pixel 2)
-0.0074% (1.0 noise)41809568.00 41812676.00
Addresses https://github.com/dart-lang/sdk/issues/49408
TEST=Inliner_always_consider_inlining, Inliner_List_of_inlined
Change-Id: I7f8fc7cb0ac4a69310c108cf519518c384dc0164
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253740
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
If we have reached the slow path, the message's subgraph is very likely to be large.
TEST=ci
Change-Id: Ie8a18c78936ae8a53f30dd61da3650e684c09dfa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249081
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
The current [StringCanonicalizer] implementation has some issues:
* It hangs on to large [Uint8List]/[String] objects in it's cache
=> This requires users (such as analyzer) to clear the cache
frequently
* Has api that works on dynamic input (which is assumed to be String
or List<int> / Uint8List)
=> Call sites have typing information we loose when doing the call
* It uses dynamic [] calls to compare input bytes with cached bytes /
input strings with cached strings
=> Dynamic calls come with overhead
=> Will cause substring generation for every character comparison
=> Will compare bytes with strings (which doesn't make sense)
To address these issues we
* Use the canonicalized [String] to compare against instead of the
(much larger) source strings, thereby no longer hanging on to large
strings in the canonicalizer cache (it's still an issue with
[Uint8List]s though)
* Make seperate API for canonicalization of strings, sub-strings or
sub-utf8-bytes and use it from the token implementation.
* For canonicalization of strings use String.== (instead of
char-by-char comparison)
* For canonicalization of sub-strings use String.charCodeAt instead of
[] (which creates substrings)
* Seperate out cache node entries into two classes and reduce memory
consumption of the nodes that represent strings by 16 bytes (it
does an additional `is` check on lookups in the cache, but that is
better than paying for dynamic calls on the payload - which
causes the compiler to do implicit checks)
=> This CL reduces RAM consumption and makes CFE scan/scan_bytes benchmarks a little faster.
TEST=ci
Change-Id: I157c298d26d25ac5da82c32eedfa270a590156f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255121
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
This script does the same job as `generate_resources.dart`, but it
doesn't search the filesystem for the input files to use, nor invoke
the compiler to create the `migration.js` file. Instead, it simply
accepts a list of input files on the command line, and outputs their
contents in an appropriate form to be stored in `resources.g.dart`.
This script will allow us to integrate more cleanly with the internal
build system.
Change-Id: I4b5445d1f5fd7eccbb5fb36f6ee4fa97d2cea87e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254421
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
For large applications only ~60% of these objects are used. This defers their deserializtion until they're accessed in the codegen member map.
In local testing on large applications this saved ~200MB of memory usage in the linker phase.
Change-Id: I8ff87803fc23ef2d3f954646687e3fc67b68a4f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254600
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
`Finalizable`s with extension methods work by virtue of being
desugared into static methods and the `Finalizable`s being normal
arguments.
If we ever change the representation of extension methods,
`Finalizable`s would need to be treated specially. This test will
catch that.
TEST=pkg/vm/test/transformations/ffi_test.dart
Bug: https://github.com/dart-lang/sdk/issues/49643#issuecomment-1214847853
Change-Id: I68cfbc098386a88495d37417c6eb7295b89bfb95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255123
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
The CFE itself uses [Utf8BytesScanner] in it's normal operation. The
analyzer instead uses [StringScanner].
The performance script used today only measures scanning performance
based on [StringScanner].
=> This CL adds a `scan_bytes` subcommand that will measure scanner
performance based on bytes (the CFE default mode).
The performance script discovers the files to scan for the benchmark by
using the analyzer to transitively scan/parse files and looking at the
imports. Doing so will - as a side effect- fill
[StringCanonicalizer] with values.
=> This CL cleans the [StringCanonicalizer] cache before doing the
actual benchmarking.
TEST=ci
Change-Id: I996efe6b3551983df19ed5aad4fc4220c07336cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255120
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
This adds a FrontendServer class that wraps steam communication,
reducing the amount of boilerplate code needed to write frontend
server tests.
Change-Id: I9ff0fe6e04a83503e00eea9fc764231e50d6207a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253666
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>