Commit Graph

29 Commits

Author SHA1 Message Date
Samir Jindel 4c6a2ab47c Re-land "[vm] Aggressive write-barrier elimination."
Three bugs were fixed:

1. BitVector::Equals was not fully fixed by the original CL.
2. We need to add old objects to the deferred marking queue during
   RememberLiveTemporaries().
3. The thread being scanned in RestoreWriteBarrierInvariant may not
   be scheduled, so we cannot use its store buffer block.

In addition, this changed uncovered another bug fixed in:
https://dart-review.googlesource.com/c/sdk/+/138960.

Original CL is in patchset 3.

This reverts commit 30a12a349e.

Change-Id: I36169b09563998ed5b3c3eac70ee0ebe78853e62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138920
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2020-03-11 13:05:59 +00:00
Martin Kustermann 30a12a349e Revert "Re-land "[vm] Aggressive write-barrier elimination.""
This reverts commit eff1a9ff97.

Reason for revert:
  Causes flaky hits of RELEASE_ASSERT in marker.cc, see b/151131634.

Original change's description:
> Re-land "[vm] Aggressive write-barrier elimination."
> 
> The original revision is in Patchset 3.
> 
> Four bugs were fixed:
> 
> 1. JoinEntryInstr::SuccessorCount() is not the correct way to get the
>    number of successor blocks from the Join block;
>    JoinEntryInstr::last_instruction()->SuccessorCount() must be used
>    instead.
> 
> 2. BitVector::Equals() was non-deterministically returning 'false'
>    for equal vectors.
> 
> 3. All blocks need to be processed at least once during the Analysis
>    phase (not only in the SaveResults phase).
> 
> 4. We were not removing write barriers from StoreIndexed instructions,
>    even though we had support for it.
> 
> This reverts commit 7fd8ad5a2d.
> 
> Fixes https://github.com/dart-lang/sdk/issues/40780
> 
> Change-Id: I9650ec2c547ec49cf88ca0524e14f6c245621f6a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138086
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

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

Change-Id: If9afd84465175fad2431405a97e9293c8bd5e476
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138808
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-03-10 10:15:30 +00:00
Samir Jindel eff1a9ff97 Re-land "[vm] Aggressive write-barrier elimination."
The original revision is in Patchset 3.

Four bugs were fixed:

1. JoinEntryInstr::SuccessorCount() is not the correct way to get the
   number of successor blocks from the Join block;
   JoinEntryInstr::last_instruction()->SuccessorCount() must be used
   instead.

2. BitVector::Equals() was non-deterministically returning 'false'
   for equal vectors.

3. All blocks need to be processed at least once during the Analysis
   phase (not only in the SaveResults phase).

4. We were not removing write barriers from StoreIndexed instructions,
   even though we had support for it.

This reverts commit 7fd8ad5a2d.

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

Change-Id: I9650ec2c547ec49cf88ca0524e14f6c245621f6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138086
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-03-09 14:37:27 +00:00
Ryan Macnak 7fd8ad5a2d Revert "[vm] Re-land aggressive write-barrier elimination."
This reverts commit c7d7552697.

Reason for revert: https://github.com/dart-lang/sdk/issues/40780

Original change's description:
> [vm] Re-land aggressive write-barrier elimination.
> 
> It incorrectly assumed that all stores in Dart code write to Instances.
> There is actually one exception, Contexts, which do not inherit from Instance.
> 
> I've added asserts to ensure this kind of bug cannot resurface.
> 
> The original change is in patchset 4.
> 
> Change-Id: Ic2d8d05e70a4de738eb9fb5980487b4f27111b8c
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136221
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

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

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

Change-Id: I1891677b21560c7fc5a54a8eb800ef5850654402
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137290
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-02-26 02:18:25 +00:00
Samir Jindel c7d7552697 [vm] Re-land aggressive write-barrier elimination.
It incorrectly assumed that all stores in Dart code write to Instances.
There is actually one exception, Contexts, which do not inherit from Instance.

I've added asserts to ensure this kind of bug cannot resurface.

The original change is in patchset 4.

Change-Id: Ic2d8d05e70a4de738eb9fb5980487b4f27111b8c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136221
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-02-24 18:26:46 +00:00
Ben Konyi edc8bd7ec6 Revert "Re-land "[vm] Aggressive write-barrier elimination.""
Reason: Causing numerous DartFuzz crashes

This reverts commit 595038d19f.

