Commit graph

1014 commits

Author SHA1 Message Date
Teagan Strickland bb24f98616 Revert "[vm/aot] Remove object wrapping of bare instructions for AOT snapshots."
This reverts commit 7475c637c3.

Reason for revert: Breakage on simarm_x64 (and thus arm_x64)

Original change's description:
> [vm/aot] Remove object wrapping of bare instructions for AOT snapshots.
> 
> Now, when writing an AOT snapshot in bare instructions mode, only
> the actual instructions in the RawInstructions payload are serialized
> instead of the entire RawInstructions object.
> 
> Since there are no longer RawInstructions objects in these AOT
> snapshots, we also change how Code objects are serialized. Instead
> of just containing a reference to the RawInstructions object, we
> serialize two pieces of information: where the instructions
> payload for this Code object begins and whether there was a single
> entry for the instructions payload. (To save space, the single
> entry bit is serialized as the low order bit of the unchecked
> offset, which was already being serialized).
> 
> While we also need the length of the instructions payload, we
> approximate it for all but the last Code object by subtracting
> the next Code object's payload start from this Code object's
> payload start. For the last Code object, we assume it extends
> to the end of the instructions image.
> 
> Changes on flutter gallery in release mode:
> armv7: instructions size -2.66%, total size -1.68%
> armv8: instructions size -5.81%, total size -3.49%
> 
> Fixes https://github.com/dart-lang/sdk/issues/38451.
> 
> Change-Id: Ia458e8d99bae18f5c3b6e849df2519027f06f574
> Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131067
> Commit-Queue: Teagan Strickland <sstrickl@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=kustermann@google.com,rmacnak@google.com,sstrickl@google.com

Change-Id: If2c8ca6b0993211b2509b275af7ff11a8fa2baa3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-simarm_x64-try, vm-kernel-precomp-android-release-arm64-try, vm-kernel-precomp-android-release-arm_x64-try, vm-kernel-precomp-mac-release-simarm64-try, vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134322
Reviewed-by: Teagan Strickland <sstrickl@google.com>
Commit-Queue: Teagan Strickland <sstrickl@google.com>
2020-02-04 17:32:28 +00:00
Teagan Strickland 7475c637c3 [vm/aot] Remove object wrapping of bare instructions for AOT snapshots.
Now, when writing an AOT snapshot in bare instructions mode, only
the actual instructions in the RawInstructions payload are serialized
instead of the entire RawInstructions object.

Since there are no longer RawInstructions objects in these AOT
snapshots, we also change how Code objects are serialized. Instead
of just containing a reference to the RawInstructions object, we
serialize two pieces of information: where the instructions
payload for this Code object begins and whether there was a single
entry for the instructions payload. (To save space, the single
entry bit is serialized as the low order bit of the unchecked
offset, which was already being serialized).

While we also need the length of the instructions payload, we
approximate it for all but the last Code object by subtracting
the next Code object's payload start from this Code object's
payload start. For the last Code object, we assume it extends
to the end of the instructions image.

Changes on flutter gallery in release mode:
armv7: instructions size -2.66%, total size -1.68%
armv8: instructions size -5.81%, total size -3.49%

Fixes https://github.com/dart-lang/sdk/issues/38451.

Change-Id: Ia458e8d99bae18f5c3b6e849df2519027f06f574
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131067
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-02-04 10:28:43 +00:00
Aske Simon Christensen 76c6282de6 [vm/aot] Use a global dispatch table for instance calls in AOT.
This is a Dart-tailored implementation of the "row-displacement
dispatch table" technique for closed-world instance calls:

All interface targets in the program are grouped into selectors such
that all targets that could potentially be called from the same call
site have the same selector (currently just grouped by name).

Each selector is assigned a selector offset such that offset + classid
is unique for all selector/classid combinations where the class
implements the selector.

At every instance call site that has an interface target (i.e. where
the static type of the receiver is not dynamic), the selector offset +
receiver classid is computed and used as index into a global table of
entry points.

If the receiver can be null (as determined by the front-end TFA and the
VM type propagation), a null check is inserted before the call.

An arguments descriptor is provided (only) for selectors that need it
(those which have type parameters or optional/named parameters).

The dispatch table calls don't need the monomorphic entry code, so for
functions that are only called via dispatch table calls (i.e. never
called dynamically), the monomorphic entry code is left out.


