1
0
mirror of https://github.com/golang/go synced 2024-10-04 15:21:22 -06:00
Commit Graph

7389 Commits

Author SHA1 Message Date
Rob Pike
f4cb96b438 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
2011-10-11 16:41:48 -07:00
Alex Brainman
059c68bf0c 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
2011-10-12 10:29:22 +11:00
Rob Pike
d69b820e01 try: delete
A fun experiment but not carrying its weight.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5246054
2011-10-11 16:17:21 -07:00
Dave Cheney
9691312e53 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
2011-10-11 15:47:00 -04:00
Robert Griesemer
ec7963565a 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
2011-10-11 11:47:24 -07:00
Louis Kruger
690d59fa3e 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
2011-10-11 13:07:32 -04:00
Hector Chu
8584445289 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
2011-10-11 12:57:16 -04:00
Chris Farmiloe
4b749567b8 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
2011-10-11 12:53:16 -04:00
Brad Fitzpatrick
1444a08098 fmt: fix doc typo
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5252050
2011-10-11 08:49:09 -07:00
Andrew Gerrand
8440fdd904 godoc: support multiple examples
gotest: document examples
go/doc: tidy comment

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5235055
2011-10-11 11:11:47 +11:00
Rob Pike
c832ecf03e 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
2011-10-10 12:38:49 -07:00
Nigel Tao
be8b4d943f html: add a Render function.
R=mikesamuel, andybalholm
CC=golang-dev
https://golang.org/cl/5218041
2011-10-10 14:44:37 +11:00
Brad Fitzpatrick
e63fcd613f http: cancel test timers; don't t.Fatalf in other goroutines
R=rsc
CC=golang-dev
https://golang.org/cl/5228041
2011-10-09 17:57:31 -07:00
Luuk van Dijk
b536adbfba 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
2011-10-08 19:37:06 +02:00
Adam Langley
bffadd6bd7 crypto/tls: forgot this file in the last change.
R=bradfitz
CC=golang-dev
https://golang.org/cl/5244042
2011-10-08 10:11:38 -04:00
Adam Langley
7e48cb5ffe 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
2011-10-08 10:06:53 -04:00
Joel Sing
060ffabd18 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
2011-10-09 00:56:13 +11:00
Robert Griesemer
bb51de1cba gofmt: update test.sh
R=r
CC=golang-dev
https://golang.org/cl/5235043
2011-10-07 15:14:37 -07:00
Rob Pike
c09af50213 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
2011-10-07 14:15:16 -07:00
Robert Griesemer
f566fca2b3 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
2011-10-07 12:45:19 -07:00
Robert Griesemer
39b6fb7a19 go/token: remove obsolete comment (cleanup)
R=r
CC=golang-dev
https://golang.org/cl/5235042
2011-10-07 08:54:02 -07:00
Mikio Hara
b5260364b1 net: add File method to IPConn
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5237041
2011-10-07 22:53:12 +09:00
Brad Fitzpatrick
2b95cfbac3 utf8: add Valid and ValidString
R=r, rsc, alex.brainman
CC=golang-dev
https://golang.org/cl/5234041
2011-10-06 22:47:24 -07:00
Robert Griesemer
f198bbc850 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
2011-10-06 21:46:05 -07:00
Nigel Tao
af2070598f 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
2011-10-07 13:33:34 +11:00
Robert Griesemer
5782ea9646 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
2011-10-06 17:37:59 -07:00
Robert Griesemer
ec9ea9a5cb 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
2011-10-06 17:36:00 -07:00
Robert Griesemer
3e46699958 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
2011-10-06 16:07:56 -07:00
Robert Griesemer
a64b2699c4 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
2011-10-06 16:06:23 -07:00
Rob Pike
b3dd32776b template: fix comments with different delimiters.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5208042
2011-10-06 15:21:56 -07:00
Rob Pike
dcf5318990 template: add method Delims to allow alternate action delimiters.
R=golang-dev, rsc, dsymonds
CC=golang-dev
https://golang.org/cl/5209045
2011-10-06 13:30:50 -07:00
Andrew Gerrand
af1ae438b9 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
2011-10-06 11:56:17 -07:00
Brad Fitzpatrick
155e21cc7f 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
2011-10-06 11:00:02 -07:00
Rob Pike
417c42218f gotest: document -test.parallel
R=golang-dev, bradfitz, dsymonds, gri
CC=golang-dev
https://golang.org/cl/5223043
2011-10-06 10:41:52 -07:00
Miki Tebeka
f80d8fbcf0 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
2011-10-06 09:58:36 -07:00
Dmitriy Vyukov
c14b2689f0 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
2011-10-06 18:42:51 +03:00
Russ Cox
ad35cea762 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
2011-10-06 11:30:48 -04:00
Dmitriy Vyukov
5695915833 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
2011-10-06 18:10:14 +03:00
Mikio Hara
504963e6a4 build: clear execute bit from source files
R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/5201042
2011-10-06 18:33:13 +09:00
Wei Guangjing
e7042418c5 cgo: support for mingw-w64 4.5.1 and newer
R=rsc, jp, hectorchu
CC=golang-dev
https://golang.org/cl/4962051
2011-10-06 07:22:48 +01:00
Marcel van Lohuizen
9a8da9d499 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
2011-10-05 14:36:02 -07:00
Robert Griesemer
f7467e85e1 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
2011-10-05 13:04:43 -07:00
Fumitoshi Ukai
9a0a30ec53 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
2011-10-05 10:50:29 -07:00
Marcel van Lohuizen
5844fc1b21 exp/norm: introduced input interface to implement string versions
of methods.

R=r, mpvl
CC=golang-dev
https://golang.org/cl/5166045
2011-10-05 10:44:11 -07:00
Robert Griesemer
0da66a2e90 ebnf: use scanner instead of go/scanner
R=rsc, r
CC=golang-dev
https://golang.org/cl/5192043
2011-10-05 10:34:01 -07:00
Joel Sing
b2f1eba324 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
2011-10-05 13:16:43 -04:00
Rob Pike
457dfd7546 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
2011-10-05 09:47:09 -07:00
Joel Sing
a5f064a3e1 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
2011-10-05 12:08:28 -04:00
Anthony Martin
528ccdc513 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
2011-10-05 12:07:44 -04:00
Ian Lance Taylor
a55de2ba61 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
2011-10-04 21:25:11 -07:00