Commit Graph

10361 Commits

Author SHA1 Message Date
Ryan Macnak 169331abb1 [vm] Misc timeline tweaks.
- Move compiler pass events to a new CompilerVerbose stream
 - Remove serialization phase events
 - Add class name to class finalization event (lost along with finalization events in recent cleanups of finalization)
 - Add event for kernel loading

Change-Id: Ie72bced978400ea174c1551c961baa55c691b019
Reviewed-on: https://dart-review.googlesource.com/c/90883
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-01-25 18:37:05 +00:00
Ryan Macnak 9043e5be44 [vm, gc] Remove --gc_at_alloc.
Change-Id: Ied987c5fb0389432474a6ef8ee62ed7089c9e672
Reviewed-on: https://dart-review.googlesource.com/c/91142
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-25 18:03:30 +00:00
Vyacheslav Egorov 27760001f5 [vm] Fix build after f496e538f4
* Introduce forward declaration for RawObject;
* Move compiler::target::ClassTable::ClassOffsetFor under ifdef PRODUCT

Change-Id: Iacf5cbdaec0c2999aae7c8e0683a58e392f3e960
Reviewed-on: https://dart-review.googlesource.com/c/91220
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-01-25 18:01:50 +00:00
Vyacheslav Egorov f496e538f4 [vm] Decouple assemblers from runtime.
This is the next step towards preventing compiler from directly peeking
into runtime and instead interact with runtime through a well defined
surface. The goal of the refactoring to locate all places where compiler
accesses some runtime information and partion those accesses into two
categories:

- creating objects in the host runtime (e.g. allocating strings, numbers, etc)
during compilation;
- accessing properties of the target runtime (e.g. offsets of fields) to
embed those into the generated code;

This change introduces dart::compiler and dart::compiler::target namespaces.

All code in the compiler will gradually be moved into dart::compiler namespace.
One of the motivations for this change is to be able to prevent access to
globally defined host constants like kWordSize by shadowing them in the
dart::compiler namespace.

The nested namespace dart::compiler::target hosts all information about
target runtime that compiler could access, e.g. compiler::target::kWordSize
defines word size of the target which will eventually be made different
from the host kWordSize (defined by dart::kWordSize).

The API for compiler to runtime interaction is placed into compiler_api.h.

Note that we still permit runtime to access compiler internals directly -
this is not going to be decoupled as part of this work.

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

Change-Id: If4396d295879391becfa6c38d4802bbff81f5b20
Reviewed-on: https://dart-review.googlesource.com/c/90242
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-01-25 16:45:13 +00:00
Martin Kustermann dfeee239c4 [VM] Fix use-after-free: move free after use
Change-Id: Idcedbd8bdbd94f126846c5390c6cb8d00a21de57
Reviewed-on: https://dart-review.googlesource.com/c/91180
Auto-Submit: Martin Kustermann <kustermann@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-01-25 13:14:19 +00:00
Martin Kustermann 51bc367806 [VM/AOT] Ensure we set flags from snapshot very early in the VM initialization
There are uses of flags before the VM snapshot gets read, so we need to
move the "snapshot sniffing" code to the very beginning of Dart::Init().

Due to the fact that FullSnapshotReader/Deserializer assume there is a
[Thread] available - and we don't have a [Thread] yet when we should
process the flags - this CL moves version/feature logic into a new
[SnapshotHeaderReader] class which does not depend on Thread/...

Change-Id: I38a45041f0696b96e44fc2b294e3442a5fba1a81
Reviewed-on: https://dart-review.googlesource.com/c/90941
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-01-25 10:31:48 +00:00
Martin Kustermann 8c439c7e84 [VM/AOT] Turn bare instructions on by default
Issue https://github.com/dart-lang/sdk/issues/33274

Change-Id: I44850d5906143a53d6b1872eb729364c3a509f9a
Reviewed-on: https://dart-review.googlesource.com/c/91060
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-01-25 10:25:18 +00:00
Matthew Dempsky adf48e4d4b [vm] Fix header includes
In https://dart-review.googlesource.com/c/sdk/+/91104, I meant to
delete #include <endian.h>, and accidentally removed #include
<errno.h> instead.

