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

Issue 6493099: code review 6493099: cmd/6g, cmd/8g: eliminate extra agen for nil comparisons. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 6 months ago by remyoudompheng
Modified:
12 years, 6 months ago
Reviewers:
CC:
DMorsing, nigeltao, rsc, golang-dev, remy_archlinux.org
Visibility:
Public.

Description

cmd/6g, cmd/8g: eliminate extra agen for nil comparisons. Removes an extra LEAL/LEAQ instructions there and usually saves a useless temporary in the idiom if err := foo(); err != nil {...} Generated code is also less involved: MOVQ err+n(SP), AX CMPQ AX, $0 (potentially CMPQ n(SP), $0) instead of LEAQ err+n(SP), AX CMPQ (AX), $0 Update issue 1914.

Patch Set 1 #

Patch Set 2 : code review 6493099: cmd/6g, cmd/8g: eliminate extra agen for nil comparisons. #

Patch Set 3 : diff -r 0a0666f2fe86 https://go.googlecode.com/hg/ #

Total comments: 5

Patch Set 4 : diff -r 46a4f787e8b7 https://go.googlecode.com/hg/ #

Patch Set 5 : diff -r 46a4f787e8b7 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+19 lines, -31 lines) Patch
M src/cmd/6g/cgen.c View 1 2 3 1 chunk +11 lines, -17 lines 0 comments Download
M src/cmd/8g/cgen.c View 1 2 3 2 chunks +8 lines, -14 lines 0 comments Download

Messages

Total messages: 13
remyoudompheng
Hello rsc@golang.org, golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com, remy@archlinux.org), I'd like you to review this change to https://go.googlecode.com/hg/
12 years, 6 months ago (2012-09-09 07:39:45 UTC) #1
DMorsing
I took a look at this section a couple of days ago, but I couldn't ...
12 years, 6 months ago (2012-09-09 07:44:09 UTC) #2
remyoudompheng
The most impressive reduction in stack size is probably Before: src/pkg/regexp/syntax/parse.go:1486) TEXT (*parser).parseClass+0(SB),$328-56 After: src/pkg/regexp/syntax/parse.go:1486) ...
12 years, 6 months ago (2012-09-09 07:48:52 UTC) #3
DMorsing
I need to read code more carefully. After a second pass, the code path looks ...
12 years, 6 months ago (2012-09-09 08:39:29 UTC) #4
remyoudompheng
No pending patches. I have vague projects: * wondering whether something could be done for ...
12 years, 6 months ago (2012-09-09 08:52:03 UTC) #5
nigeltao
Please replace "Part of issue 1914" in the CL description to "Update issue 1914". http://code.google.com/p/support/wiki/IssueTracker#Integration_with_version_control
12 years, 6 months ago (2012-09-09 09:35:38 UTC) #6
rsc
LGTM http://codereview.appspot.com/6493099/diff/4002/src/cmd/6g/cgen.c File src/cmd/6g/cgen.c (right): http://codereview.appspot.com/6493099/diff/4002/src/cmd/6g/cgen.c#newcode986 src/cmd/6g/cgen.c:986: yyerror("illegal array comparison"); s/array/slice/ while you are here. ...
12 years, 6 months ago (2012-09-11 02:30:45 UTC) #7
rsc
LGTM
12 years, 6 months ago (2012-09-11 02:30:51 UTC) #8
rsc
Sigh. The send mail box got unchecked in my first LGTM. Please see my comments ...
12 years, 6 months ago (2012-09-11 02:31:24 UTC) #9
remyoudompheng
On 2012/09/09 09:35:38, nigeltao wrote: > Please replace "Part of issue 1914" in the CL ...
12 years, 6 months ago (2012-09-11 05:58:56 UTC) #10
remyoudompheng
Hello daniel.morsing@gmail.com, nigeltao@golang.org, rsc@golang.org (cc: golang-dev@googlegroups.com, remy@archlinux.org), Please take another look.
12 years, 6 months ago (2012-09-11 05:59:09 UTC) #11
remyoudompheng
Submitting... http://codereview.appspot.com/6493099/diff/4002/src/cmd/6g/cgen.c File src/cmd/6g/cgen.c (right): http://codereview.appspot.com/6493099/diff/4002/src/cmd/6g/cgen.c#newcode986 src/cmd/6g/cgen.c:986: yyerror("illegal array comparison"); On 2012/09/11 02:30:45, rsc wrote: ...
12 years, 6 months ago (2012-09-11 05:59:23 UTC) #12
remyoudompheng
12 years, 6 months ago (2012-09-11 06:08:44 UTC) #13
*** Submitted as http://code.google.com/p/go/source/detail?r=09fe2c10489d ***

cmd/6g, cmd/8g: eliminate extra agen for nil comparisons.

Removes an extra LEAL/LEAQ instructions there and usually saves
a useless temporary in the idiom
    if err := foo(); err != nil {...}

Generated code is also less involved:
    MOVQ err+n(SP), AX
    CMPQ AX, $0
(potentially CMPQ n(SP), $0) instead of
    LEAQ err+n(SP), AX
    CMPQ (AX), $0

Update issue 1914.

R=daniel.morsing, nigeltao, rsc
CC=golang-dev, remy
http://codereview.appspot.com/6493099
Sign in to reply to this message.

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