Some future improvements to the table dispatch implementation are
mentioned in https://github.com/dart-lang/sdk/issues/40188


The table dispatch flag is disabled by default in this commit. A
separate commit enables the flag.

Change-Id: Ic2911742b4a2c9a8d3bc7df60605454cbe4c0714
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126648
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-02-03 11:04:15 +00:00
Mayank Patke ed441e48d0 Update all Slow tests to be Slow, Pass.
Change-Id: I610b272355b045eab80cf941210774fb12d775eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134103
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2020-02-01 00:17:42 +00:00
Victor Lima b68d95ec9e [vm] Reland support for real unboxed floating point fields in AOT
Issue https://github.com/dart-lang/sdk/issues/40404

Change-Id: Icfa801ff0640a6b27bb3c13d0b737c40452cbf7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133983
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-01-31 12:56:31 +00:00
Clement Skau 26ada4363a [SDK] Fixes remaining issues with --lazy-async-stacks on.
- Handle bytecode for e.g. dartkb-simarm64 does not have source position.
- Use existing GetCallerSp() instead of working across frames.
- Nit: Adds clarifying comments to test.
- Nit: Updates name of non-async-stack test to clarify flags used.

Tested:
- CQ with --lazy-async-stacks on by default.
- vm/dart/causal_stacks and language_2/vm/causal_async_exception_stack_test with current flags.

Bug: https://github.com/dart-lang/sdk/issues/39525
Change-Id: Ie6581a734cdcafbd4fb641bd86bffc03ed241532
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133063
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-01-31 10:45:21 +00:00
Zichang Guo 162d6c5634 Revert "[vm] Add support for real unboxed floating point fields in AOT"
This reverts commit 9eb531bde4.

Reason for revert: Bots are red. Some tests are failing.

https://ci.chromium.org/p/dart/builders/ci.sandbox/vm-kernel-precomp-obfuscate-linux-release-x64/6039

https://ci.chromium.org/p/dart/builders/ci.sandbox/vm-kernel-precomp-android-release-arm_x64/957

Original change's description:
> [vm] Add support for real unboxed floating point fields in AOT
> 
> Non-nullable floating point fields (double, Float32x4, Float64x2)
> are fully unboxed in their classes.
> 
> A bitmap for each class was added to the shared class table in order to keep
> track of the pointers of the classes. Since all classes in Flutter Gallery
> have less than 64 fields, the bitmap is represented by a 64 bit integer and
> fields whose offset is more than 64 words are not unboxed.
> 
> The instance sizes and field offsets might change between target and host
> in cross-compilation, since the number of words used to store unboxed fields
> may differ.
> 
> dart-aot Xeon
> 
>   SplayLatency               -4.62%
>   SplayHarderLatency         -4.17%
>   NavierStokes               -2.20%
>   Tracer                      8.72%
>   ParticleSystemPaint         2.90%
>   NBodySIMD                   8.35%
>   NBody                      25.59%
> 
> With hack TFA to make doubles in Rect/Offset/Size classes in flutter non-nullable:
> 
> flutter arm-v8:
> 
>   gallery total size: -1%
> 
>   matrix_utils_transform_rect_perspective   -16.70% (less is better)
>   matrix_utils_transform_rect_affine        -31.82% (less is better)
>   matrix_utils_transform_point_perspective  -24.90% (less is better)
>   matrix_utils_transform_point_affine)      -27.26% (less is better)
>   rrect_contains_bench                      -4.719% (less is better)
> 
> Change-Id: I9ae09c9c3167d99f9efd071a92937aa51093fd1d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131824
> Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Samir Jindel <sjindel@google.com>

TBR=kustermann@google.com,rmacnak@google.com,sjindel@google.com,victoragnez@google.com

Change-Id: Ic73858f6adb7f55c4129d4f46ff4731b378cb634
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134020
Reviewed-by: Zichang Guo <zichangguo@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-01-30 18:13:28 +00:00
Victor Lima 9eb531bde4 [vm] Add support for real unboxed floating point fields in AOT
Non-nullable floating point fields (double, Float32x4, Float64x2)
are fully unboxed in their classes.

