]> Cypherpunks repositories - gostls13.git/log
gostls13.git
13 years agoebnf, ebnflint: move under exp
Robert Griesemer [Wed, 12 Oct 2011 00:43:10 +0000 (17:43 -0700)]
ebnf, ebnflint: move under exp

pkg/ebnf -> pkg/exp/ebnf
cmd/ebnflint -> pkg/exp/ebnflint

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5188042

13 years agoexp/spdy: move http/spdy to exp/spdy
Brad Fitzpatrick [Tue, 11 Oct 2011 23:45:01 +0000 (16:45 -0700)]
exp/spdy: move http/spdy to exp/spdy

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5238051

13 years agocontainer/vector: delete
Rob Pike [Tue, 11 Oct 2011 23:41:48 +0000 (16:41 -0700)]
container/vector: delete
Slices are better:
http://code.google.com/p/go-wiki/wiki/SliceTricks

R=golang-dev, bradfitz, dsymonds
CC=golang-dev
https://golang.org/cl/5248060

13 years agonet: implement ip protocol name to number resolver for windows
Alex Brainman [Tue, 11 Oct 2011 23:29:22 +0000 (10:29 +1100)]
net: implement ip protocol name to number resolver for windows

Fixes #2215.
Fixes #2216.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/5248055

13 years agotry: delete
Rob Pike [Tue, 11 Oct 2011 23:17:21 +0000 (16:17 -0700)]
try: delete
A fun experiment but not carrying its weight.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5246054

13 years agosyscall: add #ifdefs to fix the manual corrections in ztypes_linux_arm.go
Dave Cheney [Tue, 11 Oct 2011 19:47:00 +0000 (15:47 -0400)]
syscall: add #ifdefs to fix the manual corrections in ztypes_linux_arm.go

Fixes #1998.

ztypes_linux_arm.go has been regenerated on an arm5 debian sid host and
includes a few new constants.

R=golang-dev, mikioh.mikioh, rsc
CC=golang-dev
https://golang.org/cl/5240047

13 years agogodoc: show source code if -src flag is set in command-line mode
Robert Griesemer [Tue, 11 Oct 2011 18:47:24 +0000 (11:47 -0700)]
godoc: show source code if -src flag is set in command-line mode

This also shows the source code of exported functions in server
mode (e.g. pkg/big/?m=src).

Fixes #2360.

R=rsc
CC=golang-dev
https://golang.org/cl/5254057

13 years agocrypto/tls: add 3DES ciphersuites
Louis Kruger [Tue, 11 Oct 2011 17:07:32 +0000 (13:07 -0400)]
crypto/tls: add 3DES ciphersuites

The following ciphersuites are added:
TLS_RSA_WITH_3DES_EDE_CBC_SHA
TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
This change helps conform to the TLS1.1 standard because
the first ciphersuite is "mandatory" in RFC4346

R=golang-dev, agl, rsc
CC=golang-dev
https://golang.org/cl/5164042

13 years agoCONTRIBUTORS: add Louis Kruger (Google CLA)
Russ Cox [Tue, 11 Oct 2011 17:07:01 +0000 (13:07 -0400)]
CONTRIBUTORS: add Louis Kruger (Google CLA)

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5229052

13 years agoruntime: fix crash when returning from syscall during gc
Hector Chu [Tue, 11 Oct 2011 16:57:16 +0000 (12:57 -0400)]
runtime: fix crash when returning from syscall during gc

gp->m can go from non-nil to nil when it re-enters schedule().

R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/5245042

13 years agonet: fix socket leak in case of Dial failure
Chris Farmiloe [Tue, 11 Oct 2011 16:53:16 +0000 (12:53 -0400)]
net: fix socket leak in case of Dial failure

Socket descriptors are not closed when fd.connect() fails during generic socket creation.
After a connection failure [ECONNREFUSED] descriptors are left in SYN_SENT state indefinitely (unless they get an explicit RST). Repeated failed connections will eventually cause your program to hit the user/system max-open-files limit.

Fixes #2349.

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5229047

13 years agofmt: fix doc typo
Brad Fitzpatrick [Tue, 11 Oct 2011 15:49:09 +0000 (08:49 -0700)]
fmt: fix doc typo

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5252050

13 years agogodoc: support multiple examples
Andrew Gerrand [Tue, 11 Oct 2011 00:11:47 +0000 (11:11 +1100)]
godoc: support multiple examples
gotest: document examples
go/doc: tidy comment

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5235055

13 years agogob: avoid one copy for every message written.
Rob Pike [Mon, 10 Oct 2011 19:38:49 +0000 (12:38 -0700)]
gob: avoid one copy for every message written.
Plus the need for a second in-memory buffer.
Plays a bit fast and loose with the contents of a byte buffer,
but saves a potentially huge allocation. The gotest
run is about 10% faster overall after this change.

R=golang-dev, r, gri
CC=golang-dev
https://golang.org/cl/5236043

13 years agoA+C: Chris Farmiloe (individual CLA)
Mikio Hara [Mon, 10 Oct 2011 11:48:24 +0000 (20:48 +0900)]
A+C: Chris Farmiloe (individual CLA)

R=adg
CC=golang-dev
https://golang.org/cl/5237058

13 years agohtml: add a Render function.
Nigel Tao [Mon, 10 Oct 2011 03:44:37 +0000 (14:44 +1100)]
html: add a Render function.