Change-Id: I94e79cf1a3ddf9210a2929128cfc825bf47c92ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136260
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-02-18 17:12:21 +00:00
Samir Jindel 595038d19f Re-land "[vm] Aggressive write-barrier elimination."
DoubleToIntegerInstr was incorrectly marked with CanCallDart() = false.
Original CL is in patchset 3.
Fixes https://github.com/dart-lang/sdk/issues/40593

This reverts commit e7403c149a.

Change-Id: Ibb33fcf6480c820a10c968a2e22339afc5286035
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135310
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2020-02-17 14:47:15 +00:00
Siva Annamalai e7403c149a Revert "[vm] Aggressive write-barrier elimination."
This reverts commit e5a22713b1.

Reason for revert: We are seeing some crashes on the bot see https://ci.chromium.org/p/dart/builders/ci.sandbox/vm-kernel-linux-debug-x64/8684

Original change's description:
> [vm] Aggressive write-barrier elimination.
> 
> Flutter Gallery code size total:
> -0.88% on ARM64
> -0.98% on ARM
> 
> Fixes https://github.com/dart-lang/sdk/issues/39164.
> 
> Change-Id: I8e65b1209ef1150bb73f3474506ebc97d7ab3685
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132003
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Samir Jindel <sjindel@google.com>

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

Change-Id: Ia93b43a423ee982aea550eb9fc24d34509db3dce
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135421
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-02-12 00:53:05 +00:00
Samir Jindel e5a22713b1 [vm] Aggressive write-barrier elimination.
Flutter Gallery code size total:
-0.88% on ARM64
-0.98% on ARM

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

Change-Id: I8e65b1209ef1150bb73f3474506ebc97d7ab3685
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132003
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2020-02-11 22:48:25 +00:00
Zachary Anderson a1bcf051d8 clang-format runtime/vm
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2481873005 .
2016-11-08 13:54:47 -08:00
Zachary Anderson 103881d01c Make header include guards great again
i.e. #ifndef VM_WHATEVER -> #ifndef RUNTIME_VM_WHATEVER

This lets us remove a hack from the PRESUBMIT.py script that existed
for reasons that are no longer valid, and sets us up to add some
presubmit checks for the GN build.

R=asiva@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/2450713004 .
2016-10-26 00:26:03 -07:00
Todd Turnidge 1166f83bf6 Only reload libraries when they may have been modified.
We now check all of the scripts which make up a library.  If any
script is modified, then we consider that library to be modified.  We
also consider any library which imports a modified library to be
modified.  To propagate this info efficiently, we build and discard
the imported-by graph when beginning a reload.

The embedder must provide a FileModifiedCallback in order to support
the detection of modified scripts.

In order to detect changes to package: libraries, we have modified the
embedder interface to provide the resolved url when possible, so that
we don't need to re-resolve package uris when checking for reload.
This change is incompatible and all embedders will need to be updated.

We now support a "force" flag when reloading sources.  This causes all
libraries to be reloaded regardless of whether the underlying scripts
have been updated.

Closes #26919

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2186423002 .
2016-07-29 11:23:18 -07:00
koda@google.com 99127744c6 Add Zone-based handle allocation interface and reduce use of Isolate-based interfaces.
Remove deprecated Isolate-based BitVector constructor.

R=asiva@google.com

Review URL: https://codereview.chromium.org//868913002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43136 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-26 14:54:02 +00:00
koda@google.com 280dc6fbd4 Introduce simple Thread class to support gradual refactoring of interfaces.
This first iteration of Thread just forwards a subset of the BaseIsolate methods.

The plan is to first add Thread/Zone-based interfaces where appropriate, deprecate their Isolate-based versions, and finally remove them once all callsites have been migrated.

This CL only demonstrates a small part of this migration, for BitVector and some of the compiler classes. There are thousands of additional call-sites that will need to be updated.

R=asiva@google.com

Review URL: https://codereview.chromium.org//850183005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43073 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-22 14:14:16 +00:00
srdjan@google.com b8891bf412 Pass isolate to BitVector constructor.
R=hausner@google.com

Review URL: https://codereview.chromium.org//587873003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40528 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-19 23:14:34 +00:00
johnmccutchan@google.com 8f0056371d Initial UserTag and dart:profiler library
R=asiva@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org//230863005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34949 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-10 22:32:45 +00:00
srdjan@google.com d78737298c Last cleanup int -> intptr_t. Also removed a hack (boolean is not an integer).
R=asiva@google.com

Review URL: https://codereview.chromium.org//26345002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28372 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-08 18:54:00 +00:00
fschneider@google.com 9a6657cd4d Eliminate temporary locals for some expressions
This CL affects a subset of expressions that use temporary locals: constructor
calls, array literals and and instance getter postfix-ops.

