Commit graph

94 commits

Author SHA1 Message Date
Aaron Jacobs 8628688304 Fix several out of date references to 4g/5g/6g/8g/9g.
Change-Id: Ifb8e4e13c7778a7c0113190051415e096f5db94f
Reviewed-on: https://go-review.googlesource.com/11390
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-26 03:38:21 +00:00
Russ Cox 8d504c4e97 cmd/gc: implement 'for range x {'
Fixes #6102.

LGTM=gri
R=ken, r, gri
CC=golang-codereviews
https://golang.org/cl/113120043
2014-07-16 19:27:10 -04:00
Josh Bleecher Snyder 63393faedf test: speed up chan/select5
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
2014-06-17 09:07:18 -07:00
Carl Shapiro 1c45f98fa3 test/chan: avoid wrap-around in memstats comparison
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
2013-09-20 17:27:56 -07:00
Shenghou Ma faef52c214 all: fix typos
R=golang-dev, bradfitz, khr, r
CC=golang-dev
https://golang.org/cl/7461046
2013-06-09 21:50:24 +08:00
Carl Shapiro 14cb1a1da9 test: raise the allocation threshold for chan/select2.go failure
Updates #5282

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8718045
2013-04-12 15:58:34 -07:00
Shenghou Ma dda6d6aa70 test: use testlib in a few more cases (part 2)
Introduced "runoutput" cmd for running generated program

R=golang-dev, iant, bradfitz, remyoudompheng
CC=golang-dev
https://golang.org/cl/5869049
2012-04-20 23:45:43 +08:00
Rob Pike 3fb5f329b9 test/chan: document tests
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5677094
2012-02-19 17:44:02 +11:00
Russ Cox 0b477ef17e test: use testlib (first 100)
X ,s;^// \$G (\$D/)?\$F\.go *$;// compile;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A *$;// build;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A && \./\$A\.out *$;// run;g
X ,s;^// errchk \$G( -e)? (\$D/)?\$F\.go *$;// errorcheck;g

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5656082
2012-02-16 23:48:57 -05:00
Rémy Oudompheng 842c906e2e runtime: delete UpdateMemStats, replace with ReadMemStats(&stats).
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
2012-02-06 19:16:26 +01:00
Ian Lance Taylor 4e77e0f294 test: test that x := <-c accepts a general expression
The gccgo compiler used to fail to parse this.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5610051
2012-02-01 07:31:00 -08:00
Olivier Duperray 0da89b3964 test: Add the usual Copyright notice.
Fixes #2759.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5570053
2012-01-24 14:48:15 -05:00
Rob Pike f9489bed72 renaming_4: gofix -r everything/but/src/pkg
R=rsc
CC=golang-dev
https://golang.org/cl/5338043
2011-11-08 15:43:02 -08:00
Luuk van Dijk ea9e93862d gc: Better error message for range over non-receive channel.
Fixes #2354

R=rsc
CC=golang-dev
https://golang.org/cl/5346044
2011-11-06 22:14:15 +01:00
Russ Cox 44526cdbe0 non-pkg: gofix -r error -force=error
R=golang-dev, iant, r, r
CC=golang-dev
https://golang.org/cl/5307066
2011-11-01 22:06:05 -04:00
Russ Cox f58ed4e641 gc: disallow close on receive-only channels
Fixes #2353.
Fixes #2246.

R=golang-dev, r, gri
CC=golang-dev
https://golang.org/cl/5282042
2011-10-13 16:58:04 -04:00
Ian Lance Taylor 45301ba8c0 runtime: check for nil value pointer in select syncsend case
Fixes #2309.

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5128053
2011-09-26 20:46:37 -07:00
Russ Cox 4bdf1fc02b test: silence/coalesce some tests
Add copyright notice to nilptr.go.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5139048
2011-09-26 19:35:21 -04:00
Rob Pike 97eb06233f test/chan/sieve2.go: remove container/vector.
R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/4918043
2011-08-22 13:29:17 +10:00
Rob Pike 3f5edd2461 test/chan/select5.go: change "with" to "if" in templatea
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
2011-08-18 13:27:18 +10:00
Russ Cox 3770b0e60c gc: implement nil chan support
The spec has defined nil chans this way for months.
I'm behind.

R=ken2
CC=golang-dev
https://golang.org/cl/4897050
2011-08-17 15:54:17 -04:00
Rob Pike 6b5962c274 test/chan/select5.go: update to new templates
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4911041
2011-08-17 16:51:04 +10:00
Rob Pike 73b7afbebd template: delete old template code.
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
2011-08-17 14:34:48 +10:00
Hector Chu 47e6042f73 runtime: fix select pass 3
Fixes #2075

R=rsc, ken, r
CC=golang-dev
https://golang.org/cl/4748045
2011-07-18 16:15:01 -04:00
Nigel Tao 95323c59ea runtime: fix panic for make(chan [0]byte).
I suspect that this was introduced by
http://code.google.com/p/go/source/detail?r=6e4ee32fffd1