A bitmap for each class was added to the shared class table in order to keep
track of the pointers of the classes. Since all classes in Flutter Gallery
have less than 64 fields, the bitmap is represented by a 64 bit integer and
fields whose offset is more than 64 words are not unboxed.

The instance sizes and field offsets might change between target and host
in cross-compilation, since the number of words used to store unboxed fields
may differ.

dart-aot Xeon

  SplayLatency               -4.62%
  SplayHarderLatency         -4.17%
  NavierStokes               -2.20%
  Tracer                      8.72%
  ParticleSystemPaint         2.90%
  NBodySIMD                   8.35%
  NBody                      25.59%

With hack TFA to make doubles in Rect/Offset/Size classes in flutter non-nullable:

flutter arm-v8:

  gallery total size: -1%

  matrix_utils_transform_rect_perspective   -16.70% (less is better)
  matrix_utils_transform_rect_affine        -31.82% (less is better)
  matrix_utils_transform_point_perspective  -24.90% (less is better)
  matrix_utils_transform_point_affine)      -27.26% (less is better)
  rrect_contains_bench                      -4.719% (less is better)

Change-Id: I9ae09c9c3167d99f9efd071a92937aa51093fd1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131824
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2020-01-30 13:45:08 +00:00
Martin Kustermann 37d562d2a4 [vm/async] Ensure --lazy-async-stacks also works inside custom zones with error handlers
Issue https://github.com/dart-lang/sdk/issues/37668

Change-Id: Ib7fb8299fbc8b7f73e154414f37451a488297a67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133583
Auto-Submit: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2020-01-29 11:17:50 +00:00
Alexander Aprelev 7131264848 [vm/isolates] Disallow sending of function types.
Fixes dartbug.com/37294

Change-Id: Ia39790f4ed7ef25988b0ce2849d10429027bbf92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132805
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-01-29 03:30:52 +00:00
Teagan Strickland a4aaaf05eb [vm] Cleanups in the native_stack_traces package.
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try
Change-Id: I285aada8ee46b2caf212957dfc400f00d4aa25b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133066
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-01-24 11:40:59 +00:00
Clement Skau da1e42a11c [SDK] Fixes async* stack unwinding.
For `foo() async* {}` frames we find the "caller" by finding out
what closure is registered as listener on the _AsyncStreamController.

There can be two cases:

a) The caller does a regular `foo().listen((_) {})`:
  The stack trace will have the closure as the caller and unwinding stops.

b) The caller uses 'await for (... foo())':
  In this case the listener will be a StreamIterator.

This CL changes our unwinding code to get the awaiter of `await it.moveNext()`.


Bug: https://github.com/dart-lang/sdk/issues/39525
Change-Id: I13f76025a15682aaf55fd968088fc2059982d842
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132841
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-01-24 09:04:56 +00:00
Ryan Macnak c359b5943a [vm, service] Fix and enable more services tests.
Change-Id: I3e96b3fdcb30def43c7b87183a925bd1668fb6a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133087
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-01-24 01:59:01 +00:00
Teagan Strickland a003d5e69a [vm] Refactor debug info handling code into a new package.
Change-Id: Iaf944564ebbe4bdcc215166f784e949362583a69
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132281
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-01-23 10:14:17 +00:00
Victor Lima da1b47cace [vm/aot] Fix FlowGraphCompiler::TryIntrinsifyHelper issue
for implicit getters and setters of unboxed fields

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

Change-Id: If11545eca4a87cfded52d7586de2a628d3246b90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132664
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-01-21 16:38:12 +00:00
Martin Kustermann feb73b2677 [vm/compiler] Replace uses of constant phis with constants
Issue https://github.com/dart-lang/sdk/issues/40189

Change-Id: I4b1b3c92b27833691563e964cc996d309f5005ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132000
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-01-20 16:07:28 +00:00
Martin Kustermann 9520235bfe [vm/async] Ensure all service tests run with both, --causal-async-stacks/--lazy-async-stacks
Running all existing tests with/without lazy async stacks ensures that
the existing functionality for --lazy-async-stacks does not regress.

There are still a few smaller things to be done in the debugger for lazy
async stacks.

This CL also ensures:

   * The inner closure, i.e. AsyncClosure/AsyncGenClosure, is not
     inlined if FLAG_lazy_async_stacks is on.

   * Fixes a crash in dartkb mode, when the function of the Bytecode
     object is null.

   * Does a simple integration of the lazy async stacks in debugger.cc -
     to ensure a stack is returned via vm-service.

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

