No functional changes.
Generating shorter functions improves compilation time. On my laptop, this test's running time goes from 5.5s to 1.5s; the wall clock time to run all tests goes down 1s. On Raspberry Pi, this CL cuts 50s off the wall clock time to run all tests.
Fixes#7503.
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/72590045
The select2.go test assumed that the memory allocated between
its two samplings of runtime.ReadMemStats is strictly
increasing. To avoid failing the tests when this is not true,
a greater-than check is introduced before computing the
difference in allocated memory.
R=golang-dev, r, cshapiro
CC=golang-dev
https://golang.org/cl/13701046
Unexports runtime.MemStats and rename MemStatsType to MemStats.
The new accessor requires passing a pointer to a user-allocated
MemStats structure.
Fixes#2572.
R=bradfitz, rsc, bradfitz, gustavo
CC=golang-dev, remy
https://golang.org/cl/5616072
I converted this program yesterday and the output is the
same as it used to be, ignoring space, but the result is
not the best expression of the algorithm. The old {.section
Maybe} pieces are now {{with .Maybe}}, as a direct translation,
but I they should be {{if .Maybe}} as the output is just a
bool and there is no cascading.
I have verified that the output of the program is unaffected.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4889053
It's already in old/template; make that build.
Update a couple of references to point to the old template.
They can be updated later.
Update goplay to use exp/template.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4902046
In line with other functions such as Fprintf, put the
thing to be written first.
Apologies for the breakages this is sure to cause.
R=rsc, gri, adg, eds, r2, aam
CC=golang-dev
https://golang.org/cl/4169042
The sanity checking in pass 2 is wrong
when a select is offering to communicate in
either direction on a channel and neither case
is immediately ready.
R=ken2
CC=golang-dev
https://golang.org/cl/3991047
Close of closed channel panics.
Receive from closed channel never panics,
even if done repeatedly.
Fixes#1349.
Fixes#1419.
R=gri, iant, ken2, r, gri1, r2, iant2, rog, albert.strasheim, niemeyer, ejsherry
CC=golang-dev
https://golang.org/cl/3989042
There were duplicate closes and missing closes,
with the result that the program was rarely testing
as much as it seemed to be. Now it finishes.
R=r
CC=golang-dev
https://golang.org/cl/4008046
nonblock.go wants to test nonblocking operations on
synchronous channels, so it is inherently racy. This
introduces loops to make the race conditions much more likely
to succeed when using gccgo.
R=r
CC=golang-dev
https://golang.org/cl/2161043
* adds pass 3 to dequeue from channels eagerly
various other cleanup/churn:
* use switch on cas->send in each pass to
factor out common code.
* longer goto labels, commented at target
* be more agressive about can't happen:
throw instead of print + cope.
* use "select" instead of "selectgo" in errors
* use printf for debug prints when possible
R=ken2, ken3
CC=golang-dev, r
https://golang.org/cl/875041
note that sortmain.go has been run through hg gofmt;
only the formatting of the day initializers changed.
i'm happy to revert that formatting if you'd prefer.
stop on error in doc/progs/run
R=r
CC=golang-dev
https://golang.org/cl/850041
(Thanks to ken and rsc for pointing this out)
rsc:
ken pointed out that there's a race in the new
one-lock-per-channel code. the issue is that
if one goroutine has gone to sleep doing
select {
case <-c1:
case <-c2:
}
and then two more goroutines try to send
on c1 and c2 simultaneously, the way that
the code makes sure only one wins is the
selgen field manipulation in dequeue:
// if sgp is stale, ignore it
if(sgp->selgen != sgp->g->selgen) {
//prints("INVALID PSEUDOG POINTER\n");
freesg(c, sgp);
goto loop;
}
// invalidate any others
sgp->g->selgen++;
but because the global lock is gone both
goroutines will be fiddling with sgp->g->selgen
at the same time.
This results in a 7% slowdown in the single threaded case for a
ping-pong microbenchmark.
Since the cas predominantly succeeds, adding a simple check first
didn't make any difference.
R=rsc
CC=golang-dev
https://golang.org/cl/180068