FAQ
Reviewers: golang-dev1,

Message:
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com),

I'd like you to review this change to
https://go.googlecode.com/hg/


Description:
cmd/gc: eliminate a useless bounds check in inlined append().

Please review this at https://codereview.appspot.com/9358043/

Affected files:
    M src/cmd/gc/walk.c


Index: src/cmd/gc/walk.c
===================================================================
--- a/src/cmd/gc/walk.c
+++ b/src/cmd/gc/walk.c
@@ -2537,7 +2537,7 @@
    l = list(l, nod(OAS, nn, nod(OLEN, ns, N))); // n = len(s)

    nx = nod(OSLICE, ns, nod(OKEY, N, nod(OADD, nn, na))); // ...s[:n+argc]
- nx->bounded = 1;
+ nx->etype = 1;
    l = list(l, nod(OAS, ns, nx)); // s = s[:n+argc]

    for (a = n->list->next; a != nil; a = a->next) {


--

---
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Remyoudompheng at May 12, 2013 at 2:23 pm
    For the following code:

    var s []int
    var x int

    func F() {
            s = append(s, x)
    }

    Before:
    --- prog list "F" ---
    0000 (/tmp/main.go:6) TEXT F+0(SB),$88-0
    0001 (/tmp/main.go:6) LOCALS ,$24
    0002 (/tmp/main.go:6) TYPE autotmp_0000+-24(SP){[]int},$24
    0003 (/tmp/main.go:7) MOVQ s+0(SB),BX
    0004 (/tmp/main.go:7) MOVQ BX,autotmp_0000+-24(SP)
    0005 (/tmp/main.go:7) MOVQ s+8(SB),CX
    0006 (/tmp/main.go:7) MOVQ s+16(SB),BX
    0007 (/tmp/main.go:7) MOVQ BX,AX
    0008 (/tmp/main.go:7) SUBQ CX,BX
    0009 (/tmp/main.go:7) CMPQ BX,$1
    0010 (/tmp/main.go:7) JGE ,22
    0011 (/tmp/main.go:7) MOVQ $type.[]int+0(SB),(SP)
    0012 (/tmp/main.go:7) MOVQ autotmp_0000+-24(SP),BX
    0013 (/tmp/main.go:7) MOVQ BX,8(SP)
    0014 (/tmp/main.go:7) MOVQ CX,16(SP)
    0015 (/tmp/main.go:7) MOVQ AX,24(SP)
    0016 (/tmp/main.go:7) MOVQ $1,32(SP)
    0017 (/tmp/main.go:7) CALL ,runtime.growslice+0(SB)
    0018 (/tmp/main.go:7) MOVQ 40(SP),BX
    0019 (/tmp/main.go:7) MOVQ BX,autotmp_0000+-24(SP)
    0020 (/tmp/main.go:7) MOVQ 48(SP),CX
    0021 (/tmp/main.go:7) MOVQ 56(SP),AX
    0022 (/tmp/main.go:7) MOVQ CX,DX
    0023 (/tmp/main.go:7) MOVQ CX,BP
    0024 (/tmp/main.go:7) INCQ ,BP
    0025 (/tmp/main.go:7) MOVQ AX,CX
    0026 (/tmp/main.go:7) MOVQ BP,AX
    0027 (/tmp/main.go:7) CMPQ CX,BP
    0028 (/tmp/main.go:7) JCC ,31
    0029 (/tmp/main.go:7) CALL ,runtime.panicslice+0(SB)
    0030 (/tmp/main.go:7) UNDEF ,
    0031 (/tmp/main.go:7) MOVQ autotmp_0000+-24(SP),BX
    0032 (/tmp/main.go:7) MOVQ BX,autotmp_0000+-24(SP)
    0033 (/tmp/main.go:7) MOVQ autotmp_0000+-24(SP),BX
    0034 (/tmp/main.go:7) LEAQ (BX)(DX*8),BX
    0035 (/tmp/main.go:7) MOVQ x+0(SB),BP
    0036 (/tmp/main.go:7) MOVQ BP,(BX)
    0037 (/tmp/main.go:7) MOVQ autotmp_0000+-24(SP),BX
    0038 (/tmp/main.go:7) MOVQ BX,s+0(SB)
    0039 (/tmp/main.go:7) MOVQ AX,s+8(SB)
    0040 (/tmp/main.go:7) MOVQ CX,s+16(SB)
    0041 (/tmp/main.go:8) RET ,

    After:
    --- prog list "F" ---
    0000 (/tmp/main.go:6) TEXT F+0(SB),$88-0
    0001 (/tmp/main.go:6) LOCALS ,$24
    0002 (/tmp/main.go:6) TYPE autotmp_0000+-24(SP){[]int},$24
    0003 (/tmp/main.go:7) MOVQ s+0(SB),BX
    0004 (/tmp/main.go:7) MOVQ BX,autotmp_0000+-24(SP)
    0005 (/tmp/main.go:7) MOVQ s+8(SB),CX
    0006 (/tmp/main.go:7) MOVQ s+16(SB),BX
    0007 (/tmp/main.go:7) MOVQ BX,AX
    0008 (/tmp/main.go:7) SUBQ CX,BX
    0009 (/tmp/main.go:7) CMPQ BX,$1
    0010 (/tmp/main.go:7) JGE ,22
    0011 (/tmp/main.go:7) MOVQ $type.[]int+0(SB),(SP)
    0012 (/tmp/main.go:7) MOVQ autotmp_0000+-24(SP),BX
    0013 (/tmp/main.go:7) MOVQ BX,8(SP)
    0014 (/tmp/main.go:7) MOVQ CX,16(SP)
    0015 (/tmp/main.go:7) MOVQ AX,24(SP)
    0016 (/tmp/main.go:7) MOVQ $1,32(SP)
    0017 (/tmp/main.go:7) CALL ,runtime.growslice+0(SB)
    0018 (/tmp/main.go:7) MOVQ 40(SP),BX
    0019 (/tmp/main.go:7) MOVQ BX,autotmp_0000+-24(SP)
    0020 (/tmp/main.go:7) MOVQ 48(SP),CX
    0021 (/tmp/main.go:7) MOVQ 56(SP),AX
    0022 (/tmp/main.go:7) MOVQ CX,SI
    0023 (/tmp/main.go:7) INCQ ,SI
    0024 (/tmp/main.go:7) MOVQ autotmp_0000+-24(SP),BX
    0025 (/tmp/main.go:7) MOVQ BX,autotmp_0000+-24(SP)
    0026 (/tmp/main.go:7) MOVQ autotmp_0000+-24(SP),BX
    0027 (/tmp/main.go:7) LEAQ (BX)(CX*8),BX
    0028 (/tmp/main.go:7) MOVQ x+0(SB),BP
    0029 (/tmp/main.go:7) MOVQ BP,(BX)
    0030 (/tmp/main.go:7) MOVQ autotmp_0000+-24(SP),BX
    0031 (/tmp/main.go:7) MOVQ BX,s+0(SB)
    0032 (/tmp/main.go:7) MOVQ SI,s+8(SB)
    0033 (/tmp/main.go:7) MOVQ AX,s+16(SB)
    0034 (/tmp/main.go:8) RET ,


    https://codereview.appspot.com/9358043/

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedMay 12, '13 at 2:22p
activeMay 12, '13 at 2:23p
posts2
users1
websitegolang.org

1 user in discussion

Remyoudompheng: 2 posts

People

Translate

site design / logo © 2021 Grokbase