diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-09-14 03:57:18 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-09-14 03:57:18 +0000 |
commit | 022aa0ce5eebafe60f20245c8ff26b60a5074dfd (patch) | |
tree | 4cff4e3e7be2beb8a86e66e9f1d6346a9e55fb36 /libgo/go/reflect | |
parent | 0468f67f27f49972dcd77758284a2709bd9249fe (diff) | |
download | gcc-022aa0ce5eebafe60f20245c8ff26b60a5074dfd.zip gcc-022aa0ce5eebafe60f20245c8ff26b60a5074dfd.tar.gz gcc-022aa0ce5eebafe60f20245c8ff26b60a5074dfd.tar.bz2 |
compiler, runtime: simplify select and channel operations
In preparation for upgrading libgo to the 1.9 release, this
approximately incorporates https://golang.org/cl/37661 and
https://golang.org/cl/38351.
CL 37661 changed the gc compiler such that the select statement simply
returns an integer which is then used as the argument for a switch.
Since gccgo already worked that way, this just adjusts the switch code
to look like the gc switch code by removing the explicit case index
expression and calculating it from the order of calls to selectsend,
selectrecv, and selectdefault.
CL 38351 simplifies the channel code by not passing the unused channel
type descriptor pointer.
Reviewed-on: https://go-review.googlesource.com/62730
From-SVN: r252749
Diffstat (limited to 'libgo/go/reflect')
-rw-r--r-- | libgo/go/reflect/value.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libgo/go/reflect/value.go b/libgo/go/reflect/value.go index 208bb2f..8f6a93b 100644 --- a/libgo/go/reflect/value.go +++ b/libgo/go/reflect/value.go @@ -1160,7 +1160,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{} } @@ -1191,7 +1191,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. @@ -2327,10 +2327,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) |