R=mikesamuel, andybalholm
CC=golang-dev
https://golang.org/cl/5218041

13 years agohttp: cancel test timers; don't t.Fatalf in other goroutines
Brad Fitzpatrick [Mon, 10 Oct 2011 00:57:31 +0000 (17:57 -0700)]
http: cancel test timers; don't t.Fatalf in other goroutines

R=rsc
CC=golang-dev
https://golang.org/cl/5228041

13 years agodoc: fix tutorial and Makefile PATH without dot
Andrew Gerrand [Mon, 10 Oct 2011 00:16:04 +0000 (11:16 +1100)]
doc: fix tutorial and Makefile PATH without dot

Fixes #2351.

R=r, bradfitz
CC=golang-dev
https://golang.org/cl/5235056

13 years agodashboard: include last 100 lines in build failure mail
Andrew Gerrand [Sat, 8 Oct 2011 19:50:21 +0000 (06:50 +1100)]
dashboard: include last 100 lines in build failure mail

R=golang-dev, rsc, iant, robert.hencke
CC=golang-dev
https://golang.org/cl/5235041

13 years agogc: changes to export format in preparation for inlining.
Luuk van Dijk [Sat, 8 Oct 2011 17:37:06 +0000 (19:37 +0200)]
gc: changes to export format in preparation for inlining.

string literals used as package qualifiers are now prefixed with '@'
which obviates the need for the extra ':' before tags.

R=rsc, gri, lvd
CC=golang-dev
https://golang.org/cl/5129057

13 years agocrypto/tls: forgot this file in the last change.
Adam Langley [Sat, 8 Oct 2011 14:11:38 +0000 (10:11 -0400)]
crypto/tls: forgot this file in the last change.

R=bradfitz
CC=golang-dev
https://golang.org/cl/5244042

13 years agocrypto/tls: add server side SNI support.
Adam Langley [Sat, 8 Oct 2011 14:06:53 +0000 (10:06 -0400)]
crypto/tls: add server side SNI support.

With this in place, a TLS server is capable of selecting the correct
certificate based on the client's ServerNameIndication extension.

The need to call Config.BuildNameToCertificate is unfortunate, but
adding a sync.Once to the Config structure made it uncopyable and I
felt that was too high a price to pay. Parsing the leaf certificates
in each handshake was too inefficient to consider.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5151048

13 years agoruntime: improve locking on openbsd
Joel Sing [Sat, 8 Oct 2011 13:56:13 +0000 (00:56 +1100)]
runtime: improve locking on openbsd

Implement a locking model based on the current linux model - a
tri-state mutex with active spinning, passive spinning and sleeping.

R=golang-dev, dvyukov, rsc
CC=golang-dev
https://golang.org/cl/4974043

13 years agogofmt: update test.sh
Robert Griesemer [Fri, 7 Oct 2011 22:14:37 +0000 (15:14 -0700)]
gofmt: update test.sh

R=r
CC=golang-dev
https://golang.org/cl/5235043

13 years agotesting: fix time reported for failing tests.
Rob Pike [Fri, 7 Oct 2011 21:15:16 +0000 (14:15 -0700)]
testing: fix time reported for failing tests.
t.ns was hanging after recent changes.

R=gri, rsc
CC=golang-dev
https://golang.org/cl/5237044

13 years agogodoc: show "unexported" declarations when executing "godoc builtin"
Robert Griesemer [Fri, 7 Oct 2011 19:45:19 +0000 (12:45 -0700)]
godoc: show "unexported" declarations when executing "godoc builtin"

Was never working correctly when executing from the command-line.

R=r
CC=golang-dev
https://golang.org/cl/5236042

13 years agogo/token: remove obsolete comment (cleanup)
Robert Griesemer [Fri, 7 Oct 2011 15:54:02 +0000 (08:54 -0700)]
go/token: remove obsolete comment (cleanup)

R=r
CC=golang-dev
https://golang.org/cl/5235042

13 years agonet: add File method to IPConn
Mikio Hara [Fri, 7 Oct 2011 13:53:12 +0000 (22:53 +0900)]
net: add File method to IPConn

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5237041

13 years agoutf8: add Valid and ValidString
Brad Fitzpatrick [Fri, 7 Oct 2011 05:47:24 +0000 (22:47 -0700)]
utf8: add Valid and ValidString

R=r, rsc, alex.brainman
CC=golang-dev
https://golang.org/cl/5234041

13 years agogodoc: use scanner instead of go/scanner for ebnf processing of spec
Robert Griesemer [Fri, 7 Oct 2011 04:46:05 +0000 (21:46 -0700)]
godoc: use scanner instead of go/scanner for ebnf processing of spec

Also: Fewer calls to flush for faster processing (once per identifier
or error instead of once per token).

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5236041

13 years agoimage: delete obsolete color.go
Nigel Tao [Fri, 7 Oct 2011 02:33:34 +0000 (13:33 +1100)]
image: delete obsolete color.go

I accidentally left it off of https://golang.org/cl/5132048/.

R=r
CC=golang-dev
https://golang.org/cl/5202042

13 years agogo/token: document deserialization property
Robert Griesemer [Fri, 7 Oct 2011 00:37:59 +0000 (17:37 -0700)]
go/token: document deserialization property

FileSet deserialization (Read) uses its own instance of a gob decoder.
If the FileSet data may be followed by other data on the reader, Read
may consume too much data that is lost unless the reader implements
ReadByte.

