Commit graph

440 commits

Author SHA1 Message Date
Aske Simon Christensen e3d6709289 Error message for circular constant expressions
Handles the situations described in #34204 and #34189 when front-end
constant folding is enabled.

Change-Id: I64fd8449ac1661f6fe67411113c6f99d8009547c
Reviewed-on: https://dart-review.googlesource.com/c/90007
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2019-01-17 14:21:47 +00:00
Vyacheslav Egorov 6dfb3e9f60 [vm/tools] Add pkg/vm/bin/compare_sizes.dart
This script can be used to compare two outputs of --print-instructions-sizes-to
and render a table that highlights symbols that became bigger or smaller
between two compilations.

Change-Id: I011584a370d8c94061da42e8e4f253c84d870bc3
Reviewed-on: https://dart-review.googlesource.com/c/89643
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-01-17 11:52:14 +00:00
Kevin Millikin e36ad1dad0 [Kernel] Build an invalid constant for evaluation errors
An invalid constant is (currently) represented by an unevaluated
invalid expression.  Using this instead of null fixes 63 out of 125
CFE constant-evaluation crashes with constant-update-2018 and
correctly signals 26 more previously-missed compile-time errors.

Change-Id: I5b4de3995b3a59978dfa08fc542ef0f027572eb6
Reviewed-on: https://dart-review.googlesource.com/c/89506
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-01-17 07:26:04 +00:00
Alexander Markov 78abb98ee7 [vm/bytecode] Fix AST removal for package-split kernel files with bytecode
In package-split mode, bytecode generation is performed separately for
each package. Previously, dropping AST was done right after generating
bytecode. However, dropping AST for a package makes it impossible to do
constant evaluation in other packages which import the package with dropped
AST. This breaks bytecode generation for subsequent packages.

To work around this problem, in package-split mode AST is removed
temporary until dillp file is written. After that, removed AST is restored
back.

Change-Id: I3d8b6a8ad98f2fe88b57f7b6393bbbe87b046c21
Reviewed-on: https://dart-review.googlesource.com/c/89822
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-01-16 19:04:40 +00:00
Kevin Millikin 215f6620e7 [Kernel] Signal errors on static fields in constant contexts
Fasta allows some non-const static field access in constant contexts
which leads to the constant evaluator trying to evaluate them.  Signal
an error instead of crashing.  This will double-report errors for the
cases that Fasta already catches, and we should fix that
double-reporting.

Fix unbounded recursion in printing unevaluated constants (writeNode
called visitUnevaluatedConstant which called defaultConstant which
called writeNode...).

Fix a spurious trailing comma in printing of instance constants.

Change-Id: Idff3169a3a56432ad67c27ff9c267ef355c4c1dc
Reviewed-on: https://dart-review.googlesource.com/c/89514
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-01-16 15:07:58 +00:00
Kevin Millikin d9944433af [Kernel] Clean up error reporting in constant evaluation
Make the constant evaluator take an explicit error reporter so we have
to opt in to using the "simple" one that reports errors in an ad hoc
way.  This is the start of a change to use Fasta-controlled error
messages throughout and eventually get rid of the simple error
handler, and to continue constant evaluation after the first constant
error.

Change-Id: If6b1801edab6063754b642cf4a603abf9d63103a
Reviewed-on: https://dart-review.googlesource.com/c/89501
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Auto-Submit: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-01-15 11:34:42 +00:00
Liam Appelbe df0671d664 [VM] Experimental flags in the dart CLI
Blocked on https://dart-review.googlesource.com/c/sdk/+/88840

Bug: https://github.com/dart-lang/sdk/issues/35602
Change-Id: I72b1cf574c9cb3d1dac2fbd8dfeb0f3fd80e330e
Reviewed-on: https://dart-review.googlesource.com/c/89042
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2019-01-15 01:02:07 +00:00
Alexander Markov d821a2ec96 [vm/aot/tfa] Correctly tree shake initializers of write-only fields
Fixes https://github.com/dart-lang/sdk/issues/35632