Change-Id: Ibc1e887a457e2c456ae65d9ed5fa92434f122a32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131825
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-01-16 12:47:03 +00:00
Samir Jindel 8617867757 [vm] Clone boxes for unboxed numeric fields upon rematerialization.
Fixes https://github.com/dart-lang/sdk/issues/39112

Change-Id: I0d6a7686fdef6182bba16fdceb2ff773650a0e28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128062
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-01-14 12:57:55 +00:00
Artem Serov 966d795f4e [vm/compiler] Fix Mint allocation stub runtime entry and test.
* Fix .dart test which didn't exersize the shared stub going into
   runtime.
 * Fix AllocateMint runtime entry int constant choice so it
   doesn't fit a Smi on all targets, not only 32-bit ones.
 * Make MintAllocation stubs go to runtime when
   FLAG_shared_slow_path_triggers_gc is set for testing purposes.

Change-Id: I699f36c70d055af7bd17a16f81b92b9e9d87580c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129703
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-01-10 19:30:01 +00:00
Teagan Strickland 26c88bbb74 [vm/compiler] Clean up ELF creation code.
Instead of making the ELF object handle stripping and keep track of two
possible output stream, just revert ELF objects to only output to a
single stream. Now, layers that use ELF, like the ImageWriters, handle
the stripping by deciding whether or not to add certain sections or
static symbols to the generated ELF, and we create separate DWARF
objects for each unstripped ELF object.

We also avoid duplication of writing segment and section table entries
by just creating special Sections that correspond to reserved entries,
the program table header entries for itself, etc, and then move the
section and segment entry writing into Section itself. We also lift
a lot of the same calculations used in subclass construction to the
Section level, and replace the old fields with four different kind
of object members:

* Fields that are known at construction time and thus now const
  (e.g., section_type)

* Fields that are not known at construction time that have reasonable
  defaults for most instances and so need not be changed from their
  default value (e.g., section_link)

* Fields that are not known at construction time which must be set once
  (and only once) before use. These are now accessed via getters/setters
  that check whether or not the field has been set (e.g., section_name)

* Fields that are calculated from the contents of the particular
  subclass, which are now just methods (e.g., FileSize())

We also change the snapshot profile writer test to test the size of
internally stripped ELF output on all platforms without running it
through an external stripping utility (previously untested), and test
assembled or externally stripped output on more platforms where we
support those. Instead of depending on pkg/vm/tool/precompiler2 for
assembling (which always uses gcc), I've added assembleSnapshot and
stripSnapshot to use_flag_test_helper.dart, which mimics the way the
test_runner determines the executable and flags to use.

Change-Id: I4ade45c5caffb443abb3f5c567343504c8085f89
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129083
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-01-10 11:51:57 +00:00
Samir Jindel 8a39cb8f66 [vm] Enable multiple entry-points on IA32.
Issue https://github.com/dart-lang/sdk/issues/34162

Change-Id: If3ca8448012dd1e3dc6e5f638e24202f53ccaf60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129716
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-01-07 17:05:44 +00:00
Alexander Markov 0380d3a90e [vm/compiler] Do not use specualtive unboxing for Phi instructions in AOT
When inserting Unbox instructions in SelectRepresentations pass, their
speculative mode depends on the instruction which uses corresponding
value. Phi instructions were using default kGuardInputs mode, which may
cause insertion of speculative Unbox instructions in AOT mode.
Such Unbox instructions may need deoptimization if type of an argument
changes during optimizations. Generating code for such Unbox
instructions causes assertion failure (in debug mode), or crash in
release mode.

The fix is to change speculative mode of Phi instructions in AOT, so
they won't cause speculative Unbox instructions.

Fixes https://github.com/dart-lang/sdk/issues/39747

Change-Id: Ic9c9957875fd775fe1c02f3666829f26dad64937
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130063
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-01-03 21:15:19 +00:00
Alexander Markov ff43a04d77 [vm/compiler] Fix crash in StringInterpolateInstr::Canonicalize
If OSR happens while calculating an argument of string interpolation,
array of arguments may be Phi and not CreateArray instruction.
In this case, canonicalization of StringInterpolate should gracefully
return instead of crashing. Such OSR may happen due to control flow
collections.