Also: Minor internal refactoring for symmetry.

R=r
CC=golang-dev
https://golang.org/cl/5233041

13 years agogodoc: use a bufio.Buffer to read search index
Robert Griesemer [Fri, 7 Oct 2011 00:36:00 +0000 (17:36 -0700)]
godoc: use a bufio.Buffer to read search index

Also: Minor refactoring for cleanliness and symmetry.

Fixes #2286.

R=r
CC=golang-dev
https://golang.org/cl/5232041

13 years agogo/ast: don't remove function bodies when filtering exports
Robert Griesemer [Thu, 6 Oct 2011 23:07:56 +0000 (16:07 -0700)]
go/ast: don't remove function bodies when filtering exports

This is a semantic but no API change. It is a cleaner
implementation of pure filtering. Applications that
need function bodies stripped can easily do this them-
selves.

R=rsc
CC=golang-dev
https://golang.org/cl/5206046

13 years agogodoc: documentation for all (not just exported) declarations
Robert Griesemer [Thu, 6 Oct 2011 23:06:23 +0000 (16:06 -0700)]
godoc: documentation for all (not just exported) declarations

Removed the URL form parameter "f=text" in favor of a more
flexible mode parameter "m" which now accepts a list of mode
flags as documented in doc.go.

Fixes #1784.

R=rsc
CC=golang-dev
https://golang.org/cl/5227041

13 years agotag weekly.2011-10-06
Andrew Gerrand [Thu, 6 Oct 2011 23:01:57 +0000 (16:01 -0700)]
tag weekly.2011-10-06

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5231041

13 years agoweekly.2011-10-06 weekly.2011-10-06
Andrew Gerrand [Thu, 6 Oct 2011 22:56:02 +0000 (15:56 -0700)]
weekly.2011-10-06

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5207044

13 years agotemplate: fix comments with different delimiters.
Rob Pike [Thu, 6 Oct 2011 22:21:56 +0000 (15:21 -0700)]
template: fix comments with different delimiters.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5208042

13 years agotemplate: add method Delims to allow alternate action delimiters.
Rob Pike [Thu, 6 Oct 2011 20:30:50 +0000 (13:30 -0700)]
template: add method Delims to allow alternate action delimiters.

R=golang-dev, rsc, dsymonds
CC=golang-dev
https://golang.org/cl/5209045

13 years agodoc: remove errant console.log from godocs.js
Andrew Gerrand [Thu, 6 Oct 2011 20:12:11 +0000 (13:12 -0700)]
doc: remove errant console.log from godocs.js

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5211045

13 years agogo/doc, godoc, gotest: support for reading example documentation
Andrew Gerrand [Thu, 6 Oct 2011 18:56:17 +0000 (11:56 -0700)]
go/doc, godoc, gotest: support for reading example documentation

This CL introduces the go.Example type and go.Examples functions that
are used to represent and extract code samples from Go source.

They should be of the form:

// Output of this function.
func ExampleFoo() {
        fmt.Println("Output of this function.")
}

It also modifies godoc to read example code from _test.go files,
and include them in the HTML output with JavaScript-driven toggles.

It also implements testing of example functions with gotest.
The stdout/stderr is compared against the output comment on the
function.

This CL includes examples for the sort.Ints function and the
sort.SortInts type. After patching this CL in and re-building go/doc
and godoc, try
        godoc -http=localhost:6060
and visit http://localhost:6060/pkg/sort/

R=gri, r, rsc
CC=golang-dev
https://golang.org/cl/5137041

13 years agoexec: add Command.ExtraFiles
Brad Fitzpatrick [Thu, 6 Oct 2011 18:00:02 +0000 (11:00 -0700)]
exec: add Command.ExtraFiles

Allows passing extra fds to the child process.

Fixes #2329

R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/5162050

13 years agoEffective Go: IntArray -> IntSlice
Rob Pike [Thu, 6 Oct 2011 17:46:18 +0000 (10:46 -0700)]
Effective Go: IntArray -> IntSlice
Fixes #2336.

R=golang-dev, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/5222042

13 years agogotest: document -test.parallel
Rob Pike [Thu, 6 Oct 2011 17:41:52 +0000 (10:41 -0700)]
gotest: document -test.parallel

R=golang-dev, bradfitz, dsymonds, gri
CC=golang-dev
https://golang.org/cl/5223043

13 years agotesting: Add support for running tests in parallel (t.Parallel API).
Miki Tebeka [Thu, 6 Oct 2011 16:58:36 +0000 (09:58 -0700)]
testing: Add support for running tests in parallel (t.Parallel API).

See discussion at https://groups.google.com/d/topic/golang-dev/RAKiqi44GEU/discussion

R=golang-dev, bradfitz, dvyukov, rogpeppe, r, r, borman
CC=golang-dev
https://golang.org/cl/5071044

13 years agoC+A: Miki Tebeka miki.tebeka@gmail.com
Rob Pike [Thu, 6 Oct 2011 16:54:39 +0000 (09:54 -0700)]
C+A: Miki Tebeka miki.tebeka@gmail.com

R=golang-dev, gri
CC=golang-dev, miki.tebeka
https://golang.org/cl/5225042

13 years agoruntime: faster finalizers
Dmitriy Vyukov [Thu, 6 Oct 2011 15:42:51 +0000 (18:42 +0300)]
runtime: faster finalizers