For expressions that are de-sugared in the parser I added LetNode.
It creates a scoped temporary local bound to an initializing expression.

For expressions where we need a temporary local at graph-building time,
I added a helper class TempLocalScope to easily create a single temporary
local in the graph builder since this is a frequently recurring pattern.

This simplifies code in the parser and the graph builder and also fixes a
bug with indexed-super invocation and NoSuchMethod.

BUG=dart:8918
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//14942010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23401 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-30 12:19:21 +00:00
vegorov@google.com 81ecaba321 Re-apply r20377.
Compute local variable liveness before translation to SSA.

Use it to remove dead values from deoptimization environments.

R=fschneider@google.com
BUG=

Review URL: https://codereview.chromium.org//14215006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21439 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-15 11:53:50 +00:00
vegorov@google.com 535ed8eb25 Revert "Compute local variable liveness before translation to SSA."
Attaching environments to branches on strict comparisons breaks pattern matching in the optimizer and regresses performance.

This reverts commit r20377.

TBR=kmillikin@google.com

Review URL: https://codereview.chromium.org//12827027

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20400 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-22 18:32:17 +00:00
vegorov@google.com 66ecd504f9 Compute local variable liveness before translation to SSA.
Use it to remove dead values from deoptimization environments.

R=kmillikin@google.com
BUG=

Review URL: https://codereview.chromium.org//12638040

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20377 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-22 12:33:42 +00:00
vegorov@google.com 1ee5f51793 Improve redundant load elimination.
Previously it incorrectly computed OUT sets during the fix point iteration: did not propagate changed from IN to OUT.

However just computing bitset representation of IN set was actually not enough because different values might be coming in from different predecessors.

This algorithm inserts phis at merge points.

R=fschneider@google.com
BUG=

Review URL: https://codereview.chromium.org//11505002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16109 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-13 14:10:38 +00:00
fschneider@google.com 7b70f56dfd Simple redundant load elimination.
This analysis uses bit vectors to track side effects. Currently, there is
only one type of side effect which affects all mutable load-field instructions.
The elimination pass is a dominator tree preorder traversal like the existing
CSE pass. Instead of a hash-map it keeps an array with the current dominating
occurrence for each load expression.
Review URL: https://codereview.chromium.org//10914314

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12437 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-17 14:27:45 +00:00
turnidge@google.com 2803d78dfd Change the zone allocation api.
Instead of passing a size in bytes to the allocation function, we now
have a templatized Alloc function:

  zone->Alloc<Type>(len)

This is better for security, as we can check for integer overflow in
the size computation before performing the allocation.  Before, we
often failed to check this.
Review URL: https://chromiumcodereview.appspot.com//10836061

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10254 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-03 21:51:44 +00:00
fschneider@google.com ac0dd6c295 Add a backward instruction iterator and use it in the liveness analysis.
This avoids the complication when collecting the initial live_in sets while iterating forward.

Also simplify the ForwardInstructionIterator class because we have Goto instructions now and
the last instruction of each block does not use the next-link to
indicate a fall-through anymore.
Review URL: https://chromiumcodereview.appspot.com//10796108

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9875 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-25 08:31:50 +00:00
vegorov@google.com 30288c500e Fix a bug in liveness analysis code and add more comments.
R=fschneider@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10657044

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9106 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-26 12:14:02 +00:00
vegorov@google.com 2f23dc4b60 Simple iterative liveness analysis over SSA.
R=fschneider@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10666026

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9069 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-25 17:07:16 +00:00
fschneider@google.com ee4a0fd042 First step to SSA construction: Phi insertion.
This CL contains the phi insertion step of the SSA construction algorithmus: The phi instructions inserted are not functional yet. Renaming is not included yet.


I based it on Kevin's CL (http://codereview.chromium.org/10388161/), rebased and fixed a bug (added missing iterator.Advance()) there.

It also reintroduces the Definition IL class because Phi-instructions are also
definitions that are referenced by UseVal.

I also added the set of immediately dominated blocks to each basic block.
This will be needed for pre-order dominator-tree traversal in the renaming pass.
Review URL: https://chromiumcodereview.appspot.com//10539108

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8604 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-13 13:36:04 +00:00
kmillikin@google.com e4030da968 Compute assigned variables and dominance frontiers.
During basic block discovery, compute assigned variables in each
block.  After computing immediate dominators, compute dominance
frontiers.  Both of these will be used for SSA construction.

R=fschneider@google.com,srdjan@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10377104

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7685 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-16 13:28:02 +00:00