Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Issue 6263005: Change the algorithm and generated code for parallel moves on IA32. (Closed)

Created:
9 years, 11 months ago by Kevin Millikin (Chromium)
Modified:
9 years, 7 months ago
CC:
v8-dev
Visibility:
Public.

Description

Change the algorithm and generated code for parallel moves on IA32. Instead of spilling and then immediately restoring eax to resolve memory to memory moves, the gap move resolver now tracks registers that are known to be free and uses one if available. If not it spills but restores lazily when the spilled value is needed or at the end of the algorithm. Instead of using esi for resolving cycles and assuming it is free to overwrite because it can be rematerialized, the gap move resolver now resolves cycles using swaps, possibly using a free register as above. The algorithm is also changed to be simpler: a recursive depth-first traversal of the move dependence graph. It uses a list of moves to be performed (because it mutates the moves themselves), but does not use any auxiliary structure other than the control stack. It does not build up a separate list of scheduled moves to be interpreted by the code generate, but emits code on the fly.

Patch Set 1 #

Patch Set 2 : Rebased to HEAD. #

Total comments: 6

Patch Set 3 : Fix compilation on all platforms. #

Total comments: 22
Unified diffs Side-by-side diffs Delta from patch set Stats (+644 lines, -283 lines) Patch
M src/SConscript View 1 chunk +1 line, -0 lines 0 comments Download
M src/arm/lithium-codegen-arm.cc View 1 2 2 chunks +6 lines, -6 lines 0 comments Download
M src/ia32/lithium-codegen-ia32.h View 1 2 5 chunks +16 lines, -28 lines 0 comments Download
M src/ia32/lithium-codegen-ia32.cc View 1 2 3 chunks +9 lines, -211 lines 0 comments Download
A src/ia32/lithium-gap-resolver-ia32.h View 1 2 1 chunk +107 lines, -0 lines 0 comments Download
A src/ia32/lithium-gap-resolver-ia32.cc View 1 2 1 chunk +446 lines, -0 lines 17 comments Download
M src/ia32/lithium-ia32.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M src/lithium.h View 1 1 chunk +0 lines, -3 lines 0 comments Download
M src/lithium.cc View 1 1 chunk +10 lines, -7 lines 3 comments Download
M src/lithium-allocator.h View 1 1 chunk +32 lines, -13 lines 2 comments Download
M src/lithium-allocator.cc View 3 chunks +6 lines, -6 lines 0 comments Download
M src/x64/lithium-codegen-x64.cc View 1 2 2 chunks +6 lines, -6 lines 0 comments Download
M tools/gyp/v8.gyp View 1 2 2 chunks +4 lines, -2 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
Kevin Millikin (Chromium)
Bill and Florian, could you take a look at this? The gyp changes are out ...
9 years, 11 months ago (2011-01-14 15:18:09 UTC) #1
Kevin Millikin (Chromium)
I just updated a more polished version. Compilation is fixed on all platforms, XMM register ...
9 years, 11 months ago (2011-01-17 08:20:20 UTC) #2
fschneider
LGTM. This is much better than the old code. Please also check if we hit ...
9 years, 11 months ago (2011-01-17 09:44:16 UTC) #3
Kevin Millikin (Chromium)
http://codereview.chromium.org/6263005/diff/2001/src/ia32/lithium-gap-resolver-ia32.cc File src/ia32/lithium-gap-resolver-ia32.cc (right): http://codereview.chromium.org/6263005/diff/2001/src/ia32/lithium-gap-resolver-ia32.cc#newcode64 src/ia32/lithium-gap-resolver-ia32.cc:64: if (!moves_[i].IsEliminated()) { On 2011/01/17 09:44:16, fschneider wrote: > ...
9 years, 11 months ago (2011-01-17 10:13:08 UTC) #4
William Hesse
LGTM. http://codereview.chromium.org/6263005/diff/6001/src/ia32/lithium-gap-resolver-ia32.cc File src/ia32/lithium-gap-resolver-ia32.cc (right): http://codereview.chromium.org/6263005/diff/6001/src/ia32/lithium-gap-resolver-ia32.cc#newcode35 src/ia32/lithium-gap-resolver-ia32.cc:35: : cgen_(owner), moves_(32), spilled_register_(-1) { Can we use ...
9 years, 11 months ago (2011-01-17 10:43:43 UTC) #5
Kevin Millikin (Chromium)
9 years, 11 months ago (2011-01-17 11:18:17 UTC) #6
http://codereview.chromium.org/6263005/diff/6001/src/ia32/lithium-gap-resolve...
File src/ia32/lithium-gap-resolver-ia32.cc (right):

http://codereview.chromium.org/6263005/diff/6001/src/ia32/lithium-gap-resolve...
src/ia32/lithium-gap-resolver-ia32.cc:35: : cgen_(owner), moves_(32),
spilled_register_(-1) {
On 2011/01/17 10:43:43, William Hesse wrote:
> Can we use no_reg, or no_reg.code(), for no spilled register?

That seems like a subtle type error.  This is an allocation index, not a
register code.

http://codereview.chromium.org/6263005/diff/6001/src/ia32/lithium-gap-resolve...
src/ia32/lithium-gap-resolver-ia32.cc:104: for (int i = moves_.length() - 1; i
>= 0; --i) {
On 2011/01/17 10:43:43, William Hesse wrote:
> Do we have the source use counts at this point?  I guess only for registers. 
> Can we skip this loop if the destination is a register, and its use count is
0?

We have source use counts for the general purpose registers.  I wanted to keep
things simple: most gaps have 0, 1, or two moves.

http://codereview.chromium.org/6263005/diff/6001/src/ia32/lithium-gap-resolve...
src/ia32/lithium-gap-resolver-ia32.cc:217: moves_.Rewind(0);
On 2011/01/17 10:43:43, William Hesse wrote:
> Shouldn't we have a List::Clear for Rewind(0), and also shouldn't Rewind()
> assert that the new index < length_?
> 
> Obviously, this could go in a different change.

We have List::Clear but it does something different (deallocates the backing
store).  At this point List::Rewind(0) is a V8 idiom.

http://codereview.chromium.org/6263005/diff/6001/src/ia32/lithium-gap-resolve...
src/ia32/lithium-gap-resolver-ia32.cc:265: // combinations are possible.
On 2011/01/17 10:43:43, William Hesse wrote:
> Are only combinations prohibited by the double vs word size difference, and
> constants as destinations, prohibited, or are there other, hidden,
non-supported
> cases?

The first.

Powered by Google App Engine
This is Rietveld 408576698