Linux/amd64, 2 x Intel Xeon E5620, 8 HT cores, 2.40GHz
benchmark                    old ns/op    new ns/op    delta
BenchmarkFinalizer              420.00       261.00  -37.86%
BenchmarkFinalizer-2            985.00       201.00  -79.59%
BenchmarkFinalizer-4           1077.00       244.00  -77.34%
BenchmarkFinalizer-8           1155.00       180.00  -84.42%
BenchmarkFinalizer-16          1182.00       184.00  -84.43%

BenchmarkFinalizerRun          2128.00      1378.00  -35.24%
BenchmarkFinalizerRun-2        1655.00      1418.00  -14.32%
BenchmarkFinalizerRun-4        1634.00      1522.00   -6.85%
BenchmarkFinalizerRun-8        2213.00      1581.00  -28.56%
BenchmarkFinalizerRun-16       2424.00      1599.00  -34.03%

Darwin/amd64, Intel L9600, 2 cores, 2.13GHz
benchmark                    old ns/op    new ns/op    delta
BenchmarkChanCreation          1451.00       926.00  -36.18%
BenchmarkChanCreation-2        3124.00      1412.00  -54.80%
BenchmarkChanCreation-4        6121.00      2628.00  -57.07%

BenchmarkFinalizer              684.00       420.00  -38.60%
BenchmarkFinalizer-2          11195.00       398.00  -96.44%
BenchmarkFinalizer-4          15862.00       654.00  -95.88%

BenchmarkFinalizerRun          2025.00      1397.00  -31.01%
BenchmarkFinalizerRun-2        3920.00      1447.00  -63.09%
BenchmarkFinalizerRun-4        9471.00      1545.00  -83.69%

R=golang-dev, cw, rsc
CC=golang-dev
https://golang.org/cl/4963057

13 years agoruntime: fix malloc sampling bug
Russ Cox [Thu, 6 Oct 2011 15:30:48 +0000 (11:30 -0400)]
runtime: fix malloc sampling bug

The malloc sample trigger was not being set in a
new m, so the first allocation in each new m - the
goroutine structure - was being sampled with
probability 1 instead of probability sizeof(G)/rate,
an oversampling of about 5000x for the default
rate of 1 MB.  This bug made pprof graphs show
far more G allocations than there actually were.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5224041

13 years agoruntime: fix spurious deadlock reporting
Dmitriy Vyukov [Thu, 6 Oct 2011 15:10:14 +0000 (18:10 +0300)]
runtime: fix spurious deadlock reporting
Fixes #2337.
Unfortunate sequence of events is:
1. maxcpu=2, mcpu=1, grunning=1
2. starttheworld creates an extra M:
   maxcpu=2, mcpu=2, grunning=1
4. the goroutine calls runtime.GOMAXPROCS(1)
   maxcpu=1, mcpu=2, grunning=1
5. since it sees mcpu>maxcpu, it calls gosched()
6. schedule() deschedules the goroutine:
   maxcpu=1, mcpu=1, grunning=0
7. schedule() call getnextandunlock() which
   fails to pick up the goroutine again,
   because canaddcpu() fails, because mcpu==maxcpu
8. then it sees that grunning==0,
   reports deadlock and terminates

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5191044

13 years agobuild: clear execute bit from source files
Mikio Hara [Thu, 6 Oct 2011 09:33:13 +0000 (18:33 +0900)]
build: clear execute bit from source files

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/5201042

13 years agocgo: support for mingw-w64 4.5.1 and newer
Wei Guangjing [Thu, 6 Oct 2011 06:22:48 +0000 (07:22 +0100)]
cgo: support for mingw-w64 4.5.1 and newer

R=rsc, jp, hectorchu
CC=golang-dev
https://golang.org/cl/4962051

13 years agoexp/norm: LastBoundary is used in preparation for an append operation. It seems
Marcel van Lohuizen [Wed, 5 Oct 2011 21:36:02 +0000 (14:36 -0700)]
exp/norm: LastBoundary is used in preparation for an append operation. It seems
therefore unlikely that there is a good use for its string version
LastBoundaryInString. Yet, the implemenation of this method would complicate
things a bit as it would require the introduction for another interface and
some duplication of code. Removing it seems a better choice.

R=r
CC=golang-dev
https://golang.org/cl/5182044

13 years agotag release.r60.2
Andrew Gerrand [Wed, 5 Oct 2011 21:33:18 +0000 (14:33 -0700)]
tag release.r60.2

R=bradfitz
CC=golang-dev
https://golang.org/cl/5208041

13 years agodoc: document r60.2
Andrew Gerrand [Wed, 5 Oct 2011 20:59:39 +0000 (13:59 -0700)]
doc: document r60.2

R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/5204041

13 years agoencoding/binary: added benchmarks
Robert Griesemer [Wed, 5 Oct 2011 20:04:43 +0000 (13:04 -0700)]
encoding/binary: added benchmarks

binary.BenchmarkPutUvarint32 20000000  85.6 ns/op
binary.BenchmarkPutUvarint64 10000000 299   ns/op

R=rsc
CC=golang-dev
https://golang.org/cl/5148049

13 years agodoc: link to Czech translation of The Laws of Reflection
Andrew Gerrand [Wed, 5 Oct 2011 19:45:56 +0000 (12:45 -0700)]
doc: link to Czech translation of The Laws of Reflection

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5190045

