Commit Graph

51 Commits

Author SHA1 Message Date
zerny@google.com 6ed5884c44 RemoveFromGraph on definitions asserts empty use lists.
R=fschneider@google.com,kmillikin@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10822 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-16 14:08:45 +00:00
zerny@google.com 5cc78d2a33 Refactored FlowGraphBuilder into a separate FlowGraph representation.
R=kmillikin@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10807 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-16 12:06:17 +00:00
fschneider@google.com d571e18ebd Make all variants of RelationalOp work with SSA.
This is the last instruction that causes a bailout in the register
allocator. This bailout is now changed into an ASSERT.
Review URL: https://chromiumcodereview.appspot.com//10830333

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10802 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-16 08:46:45 +00:00
vegorov@google.com 181be0165b Rename is_call to always_calls and contains_call to can_call.
R=kmillikin@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10735 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-15 14:26:39 +00:00
vegorov@google.com fe291bf0fa Implement basic support for deferred slow path code with calls that save and restore live registers.
Use it to avoid spilling over stack-checks.

R=kmillikin@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10639 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-14 12:47:42 +00:00
kmillikin@google.com 172ee045f3 Build and use stack maps in the SSA compiler.
Add a stack bitmap to the location summaries for calls that are GC
safepoints.  The bitmap covers the spill slots.  The register
allocator collects these bitmaps into a list and then marks live
pointer values during register allocation.  When emitting code for a
call, a heap-allocated stackmap is built.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10618 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-14 06:59:24 +00:00
vegorov@google.com 8aced7aab1 In AllocateAnyRegister allow spliting at blocked_at position inclusive.
R=srdjan@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10518 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-10 17:28:01 +00:00
vegorov@google.com 1cf5cc74aa Put PushArgument into the environment instead of raw values.
This allows to shorten live ranges and avoid spilling when PushArgument is the last real use of the value.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10508 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-10 14:28:02 +00:00
vegorov@google.com b9aa74f3a2 Eliminate phis that do not reach any non-environment uses.
This takes care of phis for temporary variables like :expr_temp, lia, lix, igr, casc, alloc, sca that currently create unnecessary pressure on the back-edge of loops.

R=srdjan@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10377 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-08 12:38:21 +00:00
kmillikin@google.com 4a24120c8d Move all register allocator environment initialization into class Environment.
Move the register constraints and initial live ranges of environment values
out of the register allocator and into the environment class.

R=vegorov@google.com,srdjan@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10342 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-07 15:53:02 +00:00
vegorov@google.com 4a24eb7ad8 Add hints when resolving phies and register constraints.
R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10333 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-07 11:55:42 +00:00
vegorov@google.com be323c2d61 Don't mark register constraints resolution moves as prefering registers.
R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10293 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-06 15:43:03 +00:00
kmillikin@google.com 1093cf4fe5 Allocate the environment's location backing store during register allocation.
The code relies on the addresses of elements in this backing store.  It was
correct but difficult to guarantee when it was a growable array's backing
store.

R=vegorov@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10290 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-06 15:13:21 +00:00
kmillikin@google.com 9ffbf2ffce Store variable counts in the flow graph builder.
Store the constant counts of copied parameters, non-copied parameters, and
(non-parameter) stack locals in the flow graph builder.  This saves passing
them around to flow graph member functions.

Change usage of "fixed parameter" to "non-copied parameter" because it is
different than what fixed parameter means in other parts of the system.

R=fschneider@google.com,zerny@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10289 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-06 14:33:23 +00:00
vegorov@google.com f07819adb2 Ensure that ia32 build passes all tests with --use-ssa on.
Bugs fixed in register allocator:

- incorrect assertions in SplitAt;
- allocation finger should not cache positions that are owned by a sibling after split;
- UpdateFreeUntil should allow evicting live range with vreg 0;
- values expected in fixed locations should not cause an interference at the instruction itself, they can be evicted if need arises;

Bug fixed in deoptimization:

- parallel move resolver uses push/pop to free a scratch register for memory to memory moves, when using it for deoptimization we need to ensure that those push/pops do not interfere with actual moves;

R=srdjan@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10287 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-06 12:24:12 +00:00
zerny@google.com c1262fbd49 Reapply "Added support for copied parameters to the SSA compiler."
This reapplies svn revision 10172 with a bug fix.

