runtime: remove unused *chantype parameters

The chanrecv funcs don't use it at all. The chansend ones do, but the
element type is now part of the hchan struct, which is already a
parameter.

hchan can be nil in chansend when sending to a nil channel, so when
instrumenting we must copy to the stack to be able to read the channel
type.

name             old time/op  new time/op  delta
ChanUncontended  6.42µs ± 1%  6.22µs ± 0%  -3.06%  (p=0.000 n=19+18)

Initially found by github.com/mvdan/unparam.

Fixes #19591.

Change-Id: I3a5e8a0082e8445cc3f0074695e3593fd9c88412
Reviewed-on: https://go-review.googlesource.com/38351
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Daniel Martí 2017-03-18 15:55:41 +00:00 committed by Brad Fitzpatrick
parent c65ceff125
commit 2e29eb57db
7 changed files with 106 additions and 106 deletions

View file

@ -1298,7 +1298,7 @@ func (v Value) recv(nb bool) (val Value, ok bool) {
} else {
p = unsafe.Pointer(&val.ptr)
}
selected, ok := chanrecv(v.typ, v.pointer(), nb, p)
selected, ok := chanrecv(v.pointer(), nb, p)
if !selected {
val = Value{}
}
@ -1329,7 +1329,7 @@ func (v Value) send(x Value, nb bool) (selected bool) {
} else {
p = unsafe.Pointer(&x.ptr)
}
return chansend(v.typ, v.pointer(), p, nb)
return chansend(v.pointer(), p, nb)
}
// Set assigns x to the value v.
@ -2465,10 +2465,10 @@ func chanlen(ch unsafe.Pointer) int
// (due to the escapes() call in ValueOf).
//go:noescape
func chanrecv(t *rtype, ch unsafe.Pointer, nb bool, val unsafe.Pointer) (selected, received bool)
func chanrecv(ch unsafe.Pointer, nb bool, val unsafe.Pointer) (selected, received bool)
//go:noescape
func chansend(t *rtype, ch unsafe.Pointer, val unsafe.Pointer, nb bool) bool
func chansend(ch unsafe.Pointer, val unsafe.Pointer, nb bool) bool
func makechan(typ *rtype, size uint64) (ch unsafe.Pointer)
func makemap(t *rtype) (m unsafe.Pointer)