13 years agodoc: link to A Tour of Go
Andrew Gerrand [Wed, 5 Oct 2011 18:12:07 +0000 (11:12 -0700)]
doc: link to A Tour of Go

R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/5181045

13 years agowebsocket: add hybi-13 support
Fumitoshi Ukai [Wed, 5 Oct 2011 17:50:29 +0000 (10:50 -0700)]
websocket: add hybi-13 support

Major changes between hybi-08 and hybi-13
- hybi-08 uses Sec-WebSocket-Origin, but hybi-13 uses Origin
- hybi-13 introduces new close status codes.

hybi-17 spec (editorial changes of hybi-13) mentions
- if a server doesn't support the requested version, it MUST respond
  with Sec-WebSocket-Version headers containing all available versions.
- client MUST close the connection upon receiving a masked frame
- server MUST close the connection upon receiving a non-masked frame
note that hybi-17 still uses "Sec-WebSocket-Version: 13"

see http://code.google.com/p/pywebsocket/wiki/WebSocketProtocolSpec
for changes between spec drafts.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5147043

13 years agodocumentation: Debugging Go code with GDB tutorial.
Luuk van Dijk [Wed, 5 Oct 2011 17:49:23 +0000 (10:49 -0700)]
documentation: Debugging Go code with GDB tutorial.

R=adg, cw, lvd
CC=golang-dev
https://golang.org/cl/5168046

13 years agoexp/norm: introduced input interface to implement string versions
Marcel van Lohuizen [Wed, 5 Oct 2011 17:44:11 +0000 (10:44 -0700)]
exp/norm: introduced input interface to implement string versions
of methods.

R=r, mpvl
CC=golang-dev
https://golang.org/cl/5166045

13 years agoebnf: use scanner instead of go/scanner
Robert Griesemer [Wed, 5 Oct 2011 17:34:01 +0000 (10:34 -0700)]
ebnf: use scanner instead of go/scanner

R=rsc, r
CC=golang-dev
https://golang.org/cl/5192043

13 years agoruntime: set runtime ncpu on openbsd
Joel Sing [Wed, 5 Oct 2011 17:16:43 +0000 (13:16 -0400)]
runtime: set runtime ncpu on openbsd

Set the runtime ncpu based on the hw.ncpu sysctl.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5191043

13 years agogob: when possible, allow sequential decoders on the same input stream.
Rob Pike [Wed, 5 Oct 2011 16:47:09 +0000 (09:47 -0700)]
gob: when possible, allow sequential decoders on the same input stream.
This can work only if there is no type info required to initialize the decoder,
but it's easy and gains a few percent in the basic benchmarks by avoiding
bufio when it's a bytes.Buffer - a testing-only scenario, I admit.
Add a comment about what Decode expects from the input.

R=rsc
CC=golang-dev
https://golang.org/cl/5165048

13 years agomisc/emacs: fix indent bug
Russ Cox [Wed, 5 Oct 2011 16:27:23 +0000 (12:27 -0400)]
misc/emacs: fix indent bug

Must use case-sensitive search to identify keywords.

Fixes #2287.

R=bradfitz
CC=golang-dev
https://golang.org/cl/5182043

13 years agocodereview: fix for Mercurial 1.9.2
Russ Cox [Wed, 5 Oct 2011 16:08:41 +0000 (12:08 -0400)]
codereview: fix for Mercurial 1.9.2

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5127052

13 years agogc: limit helper threads based on ncpu
Joel Sing [Wed, 5 Oct 2011 16:08:28 +0000 (12:08 -0400)]
gc: limit helper threads based on ncpu

When ncpu < 2, work.nproc is always 1 which results in infinite helper
threads being created if gomaxprocs > 1 and MaxGcproc > 1. Avoid this
by using the same limits as imposed helpgc().

R=golang-dev, rsc, dvyukov
CC=golang-dev
https://golang.org/cl/5176044

13 years agoruntime: fix Plan 9 build
Anthony Martin [Wed, 5 Oct 2011 16:07:44 +0000 (12:07 -0400)]
runtime: fix Plan 9 build

This change adds the osyield and usleep
functions and code to read the number of
processors from /dev/sysstat.

I also changed SysAlloc to return nil
when brk fails (it was returning -1).

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5177049

13 years agocodereview: fix hg change in Windows console
Yasuhiro Matsumoto [Wed, 5 Oct 2011 16:07:13 +0000 (12:07 -0400)]
codereview: fix hg change in Windows console

lib/codereview: Unable to use vim for 'hg change' from windows console
reload(sys) break workaround for windows.
see:
http://mercurial.selenic.com/bts/issue2888
http://mercurial.selenic.com/bts/issue1452
Also does not work with backslash paths.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5150054

13 years ago5l/6l/8l: add a DT_DEBUG dynamic tag to a dynamic ELF binary
Ian Lance Taylor [Wed, 5 Oct 2011 04:25:11 +0000 (21:25 -0700)]
5l/6l/8l: add a DT_DEBUG dynamic tag to a dynamic ELF binary

This requires making the .dynamic section writable, as the
dynamic linker will change the value of the DT_DEBUG tag at
runtime.  The DT_DEBUG tag is used by gdb to find all loaded
shared libraries.

R=rsc
CC=golang-dev
https://golang.org/cl/5189044