Fixes https://github.com/dart-lang/sdk/issues/39905

Change-Id: Ibf35a0f0ebb20d5a44102f7ddfd4e91925d7c6ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129900
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-01-03 18:26:19 +00:00
Martin Kustermann addd5eea00 [vm/compiler] Consistently use pc-offsets of pointing to instruction after call in static calls table, to ensure unique offsets
The pc-relative calls were recorded with pc-offsets pointing to the start of the
call instruction, where as code-based calls were recorded with
pc-offsets pointing to the next instruction (i.e. return address).

This is inconsistent and caused us to hit an assert in
`Code::set_static_calls_target_table`. The assert was benign, but it is
good to maintain the uniqueness guarantee in the static calls table, so
we'll unify the encoding to use offsets to the instruction after the
call in both cases.

Closes https://github.com/dart-lang/sdk/issues/39811

Change-Id: Id0305befd78f09ed0b0e100f39641bca9e764442
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129717
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-01-03 17:17:59 +00:00
Teagan Strickland 4774141425 [vm/compiler] Generate debugging info during single snapshot pass.
Previously when --save-debugging-info=<...> was used when not
compiling to ELF, we generated the requested snapshot format
and the separate debugging information as two separate snapshot
generation passes. However, we want to avoid this, to remove the
assumption that instruction snapshot serialization must be
deterministic.

Fixes https://github.com/dart-lang/sdk/issues/39803.

Also allows --strip to be used with --snapshot-kind=app-aot-assembly,
so that DWARF sections are not output in the generated assembly code.

Fixes https://github.com/dart-lang/sdk/issues/37560.

Change-Id: Ibdf1f5c771bae21870af252b38e64250fde53603
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128735
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-20 10:14:10 +00:00
Samir Jindel f134164332 [vm] Enable multiple entry-points on ARM64.
Adresses https://github.com/dart-lang/sdk/issues/34162

Change-Id: I7126f8c9b470041aaa260255293327f67d64d1bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128063
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-19 16:41:24 +00:00
Victor Lima 7a1c91bda9 [vm/precomp] Inline SIMD operations
This CL is responsible for inlining Float32x4 and Float64x2 arithmetic
operations in order to reduce their run-time cost.

Null-checks were required in order to allow the unbox instructions to
be non-speculative.

CheckNullInstr was modified to throw ArgumentError when checking
arguments for those operations.

Change-Id: I18b36d96a36011647480f301eb6dc6bb478f59a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128589
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2019-12-19 15:09:32 +00:00
Teagan Strickland 089aeedf56 [vm/compiler] Reland "Add --save-debugging-info flag to gen_snapshot."
Removes an unnecessary change to the names of type testing stubs that
allowed name collisions to happen.

Old commit message:

The flag can be used when creating AOT snapshots. The resulting file can be
used with package:vm/dwarf/convert.dart to convert DWARF-based stack traces
to stack traces with function, file, and line number information.

Currently the saved file will be an ELF file with DWARF debugging information,
but this is subject to change in the future. To avoid being affected by any
changes in format, read the DWARF information from the file using
Dwarf.fromFile() in package:vm/dwarf/dwarf.dart.

Also adds --dwarf-stack-traces to the VM global flag list, so its value at
compilation will be read out of snapshots by the precompiled runtime.

Fixes https://github.com/dart-lang/sdk/issues/39512, which was due to
a missing compiler::target:: prefix for Instructions::HeaderSize() in
BlobImageWriter::WriteText().

Exposes the information suggested in
https://github.com/dart-lang/sdk/issues/39490 so that package:vm/dwarf
can appropriately convert absolute PC addresses to the correct virtual
address for a given DWARF line number program.

Bug: https://github.com/dart-lang/sdk/issues/35851
Change-Id: I6723449dceb0b89c054a1f1e70e7acd7749baf14
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128730
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-18 14:14:41 +00:00
Clement Skau 6fcd1de98c [SDK] Fixes missing stack trace line numbers.
CodeSourceMapBuilder::NoteDescriptor(..) would previously only emit
CSM entries if its stack_traces_only_ flag was set, which
FlowGraphCompiler would only do if compiled in PRODUCT mode:
runtime/vm/compiler/backend/flow_graph_compiler.cc:162