Change-Id: I52e55350d2817c3e6543a8bf806492f1b1dcf3db
Reviewed-on: https://dart-review.googlesource.com/c/91109
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2019-01-25 02:03:51 +00:00
Matthew Dempsky b11f2d8e69 [vm] Implement VirtualMemory::Allocate using AllocateAligned
Instead of implementing separate aligned and unaligned memory
allocation primitives for each OS, just change the unaligned allocator
into a wrapper around the aligned primitive.

While here, we can optimize the AllocateAligned logic slightly: if we
want an N-page-aligned allocation, we only need to increase the
allocation size by N-1 pages instead of N.

Notably, this means 1-page-aligned allocations don't require any extra
alignment pages, so the new logic behaves identically as before on
Android, Fuchsia, Linux, and macOS.

On Windows, it behaves slightly differently only in that unaligned
requests used to be handled as a single VirtualAlloc call with
MEM_RESERVE | MEM_COMMIT, but now they're handled as two separate
calls (reserve *then* commit). Naively, I don't expect this matters in
practice, but if it does, we can always add a fast path for
alignment==page_size_ without affecting the OS-independent API.

Change-Id: I42b2cf5dfc6e137546d8acfb6cc8939a01687948
Reviewed-on: https://dart-review.googlesource.com/c/91081
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-01-25 01:22:20 +00:00
Ryan Macnak 41dc546c6b [vm] Check compiler flags for Dart_Save/LoadTypeFeedback.
Change-Id: Ic733591ce1cac7d69fde28a115f11d43902923bc
Reviewed-on: https://dart-review.googlesource.com/c/90640
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-25 00:53:55 +00:00
asiva fb2d829a0e [VM / Compiler] Change some OS::PrintErr to THR_Print
We still see some trace messages related to the compiler coming from the
service isolate when debugging compilations. Chnaged some of the

OS::PrintErr calls in the trace code under the compiler to THR_Print
so traces from the service isolate can be filtered out.
Change-Id: Ib370cb3bf4a1ce175b4ade9fafa187fecfa91cef
Reviewed-on: https://dart-review.googlesource.com/c/91140
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
2019-01-24 23:52:02 +00:00
Matthew Dempsky ec6b212421 [vm] Remove unused endian-conversion code
These seem to have accidentally snuck in as part of
https://codereview.chromium.org/14299008

Change-Id: I861eba1655d6f175ddfabf2a39908168b890d911
Reviewed-on: https://dart-review.googlesource.com/c/91104
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2019-01-24 23:32:33 +00:00
Matthew Dempsky 0193dd58fa [vm] Deduplicate POSIX-based memory allocation code
The Android, Linux, and macOS VirtualMemory implementations were
identical and using the same POSIX-standardized interfaces, so
deduplicate them into a common virtual_memory_posix.cc implementation.

Change-Id: I58a2aaa959aac69af52d9faba88865a4ef20d004
Reviewed-on: https://dart-review.googlesource.com/c/91080
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
2019-01-24 22:39:50 +00:00
Matthew Dempsky 8e2f3ea4d6 [fuchsia] Always allocate executable memory in W^X mode
In W^X mode (i.e., FLAG_write_protect_code), the Dart VM allocates
code memory with is_executable==false and then later makes it
executable with Protect(kReadExecute). However, on Fuchsia, this will
require a VMO with ZX_RIGHT_EXECUTE (which soon will not be the
default).

This CL takes the approach of always adding ZX_RIGHT_EXECUTE when in
W^X mode. This is suboptimal because it means all VM allocated memory
can be changed to executable, but currently the OS-independent
VirtualMemory::Allocate API doesn't provide us a way to identify
memory that doesn't need to be executable now but will in the future.
(Note that ZX_RIGHT_EXECUTE only *allows* mapping the memory as
executable; the memory is still initially mapped by
VirtualMemory::Allocate as non-executable.)

Extending the VirtualMemory::Allocate API is tracked in FL-172.

Bug: SEC-42
Change-Id: I20555c546c5ab1798c4c36b7394f6221d3993c9e
Reviewed-on: https://dart-review.googlesource.com/c/90882
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2019-01-24 16:59:08 +00:00
Ryan Macnak b6b4836d1d [vm] Reference type test stubs through Code; use the type as the owner of a type test stub.
Directly referencing VM isolate instructions from an isolate snapshot causes the instructions to be copied into the isolate's image page because instructions do not use the indirection of the ref array. Duplicating the instructions caused TypeTestingStubFinder::LookupByAddresss to be unable to identity the duplicate copies of the VM isolate type testing stubs.

