go/src
Keith Randall e410a527b2 runtime: simplify chan ops, take 2
This change is the same as CL #9345 which was reverted,
except for a small bug fix.

The only change is to the body of sendDirect and its callsite.
Also added a test.

The problem was during a channel send operation.  The target
of the send was a sleeping goroutine waiting to receive.  We
basically do:
1) Read the destination pointer out of the sudog structure
2) Copy the value we're sending to that destination pointer
Unfortunately, the previous change had a goroutine suspend
point between 1 & 2 (the call to sendDirect).  At that point
the destination goroutine's stack could be copied (shrunk).
The pointer we read in step 1 is no longer valid for step 2.

Fixed by not allowing any suspension points between 1 & 2.
I suspect the old code worked correctly basically by accident.

Fixes #13169

The original 9345:

This change removes the retry mechanism we use for buffered channels.
Instead, any sender waking up a receiver or vice versa completes the
full protocol with its counterpart.  This means the counterpart does
not need to relock the channel when it wakes up.  (Currently
buffered channels need to relock on wakeup.)

For sends on a channel with waiting receivers, this change replaces
two copies (sender->queue, queue->receiver) with one (sender->receiver).
For receives on channels with a waiting sender, two copies are still required.

This change unifies to a large degree the algorithm for buffered
and unbuffered channels, simplifying the overall implementation.

Fixes #11506

Change-Id: I57dfa3fc219cffa4d48301ee15fe5479299efa09
Reviewed-on: https://go-review.googlesource.com/16740
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-11-08 23:20:25 +00:00
..
archive archive/tar: detect truncated files 2015-11-06 04:31:26 +00:00
bufio bufio: fix scanning with a final empty token. 2015-09-25 21:46:13 +00:00
builtin
bytes bytes: improve Compare function on amd64 for large byte arrays 2015-08-26 03:52:20 +00:00
cmd cmd/link, runtime: arm implementation of addmoduledata 2015-11-08 21:46:17 +00:00
compress compress/flate: improve inflate speed by reading more bits at a time 2015-10-19 00:01:31 +00:00
container
crypto crypto/x509: add /etc/ssl/certs to certificate directories 2015-11-05 02:26:08 +00:00
database/sql database/sql: use RWMutex for driver registration 2015-10-23 04:33:50 +00:00
debug debug/gosym: clean up and modernize pclntab_test 2015-10-07 17:01:59 +00:00
encoding encoding/xml: check for exported fields in embedded structs 2015-10-26 11:26:11 +00:00
errors
expvar
flag
fmt fmt: Add support for capital '%X' format verb for scanning 2015-10-20 01:08:54 +00:00
go go/build: introduce go1.6 build tag 2015-11-08 10:57:57 +00:00
hash hash/crc32: add AMD64 optimized IEEE CRC calculation 2015-09-16 15:42:42 +00:00
html html/template: include itself while cloning 2015-10-20 23:53:27 +00:00
image image: add NYCbCrA types. 2015-10-11 11:07:25 +00:00
index/suffixarray
internal internal/syscall/unix: eliminate non-trivial randomTrap initializer 2015-11-05 00:09:59 +00:00
io io: simplify documentation for ByteReader 2015-10-06 02:21:29 +00:00
log log/syslog: disable unix/unixgram tests on android 2015-10-21 17:56:51 +00:00
math math: fix bad shift in Expm1 2015-10-30 22:55:19 +00:00
mime mime: Remove an allocation in word decoding. 2015-10-18 17:31:52 +00:00
net net/http: update bundled http2 revision 2015-11-08 15:11:14 +00:00
os os: reduce allocations in Readdir on unix 2015-10-30 19:47:55 +00:00
path path/filepath: fix EvalSymlinks(".") on windows 2015-11-01 04:45:37 +00:00
reflect reflect: Comment fix 2015-10-27 15:46:29 +00:00
regexp regexp: fix slice bounds out of range panics 2015-10-23 03:30:25 +00:00
runtime runtime: simplify chan ops, take 2 2015-11-08 23:20:25 +00:00
sort sort: Fix typo in Stable() comment 2015-08-17 06:58:16 +00:00
strconv strconv: slightly simplified roundShortest; better comments 2015-09-23 21:14:29 +00:00
strings strings: add asm version of Index() for short strings on amd64 2015-11-03 16:04:28 +00:00
sync runtime, sync/atomic: add memory barriers in arm cas routines 2015-07-30 20:11:11 +00:00
syscall syscall: allow nacl's fake network code to Listen twice on the same address 2015-11-04 16:03:21 +00:00
testing testing/quick: terminate for arbitrary recursive types 2015-08-29 19:23:37 +00:00
text text/template: remove redundant indirect 2015-10-28 02:51:40 +00:00
time time: allow any one- or two-digit day of the month when parsing. 2015-09-10 20:27:53 +00:00
unicode unicode/utf8: added benchmarks 2015-10-26 10:42:38 +00:00
unsafe
vendor/golang.org/x/net/http2/hpack net/http: update copy of http2 2015-10-21 00:28:55 +00:00
Make.dist
all.bash
all.bat
all.rc
androidtest.bash androidtest.bash: set GOARM=7 2015-10-26 15:20:02 +00:00
bootstrap.bash build: Fix bootstrap.bash for official source tarballs 2015-09-01 19:52:59 +00:00
buildall.bash
clean.bash build: clean current tree in clean.bash 2015-08-05 19:36:15 +00:00
clean.bat
clean.rc
iostest.bash
make.bash make.bash: abort if $GOROOT_BOOTSTRAP == $GOROOT 2015-08-24 03:04:52 +00:00
make.bat
make.rc
nacltest.bash
race.bash
race.bat
run.bash
run.bat
run.rc