Bug: https://github.com/dart-lang/sdk/issues/39525
Change-Id: I78c56a18a5a95ef3c8c37a2d7eae6ab612e6674f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127464
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-18 10:34:41 +00:00
Clement Skau 3764928769 [SDK] Switch to isSync to determine if async func. is running sync-async.
Bug: https://github.com/dart-lang/sdk/issues/39525
Change-Id: I1e23a726bf0fbff2c02891e25c714ea599330c47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128666
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-18 08:57:00 +00:00
asiva 8a4cac1ddb Reverting a chain of commits related to debug info splitting.
REASON: the first commit in the chain contains a change that breaks internal
Flutter roll due to duplicated symbols for type testing stubs in assembly
snapshots.

Revert "[vm/compiler] Add --save-debugging-info flag to gen_snapshot."

This reverts commit c2b6c2e1db.

Revert "[vm] De-obfuscate function and file names in DWARF sections."

This reverts commit 4b8fd3c412.

Revert "[vm] Add docs for DWARF stack traces and related tools/libraries."

This reverts commit 5543e5ceb8.

Revert "[vm] Weaken dwarf_stack_trace expected stack trace."

This reverts commit 5824d3ed53.

Change-Id: I95ecd16fe493f61ae761dabfdd91a6ec0c2f0ca3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128776
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2019-12-18 01:02:05 +00:00
Teagan Strickland 217e265b02 [vm/compiler] During DCE, remove PushArguments of non-live definitions.
In the current compiler pipeline, PushArgument instructions can
end up outliving the calls to which they are an argument in some
circumstances. For example, the PushArgument is left in the graph
if it also appears in the environments of interleaving instructions.

When the dead code eliminator calculates liveness of a definition,
it ignores appearances in PushArgument instructions. Instead, it
looks for uses of the definition either directly or via
PushArgument in the arguments of calls and environments of other
instructions in the graph. An separate pass run before DCE
removes environments from instructions, so a definition used only
in PushArguments that have outlived their calls is considered dead.

The current DCE removes dead definitions but leaves PushArgument
instructions be. For orphaned PushArguments of dead definitions,
this means after DCE they now reference definitions no longer in
the graph.

This change instead checks the definitions referenced by
PushArgument instructions for liveness. If a PushArgument
references a dead definition, then the DCE removes the PushArgument
instruction, as its call must have already been removed (else
the definition would still be live), and environments, and thus
environmental uses, have already been removed from the graph.

Bug: https://github.com/dart-lang/sdk/issues/39767
Change-Id: I74c8e92a0d93f2aae42f8ff6f06ee70899b2f794
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128403
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Teagan Strickland <sstrickl@google.com>
2019-12-13 18:15:04 +00:00
Martin Kustermann 6f6bdfac3a Reland "[vm/compiler] Fix TypeTestingStub -> SubtypeTestCache fallback code if dst_type = TypeParameter"
If the dst_type of an AssertAssignable is a type parameter, the AssertAssignable
implementation will load the value of the type parameter using
the (instantiator or function) type arguments. It will then call the
type testing stub (TTS) of that type.

If the TTS is not exhaustive (e.g. because `T = X<..>` wher `X` is
implemented), it can fall back to the slower SubTypeTestCache implementation.

Right now the STC fallback will get the loaded value of the type
parameter for `dst_type` instead of the type parameter. Doing so is
incorrect.

  => This CL ensures we preserve dst_type = TypeParameter for the STC
  fallback.

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

Change-Id: Id5b318ed4940b4d749f6ab8b4c2a4efc295d9dde
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127888
Auto-Submit: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-12-13 15:03:18 +00:00
Teagan Strickland c2b6c2e1db [vm/compiler] Add --save-debugging-info flag to gen_snapshot.
The flag can be used when creating AOT snapshots. The resulting file can be
used with package:vm/dwarf/convert.dart to convert DWARF-based stack traces
to stack traces with function, file, and line number information.

Currently the saved file will be an ELF file with DWARF debugging information,
but this is subject to change in the future. To avoid being affected by any
changes in format, read the DWARF information from the file using
Dwarf.fromFile() in package:vm/dwarf/dwarf.dart.

Also adds --dwarf-stack-traces to the VM global flag list, so its value at
compilation will be read out of snapshots by the precompiled runtime.