13 years agopkg/syscall: add Mkfifo for linux platforms
Paul Borman [Tue, 4 Oct 2011 20:58:31 +0000 (13:58 -0700)]
pkg/syscall: add Mkfifo for linux platforms

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5131055

13 years agowebsocket: better error message in a test
Brad Fitzpatrick [Tue, 4 Oct 2011 20:46:03 +0000 (13:46 -0700)]
websocket: better error message in a test

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5185045

13 years agotime: make month/day name comparisons case insenstive
Paul Borman [Tue, 4 Oct 2011 19:52:30 +0000 (12:52 -0700)]
time: make month/day name comparisons case insenstive

Fixes #2324.

R=r, r
CC=golang-dev
https://golang.org/cl/5180044

13 years ago5g, 6g, 8g: fix loop finding bug, squash jmps
Russ Cox [Tue, 4 Oct 2011 19:06:16 +0000 (15:06 -0400)]
5g, 6g, 8g: fix loop finding bug, squash jmps

The loop recognizer uses the standard dominance
frontiers but gets confused by dead code, which
has a (not explicitly set) rpo number of 0, meaning it
looks like the head of the function, so it dominates
everything.  If the loop recognizer encounters dead
code while tracking backward through the graph
it fails to recognize where it started as a loop, and
then the optimizer does not registerize values loaded
inside that loop.  Fix by checking rpo against rpo2r.

Separately, run a quick pass over the generated
code to squash JMPs to JMP instructions, which
are convenient to emit during code generation but
difficult to read when debugging the -S output.
A side effect of this pass is to eliminate dead code,
so the output files may be slightly smaller and the
optimizer may have less work to do.
There is no semantic effect, because the linkers
flatten JMP chains and delete dead instructions
when laying out the final code.  Doing it here too
just makes the -S output easier to read and more
like what the final binary will contain.

The "dead code breaks loop finding" bug is thus
fixed twice over.  It seemed prudent to fix loopit
separately just in case dead code ever sneaks back
in for one reason or another.

R=ken2
CC=golang-dev
https://golang.org/cl/5190043

13 years agopath/filepath: added Rel as the complement of Abs
Gustavo Niemeyer [Tue, 4 Oct 2011 14:27:06 +0000 (11:27 -0300)]
path/filepath: added Rel as the complement of Abs

R=golang-dev, rsc, gustavo, r, borman
CC=golang-dev
https://golang.org/cl/4981049

13 years agocgo: allow Window's specific path characters in flag directives.
Joe Poirier [Tue, 4 Oct 2011 04:07:28 +0000 (15:07 +1100)]
cgo: allow Window's specific path characters in flag directives.

Example: #cgo windows LDFLAGS: -LC:\\WINDOWS\\system32

R=alex.brainman, go.peter.90, golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5154042

13 years agoFix build, disabling flaky registerization test.
Brad Fitzpatrick [Tue, 4 Oct 2011 00:25:55 +0000 (17:25 -0700)]
Fix build, disabling flaky registerization test.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5179045

13 years agoimage: spin off a new color package out of the image package.
Nigel Tao [Tue, 4 Oct 2011 00:09:03 +0000 (11:09 +1100)]
image: spin off a new color package out of the image package.

The spin-off renames some types. The new names are simply better:
image.Color              -> color.Color
image.ColorModel         -> color.Model
image.ColorModelFunc     -> color.ModelFunc
image.PalettedColorModel -> color.Palette
image.RGBAColor          -> color.RGBA
image.RGBAColorModel     -> color.RGBAModel
image.RGBA64Color        -> color.RGBA64
image.RGBA64ColorModel   -> color.RGBA64Model
(similarly for NRGBAColor, GrayColorModel, etc)

The image.ColorImage type stays in the image package, but is renamed:
image.ColorImage -> image.Uniform

The image.Image implementations (image.RGBA, image.RGBA64, image.NRGBA,
image.Alpha, etc) do not change their name, and gain a nice symmetry:
an image.RGBA is an image of color.RGBA, etc.

The image.Black, image.Opaque uniform images remain unchanged (although
their type is renamed from image.ColorImage to image.Uniform). The
corresponding color types (color.Black, color.Opaque, etc) are new.

Nothing in the image/ycbcr is renamed yet. The ycbcr.YCbCrColor and
ycbcr.YCbCrImage types will eventually migrate to color.YCbCr and
image.YCbCr, but that will be a separate CL.

R=r, bsiegert
CC=golang-dev
https://golang.org/cl/5132048

