]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/gc: drop unused Reslice field from Node
authorRuss Cox <rsc@golang.org>
Wed, 6 May 2015 16:25:56 +0000 (12:25 -0400)
committerRuss Cox <rsc@golang.org>
Mon, 11 May 2015 15:22:26 +0000 (15:22 +0000)
Dead code.

This field is left over from Go 1.4, when we elided the fake write
barrier in this case. Today, it's unused (always false).
The upcoming append/slice changes handle this case again,
but without needing this field.

Change-Id: Ic6f160b64efdc1bbed02097ee03050f8cd0ab1b8
Reviewed-on: https://go-review.googlesource.com/9789
Reviewed-by: David Chase <drchase@google.com>
src/cmd/internal/gc/syntax.go
src/cmd/internal/gc/typecheck.go
src/cmd/internal/gc/walk.go

index 7c9fb8d2b889bc451e60b9db1d964ecc8199f185..70c6f3f5674cd837df7ea569f0de8d6cdeaf3c71 100644 (file)
@@ -48,7 +48,6 @@ type Node struct {
        Assigned    bool   // is the variable ever assigned to
        Captured    bool   // is the variable captured by a closure
        Byval       bool   // is the variable captured by value or by reference
-       Reslice     bool   // this is a reslice x = x[0:y] or x = append(x, ...)
        Likely      int8   // likeliness of if statement
        Hasbreak    bool   // has break statement
        Needzero    bool   // if it contains pointers, needs to be zeroed on function entry
index 6daf842474cee35851433d06abb8c163b282aa45..fdd393d0cf7a96519ea3c39cb44204c907e5fa6e 100644 (file)
@@ -3360,29 +3360,6 @@ func typecheckas(n *Node) {
        if n.Left.Typecheck == 0 {
                typecheck(&n.Left, Erv|Easgn)
        }
-
-       // Recognize slices being updated in place, for better code generation later.
-       // Don't rewrite if using race detector, to avoid needing to teach race detector
-       // about this optimization.
-       if n.Left != nil && n.Left.Op != OINDEXMAP && n.Right != nil && flag_race == 0 {
-               switch n.Right.Op {
-               // For x = x[0:y], x can be updated in place, without touching pointer.
-               // TODO(rsc): Reenable once it is actually updated in place without touching the pointer.
-               case OSLICE, OSLICE3, OSLICESTR:
-                       if false && samesafeexpr(n.Left, n.Right.Left) && (n.Right.Right.Left == nil || iszero(n.Right.Right.Left)) {
-                               n.Right.Reslice = true
-                       }
-
-                       // For x = append(x, ...), x can be updated in place when there is capacity,
-               // without touching the pointer; otherwise the emitted code to growslice
-               // can take care of updating the pointer, and only in that case.
-               // TODO(rsc): Reenable once the emitted code does update the pointer.
-               case OAPPEND:
-                       if false && n.Right.List != nil && samesafeexpr(n.Left, n.Right.List.N) {
-                               n.Right.Reslice = true
-                       }
-               }
-       }
 }
 
 func checkassignto(src *Type, dst *Node) {
index c32a8137d614706740f13e2590495e21d288ed8a..c8a5c7e2f3a0aec3aa3ef6b299a7b089a0475157 100644 (file)
@@ -2185,26 +2185,6 @@ func needwritebarrier(l *Node, r *Node) bool {
                return false
        }
 
-       // No write barrier for reslice: x = x[0:y] or x = append(x, ...).
-       // Both are compiled to modify x directly.
-       // In the case of append, a write barrier may still be needed
-       // if the underlying array grows, but the append code can
-       // generate the write barrier directly in that case.
-       // (It does not yet, but the cost of the write barrier will be
-       // small compared to the cost of the allocation.)
-       if r.Reslice {
-               switch r.Op {
-               case OSLICE, OSLICE3, OSLICESTR, OAPPEND:
-                       break
-
-               default:
-                       Dump("bad reslice-l", l)
-                       Dump("bad reslice-r", r)
-               }
-
-               return false
-       }
-
        // Otherwise, be conservative and use write barrier.
        return true
 }