Fixes https://github.com/dart-lang/sdk/issues/39512, which was due to
a missing compiler::target:: prefix for Instructions::HeaderSize() in
BlobImageWriter::WriteText().

Exposes the information suggested in
https://github.com/dart-lang/sdk/issues/39490 so that package:vm/dwarf
can appropriately convert absolute PC addresses to the correct virtual
address for a given DWARF line number program.

Bug: https://github.com/dart-lang/sdk/issues/35851
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-precomp-mac-release-simarm_x64-try,vm-kernel-precomp-win-release-x64-try
Change-Id: I80d900fd9e5f1e2399ad3f2fd25c85131a7ea43c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121857
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-12 14:18:59 +00:00
Alexander Markov 9307b18f1b [vm/test] Fix vm/dart/product_aot_kernel_test for bytecode
Change-Id: Ic074472d2cfbb413283858b1815c56e6abe3a0a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127987
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-12-11 17:25:27 +00:00
Martin Kustermann 922a74c96a Revert "[vm/compiler] Fix TypeTestingStub -> SubtypeTestCache fallback code if dst_type = TypeParameter"
This reverts commit 20ec71d447.

Reason for revert: Performance regressions and seemingly broken TypedData.* benchmarks.

Original change's description:
> [vm/compiler] Fix TypeTestingStub -> SubtypeTestCache fallback code if dst_type = TypeParameter
> 
> If the dst_type of an AssertAssignable is a type parameter, the AssertAssignable
> implementation will load the value of the type parameter using
> the (instantiator or function) type arguments. It will then call the
> type testing stub (TTS) of that type.
> 
> If the TTS is not exhaustive (e.g. because `T = X<..>` wher `X` is
> implemented), it can fall back to the slower SubTypeTestCache implementation.
> 
> Right now the STC fallback will get the loaded value of the type
> parameter for `dst_type` instead of the type parameter. Doing so is
> incorrect.
> 
>   => This CL ensures we preserve dst_type = TypeParameter for the STC
>   fallback.
> 
> Issue https://github.com/dart-lang/sdk/issues/39716
> 
> Change-Id: Idea2405efbdc01c031ee68dbb345820e721533eb
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127640
> Commit-Queue: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Régis Crelier <regis@google.com>

TBR=vegorov@google.com,kustermann@google.com,regis@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I79f2d7db8747743a778126088e375bb4d268c91a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128020
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-12-10 23:56:06 +00:00
Alexander Markov d03a7686d2 [vm/compiler] Fix inlining of SIMD shuffle operations
When trying to inline SIMD shuffle operation in InlineSimdOp
(inliner.cc), FunctionEntry instruction was created and inherited
deopt_id and environment from call. Inheriting environment also
added FunctionEntry into env_use_list of other instructions.
If inlining didn't actualy happen due to invalid mask argument,
created FunctionEntry still left in the env_use_list.
Later optimization passes (for example AllocationSinking) may crash
while trying to update environment uses of instructions.

Fixes https://github.com/dart-lang/sdk/issues/39520

Change-Id: I6bdb7c6f7a7947259ea5ad097d05eebe5d73269b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127802
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-12-10 16:40:35 +00:00
Victor Lima 98c13ba18f [vm/precomp] Reduce arm-32 code size in BoxInt64Instr
Change-Id: Id544f20493c0baffb154ee1ea235247ddd844a60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127146
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-10 15:28:45 +00:00
Samir Jindel a846098c18 [vm] Enable ELF loader to read snapshots from memory without any backing file.
Also build Dart_LoadELF_Fd on Linux as well to get minimal coverage for Fuchsia.

Change-Id: I4be3eeae3e4559e95413fd60a26b9e6d2edabb32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127644
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-10 12:26:05 +00:00
Martin Kustermann 20ec71d447 [vm/compiler] Fix TypeTestingStub -> SubtypeTestCache fallback code if dst_type = TypeParameter
If the dst_type of an AssertAssignable is a type parameter, the AssertAssignable
implementation will load the value of the type parameter using
the (instantiator or function) type arguments. It will then call the
type testing stub (TTS) of that type.

If the TTS is not exhaustive (e.g. because `T = X<..>` wher `X` is
implemented), it can fall back to the slower SubTypeTestCache implementation.