Change-Id: I9736268087a90fd409509f35bf2fc0637443a9fb
Reviewed-on: https://dart-review.googlesource.com/c/89161
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-01-11 20:46:30 +00:00
Peter von der Ahé 8e5ad9b3bd Prepare the VM for removing TypeEnvironment.hierarchy
Validating the class hierarchy requires subtype tests. Previously,
Fasta has worked around this by computing the hierarchy twice, as
well as visiting the hierarchy several times. In order to improve
performance of modular compilation, we're working on changing this.

To enable creating a TypeEnvironment without a hierarchy, we're
removing the field from the API.

Change-Id: I7c9f88d5c6495aaa8223eaeff7d2dfd5669e9e95
Reviewed-on: https://dart-review.googlesource.com/c/88823
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-01-10 05:21:24 +00:00
Samir Jindel b58e8d7307 [vm] Use TFA to remove explicit type-checks (including keyword-covariant parameters).
- Also allow using the unchecked entry-point for invocations of generic functions where
  there are no bounds or the bounds don't require dynamic checks.

Change-Id: I6ca1ebec777ecf2989c4fb77425d65d542d5adf2
Cq-Include-Trybots: luci.dart.try:vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-mac-release-simarm64-try, vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/87181
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-01-08 08:36:58 +00:00
Alexander Markov 3b29f5ad81 [VM/AOT/TFA] Do not attribute calls via fields/getters with inference results
MethodInvocation nodes which have field or getter as interface target
actually correspond to 2 calls: 1) getter; 2) implicit call() on the result
of the getter.

While this was correctly modeled in summaries in TFA, it is not correct
to attribute such MethodInvocation nodes with results of the inference,
as results correspond to an each distinct call. To fix this, Call
statements in summaries are created without attaching them to a
corresponding kernel AST node.

Change-Id: I3ea28ed85550192f8b592a926cac0eae23810811
Reviewed-on: https://dart-review.googlesource.com/c/88424
Commit-Queue: Martin Kustermann <kustermann@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-01-07 10:22:40 +00:00
Jens Johansen 6c909a0efa Be explicit about whether a reference is allowed to be null or not
Before this change we allowed to serialize some references as null,
and would only complain when trying to read the dill back in.
This CL changes that so it complains up front.

It is unknown if any of this would ever occur in practise.

Change-Id: Id5e1af89abfb88a2d4249bd439b53b062d7aeffa
Reviewed-on: https://dart-review.googlesource.com/c/85392
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-01-04 08:39:36 +00:00
Alexander Markov 16b51c3dc1 [vm/bytecode] Disable incremental compilation if bytecode is used
Bytecode generation doesn't work on incremental components as they
omit core libraries. As a temporary workaround, this CL disables
incremental compilation in bytecode mode in order to be able to run VM
with '--use-bytecode-compiler --observe' and get profiles.

Change-Id: Id843a03871d959e11acfb8f046019aa756ee7c65
Reviewed-on: https://dart-review.googlesource.com/c/88233
Commit-Queue: Alexander Aprelev <aam@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2019-01-03 00:05:30 +00:00
Kevin Millikin d0c2cdcd4c [Kernel] Remove the syncAsync flag
This flag was always true so we can remove it and specialize the
remaining code that used it.  The only code that used it was in the
Dart VM's async transformation.

Specializing that code led to some unused fields in the async helper
class which were removed.  This triggered me to look at core types
which seems to have a lot of unused stuff.

Change-Id: I7da800ca17ac05478149f4c90337a38d2c2b1459
Reviewed-on: https://dart-review.googlesource.com/c/87960
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
2018-12-21 10:07:04 +00:00
asiva dff358223e [VM/Runtime] Delete flag --sync-async and it's uses.
Remove all references to the --sync-async flag which was added as a transition step
when the feature was being introduced.

Change-Id: Ic5b1c8c8b3e2d92a70d954d401afeddfd43f5e92
Reviewed-on: https://dart-review.googlesource.com/c/87381
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-12-20 23:37:45 +00:00
Alexander Markov 6d8d57c967 [vm/kernel] Cleanup use of legacyMode in pkg/vm/test
When default mode of TypeEnvironment was flipped in
https://dart.googlesource.com/sdk/+/e45e33454874d5751fadc0ea15d8141165e24587,
the test was updated to use legacy mode explicitly.

However, the test needs a default mode of TypeEnvironment (whatever it is)
and not legacy mode, so reverting it back to use default.