Original Review URL: https://chromiumcodereview.appspot.com//10837076

R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10280 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-06 10:07:26 +00:00
kmillikin@google.com 5a5c84fa06 Change TRACE_ALLOC to take a statement rather than an argument list.
This allows tracing things that are not arguments to OS::Print.

R=vegorov@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10216 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-03 08:27:42 +00:00
vegorov@google.com b601fa02c7 When selecting an optimal position for SplitBetween(from, to) ensure:
- that loop and block structure is taken into account;
- that split sibling has proper interference with values incoming into instruction corresponding to the to position.

R=srdjan@google.com
BUG=4308

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10208 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-03 06:29:35 +00:00
kmillikin@google.com 0d699e6c15 Revert "Added support for copied parameters to the SSA compiler."
This reverts svn revision 10172.

TBR=zerny@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10173 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-02 15:10:13 +00:00
zerny@google.com 41f9e67324 Added support for copied parameters to the SSA compiler.
R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10172 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-02 14:53:18 +00:00
kmillikin@google.com acff96c5b8 Fix a register allocation crash on IA32, caused by an uninitialized finger.
R=vegorov@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10166 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-02 13:40:19 +00:00
vegorov@google.com abfb2bf67a Implement simple spill store elimination.
Values that are spilled somewhere during their life-time are spilled eagerly at their definiton.

Additionally improve liverange printing used for debugging purposes.

R=srdjan@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10155 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-02 08:45:49 +00:00
fschneider@google.com 8eee3f1899 Eliminate unnecessary deoptimization environments.
This CL adds a CanOptimize predicate to every instruction. Before register
allocation there is a simple pass over the IR to remove environments from
instruction that never deoptmize. This reduces the number of uses and shortens
live ranges of values resulting in better code.
Review URL: https://chromiumcodereview.appspot.com//10829098

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10115 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-01 12:09:10 +00:00
vegorov@google.com 7eb80c3810 Mark phi-operands live-in for a predecessor if they are not defined by it.
R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10114 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-01 11:52:40 +00:00
vegorov@google.com 8822d6e652 Ignore life ranges with no uses for a values defined as fixed output.
R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10113 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-01 11:01:39 +00:00
vegorov@google.com b3c12e31d2 Do not mark phi-operands as live-out from predecessor.
R=srdjan@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10112 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-01 10:37:16 +00:00
vegorov@google.com 45e3affbb3 Ensure that we never try to split range at its end position.
Move parallel moves corresponding to gotos and block entries into this intructions to separate them from normal parallel moves that are used data flow inside basic blocks.

Block fixed locations only from instruction's start to instruction end (not to the start of the next instruction).

R=fschneider@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10065 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-31 16:28:09 +00:00
vegorov@google.com 79199170eb Revert instruction numbering scheme to an instruction start (2*k) - instruction end (2*k + 1) one. Current instruction numbering scheme does not capture interference between temporaries and inputs correctly which in rare cases causes allocation of the same register both to the temp and to the input register.
Allow live range splitting at every position.

Don't reuse phi-resolution parallel move for connecting live ranges or meeting register constraints, this might cause conflicts between moves.

Allow deoptimization with environments containing spilled values.

R=kmillikin@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10050 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-31 11:16:51 +00:00
fschneider@google.com c87efe45fa Add explicit PushArgument IL instructions to static calls.
This enables compiling static calls with the SSA-based code generator.

Add a helper to the graph builder for adding argument expressions to the graph.
Review URL: https://chromiumcodereview.appspot.com//10824078

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10008 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-30 11:19:42 +00:00
vegorov@google.com 4eff74b9b3 In FlowGraphAllocator::ComputeInitialSets use post-order number when accessing kill and live-in sets for graph entry
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9974 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-27 11:53:06 +00:00
vegorov@google.com c9e8d9594e Add support for fixed parameters in the register allocator.
This remove bailout for functions with non-zero number of non-fixed parameters and increases our coverage.

SpillSlot location was renamed into StackSlot location and now allows to address spill slots (positive stack index) and incoming parameters (negative stack index).

Environment was reordered to match order of values on the stack (previously it was inversed).

Correctly reserve spill slots in the prologue of the code. Previously register allocator was allocating spill slots, but generated code did not reserve any space for them on the stack so they might have been overwritten by calls.

Fix off by one in DeoptimizationStub::GenerateCode - we were reserving one slot too many.