R=r
CC=golang-dev
https://golang.org/cl/4764045
2011-07-18 15:54:11 +10:00
Russ Cox 3f915f51a8 go code: replace closed(c) with x, ok := <-c
R=golang-dev, rog, bradfitzwork, r
CC=golang-dev
https://golang.org/cl/4243072
2011-03-11 14:47:44 -05:00
Rob Pike fb9e37cd9b template: reverse order of arguments to Execute
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
2011-02-09 14:23:01 -08:00
Russ Cox 0e47460915 gc: fix send precedence
Test and fix case found by Robert.
Add receive inside send to tree too.

R=ken2
CC=golang-dev
https://golang.org/cl/3973052
2011-02-01 08:29:21 -05:00
Russ Cox f4e76d8309 replace non-blocking send, receive syntax with select
R=golang-dev, nigeltao, niemeyer, r
CC=golang-dev
https://golang.org/cl/4079053
2011-01-31 18:36:28 -05:00
Russ Cox 7247d6b96f test: another select test
R=r
CC=golang-dev
https://golang.org/cl/4004044
2011-01-30 15:46:02 -05:00
Russ Cox 504da53c85 runtime: select bug
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
2011-01-28 17:17:38 -05:00
Russ Cox 27c74d3499 spec, runtime, tests: send on closed channel panics
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
2011-01-21 15:07:13 -05:00
Russ Cox 0a5fc261b6 test/chan/doubleselect: fix various races
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
2011-01-21 15:06:44 -05:00
Russ Cox 9b62461a8f gc: allow select case expr = <-c
Fixes #1139.

R=ken2
CC=golang-dev
https://golang.org/cl/2194046
2010-09-27 12:04:21 -04:00
Ian Lance Taylor 8e985dcda6 test: Reduce race conditions in chan/nonblock.go.
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
2010-09-10 15:37:20 -07:00
Rob Pike 4f61fc96b2 test: remove semiocolons.
The ken directory is untouched so we have some examples with explicit semis.

R=gri
CC=golang-dev
https://golang.org/cl/2157041
2010-09-04 10:36:13 +10:00
Russ Cox 3f19d8ae8d gc: empty select
R=ken2
CC=golang-dev
https://golang.org/cl/1871057
2010-08-03 01:07:57 -07:00
Robert Griesemer 47b835e4a8 channel tests: added a couple of tests with closed channels
R=rsc
CC=golang-dev
https://golang.org/cl/1774047
2010-07-14 13:18:57 -07:00
Robert Griesemer d00b479888 select statement: initial set of test cases for corner cases
R=r, rsc
CC=golang-dev
https://golang.org/cl/1772043
2010-07-14 09:55:08 -07:00
Russ Cox ec53627ed5 runtime: correct memory leak in select
* 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
2010-04-01 11:56:18 -07:00
Russ Cox 00f9f0c056 single argument panic
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
2010-03-30 10:34:57 -07:00
Rob Pike 325cf8ef21 delete all uses of panicln by rewriting them using panic or,
in the tests, println+panic.
gofmt some tests too.

R=rsc
CC=golang-dev
https://golang.org/cl/741041
2010-03-24 16:46:53 -07:00
Anh Hai Trinh 16192c2d10 Include an Eratosthenesque concurrent prime sieve to go along with the "naive" version.
R=r
CC=golang-dev
https://golang.org/cl/218046
2010-02-24 16:21:16 +11:00
Adam Langley 50d6c81d4a runtime: fix race condition
(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
2009-12-18 12:25:53 -08:00
Robert Griesemer 4d44d6a3d6 missed a couple of files in test
R=rsc, r
https://golang.org/cl/172045
2009-12-09 21:39:20 -08:00
Robert Griesemer 542099d78f making some more non-gofmt'ed files save for new semicolon rule
R=rsc, r
https://golang.org/cl/171051
2009-12-09 19:27:08 -08:00
Russ Cox ae54cf73ca last round: non-package code
R=r
DELTA=127  (38 added, 3 deleted, 86 changed)
OCL=34640
CL=34650
2009-09-15 12:42:24 -07:00
Rob Pike 74dd0ab670 fix up some irregular indentation
R=rsc
OCL=33382
CL=33391
2009-08-17 13:30:22 -07:00
Russ Cox 5b62b19d43 convert non-pkg go files to whole-package compilation.
mostly removing forward declarations.

R=r
DELTA=138  (2 added, 127 deleted, 9 changed)
OCL=33068
CL=33099
2009-08-12 13:18:54 -07:00
Russ Cox 9dc22b6d6f more 6g reorg; checkpoint.
typecheck.c is now responsible for all type checking
except for assignment and function argument "..."

R=ken
OCL=32661
CL=32667
2009-08-03 11:58:52 -07:00