Change-Id: Iec0c42588cf6a2083d395a8bdc95982aab2b0da1
Reviewed-on: https://dart-review.googlesource.com/c/87900
Commit-Queue: Alexander Aprelev <aam@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2018-12-20 20:16:45 +00:00
Peter von der Ahé e45e334548 Rename strong mode to legacy mode in package:kernel
Change-Id: Ia4a8a9cac7817a8db5771ec82541b556c705f7c8
Reviewed-on: https://dart-review.googlesource.com/c/86353
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-12-20 18:06:34 +00:00
Alexander Markov 2fc5a23dd5 [vm/kernel] Enable sync-async in pkg/vm tests
Change-Id: I7fc4a9ad503cb47a0c1b8b37ffdcdb754e2e7200
Reviewed-on: https://dart-review.googlesource.com/c/87608
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
2018-12-18 22:34:11 +00:00
Alexander Markov 80412dcf6a [vm/kernel] Accept URIs in --packages option if multi-root filesystem is used
Change-Id: I0558a8feed81f895e75f2d9f73a5f737d8b4f085
Reviewed-on: https://dart-review.googlesource.com/c/86460
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-12-17 20:06:44 +00:00
Alexander Aprelev 7d14785115 This relands "Load isolate from parent's kernel in Isolate.spawn calls.".
Original PR was reverted because it broke hot-reload bots. This CL adds steps to initialize kernel_service compiler for child isolate. Compiler is needed to support hot-reload request. Child isolate's compiler is created from full kernel file produced by main isolate's compiler. Changes since original PR are pkg/vm/bin/kernel_service.dart in pkg/vm/lib/incremental_compiler.dart.

Further this CL changes kernel fingerprint calculation for interface types so it calculates the hash of the canonical names themselves, rather than indices(that might change from one compilation to another).

This reverts commit 63fd8f63e6.

Change-Id: I6fe5b2ef99f209b32cd4087dfd1c8cac229c2d8b
Reviewed-on: https://dart-review.googlesource.com/c/87265
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2018-12-14 23:45:57 +00:00
Régis Crelier 25851db73d [vm/bytecode] Replace InstanceCall instruction with InterfaceCall and DynamicCall.
Dispatch interface calls via hashtable rather than inline cache.
InterfaceCall doesn't need to take arguments descriptor into account
when doing method lookup.

Change-Id: I30eae6ea638d1d2ad2cf3ff073c653fee3377f31
Reviewed-on: https://dart-review.googlesource.com/c/86106
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2018-12-14 16:51:51 +00:00
Dmitry Stefantsov cdbb2a74a1 Reland [fasta] Invoke constructors of mixin applications in super invocations
Reland of https://dart-review.googlesource.com/c/sdk/+/86200.

TBR=aam@google.com

