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

Issue 96720043: cmd/gc: don't generate checknils when slicing an array (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years ago by josharian
Modified:
9 years, 4 months ago
Reviewers:
gobot, rsc
CC:
golang-codereviews
Visibility:
Public.

Description

cmd/gc: don't generate checknils when slicing an array Compiling func f() int { buf := make([]byte, 1024) return len(buf) } now generates "".f t=1 size=80 value=0 args=0x8 locals=0x418 0x0000 00000 (x.go:3) TEXT "".f+0(SB),$1048-8 0x0000 00000 (x.go:3) MOVQ (TLS),CX 0x0009 00009 (x.go:3) LEAQ -920(SP),AX 0x0011 00017 (x.go:3) CMPQ AX,(CX) 0x0014 00020 (x.go:3) JHI ,29 0x0016 00022 (x.go:3) CALL ,runtime.morestack8_noctxt(SB) 0x001b 00027 (x.go:3) JMP ,0 0x001d 00029 (x.go:3) SUBQ $1048,SP 0x0024 00036 (x.go:3) FUNCDATA $2,gclocals·a7a3692b8e27e823add69ec4239ba55f+0(SB) 0x0024 00036 (x.go:3) FUNCDATA $3,gclocals·0528ab8f76149a707fd2f0025c2178a3+0(SB) 0x0024 00036 (x.go:4) LEAQ "".autotmp_0000+0(SP),DI 0x0028 00040 (x.go:4) MOVL $0,AX 0x002a 00042 (x.go:4) DUFFZERO ,$ 0x002f 00047 (x.go:4) LEAQ "".autotmp_0000+0(SP),BX 0x0033 00051 (x.go:4) MOVQ $1024,AX 0x003a 00058 (x.go:5) MOVQ AX,"".~r0+1056(FP) 0x0042 00066 (x.go:5) ADDQ $1048,SP 0x0049 00073 (x.go:5) RET , This is not quite perfect, but it is good enough for now. Fixes issue 7316.

Patch Set 1 #

Patch Set 2 : diff -r f613443bb13a https://code.google.com/p/go #

Patch Set 3 : diff -r f613443bb13a https://code.google.com/p/go #

Patch Set 4 : diff -r f613443bb13a https://code.google.com/p/go #

Patch Set 5 : diff -r 977be8fe2e5d https://code.google.com/p/go #

Patch Set 6 : diff -r 977be8fe2e5d https://code.google.com/p/go #

Patch Set 7 : diff -r 977be8fe2e5d https://code.google.com/p/go #

Patch Set 8 : diff -r 977be8fe2e5d https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+15 lines, -0 lines) Patch
M src/cmd/5g/cgen.c View 1 chunk +2 lines, -0 lines 0 comments Download
M src/cmd/6g/cgen.c View 1 chunk +2 lines, -0 lines 0 comments Download
M src/cmd/8g/cgen.c View 1 chunk +2 lines, -0 lines 0 comments Download
M src/cmd/gc/fmt.c View 1 chunk +3 lines, -0 lines 0 comments Download
M src/cmd/gc/go.h View 1 chunk +1 line, -0 lines 0 comments Download
M src/cmd/gc/pgen.c View 1 chunk +2 lines, -0 lines 0 comments Download
M src/cmd/gc/typecheck.c View 2 chunks +2 lines, -0 lines 0 comments Download
M src/cmd/gc/walk.c View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 11
josharian
Hello rsc@golang.org (cc: golang-codereviews@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go
10 years ago (2014-04-24 01:36:34 UTC) #1
josharian
I didn't see an obvious way to accomplish this without adding a field to Node. ...
10 years ago (2014-04-24 01:37:39 UTC) #2
josharian
The savings from this CL are small and the release is coming up soon. I'll ...
10 years ago (2014-05-05 18:18:05 UTC) #3
gobot
R=close (assigned by josharian@gmail.com)
10 years ago (2014-05-05 18:18:26 UTC) #4
rsc
FWIW, this is too precise a fix. There is a general problem here not being ...
10 years ago (2014-05-09 19:50:48 UTC) #5
josharian
> FWIW, this is too precise a fix. There is a general problem here not ...
10 years ago (2014-05-09 20:21:57 UTC) #6
rsc
The broader fix I had in mind is any slice of an array doesn't need ...
10 years ago (2014-05-09 20:24:36 UTC) #7
josharian
> The broader fix I had in mind is any slice of an array doesn't ...
10 years ago (2014-05-10 00:29:44 UTC) #8
rsc
On 2014/05/10 00:29:44, josharian wrote: > > The broader fix I had in mind is ...
9 years, 11 months ago (2014-06-17 16:27:29 UTC) #9
josharian
> The broader fix I had in mind is any slice of an array doesn't ...
9 years, 9 months ago (2014-08-01 00:21:40 UTC) #10
rsc
9 years, 8 months ago (2014-08-25 00:34:10 UTC) #11
i think we can leave this for later. it's not important enough and it's not
obviously correct.
Sign in to reply to this message.

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