Change --optimization-filter flag to use substring search instead of prefix comparison, this is much more useful when VM prefixes function name with a path to the file.

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9934 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-26 13:21:39 +00:00
vegorov@google.com 106ce578cf When evicting interference convert uses from evicted ranges.
R=kmillikin@google.com
BUG=4193
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9881 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-25 12:17:29 +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
srdjan@google.com 67de9f1323 Some cleanups.
Review URL: https://chromiumcodereview.appspot.com//10806099

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9874 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-25 00:25:00 +00:00
regis@google.com 4968398d2a Nitpicking.
Review URL: https://chromiumcodereview.appspot.com//10807093

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9863 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-24 20:39:21 +00:00
srdjan@google.com b7ef0471e3 Add HasSSATemp and an assert to ssa_temp_idnex setter.
Review URL: https://chromiumcodereview.appspot.com//10806089

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9859 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-24 17:39:07 +00:00
vegorov@google.com 925c9d6128 Adjust location summaries to match expectations of new register allocator.
Instructions containing calls can only use fixed registers everything else is blocked and unavailable for allocation.

Insert phi-connecting parallel moves after all instructions were numbered otherwise move gets incorrect position.

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9856 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-24 17:19:20 +00:00
vegorov@google.com 16e25206d1 New linear scan allocator.
Review URL: https://chromiumcodereview.appspot.com//10800037

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9851 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-24 16:01:54 +00:00
srdjan@google.com 9df3e4deaa Add higher-level accesses to Environment. Print flow graph after register allocation. Most interesting with --print-flags --print-environments
Review URL: https://chromiumcodereview.appspot.com//10800080

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9826 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-23 20:29:51 +00:00
srdjan@google.com c490158706 Cleanups.
Review URL: https://chromiumcodereview.appspot.com//10809047

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9795 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-20 23:42:23 +00:00
srdjan@google.com 66d31c8b23 Fix crash during parallel moves. Made MoveOperands ZoneAlloacted. Non-const ValueObjects a fragile, since it is easy to modify a copy instead of the original. It is also dangereous to use pointers to ValueObjects that contain copy constructors.
Review URL: https://chromiumcodereview.appspot.com//10806047

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9790 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-20 21:16:06 +00:00
kmillikin@google.com e440d86cb5 Revert "Revert "Introduce Goto instructions to the flow graph.""
Reapply svn revision 9731 with a bug fix.  The original review is at
http://chromiumcodereview.appspot.com/10735071/

R=vegorov@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9738 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-18 13:44:12 +00:00
kmillikin@google.com a368233743 Revert "Introduce Goto instructions to the flow graph."
This reverts svn revision 9731 due to test failures.

TBR=vegorov@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9733 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-18 10:44:54 +00:00
kmillikin@google.com 87d743a3c5 Introduce Goto instructions to the flow graph.
Goto is a control instruction with a single successor.

Before: basic blocks ended with an exit (return, throw, or rethrow), a
branch to a pair of target entries, or else they fell through to the
next block entry.

Now: basic blocks end with an exit, a branch, or an explicit goto to a
join entry.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9731 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-18 10:28:37 +00:00
vegorov@google.com 1bd5a9b414 Skeleton of a linear scan register allocator.
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9563 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-11 18:52:17 +00:00
srdjan@google.com e801021a27 Cleanups.
Review URL: https://chromiumcodereview.appspot.com//10765007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9482 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-09 20:31:25 +00:00
fschneider@google.com a411bf5045 Add forward iterator to iterate instructions inside a basic block.
It is currently only used in SSA renaming.
Review URL: https://chromiumcodereview.appspot.com//10692107

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9438 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-06 12:31:37 +00:00
fschneider@google.com eba7136e7b Make IL instructions a doubly-linked list within basic blocks.
In order to be able to efficiently iterate backwards over instructions
and removing or replacing instructions in the graph we want them to
be a double-linked list inside basic blocks. The list has the following

1. Block entry instructions do not have a previous instruction.
2. The last instruction in a block may or may not have a next instruction:
   - Branches have a NULL-successor.
   - Normal block exits have a block entry instructions as successor.

This CL also makes the accessor for previous and next instruction in this
list non-virtual. This avoidis the current code duplication there.
Review URL: https://chromiumcodereview.appspot.com//10665022

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9297 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-02 16:08:58 +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