Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4185)

Issue 6733055: code review 6733055: cmd/5g, cmd/6g: fix out of registers with array indexing. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 6 months ago by remyoudompheng
Modified:
4 years, 5 months ago
Reviewers:
rsc, Nick name
CC:
dfc, DMorsing, rsc, golang-dev
Visibility:
Public.

Description

cmd/5g, cmd/6g: fix out of registers with array indexing. Compiling expressions like: s[s[s[s[s[s[s[s[s[s[s[s[i]]]]]]]]]]]] make 5g and 6g run out of registers. Such expressions can arise if a slice is used to represent a permutation and the user wants to iterate it. This is due to the usual problem of allocating registers before going down the expression tree, instead of allocating them in a postfix way. The functions cgenr and agenr (that generate a value to a newly allocated register instead of an existing location), are either introduced or modified when they already existed to allocate the new register as late as possible, and sudoaddable is disabled for OINDEX nodes so that igen/agenr is used instead. Update issue 4207.

Patch Set 1 #

Patch Set 2 : diff -r 11f0ba3b7006 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 11f0ba3b7006 https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r 8e87cb8dca7d https://go.googlecode.com/hg/ #

Patch Set 5 : diff -r 8e87cb8dca7d https://go.googlecode.com/hg/ #

Patch Set 6 : diff -r 8e87cb8dca7d https://go.googlecode.com/hg/ #

Total comments: 3

Patch Set 7 : diff -r 8e87cb8dca7d https://go.googlecode.com/hg/ #

Patch Set 8 : diff -r 8e87cb8dca7d https://go.googlecode.com/hg/ #

Total comments: 1

Patch Set 9 : diff -r 4f5ad3a5b26d https://go.googlecode.com/hg/ #

Patch Set 10 : diff -r 4f5ad3a5b26d https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+396 lines, -269 lines) Patch
M src/cmd/5g/cgen.c View 1 2 3 4 5 6 7 8 6 chunks +222 lines, -161 lines 0 comments Download
M src/cmd/5g/gsubr.c View 1 2 3 4 5 6 7 8 1 chunk +3 lines, -0 lines 0 comments Download
M src/cmd/6g/cgen.c View 1 2 3 4 5 6 7 8 7 chunks +149 lines, -96 lines 0 comments Download
M src/cmd/6g/gg.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M src/cmd/6g/gsubr.c View 1 2 3 4 5 6 7 8 2 chunks +3 lines, -12 lines 0 comments Download
M src/cmd/gc/fmt.c View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download
M test/torture.go View 1 2 3 1 chunk +17 lines, -0 lines 0 comments Download

Messages

Total messages: 19
remyoudompheng
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
11 years, 6 months ago (2012-10-20 19:24:27 UTC) #1
dfc
./all.bash does not pass nilptr.go # ../test run nilptr.go : incorrect output 0 panic: memory ...
11 years, 6 months ago (2012-10-21 10:15:31 UTC) #2
remyoudompheng
On 2012/10/21 10:15:31, dfc wrote: > ./all.bash does not pass nilptr.go The old code in ...
11 years, 5 months ago (2012-10-29 07:50:16 UTC) #3
dfc
Thank you. On Mon, Oct 29, 2012 at 6:50 PM, <remyoudompheng@gmail.com> wrote: > On 2012/10/21 ...
11 years, 5 months ago (2012-10-29 07:51:33 UTC) #4
remyoudompheng
Hello golang-dev@googlegroups.com, dave@cheney.net (cc: golang-dev@googlegroups.com), Please take another look.
11 years, 5 months ago (2012-10-29 07:55:35 UTC) #5
dfc
http://codereview.appspot.com/6733055/diff/14001/src/cmd/5g/gsubr.c File src/cmd/5g/gsubr.c (right): http://codereview.appspot.com/6733055/diff/14001/src/cmd/5g/gsubr.c#newcode1809 src/cmd/5g/gsubr.c:1809: // disabled. could you please leave a small comment ...
11 years, 5 months ago (2012-10-29 08:04:15 UTC) #6
dfc
linux/arm, omap4: benchmark old ns/op new ns/op delta BenchmarkBinaryTree17 46192261000 45795379000 -0.86% BenchmarkFannkuch11 34446014000 34150849000 ...
11 years, 5 months ago (2012-10-29 08:37:57 UTC) #7
dfc
http://codereview.appspot.com/6733055/diff/14001/src/cmd/5g/cgen.c File src/cmd/5g/cgen.c (right): http://codereview.appspot.com/6733055/diff/14001/src/cmd/5g/cgen.c#newcode599 src/cmd/5g/cgen.c:599: USED(nr); If nr is not used, can it be ...
11 years, 5 months ago (2012-10-29 16:51:51 UTC) #8
remyoudompheng
Hello golang-dev@googlegroups.com, dave@cheney.net (cc: golang-dev@googlegroups.com), Please take another look.
11 years, 5 months ago (2012-10-30 07:14:02 UTC) #9
remyoudompheng
On 2012/10/29 08:37:57, dfc wrote: > linux/arm, omap4: > > benchmark old ns/op new ns/op ...
11 years, 5 months ago (2012-10-30 07:32:58 UTC) #10
dfc
> I'm surprised to see a noticeable performance improvement. Could this be an improvement in ...
11 years, 5 months ago (2012-10-30 09:45:26 UTC) #11
DMorsing
On 2012/10/30 09:45:26, dfc wrote: > Could this be an improvement in stack usage ? ...
11 years, 5 months ago (2012-10-30 10:41:05 UTC) #12
dfc
Here is an analysis of the difference in stack usage between 3312fddeb739 without and with ...
11 years, 5 months ago (2012-10-30 14:40:14 UTC) #13
dfc
For clarity, this analysis was on linux/amd64 (not arm)
11 years, 5 months ago (2012-10-30 14:41:39 UTC) #14
remyoudompheng
On arm the difference is very small. I think the difference on amd64 is just ...
11 years, 5 months ago (2012-10-31 05:28:51 UTC) #15
rsc
LGTM https://codereview.appspot.com/6733055/diff/15002/src/cmd/5g/cgen.c File src/cmd/5g/cgen.c (right): https://codereview.appspot.com/6733055/diff/15002/src/cmd/5g/cgen.c#newcode834 src/cmd/5g/cgen.c:834: * newreg = &n In agenr the parameter ...
11 years, 5 months ago (2012-11-01 17:54:26 UTC) #16
remyoudompheng
*** Submitted as http://code.google.com/p/go/source/detail?r=0167b45ce063 *** cmd/5g, cmd/6g: fix out of registers with array indexing. Compiling ...
11 years, 5 months ago (2012-11-02 06:51:09 UTC) #17
Nick name
Not hard and I'm still doing all this with just 2g
4 years, 8 months ago (2019-08-04 15:40:20 UTC) #18
Nick name
4 years, 8 months ago (2019-08-04 15:44:25 UTC) #19
Message was sent while issue was closed.
On 2012/10/30 09:45:26, dfc wrote:
> > I'm surprised to see a noticeable performance improvement.
> 
> Could this be an improvement in stack usage ? If this is truly unexpected, I
can
> investigate further, but I am happy that there is no performance regression.
>  
> > sudoaddable is essentially unused after this patch. Its role is essentially
to
> > implement something similar to igen for OINDEX nodes (the ODOT and ODOTPTR
> cases
> > are redundant with igen), and allow 6g to generate instructions like "MOVQ
> > (R8)(8*R9), R10".
> 
> I am very happy to see sudoaddable on its way out the door.

No I did have the 5-6 running on it so yeah if it's not out of your way go ahead
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b