Change-Id: Id3137cf5c7f87492db5bf3aabb505ac04529fa2c
Reviewed-on: https://dart-review.googlesource.com/c/87079
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2018-12-14 11:21:58 +00:00
Dmitry Stefantsov a116759784 [vm] Fix super refs in non-synthetic constructors in mixin deduplication
Change-Id: I50bc48b6956aadd770ee73bc09b6292f33eac2ea
Reviewed-on: https://dart-review.googlesource.com/c/87078
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-12-14 11:21:58 +00:00
Alexander Aprelev fc3153a4f0 [vm] Unskip isolate tests on sim* architecture.
Also make kernel-service verbose output friendlier(so it doesn't dump platform.dill on console).

Change-Id: Ibed494f324cd574e05b701f7d56b18c0fb1b451f
Reviewed-on: https://dart-review.googlesource.com/c/86784
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2018-12-13 03:07:06 +00:00
Alexander Aprelev 4ed049d782 Revert "[fasta] Invoke constructors of mixin applications in super invocations"
This reverts commit 7d1ebf260a as it
breaks vm-kernel-precomp-obfuscate-linux-release-x64, kernel-precomp
bots.

Change-Id: Icf7ba0fc2c3781c34b1c4327655f958c809d99fe
Reviewed-on: https://dart-review.googlesource.com/c/87120
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2018-12-12 18:32:53 +00:00
Kevin Millikin a8493e1b50 Flip the default value of the Kernel syncAsync flag
In Kernel's TargetFlags, this flag still defaulted to false.  Flip the
default to true and update all client code in the SDK.  The
expectation is that many of the places that now pass false explicitly
really just want the default, but that will be verified separately and
then the flag will be removed.

Change-Id: I2a38eb53f280f21f59bb1d2e88c42516f827fd39
Reviewed-on: https://dart-review.googlesource.com/c/85448
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
2018-12-12 14:23:54 +00:00
Dmitry Stefantsov 7d1ebf260a [fasta] Invoke constructors of mixin applications in super invocations
Change-Id: I24859587e1ba0e63a8219a60e1218c1ce5c83f24
Reviewed-on: https://dart-review.googlesource.com/c/86200
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2018-12-12 14:09:28 +00:00
Samir Jindel 921e62f1bf [vm] Introduce multiple entrypoints to AOT.
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try, vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-win-release-x64-try
Change-Id: I8643033febf9bdc57c8298dca5f43346fb8bf6d1
Reviewed-on: https://dart-review.googlesource.com/c/80304
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-12-07 13:19:24 +00:00
Alexander Markov 170d5578c7 [vm/kernel] Move functionality of Fuchsia's compiler.dart into pkg/vm
This includes:
* Selecting front-end target.
* Support for multi-root virtual file system.
* Not linking platform into resulting kernel file.
* Specifying input as URI (instead of file path) on command line.
* Automatically converting input script URI to package URI.
* Writing ninja dependencies file.
* Writing package-split kernel binaries.

After this change Fuchsia's compiler.dart will become a small wrapper
over pkg/vm, sharing most logic and even most command line options
with pkg/vm gen_kernel tool.

Also, this CL attempts to share some pieces of code between frontend
server and gen_kernel.

In addition, seperate bytecode generation for package-split binaries
is implemented (needed for https://dart-review.googlesource.com/c/sdk/+/85469).

Corresponding Fuchsia CL: https://fuchsia-review.googlesource.com/c/topaz/+/229964

Change-Id: I12d7b2f6401357b3c9df2e31bc736af5a9dc5fd2
Reviewed-on: https://dart-review.googlesource.com/c/85721
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-12-04 01:08:03 +00:00
Alexander Markov 9f49b47823 [vm/bytecode] Revise representation of objects and strings in bytecode
This is a major revamp of bytecode metadata format. Now bytecode has
its own serialization mechanisms.

This CL adds 'bytecode component' metadata, which contains bytecode
object table and string table. All references from bytecode (constant
pools) to libraries, classes, members, types and strings now have a new
format. References to frequently used objects are represented as indices
in object table, while rarely used objects are written inline.
This allows VM to cache frequently used objects while reading bytecode.

Representation of strings is aligned with VM - string characters are
stored in separate pools of one-byte and two-byte strings. This allows
VM to avoid UTF-8 decoding and extra copying.

Closure declarations are now explicit. Type parameters no longer require
enslosing scopes when reading/writing them.

Benchmarks:
GenKernelKernelReadAllBytecode (Intel Core i5) +29.84%
GenKernelKernelReadAllBytecode (Intel Xeon) +28.74%
Change-Id: I4b80009733a8f8c038264af74f97c4e094b9e311
Reviewed-on: https://dart-review.googlesource.com/c/85469
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-12-03 19:08:42 +00:00
Martin Kustermann 0ef66e0f5c [VM] Add @pragma("vm:non-nullable-result-type") annotation
A field/function annotated with this pragma must be guaranteed to not
return `null` at runtime.

Make use of this non-nullable annotation in the VM's type propagator.

Annotates the "_TypedListView._typedData" field to ensure the VM knows it
returns a non-nullable _TypedListView.

Furthermore annotates methods on the integer implementation.  Those particular
methods are recognized methods with a "dynamic" return type.  This caused
the type propagator to use CompileType::Dynamic() as result type.  Since a
previous CL started to only utilize the annotated type if it is better than
"dynamic" more integer operations got handled in-line, though with null-checks.
Annotating those methods to return non-null improves the in-line handling of
integer operations.

This improves dart-aot

On arm7hf:
  SHA256: +5%, SHA: +6%, JsonObjectRoundTrip: +7%, ...

On arm8:
  SHA1: +28%, MD5: +25%, SHA256: +15%, TypedData.Int16ListViewBench: +18.5%, StringInterpolation: +18%, ...


Issue https://github.com/dart-lang/sdk/issues/31954
Issue https://github.com/dart-lang/sdk/issues/35154

Change-Id: Ia4263a37241a36c9dc35e8a48893297effa6f4b2
Reviewed-on: https://dart-review.googlesource.com/c/84421
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-11-22 16:18:27 +00:00
Samir Jindel cde4270e47 Re-land "[vm/aot] Snapshot size analysis."
Minor fixes have been applied, see diff against patchset 1.

This reverts commit 9b937f1226.

Change-Id: I8e4bbc0b88e33d3b554e91c17d1f849e24a1ccb3
Cq-Include-Trybots: luci.dart.try:vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-win-product-x64-try, vm-kernel-precomp-win-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/84845
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Samir Jindel <sjindel@google.com>
2018-11-22 15:14:46 +00:00
Alexander Markov e6800d9589 [vm] Disable bytecode generation while training kernel service
Change-Id: Ibfdc9379965bda99f63250b880b46fbdeb384248
Reviewed-on: https://dart-review.googlesource.com/c/85120
Commit-Queue: Alexander Aprelev <aam@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2018-11-21 18:05:08 +00:00
Zach Anderson 9b937f1226 Revert "[vm/aot] Snapshot size analysis."
This reverts commit 06c89287b9.

Reason for revert:
- Failure of v8_snapshot_profile_writer_test on vm-kernel-precomp-android-release
- many failures on windows precomp (?)
- link failures in windows product builds.

Original change's description:
> [vm/aot] Snapshot size analysis.
> 
> Cq-Include-Trybots: luci.dart.try:vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try
> Change-Id: Ie5d5d9f0f064f2c9ef8b7c9a0537b1e633bf8175
> Reviewed-on: https://dart-review.googlesource.com/c/84425
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

TBR=vegorov@google.com,rmacnak@google.com,sjindel@google.com

Change-Id: I461f06236f27bb5c6548bd08f4b73507d1b913fa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.dart.try:vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/84860
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-11-19 22:29:09 +00:00
Samir Jindel 06c89287b9 [vm/aot] Snapshot size analysis.
Cq-Include-Trybots: luci.dart.try:vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try
Change-Id: Ie5d5d9f0f064f2c9ef8b7c9a0537b1e633bf8175
Reviewed-on: https://dart-review.googlesource.com/c/84425
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-11-19 20:29:05 +00:00
Alexander Markov 62c562ed7a [vm/bytecode] Encapsulate constant pool entry creation
This refactoring is needed to simplify upcoming changes in constant pool entries.

Change-Id: Ia0356b0a738d33b4e676cd5be67bd77a2f75279a
Reviewed-on: https://dart-review.googlesource.com/c/84684
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-11-19 17:23:40 +00:00
Alexander Markov a9abc64613 [vm/bytecode] Add context IDs to disambiguate accesses to distinct contexts
This CL adds context ID operand to AllocateContext, CloneContext,
LoadContextVar and StoreContextVar bytecode instructions.
The context ID will be used to create distinct Slots and disambiguate
accesses to context objects corresponding to different scopes.

Change-Id: I98850ab763017b71c1dcacfccaffc085bd850e00
Reviewed-on: https://dart-review.googlesource.com/c/84681
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-11-17 00:35:30 +00:00
Alexander Markov 7fafcec013 [vm/bytecode] Eliminate AssertBoolean instructions if condition is non-nullable
Number of AssertBoolean instructions in the 100Mb dynamic trace of
Richards benchmark in pure interpreted mode (platform with bytecode):

Before: 1812005
After:   251451
Change-Id: I9fe9d37499d73ffa7636c9ca5fb9c2c18dbc1397
Reviewed-on: https://dart-review.googlesource.com/c/84643
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-11-16 19:18:27 +00:00
Vyacheslav Egorov ddbe22190c [vm/compiler] Refactor representation of stores and loads in IL.
Make StoreIntanceField and LoadField instructions use a single uniform
abstraction: Slot (used to be called NativeFieldDesc), which represents
either a real Dart field (i.e. a field that has a corresponding Field object)
or a native VM field that does not have a corresponding Field object.

This refactoring eliminates raw stores/loads that were just using offsets
before - now we always know what kind of slots we are accessing and
this yields better aliasing information.

Change-Id: I2f48332d58258219565bd961764e8cc9dd4d75ce
Reviewed-on: https://dart-review.googlesource.com/c/74582
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-11-16 17:57:29 +00:00
Zach Anderson b981cbfff8 [vm] Adds a flag to dump dynamic bytecode traces in a debug build.
Also adds a program in pkg/vm/bin/dump_bytecode_ngrams.dart that
analyzes the traces.

Change-Id: I39c9645ca858195a41e001dab47a7b1398f4b15e
Reviewed-on: https://dart-review.googlesource.com/c/83340
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-11-16 06:24:02 +00:00
Alexander Markov 8f7a0f400b [vm/bytecode] Emit source positions for bytecode instructions
Change-Id: I83963771db301089317823f6bf14eb4a2728dbfb
Reviewed-on: https://dart-review.googlesource.com/c/81740
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-11-14 00:27:45 +00:00
Kevin Moore bc03bd3805 Cleanup unused vars in VM patch files
Change-Id: Ibc548921113d979df5b0ed8eb7f6ad48a553fc86
Reviewed-on: https://dart-review.googlesource.com/c/84121
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-11-13 22:56:54 +00:00
Alexander Markov c04461c16d [vm/bytecode] Fix allocation of temporary locals for StaticSet
Change-Id: I47fc4f5d462be30351f4828bf4354404c0ad7088
Reviewed-on: https://dart-review.googlesource.com/c/84300
Commit-Queue: Régis Crelier <regis@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-11-13 20:19:16 +00:00
Alexander Markov 3c32b32d56 [vm/bytecode] Enable OSR for unoptimized code compiled from bytecode
In order to enable OSR, CheckStackOverflow IL instructions are attributed
with a non-zero loop depth. The original loop depth is passed as operand
of CheckStack bytecode instruction.

Change-Id: I771f59ba9f8d071680a3b7156be380e0f606b7b2
Reviewed-on: https://dart-review.googlesource.com/c/84081
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-11-12 19:04:54 +00:00
Alexander Markov a4dc8cd22e [vm/kernel/bytecode] Make sure bytecode instructions are aligned in kernel
Change-Id: I109123e88b8352b198d5ef9aad9eedc1df7141c8
Reviewed-on: https://dart-review.googlesource.com/c/83543
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-11-09 17:08:46 +00:00
Jens Johansen 3e56b7ec3a Exercise loadComponent of sdk more when training kernel_service
By exercising loadComponent more we speedup the loading of the sdk.
This is going to be noticable when executing small scripts.
On my machine execution of a hello-world script is speed up by ~15-20%.

More data from local experiments:

Before:

$ perf stat -r 25 -d out/ReleaseX64/dart hello.dart

 Performance counter stats for 'out/ReleaseX64/dart hello.dart' (25 runs):

        389.268166      task-clock:u (msec)       #    2.035 CPUs utilized            ( +-  0.91% )
                 0      context-switches:u        #    0.000 K/sec
                 0      cpu-migrations:u          #    0.000 K/sec
            19,278      page-faults:u             #    0.050 M/sec                    ( +-  0.65% )
       979,345,922      cycles:u                  #    2.516 GHz                      ( +-  1.31% )  (48.75%)
     1,120,493,995      instructions:u            #    1.14  insn per cycle           ( +-  0.73% )  (61.28%)
       207,470,248      branches:u                #  532.975 M/sec                    ( +-  0.84% )  (60.76%)
         4,439,025      branch-misses:u           #    2.14% of all branches          ( +-  1.00% )  (61.00%)
       387,461,284      L1-dcache-loads:u         #  995.358 M/sec                    ( +-  1.38% )  (49.12%)
        18,764,375      L1-dcache-load-misses:u   #    4.84% of all L1-dcache hits    ( +-  2.94% )  (26.43%)
         5,713,192      LLC-loads:u               #   14.677 M/sec                    ( +-  2.13% )  (25.71%)
         1,266,848      LLC-load-misses:u         #   22.17% of all LL-cache hits     ( +-  3.74% )  (37.01%)

       0.191278504 seconds time elapsed                                          ( +-  1.10% )


$ runxtimes 25 sudo chrt -f 99 /usr/bin/time -f "%e" out/ReleaseX64/dart hello.dart > /dev/null 2>> before.txt

After:

$ perf stat -r 25 -d out/ReleaseX64/dart hello.dart

 Performance counter stats for 'out/ReleaseX64/dart hello.dart' (25 runs):

        311.248543      task-clock:u (msec)       #    1.981 CPUs utilized            ( +-  0.91% )
                 0      context-switches:u        #    0.000 K/sec
                 0      cpu-migrations:u          #    0.000 K/sec
            18,055      page-faults:u             #    0.058 M/sec                    ( +-  0.84% )
       727,169,504      cycles:u                  #    2.336 GHz                      ( +-  1.66% )  (48.89%)
       875,097,166      instructions:u            #    1.20  insn per cycle           ( +-  0.74% )  (60.69%)
       164,966,288      branches:u                #  530.015 M/sec                    ( +-  0.82% )  (59.50%)
         3,403,794      branch-misses:u           #    2.06% of all branches          ( +-  0.93% )  (59.61%)
       272,404,305      L1-dcache-loads:u         #  875.199 M/sec                    ( +-  1.53% )  (47.62%)
        11,115,851      L1-dcache-load-misses:u   #    4.08% of all L1-dcache hits    ( +-  1.70% )  (27.55%)
         4,154,542      LLC-loads:u               #   13.348 M/sec                    ( +-  2.22% )  (26.40%)
         1,225,723      LLC-load-misses:u         #   29.50% of all LL-cache hits     ( +-  2.75% )  (37.49%)

       0.157151348 seconds time elapsed                                          ( +-  1.12% )



$ runxtimes 25 sudo chrt -f 99 /usr/bin/time -f "%e" out/ReleaseX64/dart hello.dart > /dev/null 2>> after.txt

$ ministat -A before.txt after.txt
x before.txt
+ after.txt
    N           Min           Max        Median           Avg        Stddev
x  25          0.17           0.2          0.18        0.1816         0.008
+  25          0.13          0.19          0.15         0.152   0.013844373
Difference at 95.0% confidence
        -0.0296 +/- 0.00643101
        -16.2996% +/- 3.5413%
        (Student's t, pooled s = 0.0113063)



Notes:

$ type runxtimes
runxtimes is a function
runxtimes ()
{
    number=$1;
    shift;
    for i in `seq $number`;
    do
        $@;
    done
}

Change-Id: I760759976136195da00e3719663bdadbfe962e70
Reviewed-on: https://dart-review.googlesource.com/c/82581
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-11-06 10:59:27 +00:00
jonahwilliams b5caca143d Add dart_runner and flutter_runner as supported targets to frontend_server
Bug: 35057
Change-Id: Icecd75bf6304c355af70d05d896bccb6d03a92f5
Reviewed-on: https://dart-review.googlesource.com/c/82920
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2018-11-06 03:17:09 +00:00
Martin Kustermann 8953788993 [VM] Convert const Symbol("..") to SymbolConstants in kernel2kernel transformation
Issue https://github.com/dart-lang/sdk/issues/34911

Change-Id: Ib504d57b5a529a04f511f737af4cec0ff0590250
Reviewed-on: https://dart-review.googlesource.com/c/82069
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-11-02 09:28:15 +00:00
Alexander Markov 056fdb8734 [vm/kernel] Fix kernel tree shaker after FunctionType.typedefType change
Fixes https://github.com/dart-lang/sdk/issues/34995

Change-Id: Ieef2696ea9cfe689a661dc7d1ebd86b257b49bbb
Reviewed-on: https://dart-review.googlesource.com/c/82261
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-11-01 15:41:12 +00:00
Régis Crelier 98a0309fbd [VM compiler] Reuse function type arguments to avoid instantiation at runtime, when possible.
Change-Id: Icfcbd165bb96cf83b7911c6c11a7daca17c6ba12
Reviewed-on: https://dart-review.googlesource.com/c/81701
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-10-30 18:38:37 +00:00