13 years agodoc: update tutorial.
Rob Pike [Mon, 3 Oct 2011 23:18:47 +0000 (16:18 -0700)]
doc: update tutorial.
Fix for new regexp library ($ isn't end of line any more).
Don't assume . is in PATH.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5175052

13 years agostrings: implement a faster byte->string Replacer
Brad Fitzpatrick [Mon, 3 Oct 2011 22:19:04 +0000 (15:19 -0700)]
strings: implement a faster byte->string Replacer

This implements a replacer for when all old strings are single
bytes, but new values are not.

BenchmarkHTMLEscapeNew   1000000   1090 ns/op
BenchmarkHTMLEscapeOld   1000000   2049 ns/op

R=rsc
CC=golang-dev
https://golang.org/cl/5176043

13 years ago5g, 6g, 8g: registerize variables again
Russ Cox [Mon, 3 Oct 2011 21:46:36 +0000 (17:46 -0400)]
5g, 6g, 8g: registerize variables again

My previous CL:

changeset:   9645:ce2e5f44b310
user:        Russ Cox <rsc@golang.org>
date:        Tue Sep 06 10:24:21 2011 -0400
summary:     gc: unify stack frame layout

introduced a bug wherein no variables were
being registerized, making Go programs 2-3x
slower than they had been before.

This CL fixes that bug (along with some others
it was hiding) and adds a test that optimization
makes at least one test case faster.

R=ken2
CC=golang-dev
https://golang.org/cl/5174045

13 years agostrings: implement a faster byte->byte Replacer
Brad Fitzpatrick [Mon, 3 Oct 2011 20:12:01 +0000 (13:12 -0700)]
strings: implement a faster byte->byte Replacer

When all old & new string values are single bytes,
byteReplacer is now used, instead of the generic
algorithm.

BenchmarkGenericMatch       10000  102519 ns/op
BenchmarkByteByteMatch    1000000    2178 ns/op

fast path, when nothing matches:
BenchmarkByteByteNoMatch  1000000    1109 ns/op

comparisons to multiple Replace calls:
BenchmarkByteByteReplaces  100000   16164 ns/op

comparison to strings.Map:
BenchmarkByteByteMap       500000    5454 ns/op

R=rsc
CC=golang-dev
https://golang.org/cl/5175050

13 years agoruntime: fix usleep on linux/386 and re-enable parallel gc
Hector Chu [Mon, 3 Oct 2011 18:08:59 +0000 (19:08 +0100)]
runtime: fix usleep on linux/386 and re-enable parallel gc

R=golang-dev, jsing, alex.brainman, cw, rsc
CC=golang-dev
https://golang.org/cl/5166047

13 years agoruntime: implement runtime usleep for openbsd
Joel Sing [Sat, 1 Oct 2011 18:58:36 +0000 (11:58 -0700)]
runtime: implement runtime usleep for openbsd

R=golang-dev, mikioh.mikioh, hectorchu
CC=golang-dev
https://golang.org/cl/5173043

13 years agoruntime: fix map memory leak
Russ Cox [Sat, 1 Oct 2011 17:00:53 +0000 (13:00 -0400)]
runtime: fix map memory leak

The map implementation was using the C idiom of using
a pointer just past the end of its table as a limit pointer.
Unfortunately, the garbage collector sees that pointer as
pointing at the block adjacent to the map table, pinning
in memory a block that would otherwise be freed.

Fix by making limit pointer point at last valid entry, not
just past it.

Reviewed by Mike Burrows.

R=golang-dev, bradfitz, lvd, r
CC=golang-dev
https://golang.org/cl/5158045

13 years agosyscall: update multicast socket options for darwin, freebsd, linux, openbsd
Mikio Hara [Sat, 1 Oct 2011 09:45:06 +0000 (18:45 +0900)]
syscall: update multicast socket options for darwin, freebsd, linux, openbsd

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/5137042

13 years agofreebsd: Add stubs for runtime·osyield and runtime·usleep.
David Symonds [Fri, 30 Sep 2011 23:39:10 +0000 (16:39 -0700)]
freebsd: Add stubs for runtime·osyield and runtime·usleep.

These don't do anything useful; they are just here to fix the build.

R=golang-dev
TBR=r
CC=golang-dev
https://golang.org/cl/5154048

13 years agoio: rename Copyn to CopyN.
David Symonds [Fri, 30 Sep 2011 20:13:39 +0000 (13:13 -0700)]
io: rename Copyn to CopyN.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5157045

13 years agoruntime: disable parallel gc
Russ Cox [Fri, 30 Sep 2011 18:59:46 +0000 (14:59 -0400)]
runtime: disable parallel gc

Breaks on Linux/386 during parallel sync tests.

TBR=r
CC=golang-dev
https://golang.org/cl/5168044

13 years agoruntime: fix windows build
Hector Chu [Fri, 30 Sep 2011 18:33:13 +0000 (11:33 -0700)]
runtime: fix windows build

Add osyield and usleep as required by recent GC changes.

R=golang-dev, r, dsymonds, rsc, r
CC=golang-dev
https://golang.org/cl/5156042

13 years agoindex/suffixarray: 4.5x faster index serialization (to memory)
Robert Griesemer [Fri, 30 Sep 2011 18:31:28 +0000 (11:31 -0700)]
index/suffixarray: 4.5x faster index serialization (to memory)

Benchmark results (best of 3 runs):

old: suffixarray.BenchmarkSaveRestore        1 1931909000 ns/op   28.21 MB/s
new: suffixarray.BenchmarkSaveRestore        5  429721800 ns/op  117.14 MB/s

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5161043

13 years agoruntime: fix darwin build
Rob Pike [Fri, 30 Sep 2011 17:52:36 +0000 (10:52 -0700)]
runtime: fix darwin build
Add place holder for runtime.osyield.

R=golang-dev
CC=golang-dev
https://golang.org/cl/5149049

13 years agoruntime: parallelize garbage collector mark + sweep
Russ Cox [Fri, 30 Sep 2011 13:40:01 +0000 (09:40 -0400)]
runtime: parallelize garbage collector mark + sweep

Running test/garbage/parser.out.

On a 4-core Lenovo X201s (Linux):
31.12u 0.60s 31.74r   1 cpu, no atomics
32.27u 0.58s 32.86r   1 cpu, atomic instructions
33.04u 0.83s 27.47r   2 cpu

On a 16-core Xeon (Linux):
33.08u 0.65s 33.80r   1 cpu, no atomics
34.87u 1.12s 29.60r   2 cpu
36.00u 1.87s 28.43r   3 cpu
36.46u 2.34s 27.10r   4 cpu
38.28u 3.85s 26.92r   5 cpu
37.72u 5.25s 26.73r  6 cpu
39.63u 7.11s 26.95r  7 cpu
39.67u 8.10s 26.68r  8 cpu

On a 2-core MacBook Pro Core 2 Duo 2.26 (circa 2009, MacBookPro5,5):
39.43u 1.45s 41.27r   1 cpu, no atomics
43.98u 2.95s 38.69r   2 cpu

On a 2-core Mac Mini Core 2 Duo 1.83 (circa 2008; Macmini2,1):
48.81u 2.12s 51.76r   1 cpu, no atomics
57.15u 4.72s 51.54r   2 cpu

The handoff algorithm is really only good for two cores.
Beyond that we will need to so something more sophisticated,
like have each core hand off to the next one, around a circle.
Even so, the code is a good checkpoint; for now we'll limit the
number of gc procs to at most 2.

R=dvyukov
CC=golang-dev
https://golang.org/cl/4641082

13 years agoexp/template/html: avoid redundant escaping directives.
Mike Samuel [Fri, 30 Sep 2011 04:31:41 +0000 (21:31 -0700)]
exp/template/html: avoid redundant escaping directives.

This is a possible optimization.  I'm not sure the complexity is worth it.
The new benchmark in escape_test is 46us without and 35us with the optimization.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5168041

13 years agodoc: link to image/draw blog post.
Nigel Tao [Fri, 30 Sep 2011 03:11:20 +0000 (13:11 +1000)]
doc: link to image/draw blog post.

R=adg
TBR=adg
CC=golang-dev
https://golang.org/cl/5154046

13 years agoexp/template/html: simplify URL filtering
Mike Samuel [Fri, 30 Sep 2011 01:09:11 +0000 (18:09 -0700)]
exp/template/html: simplify URL filtering

This removes a few cases from escapeAction and clarifies the
responsibilities of urlFilter which no longer does any
escaping or normalization.  It is now solely a filter.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5162043

13 years agoexp/sql{,/driver}: new database packages
Brad Fitzpatrick [Thu, 29 Sep 2011 23:12:21 +0000 (16:12 -0700)]
exp/sql{,/driver}: new database packages

R=gustavo, rsc, borman, dave, kevlar, nigeltao, dvyukov, kardianos, fw, r, r, david.crawshaw
CC=golang-dev
https://golang.org/cl/4973055

13 years agoio/ioutil: add a comment on why devNull is a ReaderFrom
Brad Fitzpatrick [Thu, 29 Sep 2011 22:35:01 +0000 (15:35 -0700)]
io/ioutil: add a comment on why devNull is a ReaderFrom

... protects this optimization from future well-meaning
Gophers looking to delete unused code. :)