Fixes identity of StubCode::*TypeTest broken by duplication in snapshot.
Fixes generating AppJIT snapshots after loading from AppJIT snapshots.
Fixes attribution of ticks for type test stubs in the AOT profiler.

Change-Id: I9879a85bd548e694ee36e14f795898582ccdddb0
Reviewed-on: https://dart-review.googlesource.com/c/90501
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2019-01-23 22:59:47 +00:00
Régis Crelier 27316cc97b Revert "[vm] Prevent access to non-annotated members through native API."
This reverts commit 0203243381.

Reason for revert: breaking several bots

Original change's description:
> [vm] Prevent access to non-annotated members through native API.
> 
> We will issue warnings and throw an API error when the native API is used to access members which were not appropriately
> annotated as entry-points, if the flag "--verify-entry-points" is passed.
> 
> Also, fixes Class::Invoke against fields (isn't allowed through native API but
> could be allowed with mirrors, and is inconsistent with Library::Invoke behavior).
> 
> I've checked locally that this would have caught the bug in
> "Wrap the user entrypoint function in a zone with native exception callback. (#7512)".
> 
> Change-Id: I617c71e1965457c956c97761359765bb9bb18c1c
> 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/90060
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

TBR=alexmarkov@google.com,sjindel@google.com

Change-Id: I554b389780e4ba652183c044b040b0c524beb5c2
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, vm-kernel-precomp-mac-release-simarm64-try, vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/90841
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-01-23 20:37:22 +00:00
Samir Jindel 0203243381 [vm] Prevent access to non-annotated members through native API.
We will issue warnings and throw an API error when the native API is used to access members which were not appropriately
annotated as entry-points, if the flag "--verify-entry-points" is passed.

Also, fixes Class::Invoke against fields (isn't allowed through native API but
could be allowed with mirrors, and is inconsistent with Library::Invoke behavior).

I've checked locally that this would have caught the bug in
"Wrap the user entrypoint function in a zone with native exception callback. (#7512)".

Change-Id: I617c71e1965457c956c97761359765bb9bb18c1c
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/90060
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-01-23 19:04:26 +00:00
Martin Kustermann f1f688215a [VM/AOT] Initialize global VM flags by reading them from vm-isolate snapshots
Issue https://github.com/dart-lang/sdk/issues/33274

Change-Id: I2dca1fb9a8807294fb756ea796bb7560bb6d17cc
Reviewed-on: https://dart-review.googlesource.com/c/90221
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-01-23 09:49:46 +00:00
Ryan Macnak 2e9cf40002 [vm, isolate] Fix length truncation in message snapshots, take 2.
Only run test on x64 VMs.

Bug: https://github.com/dart-lang/sdk/issues/35635
Change-Id: I3ab16a96669a9f29187954896e59a3341dce5dc4
Reviewed-on: https://dart-review.googlesource.com/c/89925
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-23 01:29:44 +00:00
Aart Bik dc182cc951 [dart/vm] Add assert in Selector() method
Rationale:
This would have made triaging the bug below a lot quicker.

https://github.com/dart-lang/sdk/issues/35703

Change-Id: I23451f1b2944f9447a1f1c1c85af073a7211fe4b
Reviewed-on: https://dart-review.googlesource.com/c/90302
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-01-22 19:03:18 +00:00
Ryan Macnak 5812a3bf74 [vm] Fix scoping in TIMELINE_DURATION.
Change-Id: I67d53f0e6d17d904b1bebc89bd4d7d45aaf95122
Reviewed-on: https://dart-review.googlesource.com/c/90342
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-22 18:38:49 +00:00
Samir Jindel 55c3106a3f [vm] Improve SelectRepresentations.
It's no longer necessary to prove that a phi will fit into 64 bits to unbox it,
because all ints in Dart 2 are 64-bit.

Also, we add a new heuristic to always unbox a phi if all inputs are unboxed.

This improves MD5 performance on ARM32 AOT by 27%, matching existing JIT performance.

