Descriptioncmd/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 #
MessagesTotal messages: 11
|