Right now the STC fallback will get the loaded value of the type
parameter for `dst_type` instead of the type parameter. Doing so is
incorrect.

  => This CL ensures we preserve dst_type = TypeParameter for the STC
  fallback.

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

Change-Id: Idea2405efbdc01c031ee68dbb345820e721533eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127640
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2019-12-09 21:02:12 +00:00
Alexander Aprelev 929877c822 [gardening] Fix gen_kernel path on Windows for product_aot_kernel_test.dart.
This is follow-up to https://dart-review.googlesource.com/c/sdk/+/127004.

Change-Id: I2ccdfee835beb5182a73ca065dae1791e526295f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127380
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2019-12-05 18:40:49 +00:00
Martin Kustermann 1bbbc9f599 [vm/aot] Check in test to ensure in PRODUCT mode we don't retain any code in dart:vmservice_io/dart:_vmservice
The CL also updates a number of pragma annotations to be conditional on
non-product mode.

Change-Id: Ia00b5089d54bbb8f6f6006ef67d65859ab56c132
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127004
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-12-04 15:30:58 +00:00
Clement Skau f9327d3bac [SDK] Adds --lazy-async-stack support for async*.
Bug: https://github.com/dart-lang/sdk/issues/39525
Change-Id: I53cd334243649901ea8e0f9799d9f41c126e3627
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126729
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-04 12:47:48 +00:00
Clement Skau 27bdabe02e [SDK] Stop injecting <async gap> when async hasn't yielded yet.
Bug: https://github.com/dart-lang/sdk/issues/37668
Change-Id: I1637b7228f0a169a97db411afddfe089317a20e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126722
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2019-11-29 11:50:56 +00:00
Samir Jindel 4d95ec1360 [vm] Enable multiple entry-points for unoptimized calls.
This also makes the entrypoints tests less sensitive to the order in which
functions are optimized and removes flaky checks.

Fixes https://github.com/dart-lang/sdk/issues/37144.
Fixes https://github.com/dart-lang/sdk/issues/39447.

Change-Id: I5ba23c74769ddb8415e2b635caefc798c2b70500
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109704
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-28 13:55:34 +00:00
Martin Kustermann 5aa86eb123 [vm/concurrency] Run all isolate related tests with/without enabling isolate groups
Issue https://github.com/dart-lang/sdk/issues/36097

Change-Id: I0b7eca744bc49ab5ba09da3ce2a9286b1ed3c70f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126340
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2019-11-27 17:23:31 +00:00
Clement Skau d5dbf10672 [SDK] Adds non-eager async stack frame collector.
This is done by collecting all frames on the current stack until an async/async* frame is hit
which has yielded before (i.e. is not in sync-async case).
From there on it finds the closure of the async/async* frame and starts traversing the listeners:
  while (closure != null) {
    yield_index = closure.context[Context::kAsyncJumpVarIndex]
    pc = closure.function.code.pc_descriptors.LookupPcFromYieldIndex(yield_index);
    <emit pc in frame>
    closure = closure.context[Context::kAsyncCompleterVarIndex]._future._resultOrListeners.callback;
  }

Bug: https://github.com/dart-lang/sdk/issues/37668
Change-Id: I97030d22e529bf8a74ecd30a8a2589cfe57ad330
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122644
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-26 11:51:27 +00:00
Martin Kustermann c5b87f2a01 [vm] Disable entire test (apparently status files can no longer disable individual multitests)
Change-Id: I9f7be990c28a76e124b8a54b7bcc0df76d64b9fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125406
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-11-15 16:58:48 +00:00
Martin Kustermann 5f18b77d39 [vm/reload] Disable vm/dart/isolates/spawn_function_test/0 until full IG reloading is implemented
The test explicitly passes --enable-isolate-groups (off by-default in JIT).
It will be enabled once full hot-reload with multiple isolates in one IG is implemented.

Change-Id: I8c71a948406f6911c450161a3b5b0b0c0519b0d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125403
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-11-15 15:54:55 +00:00
Samir Jindel 6c5033acac Re-land "[vm/async] Don't add an <asynchronous gap> marker along sync-async calls."
Original change is in patchset 1.

The issue was that the expected "_Closure.call" frame is not always present.

Change-Id: I91116861e785a72536dde300f4771de4f6fa9d3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124988
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-14 15:29:16 +00:00