Change-Id: I9ebbfc3bb8d565e746d3740528fdf7ee32c0f7a4
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/88841
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-01-22 12:42:48 +00:00
Samir Jindel 85515884c2 [vm] Fix inference of shifts' RHS in range analysis for nullable SMIs.
Change-Id: I9b84c751b7a148ec9c0196b99dd78ab8f70ee66c
Reviewed-on: https://dart-review.googlesource.com/c/90225
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Auto-Submit: Samir Jindel <sjindel@google.com>
2019-01-22 11:44:24 +00:00
Martin Kustermann cc9607b04c [VM/AOT] Make trampolines look like free list elements to enable heap walking
Issue https://github.com/dart-lang/sdk/issues/33274

Change-Id: Ib6afdbc80012326134d409c4065a680d67de3ed8
Reviewed-on: https://dart-review.googlesource.com/c/90064
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-01-19 13:37:09 +00:00
Régis Crelier 38a7f0097f [vm/finalizer] Stop background compiler before sorting classes.
Prevent background compiler from adding deferred classes or canonicalizing
new types while classes are being sorted and type hashes are modified.
This should fix issue #34627 and its duplicate #35690.


Change-Id: I3e52602e77ad6b80b58f5292721c01eea22abfb0
Reviewed-on: https://dart-review.googlesource.com/c/90300
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-01-18 23:08:21 +00:00
Devon Carew b0b055541b Make Script.tokenPosTable optional.
Change-Id: I681f6c3c762e16a2eff8a9aac1d680856aa94935
Reviewed-on: https://dart-review.googlesource.com/c/90321
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2019-01-18 22:46:23 +00:00
Zichang Guo 970390a36e Add field evaluation to source report generation
Change-Id: I62808852a35ef53c05ac1ea715d4559db46bb3d5
Reviewed-on: https://dart-review.googlesource.com/c/89173
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-01-18 19:15:44 +00:00
Ben Konyi 2e5453ddb4 [ VM ] Updated licenses to match other licenses in project
Change-Id: I0848e49c63de5a6a6385fa926e7d5550d9a41c1d
Reviewed-on: https://dart-review.googlesource.com/c/90301
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-01-18 18:23:26 +00:00
Martin Kustermann be47aad327 [VM/Compiler/AOT] Bare instructions 9: Improve write barrier on ARM/ARM64/X64
ARM write barrier goes from

   ldrne lr, [thr, #+508]
   blxne lr
to
   blne <offset>

ARM64 write barrier goes from (similarly X64)

   beq +8
   ldrx lr, [thr, #1056]
   blr lr
to
   beq +4
   bl <offset>

It reduces RX on arm/arm64 by around 0.9%

Though the write barrier wrappers stub has multiple entrypoints (one for
each available register).  Because of this, we modify the relocation
logic to support per-call offsets into the target.

To avoid making the assembler code depend on StubCode/FlowGraphCompiler,
we set a closure, which the assembler can call.

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

Change-Id: I9e3d68260cab7ef19ea88f1235c78d6031819d6d
Reviewed-on: https://dart-review.googlesource.com/c/90063
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-01-18 16:13:17 +00:00
Kevin Millikin c9a55b437a [Kernel] Remove the dedicated fromEnvironment constants
These can be represented as an unevaluated static invocation.

Change-Id: Ib827345f1f65a09f1a856eae33366722a2e613d2
Reviewed-on: https://dart-review.googlesource.com/c/90008
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-01-18 10:10:42 +00:00
Alexander Markov e64428a839 Revert "[vm] Cleanup Dart_Get/Set/HasStickyError API and use isolate's sticky error only as a backup for thread's sticky error"
This reverts commit b10f179608.

Reason for revert: failed service/* tests

Original change's description:
> [vm] Cleanup Dart_Get/Set/HasStickyError API and use isolate's sticky error only as a backup for thread's sticky error
> 
> Both thread and isolate have sticky error fields. Dart API was using
> isolate's sticky error, while Dart code was using thread's sticky error.
> There was a one-way move of a thread's sticky error into isolate
> when thread was unscheduled.
> 
> This causes a problem as error in the isolate may go unnoticed and
> repeated unscheduling/re-scheduling might end up overwriting the error
> in the isolate (which triggers the assertion).
> 
> To solve this problem, this CL:
> * Cleans up Dart API which manipulates isolate's sticky error, so
>   isolate's sticky error is never set directly.
> * When sceduling an isolate to a thread, sticky error is moved back from
>   isolate (if any).
> 
> With this changes, thread's sticky error is always used if thread is running,
> and isolate's sticky error is only used to hold sticky error while
> isolate has no thread.
> 
> Fixes https://github.com/dart-lang/sdk/issues/35590
> 
> Change-Id: I99b128cac363ca2df75f6e64c083b1ec36c866ce
> Reviewed-on: https://dart-review.googlesource.com/c/89442
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

TBR=rmacnak@google.com,alexmarkov@google.com,zra@google.com,asiva@google.com

Change-Id: I15874575b6b8ddca618741c59c21d4e692c4dcab
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/90127
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-01-18 01:41:18 +00:00
Alexander Aprelev 324718fadd [vm] Revert "Restore TLABs."
This reverts commit 7e1aa67855 as this
regresses flutter stock_layout_iterations by about ~9% on Moto G4.

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

Change-Id: I3c76ee868c64e4b1ed947bd2d295aa8a07d9d1d0
Reviewed-on: https://dart-review.googlesource.com/c/90140
Commit-Queue: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Auto-Submit: Alexander Aprelev <aam@google.com>
2019-01-18 00:29:17 +00:00
Aart Bik 6b5e8603d5 Reland "[vm/compiler] AOT inline heuristics improvements"
This reverts commit 43a96d49af.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Revert "[vm/compiler] AOT inline heuristics improvements"
> 
> This reverts commit 2908e61f2a.
> 
> Reason for revert: regress_32322_test crashes
> 
> Original change's description:
> > [vm/compiler] AOT inline heuristics improvements
> > 
> > Rationale:
> > Yields substantial improvements on various benchmarks
> > (1.8x on HMAC stand-alone, around 5x on TypedData settters and getters),
> > with only moderate increase in code size (3.2% on Flutter gallery).
> > 
> > https://github.com/dart-lang/sdk/issues/34473
> > https://github.com/dart-lang/sdk/issues/32167
> > 
> > Change-Id: I0909efd7afc72229524ff8edb7322ce025a14af4
> > Reviewed-on: https://dart-review.googlesource.com/c/89162
> > Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> > Reviewed-by: Alexander Markov <alexmarkov@google.com>
> > Commit-Queue: Aart Bik <ajcbik@google.com>
> 
> TBR=vegorov@google.com,alexmarkov@google.com,ajcbik@google.com
> 
> Change-Id: I9c7dadb18935ad32f4d4cd72872838e8ac9cc288
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://dart-review.googlesource.com/c/89740
> Reviewed-by: Aart Bik <ajcbik@google.com>
> Commit-Queue: Aart Bik <ajcbik@google.com>

TBR=vegorov@google.com,alexmarkov@google.com,ajcbik@google.com

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

Change-Id: Iace9857654b63af2fbcd2808d19802fb60305973
Reviewed-on: https://dart-review.googlesource.com/c/90141
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-01-18 00:20:35 +00:00
Ryan Macnak 06a1e6e9e3 [vm] Enable timeline on Fuchsia even in product mode.
On Fuchsia, the timeline is accessed without involving the service isolate or vm-service.

Change-Id: Ia0d4e1ca252604e8fcef466a31e3d2a8b0912251
Reviewed-on: https://dart-review.googlesource.com/c/90100
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-18 00:06:10 +00:00
Alexander Markov b10f179608 [vm] Cleanup Dart_Get/Set/HasStickyError API and use isolate's sticky error only as a backup for thread's sticky error
Both thread and isolate have sticky error fields. Dart API was using
isolate's sticky error, while Dart code was using thread's sticky error.
There was a one-way move of a thread's sticky error into isolate
when thread was unscheduled.

This causes a problem as error in the isolate may go unnoticed and
repeated unscheduling/re-scheduling might end up overwriting the error
in the isolate (which triggers the assertion).

To solve this problem, this CL:
* Cleans up Dart API which manipulates isolate's sticky error, so
  isolate's sticky error is never set directly.
* When sceduling an isolate to a thread, sticky error is moved back from
  isolate (if any).

With this changes, thread's sticky error is always used if thread is running,
and isolate's sticky error is only used to hold sticky error while
isolate has no thread.

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

Change-Id: I99b128cac363ca2df75f6e64c083b1ec36c866ce
Reviewed-on: https://dart-review.googlesource.com/c/89442
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-01-17 23:27:13 +00:00
Aart Bik c701e76506 [vm/compiler] handle non-nullable null situation better
Rationale:
Previously, we avoided introducing redefinitions that
introduced the empty non-nullable null type. This situation
arises when we do a null check on an actual null value
(making all subsequent uses effectively dead code). This
is too simple, however, since it still allows hoisting the
uses before the check. This CL gives a better solution
by introducing redefinitions without a constraining type
(which are not removed and avoid the type). In the long
run perhaps the best solution would be to simply remove
all subsequent uses as dead.

https://github.com/dart-lang/sdk/issues/32167
https://github.com/dart-lang/sdk/issues/34473
https://github.com/dart-lang/sdk/issues/35335

Change-Id: Ib5dd072a9e546f6b91faa52ea08e8c0f6350d7e0
Reviewed-on: https://dart-review.googlesource.com/c/89922
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
2019-01-17 22:22:32 +00:00
Ryan Macnak e7bd3edc9f [vm] Assert callback state for all Dart_Set*ReturnValue, take 2.
Fix scoping of raw typed data access in dart:io.

Change-Id: I458b36bf655e429cc57e266550ff1ab00f328f45
Reviewed-on: https://dart-review.googlesource.com/c/89943
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-17 20:37:33 +00:00
Martin Kustermann ca2db2ad53 [VM/Compiler/AOT] Bare instructions 8: Improve AOT code by using pc-relative calls
This CL improves AOT code for StackOverflowInstr/CheckNullInstr:

  * On ARM we can do a conditional pc-relative calls for the stack overflow
    checks, getting rid of the slow-paths entirely.

  * On ARM64 we can do pc-relative calls on the slow path, avoiding an
    extra load.

Flutter gallery size impact (in bare instructions mode):
  * ARM: -3.7% RX
  * ARM64: -1.4% RX

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

Change-Id: Ia1acd76ac6efa26642f99e1ce3e417100aa357f3
Reviewed-on: https://dart-review.googlesource.com/c/89620
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-01-17 17:53:52 +00:00
Martin Kustermann 16ddc23a57 [VM/Compiler/AOT] Bare instructions 7: Trampolines for out-of-range calls
This CL adds support to the ImageWriter to write opaque blocks of
trampoline bytes

The AOT code relocator is adapted to allow limited range calls and
inserts trampolines if need be. The algorithm tries to minimize the
number of trampolines added, which for small applications will be 0.

The unconditional pc-relative calls have limited range:
  * on ARM (+/-32 MB)
  * on ARM64 (+/-128 MB)

To avoid verbose code for doubly-linked list, this CL adds double_list.h

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

Change-Id: I0354cf4b2dd58ed5de25d67fc818f0603a2ec501
Reviewed-on: https://dart-review.googlesource.com/c/89283
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-01-17 12:32:38 +00:00
Jens Johansen 1c82f6757c Save problems in ast - kernel format changes
Change-Id: I978c90762ee85a6d7936d6a55e11d5d95d509b4f
Reviewed-on: https://dart-review.googlesource.com/c/89507
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-01-17 10:41:53 +00:00
Ryan Macnak 07f95e7761 Revert "[vm] Enable timeline on Fuchsia even in product mode."
This reverts commit 3f7b371f2c.

Reason for revert: Some modes failing to find new constant?

Original change's description:
> [vm] Enable timeline on Fuchsia even in product mode.
> 
> On Fuchsia, the timeline is accessed without involving the service isolate or vm-service.
> 
> Change-Id: I0d2351dcadcfc47835732235e1b8fafa8212f883
> Reviewed-on: https://dart-review.googlesource.com/c/89880
> Reviewed-by: Zach Anderson <zra@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=rmacnak@google.com,alexmarkov@google.com,zra@google.com,asiva@google.com

Change-Id: Ic03a78d14821e0361d54587f1f7510bc9ebfef1c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/89942
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-17 00:39:39 +00:00
Ryan Macnak c3599a9d8c Revert "[vm, isolate] Fix length truncation in message snapshots."
This reverts commit 4b22195ea1.

Reason for revert: 32-bit fails the wrong way

Original change's description:
> [vm, isolate] Fix length truncation in message snapshots.
> 
> Bug: https://github.com/dart-lang/sdk/issues/35635
> Change-Id: I942f2c98c300d72e4b36329ab2e2d0d51029f478
> Reviewed-on: https://dart-review.googlesource.com/c/89168
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=rmacnak@google.com,zra@google.com,asiva@google.com

Change-Id: I47018f43df33a47a08fc4d40a15727ce049393ff
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/35635
Reviewed-on: https://dart-review.googlesource.com/c/89940
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-16 23:33:37 +00:00
Ryan Macnak 95e10c336f Revert "[vm] Assert callback state for all Dart_Set*ReturnValue."
This reverts commit ca12afec50.

Reason for revert: DBC failures

Original change's description:
> [vm] Assert callback state for all Dart_Set*ReturnValue.
> 
> Change-Id: I706394086586756d362c12588d7d4c0b8b84d3cb
> Reviewed-on: https://dart-review.googlesource.com/c/89047
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=bkonyi@google.com,rmacnak@google.com

Change-Id: I33f2a5a7e2058b305f03e497c1e36bebf9456b28
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/89924
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-16 23:22:31 +00:00
Ryan Macnak 3f7b371f2c [vm] Enable timeline on Fuchsia even in product mode.
On Fuchsia, the timeline is accessed without involving the service isolate or vm-service.

Change-Id: I0d2351dcadcfc47835732235e1b8fafa8212f883
Reviewed-on: https://dart-review.googlesource.com/c/89880
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-16 22:55:51 +00:00
Ryan Macnak 4b22195ea1 [vm, isolate] Fix length truncation in message snapshots.
Bug: https://github.com/dart-lang/sdk/issues/35635
Change-Id: I942f2c98c300d72e4b36329ab2e2d0d51029f478
Reviewed-on: https://dart-review.googlesource.com/c/89168
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-01-16 22:36:41 +00:00
Ryan Macnak a353b1172a [vm, compiler] Remove TAG_IC_DATA, which has since been subsumed by RebindRule.
Change-Id: Iaef4ba625aaa789dacb34efdb3de3c8ab8c15498
Reviewed-on: https://dart-review.googlesource.com/c/89901
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-01-16 22:33:01 +00:00
Ryan Macnak ca12afec50 [vm] Assert callback state for all Dart_Set*ReturnValue.
Change-Id: I706394086586756d362c12588d7d4c0b8b84d3cb
Reviewed-on: https://dart-review.googlesource.com/c/89047
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-16 22:21:01 +00:00
Ben Konyi a10ddca1b1 [ VM / Service ] Allow for profile_period flag to be set via the service protocol
`profile_period` has been added to the list of flags which can be
changed at runtime via the `setFlag` RPC. Changing this flag at runtime will
cause the ThreadInterrupter to be shutdown, reinitialized, and started with the
new profiling period.

Fixes #35654.

Change-Id: I2f365fdf8e404270f2eed1e172c8d21b48e0aff9
Reviewed-on: https://dart-review.googlesource.com/c/89445
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Jacob Richman <jacobr@google.com>
2019-01-16 18:08:19 +00:00
Ben Konyi f701e11756 [ VM / Debugger ] Fix issue where a 'Step' command issued when there's no stack caused a crash.
For example, running this sample, pausing the isolate, and stepping
would crash, whereas we would expect to pause in the ServerSocket.listen
callback.

```
import 'dart:io';

main() {
  ServerSocket.bind('127.0.0.1', 22000).then((s) {
    s.listen((m) { // Should pause here on socket connection after step.
      print(m);
    });
  });
}
```

Fixes #35601.

Change-Id: I2155de1cface159f92734d3112b6e17c35ab7550
Reviewed-on: https://dart-review.googlesource.com/c/89780
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-01-16 17:28:02 +00:00
Zach Anderson 56f87f409e [dart:io,fuchsia] Pass Isolate namespace to child process. Fix double free.
Before this change, the child process inherits the namespace of the
process. After this change the child process inherits the namespace of
the calling isolate.

Related: DX-710

Change-Id: Idbc72e30f5796f8034cedae776d4572ad0b0360f
Reviewed-on: https://dart-review.googlesource.com/c/89460
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2019-01-15 22:07:51 +00:00