R=gri
CC=golang-dev
https://golang.org/cl/5165041

13 years agogo spec: remove notes about gccgo limitations, now fixed
Ian Lance Taylor [Thu, 29 Sep 2011 21:50:55 +0000 (14:50 -0700)]
go spec: remove notes about gccgo limitations, now fixed

R=gri
CC=golang-dev
https://golang.org/cl/5164041

13 years agoruntime: gdb support, fix pretty printing of channels.
Luuk van Dijk [Thu, 29 Sep 2011 19:07:38 +0000 (12:07 -0700)]
runtime: gdb support, fix pretty printing of channels.

The type to cast the elements to was stolen from a field
that's no longer there.

R=rsc
CC=golang-dev
https://golang.org/cl/5143050

13 years agofmt: replace channel cache with slice.
Rob Pike [Thu, 29 Sep 2011 18:23:06 +0000 (11:23 -0700)]
fmt: replace channel cache with slice.
Simpler concept, and it turns a queue into a stack.
Speeds up benchmarks noticeably.

Before:
fmt_test.BenchmarkSprintfEmpty 10000000        282 ns/op
fmt_test.BenchmarkSprintfString  2000000        910 ns/op
fmt_test.BenchmarkSprintfInt  5000000        723 ns/op
fmt_test.BenchmarkSprintfIntInt  1000000       1071 ns/op
fmt_test.BenchmarkSprintfPrefixedInt  1000000       1108 ns/op
fmt_test.BenchmarkScanInts     1000    2239510 ns/op
fmt_test.BenchmarkScanRecursiveInt     1000    2365432 ns/op

After:
fmt_test.BenchmarkSprintfEmpty 10000000        232 ns/op
fmt_test.BenchmarkSprintfString  2000000        837 ns/op
fmt_test.BenchmarkSprintfInt  5000000        590 ns/op
fmt_test.BenchmarkSprintfIntInt  2000000        910 ns/op
fmt_test.BenchmarkSprintfPrefixedInt  2000000        996 ns/op
fmt_test.BenchmarkScanInts     1000    2210715 ns/op
fmt_test.BenchmarkScanRecursiveInt     1000    2367800 ns/op

R=rsc, r
CC=golang-dev
https://golang.org/cl/5151044