]> Cypherpunks repositories - gostls13.git/log
gostls13.git
12 years agodatabase/sql: document non-open of Open; add Ping
Brad Fitzpatrick [Thu, 14 Mar 2013 21:06:46 +0000 (14:06 -0700)]
database/sql: document non-open of Open; add Ping

Fixes #4804

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

12 years agoruntime, net: fix arm build
Russ Cox [Thu, 14 Mar 2013 19:42:25 +0000 (19:42 +0000)]
runtime, net: fix arm build

Bring net/fd_linux.go back (it was deleted this morning)
because it is still needed for ARM.

Fix a few typos in the runtime reorg.

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

12 years agocmd/ld: another use-after-free
Russ Cox [Thu, 14 Mar 2013 18:35:47 +0000 (14:35 -0400)]
cmd/ld: another use-after-free

This only shows up in the duplicate symbol error message.

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

12 years agoruntime: refactor os-specific code
Russ Cox [Thu, 14 Mar 2013 18:35:13 +0000 (11:35 -0700)]
runtime: refactor os-specific code

thread_GOOS.c becomes os_GOOS.c.

signal_GOOS_GOARCH.c becomes os_GOOS_GOARCH.c,
but with non-GOARCH-specific code moved into os_GOOS.c.

The actual arch-specific signal handler moves into signal_GOARCH.c
to avoid per-GOOS duplication.

New files signal_GOOS_GOARCH.h provide macros for
accessing fields of the very system-specific signal info structs.

Lots moving, but nothing changing.
This is a preliminarly cleanup so I can work on the signal
handling code to fix some open issues without having to
make each change 13 times.

Tested on Linux and OS X, 386 and amd64.
Will fix Plan 9, Windows, and ARM after the fact if necessary.
(Plan 9 and Windows should be fine; ARM will probably have some typos.)

Net effect: -1081 lines of code.

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

12 years agonet: deflake TestDialTimeout
Albert Strasheim [Thu, 14 Mar 2013 16:42:29 +0000 (09:42 -0700)]
net: deflake TestDialTimeout

Fixes #3867.
Fixes #3307.

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

12 years agoruntime: do not memprofile settype_flush
Dmitriy Vyukov [Thu, 14 Mar 2013 15:11:29 +0000 (19:11 +0400)]
runtime: do not memprofile settype_flush
Fixes #4850.

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

12 years agoruntime: integrated network poller for linux
Dmitriy Vyukov [Thu, 14 Mar 2013 15:06:35 +0000 (19:06 +0400)]
runtime: integrated network poller for linux
vs tip:
BenchmarkTCP4OneShot                    172994        40485  -76.60%
BenchmarkTCP4OneShot-2                   96581        30028  -68.91%
BenchmarkTCP4OneShot-4                   52615        18454  -64.93%
BenchmarkTCP4OneShot-8                   26351        12289  -53.36%
BenchmarkTCP4OneShot-16                  12258        16093  +31.29%
BenchmarkTCP4OneShot-32                  13200        17045  +29.13%

BenchmarkTCP4OneShotTimeout             124814        42932  -65.60%
BenchmarkTCP4OneShotTimeout-2            99090        29040  -70.69%
BenchmarkTCP4OneShotTimeout-4            51860        18455  -64.41%
BenchmarkTCP4OneShotTimeout-8            26100        12073  -53.74%
BenchmarkTCP4OneShotTimeout-16           12198        16654  +36.53%
BenchmarkTCP4OneShotTimeout-32           13438        17143  +27.57%

BenchmarkTCP4Persistent                 115647         7782  -93.27%
BenchmarkTCP4Persistent-2                58024         4808  -91.71%
BenchmarkTCP4Persistent-4                24715         3674  -85.13%
BenchmarkTCP4Persistent-8                16431         2407  -85.35%
BenchmarkTCP4Persistent-16                2336         1875  -19.73%
BenchmarkTCP4Persistent-32                1689         1637   -3.08%

BenchmarkTCP4PersistentTimeout           79754         7859  -90.15%
BenchmarkTCP4PersistentTimeout-2         57708         5952  -89.69%
BenchmarkTCP4PersistentTimeout-4         26907         3823  -85.79%
BenchmarkTCP4PersistentTimeout-8         15036         2567  -82.93%
BenchmarkTCP4PersistentTimeout-16         2507         1903  -24.09%
BenchmarkTCP4PersistentTimeout-32         1717         1627   -5.24%

vs old scheduler:
benchmark                           old ns/op    new ns/op    delta
BenchmarkTCPOneShot                    192244        40485  -78.94%
BenchmarkTCPOneShot-2                   63835        30028  -52.96%
BenchmarkTCPOneShot-4                   35443        18454  -47.93%
BenchmarkTCPOneShot-8                   22140        12289  -44.49%
BenchmarkTCPOneShot-16                  16930        16093   -4.94%
BenchmarkTCPOneShot-32                  16719        17045   +1.95%

BenchmarkTCPOneShotTimeout             190495        42932  -77.46%
BenchmarkTCPOneShotTimeout-2            64828        29040  -55.20%
BenchmarkTCPOneShotTimeout-4            34591        18455  -46.65%
BenchmarkTCPOneShotTimeout-8            21989        12073  -45.10%
BenchmarkTCPOneShotTimeout-16           16848        16654   -1.15%
BenchmarkTCPOneShotTimeout-32           16796        17143   +2.07%

BenchmarkTCPPersistent                  81670         7782  -90.47%
BenchmarkTCPPersistent-2                26598         4808  -81.92%
BenchmarkTCPPersistent-4                15633         3674  -76.50%
BenchmarkTCPPersistent-8                18093         2407  -86.70%
BenchmarkTCPPersistent-16               17472         1875  -89.27%
BenchmarkTCPPersistent-32                7679         1637  -78.68%

BenchmarkTCPPersistentTimeout           83186         7859  -90.55%
BenchmarkTCPPersistentTimeout-2         26883         5952  -77.86%
BenchmarkTCPPersistentTimeout-4         15776         3823  -75.77%
BenchmarkTCPPersistentTimeout-8         18180         2567  -85.88%
BenchmarkTCPPersistentTimeout-16        17454         1903  -89.10%
BenchmarkTCPPersistentTimeout-32         7798         1627  -79.14%

R=golang-dev, iant, bradfitz, dave, rsc
CC=golang-dev
https://golang.org/cl/7579044

12 years agocmd/dist: support goos,goarch build tags
Dmitriy Vyukov [Thu, 14 Mar 2013 15:04:47 +0000 (19:04 +0400)]
cmd/dist: support goos,goarch build tags
This is necessary to submit netpoll for linux,386 linux,amd64

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

12 years agoruntime: make panic possible before malloc is ready
Russ Cox [Thu, 14 Mar 2013 14:10:12 +0000 (10:10 -0400)]
runtime: make panic possible before malloc is ready

Otherwise startup problems can be difficult to debug.

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

12 years agoruntime: revert UseSpanType back to 1
Dmitriy Vyukov [Thu, 14 Mar 2013 09:48:19 +0000 (13:48 +0400)]
runtime: revert UseSpanType back to 1

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

12 years agoruntime: fix build
Dmitriy Vyukov [Thu, 14 Mar 2013 06:59:55 +0000 (10:59 +0400)]
runtime: fix build

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

12 years agoruntime: integrated network poller for darwin
Dmitriy Vyukov [Thu, 14 Mar 2013 06:38:37 +0000 (10:38 +0400)]
runtime: integrated network poller for darwin
vs tip:
benchmark                           old ns/op    new ns/op    delta
BenchmarkTCP4Persistent                 67786        33175  -51.06%
BenchmarkTCP4Persistent-2               49085        31227  -36.38%
BenchmarkTCP4PersistentTimeout          69265        32565  -52.98%
BenchmarkTCP4PersistentTimeout-2        49217        32588  -33.79%

vs old scheduler:
benchmark                           old ns/op    new ns/op    delta
BenchmarkTCP4Persistent                 63517        33175  -47.77%
BenchmarkTCP4Persistent-2               54760        31227  -42.97%
BenchmarkTCP4PersistentTimeout          63234        32565  -48.50%
BenchmarkTCP4PersistentTimeout-2        56956        32588  -42.78%

R=golang-dev, bradfitz, devon.odell, mikioh.mikioh, iant, rsc
CC=golang-dev, pabuhr
https://golang.org/cl/7569043

12 years agonet: prepare connect() for new network poller
Dmitriy Vyukov [Thu, 14 Mar 2013 06:32:42 +0000 (10:32 +0400)]
net: prepare connect() for new network poller
The problem is that new network poller can have spurious
rediness notifications. This implementation ensures that
the socket is actually connected.

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

12 years agocmd/go: allow ~ in middle of path, just not at beginning
Russ Cox [Thu, 14 Mar 2013 03:32:12 +0000 (23:32 -0400)]
cmd/go: allow ~ in middle of path, just not at beginning

An earlier CL disallowed ~ anywhere in GOPATH, to avoid
problems with GOPATH='~/home' instead of GOPATH=~/home.
But ~ is only special in the shell at the beginning of each of
the paths in the list, and some paths do have ~ in the middle.
So relax the requirement slightly.

Fixes #4140.

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

12 years agoencoding/xml: rewrite invalid code points to U+FFFD in Marshal, Escape
Olivier Saingre [Thu, 14 Mar 2013 03:26:03 +0000 (23:26 -0400)]
encoding/xml: rewrite invalid code points to U+FFFD in Marshal, Escape

Fixes #4235.

R=rsc, dave, r, dr.volker.dobler
CC=golang-dev
https://golang.org/cl/7438051

12 years agocmd/go: add go1.1 build tag, add -installsuffix flag
Russ Cox [Wed, 13 Mar 2013 21:37:49 +0000 (17:37 -0400)]
cmd/go: add go1.1 build tag, add -installsuffix flag

The new build tag "go1.1" will be satisfied by any Go 1.z release >= 1.1.
In general, the build tag "go1.x" will be satisfied by any Go 1.z release >= 1.x.
What happens when we reach Go 2 is yet to be decided.

The tags "go1" or "go1.0" are missing, because +build tags did not exist
before then, and also because the Go 1.0 releases do not recognize them.

The new -installsuffix flag gives access to the build context's InstallSuffix
(formerly named InstallTag, but not part of Go 1.0), for use in isolating
builds to custom directories. For example -race implies -installsuffix race,
and an AppEngine-specific build might use -tags appengine -installsuffix appengine.

Fixes #4116.
Fixes #4443.

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

12 years agocmd/vet: make struct tag literal test work better with no go/types
Russ Cox [Wed, 13 Mar 2013 21:37:37 +0000 (17:37 -0400)]
cmd/vet: make struct tag literal test work better with no go/types

Eliminate false positives when you can tell even without
type information that the literal does not need field tags.

Far too noisy otherwise.

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

12 years agocmd/go: better documentation about profiling
Rob Pike [Wed, 13 Mar 2013 20:56:51 +0000 (13:56 -0700)]
cmd/go: better documentation about profiling
Point the user to "go tool pprof" and mention some
important flags.

Fixes #4990.

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

12 years agocmd/gc: silence valgrind error
Dave Cheney [Wed, 13 Mar 2013 20:12:38 +0000 (16:12 -0400)]
cmd/gc: silence valgrind error

valgrind complained that under some circumstances,

    *nr = *nc

was being called when nr and nc were the same *Node. The suggestion my Rémy was to introduce a tmp node to avoid the potential for aliasing in subnode.

R=remyoudompheng, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7780044

12 years agocmd/godoc: fix BUGS heading in text mode
Russ Cox [Wed, 13 Mar 2013 19:22:59 +0000 (15:22 -0400)]
cmd/godoc: fix BUGS heading in text mode

All the headings are CAPS not Title.

Fixes #4843.

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

12 years agoencoding/json: properly handle extra objects with fixed size arrays
Rick Arnold [Wed, 13 Mar 2013 18:53:03 +0000 (14:53 -0400)]
encoding/json: properly handle extra objects with fixed size arrays

If a fixed size array is passed in as the decode target and the JSON
to decode has extra array elements that are objects, then previously
the decoder would return a "data changing underfoot" error.

Fixes #3717.

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

12 years agonet: use original raddr if getpeername fails
Tyler Bunnell [Wed, 13 Mar 2013 18:49:24 +0000 (14:49 -0400)]
net: use original raddr if getpeername fails

Fixes #3838.

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

12 years agoencoding/xml: predefine xml name space prefix
Russ Cox [Wed, 13 Mar 2013 18:36:42 +0000 (14:36 -0400)]
encoding/xml: predefine xml name space prefix

Also change prefix generation to use more human-friendly prefixes.

Fixes #5040.

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

12 years agomisc/pprof: fix address lookup regression on Linux
Jeff R. Allen [Wed, 13 Mar 2013 16:40:38 +0000 (09:40 -0700)]
misc/pprof: fix address lookup regression on Linux

Just use "go tool addr2line" no matter what, since we know
it works for all OSs.

Fixes #4818.

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

12 years agounicode/utf8: fix insignificant typos in tests
Jeff R. Allen [Wed, 13 Mar 2013 14:45:31 +0000 (07:45 -0700)]
unicode/utf8: fix insignificant typos in tests

Fixes #4972.

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

12 years agonet: fix windows and plan9 build
Brad Fitzpatrick [Wed, 13 Mar 2013 14:42:55 +0000 (07:42 -0700)]
net: fix windows and plan9 build

Don't call unix-only function in test init.

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

12 years agomisc/emacs: Fix indentation for code following multiline function declarations
Dominik Honnef [Wed, 13 Mar 2013 04:37:18 +0000 (21:37 -0700)]
misc/emacs: Fix indentation for code following multiline function declarations

Correctly indent the body of functions that have been declared
over multiple lines. See http://play.golang.org/p/MHMwNDbFyf for
an example.

Previously, the body of the function would be indented as deep as
the continuation line of the function declaration. Now it gets
indented as deep as the func keyword.

R=adonovan, cw, patrick.allen.higgins
CC=golang-dev
https://golang.org/cl/7628043

12 years agodoc: clarify that gccgo is a GCC front-end
Mike Rosset [Wed, 13 Mar 2013 00:12:56 +0000 (17:12 -0700)]
doc: clarify that gccgo is a GCC front-end

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

12 years agonet: require of both -external and -ipv6 flags to run IPv6 multicast tests
Mikio Hara [Wed, 13 Mar 2013 00:00:01 +0000 (08:00 +0800)]
net: require of both -external and -ipv6 flags to run IPv6 multicast tests

On BSD variants, the tests need surely constructed IPv6
routing table.

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

12 years agogo/test/bench/go1: add regexp test
Rob Pike [Tue, 12 Mar 2013 23:50:10 +0000 (16:50 -0700)]
go/test/bench/go1: add regexp test

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

12 years agotest/bench/go1: add http test
Brad Fitzpatrick [Tue, 12 Mar 2013 23:46:38 +0000 (16:46 -0700)]
test/bench/go1: add http test

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

12 years agoimage/jpeg: ignore extraneous data, the same as what libjpeg does.
Nigel Tao [Tue, 12 Mar 2013 23:44:45 +0000 (10:44 +1100)]
image/jpeg: ignore extraneous data, the same as what libjpeg does.

Fixes #4705.

Note that libjpeg will print a warning to stderr if there are many
extraneous bytes, but can be silent if the extraneous bytes can fit
into its int32 bit-buffer for Huffman decoding. I'm guessing that
this is why whatever encoder that produced the image filed for issue
4705 did not realize that they are, strictly speaking, generating an
invalid JPEG. That issue's attached image has two extraneous bytes.

For example, piping the program below into libjpeg's djpeg program
will print an "18 extraneous bytes" warning, even though N == 20.

$ cat main.go
package main

import (
        "bytes"
        "image"
        "image/color"
        "image/jpeg"
        "os"
)

const N = 20

func main() {
        // Encode a 1x1 red image.
        m := image.NewRGBA(image.Rect(0, 0, 1, 1))
        m.Set(0, 0, color.RGBA{255, 0, 0, 255})
        buf := new(bytes.Buffer)
        jpeg.Encode(buf, m, nil)
        b := buf.Bytes()
        // Strip the final "\xff\xd9" EOI marker.
        b = b[:len(b)-2]
        // Append N dummy 0x80 bytes to the SOS data.
        for i := 0; i < N; i++ {
                b = append(b, 0x80)
        }
        // Put back the "\xff\xd9" EOI marker.
        b = append(b, 0xff, 0xd9)
        os.Stdout.Write(b)
}
$ go run main.go | djpeg /dev/stdin > /tmp/foo.pnm
Corrupt JPEG data: 18 extraneous bytes before marker 0xd9

The resultant /tmp/foo.pnm is a perfectly good 1x1 red image.

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

12 years agonet: make sure to use /tmp in unix domain socket tests
Mikio Hara [Tue, 12 Mar 2013 23:26:21 +0000 (07:26 +0800)]
net: make sure to use /tmp in unix domain socket tests

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

12 years agoruntime: Plan 9, 32-bit: fix build by updating call to open()
Akshat Kumar [Tue, 12 Mar 2013 22:10:18 +0000 (23:10 +0100)]
runtime: Plan 9, 32-bit: fix build by updating call to open()

With the global redefinition of runtime·open by CL 7543043,
we need to provide a third argument and remove the cast
to the string.

Fixes build on 386 version of Plan 9.

R=khr, rsc, rminnich, ality
CC=golang-dev
https://golang.org/cl/7644047

12 years agonet: Plan 9: add lookupProtocol
Akshat Kumar [Tue, 12 Mar 2013 22:05:39 +0000 (23:05 +0100)]
net: Plan 9: add lookupProtocol

Needed by TestResolveIPAddr. This makes us pass tests
again.

R=rsc, rminnich, ality, bradfitz
CC=golang-dev
https://golang.org/cl/7737043

12 years agocmd/ld: fix 'use after free' error in new obj code
Russ Cox [Tue, 12 Mar 2013 21:57:13 +0000 (17:57 -0400)]
cmd/ld: fix 'use after free' error in new obj code

Many thanks to Elias Naur for finding this with Valgrind on Linux.
Perhaps this is what is breaking the windows/amd64 builder.

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

12 years agoapi/next.txt: remove references to go/types, now in separate repo
Rob Pike [Tue, 12 Mar 2013 21:42:37 +0000 (14:42 -0700)]
api/next.txt: remove references to go/types, now in separate repo

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

12 years agohtml/template: Ensure release of namespace mutex in Template.Execute()
Robert Figueiredo [Tue, 12 Mar 2013 21:35:14 +0000 (14:35 -0700)]
html/template: Ensure release of namespace mutex in Template.Execute()

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

12 years agomisc/bbedit, misc/notepadplus: remove executable bits from files.
Benny Siegert [Tue, 12 Mar 2013 21:29:25 +0000 (14:29 -0700)]
misc/bbedit, misc/notepadplus: remove executable bits from files.

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

12 years agospec: rewrite the description of panic and recover.
Rob Pike [Tue, 12 Mar 2013 21:28:16 +0000 (14:28 -0700)]
spec: rewrite the description of panic and recover.
The old description was misleading and inaccurate.

Fixes #4774.

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

12 years agotest/bench/garbage: fix parser benchmark
Jan Ziak [Tue, 12 Mar 2013 21:25:15 +0000 (22:25 +0100)]
test/bench/garbage: fix parser benchmark

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

12 years agogo/types: delete from main repo; part of move to go.exp
Rob Pike [Tue, 12 Mar 2013 20:55:58 +0000 (13:55 -0700)]
go/types: delete from main repo; part of move to go.exp
See also https://golang.org/cl/7656044

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

12 years agoencoding/xml: reject > chain with non-element
Russ Cox [Tue, 12 Mar 2013 20:42:25 +0000 (16:42 -0400)]
encoding/xml: reject > chain with non-element

Fixes #5033.

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

12 years agogo/printer, gofmt: avoid extra final comma in multi-line signatures
Robert Griesemer [Tue, 12 Mar 2013 20:07:15 +0000 (13:07 -0700)]
go/printer, gofmt: avoid extra final comma in multi-line signatures

The parameter list layout function was incorrectly computing the
end of the previous line in cases where a parameter type spanned
multiple lines. As a result, an extra (valid, but not needed)
comma was introduced before the paremeter list's closing parenthesis.

Fixes #4533.

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

12 years agogo/doc: set receiver type position for embedded methods
Robert Griesemer [Tue, 12 Mar 2013 20:06:55 +0000 (13:06 -0700)]
go/doc: set receiver type position for embedded methods

This was a bug that didn't manifest itself before CL 7674044;
but with that CL and without this fix, the go/doc tests fail.
(The bug fixed by 7674044 and the bug fixed here cancelled
each other out w/ respect to the go/doc tests).

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

12 years agonet: refactoring in preparation for integrated network poller
Dmitriy Vyukov [Tue, 12 Mar 2013 20:03:00 +0000 (00:03 +0400)]
net: refactoring in preparation for integrated network poller
Introduce pollDesc struct, to split netFD struct into fd-related
and poller-related parts.

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

12 years agoos/signal: windows is supported, update comment
Shenghou Ma [Tue, 12 Mar 2013 18:40:56 +0000 (02:40 +0800)]
os/signal: windows is supported, update comment
Fixes #5035.

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

12 years agoruntime: Fix plan9 aes hash initialization.
Keith Randall [Tue, 12 Mar 2013 18:03:16 +0000 (11:03 -0700)]
runtime: Fix plan9 aes hash initialization.

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

12 years agoeffective_go.html: fix semaphore example
Rob Pike [Tue, 12 Mar 2013 17:53:01 +0000 (10:53 -0700)]
effective_go.html: fix semaphore example
It didn't work properly according to the Go memory model.
Fixes #5023.

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

12 years agoruntime: faster & safer hash function
Keith Randall [Tue, 12 Mar 2013 17:47:44 +0000 (10:47 -0700)]
runtime: faster & safer hash function

Uses AES hardware instructions on 386/amd64 to implement
a fast hash function.  Incorporates a random key to
thwart hash collision DOS attacks.
Depends on CL#7548043 for new assembly instructions.

Update #3885
Helps some by making hashing faster.  Go time drops from
0.65s to 0.51s.

R=rsc, r, bradfitz, remyoudompheng, khr, dsymonds, minux.ma, elias.naur
CC=golang-dev
https://golang.org/cl/7543043

12 years agoruntime: fix build
Dmitriy Vyukov [Tue, 12 Mar 2013 17:39:49 +0000 (21:39 +0400)]
runtime: fix build

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

12 years agoruntime: add network polling support into scheduler
Dmitriy Vyukov [Tue, 12 Mar 2013 17:14:26 +0000 (21:14 +0400)]
runtime: add network polling support into scheduler
This is a part of the bigger change that moves network poller into runtime:
https://golang.org/cl/7326051/

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

12 years agoencoding/xml: name space bug fixes
Russ Cox [Tue, 12 Mar 2013 15:46:12 +0000 (11:46 -0400)]
encoding/xml: name space bug fixes

If two fields have the same name but different explicit name spaces,
treat as non-conflicting. This allows parsing common XML formats
that have ns1:tag and ns2:tag in the same XML element.
Fixes #4691.

Allow setting the default name space for unadorned tags, by
writing to Decoder.DefaultSpace. This allows turned the job of
parsing common XML formats that have tag and ns2:tag in the
same XML element into the first case by setting DefaultSpace="ns1".
Fixes #3703.

Use name space attributes when decoding.
Attach name space to attributes when encoding.
Could be done with fewer annotations, but semantically correct as is.
Fixes #3526.

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

12 years agonet/rpc/jsonrpc: nil pointer deference on invalid reply.
Adrian Nos [Tue, 12 Mar 2013 15:45:56 +0000 (11:45 -0400)]
net/rpc/jsonrpc: nil pointer deference on invalid reply.
Fixes #5006.

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

12 years agoA+C: Adrian Nos (individual CLA)
Russ Cox [Tue, 12 Mar 2013 15:45:30 +0000 (11:45 -0400)]
A+C: Adrian Nos (individual CLA)

Generated by addca.

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

12 years agoruntime: fix deadlock detector false negative
Dmitriy Vyukov [Tue, 12 Mar 2013 13:21:44 +0000 (17:21 +0400)]
runtime: fix deadlock detector false negative
The issue was that scvg is assigned *after* the scavenger goroutine is started,
so when the scavenger calls entersyscall() the g==scvg check can fail.
Fixes #5025.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7629045

12 years agoruntime: deflake TestStackMem
Dmitriy Vyukov [Tue, 12 Mar 2013 11:19:06 +0000 (15:19 +0400)]
runtime: deflake TestStackMem
The problem is that there are lots of dead G's from previous tests,
each dead G consumes 1 stack segment.
Fixes #5034.

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

12 years agonet/http: deflake test
Dmitriy Vyukov [Tue, 12 Mar 2013 08:52:49 +0000 (12:52 +0400)]
net/http: deflake test
Update #5005.

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

12 years agoencoding/base32, encoding/base64: fix issues with decoder whitespace handling
Philip K. Warren [Tue, 12 Mar 2013 05:50:10 +0000 (01:50 -0400)]
encoding/base32, encoding/base64: fix issues with decoder whitespace handling

Adds a new reader to filter newlines, which fixes errors seen in the
decoder chunking code. Found additional issues with whitespace handling
after the first padding character.
Fixes #4779.

R=minux.ma, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/7311069

12 years agoA+C: Philip K. Warren (individual CLA)
Russ Cox [Tue, 12 Mar 2013 05:50:03 +0000 (01:50 -0400)]
A+C: Philip K. Warren (individual CLA)

Generated by addca.

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

12 years agonet: never use backlog > 65535
Russ Cox [Tue, 12 Mar 2013 05:48:48 +0000 (01:48 -0400)]
net: never use backlog > 65535

The system call takes an int, but the kernel stores it in a uint16.
At least one Linux system sets /proc/sys/net/core/somaxconn
to 262144, which ends up being 0 in the uint16. Avoid being tricked.

FreeBSD sources also store the backlog in a uint16.
Assume the problem is systemic and fix it everywhere.

Fixes #5030.

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

12 years agoencoding/xml: fix spurious "no semicolon" in error
Russ Cox [Tue, 12 Mar 2013 04:29:36 +0000 (00:29 -0400)]
encoding/xml: fix spurious "no semicolon" in error

Noticed while doing other XML investigations.

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

12 years agoencoding/xml: allow embedded non-structs
Russ Cox [Tue, 12 Mar 2013 03:58:20 +0000 (23:58 -0400)]
encoding/xml: allow embedded non-structs

The old code just assumed that the only thing
you can embed is a struct. Not true.

Fixes #3803.

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

12 years agonet/http: bit more docs on Client vs Transport
Brad Fitzpatrick [Tue, 12 Mar 2013 01:51:01 +0000 (18:51 -0700)]
net/http: bit more docs on Client vs Transport

This isn't as bad as it used to be, but add a bit
more detail to close the issue.

Fixes #3359

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

12 years agoencoding/base32, encoding/base64: a small stack-space optimization.
Nigel Tao [Tue, 12 Mar 2013 00:24:24 +0000 (11:24 +1100)]
encoding/base32, encoding/base64: a small stack-space optimization.

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

12 years agonet/http: add tests for ParseHTTPVersion
Dave Cheney [Tue, 12 Mar 2013 00:18:18 +0000 (11:18 +1100)]
net/http: add tests for ParseHTTPVersion

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

12 years agogo/test/bench/go1: add printf and time format tests
Rob Pike [Tue, 12 Mar 2013 00:17:25 +0000 (17:17 -0700)]
go/test/bench/go1: add printf and time format tests
Also rename the go parser test to GoParse so it doesn't grab the globally useful Parse name.

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

12 years agoencoding/base32: don't panic when decoding "AAAA==".
Nigel Tao [Tue, 12 Mar 2013 00:07:36 +0000 (11:07 +1100)]
encoding/base32: don't panic when decoding "AAAA==".

Edit encoding/base64's internals and tests to match encoding/base32.

Properly handling line breaks in padding is left for another CL.

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

12 years agoregexp: identify that submatch is also known as capturing group
Rob Pike [Mon, 11 Mar 2013 23:23:06 +0000 (16:23 -0700)]
regexp: identify that submatch is also known as capturing group
Mention the syntax is defined by the regexp/syntax package.
Fixes #3953.

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

12 years agogo/parser: better error message if = is seen instead of ==
Robert Griesemer [Mon, 11 Mar 2013 22:23:18 +0000 (15:23 -0700)]
go/parser: better error message if = is seen instead of ==

Fixes #4519.

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

12 years agocmd/pprof: never use c++filt
Russ Cox [Mon, 11 Mar 2013 22:15:23 +0000 (18:15 -0400)]
cmd/pprof: never use c++filt

The copy of c++filt shipped on OS X is six years old,
and in our case it does far more mangling than it
does demangling. People on non-OS X systems will
have a working nm --demangle, so this won't affect them.

$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.8.2
BuildVersion: 12C2034
$ c++filt --version
GNU c++filt 070207 20070207
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.
$

$ go tool nm -n revcomp | grep quoteWith
   4f560 T strconv.quoteWith
$ go tool nm -n revcomp | grep quoteWith  | c++filt
   f560 T strconv.quoteWith
$

$ nm -n revcomp | grep quoteWith
000000000004f560 t _strconv.quoteWith
$ nm -n revcomp | grep quoteWith | c++filt
000000000004f560 unsigned short _strconv.quoteWith
$

Fixes #4818.

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

12 years agocmd/addr2line: exit 0 for --help
Russ Cox [Mon, 11 Mar 2013 22:12:07 +0000 (18:12 -0400)]
cmd/addr2line: exit 0 for --help

This is what pprof expects, or else it won't use the program.
And if it doesn't use the program, it gets very bad results.

Fixes #4818.

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

12 years agocmd/gc: reject complex calls with mismatched argument types.
Rémy Oudompheng [Mon, 11 Mar 2013 21:55:14 +0000 (22:55 +0100)]
cmd/gc: reject complex calls with mismatched argument types.

The specification says "the two arguments must be of the same
floating-point type."

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

12 years agoall: remove now-unnecessary unreachable panics
Brad Fitzpatrick [Mon, 11 Mar 2013 21:16:55 +0000 (14:16 -0700)]
all: remove now-unnecessary unreachable panics

Take advantage of the new terminating statement rule.

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

12 years agocmd/go: fix description of -o flag to build
Rob Pike [Mon, 11 Mar 2013 21:07:47 +0000 (14:07 -0700)]
cmd/go: fix description of -o flag to build
Fixes #5003.

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

12 years agocmd/dist: make cc rule match what cmd/go uses
Russ Cox [Mon, 11 Mar 2013 20:50:44 +0000 (16:50 -0400)]
cmd/dist: make cc rule match what cmd/go uses

We added -I$GOROOT/pkg/$GOOS_$GOARCH in cmd/go
(I think for use by cgo and swig, primarily) but didn't
update cmd/dist. I was testing some other code and
found that my changes built with cmd/go but failed
during the initial bootstrap. Make them match again.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7707044

12 years agocmd/godoc: only show package documentation for commands
Robert Griesemer [Mon, 11 Mar 2013 20:38:59 +0000 (13:38 -0700)]
cmd/godoc: only show package documentation for commands

Fixed package.txt and adjusted package.html to match
structure (swapped if branches).

Fixes #4861.

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

12 years agogo/types: update operand types early
Robert Griesemer [Mon, 11 Mar 2013 20:38:45 +0000 (13:38 -0700)]
go/types: update operand types early

For expressions where the result type is independent
of the argument types (comparisons, conversions, rhs
of shifts), set the final expression types for those
subtrees early.

This fixes several bugs where incorrect lhs shift
operands where used (say in a comparison), but were
not reported.

Together with the changes listed below this CL fixes
many type-checker bugs.

Also:
- better documented updateExprType
- added larger comment to expr.go explaining
  the basic expression checking algorithm
- use latest definition for indices and make
  arguments; use the same code to check both
- use the same mechanism for cycle detection
  in constant expressions as for variables
  (new field Constant.visited)
- more tests for complex and make builtins
- many more and systematic tests for shifts;
  moved them into separate testfile
- in the testing code, don't compare the
  expected error pattern against itself
  (the actual message was always ignored...)
- fix affected error patterns in the test files
- various cleanups along the way

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

12 years agoA+C: Chris Howey (individual CLA)
Russ Cox [Mon, 11 Mar 2013 20:36:11 +0000 (16:36 -0400)]
A+C: Chris Howey (individual CLA)

Generated by addca.

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

12 years agolib9, cmd/dist, cmd/ld: Plan 9: fix build
Akshat Kumar [Mon, 11 Mar 2013 20:34:57 +0000 (13:34 -0700)]
lib9, cmd/dist, cmd/ld: Plan 9: fix build

lib9: fix runcmd, removeall, and tempdir functions

cmd/dist: Include run_plan9.c and tempdir_plan9.c
        from lib9 for build, and in general consider
        file names containing "plan9" for building.

cmd/ld: provide function args for the new functions
        from lib9.

R=rsc, rminnich, ality, bradfitz
CC=golang-dev
https://golang.org/cl/7666043

12 years agocmd/gc: enable inlining in generated method wrappers.
Rémy Oudompheng [Mon, 11 Mar 2013 20:24:51 +0000 (21:24 +0100)]
cmd/gc: enable inlining in generated method wrappers.

Method calls on interfaces with large stored values
will call the pointer receiver method which may be
a wrapper over a method with value receiver.

This is particularly inefficient for very small bodies.
Inlining the wrapped method body saves a potentially expensive
function call.

benchmark                old ns/op    new ns/op    delta
BenchmarkSortString1K       802295       641387  -20.06%
BenchmarkSortInt1K          359914       238234  -33.81%
BenchmarkSortInt64K       35764226     22803078  -36.24%

Fixes #4707.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/7214044

12 years agonet/http/httputil: fix string in test failure message
Brad Fitzpatrick [Mon, 11 Mar 2013 20:23:47 +0000 (13:23 -0700)]
net/http/httputil: fix string in test failure message

R=golang-dev, daniel.morsing
CC=golang-dev
https://golang.org/cl/7722043

12 years agodebug/macho: add doc comment for FormatError
Rob Pike [Mon, 11 Mar 2013 19:32:47 +0000 (12:32 -0700)]
debug/macho: add doc comment for FormatError

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

12 years agonet/url: better path resolution
Rodrigo Moraes de Oliveira [Mon, 11 Mar 2013 19:03:07 +0000 (15:03 -0400)]
net/url: better path resolution

This includes a simplified resolvePath function and tests for all normal and abnormal path resolution examples described in RFC 3986, sections 5.4.1 and 5.4.2 [1]. Some of those examples failed before (see http://play.golang.org/p/F0ApSaXniv).

Also, parsing a reference "//foo" now works as expected. It was treated as an absolute path with very weird results (see http://play.golang.org/p/089b-_xoNe).

During path resolution, all dot segments are removed as described by the RFC.

A few existing tests had to be changed because they expected the wrong output.

Fixes #4700.

Fixes #4706.

[1] http://tools.ietf.org/html/rfc3986#section-5.4.1

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

12 years agoA+C: Rodrigo Moraes de Oliveira (individual CLA)
Russ Cox [Mon, 11 Mar 2013 18:53:39 +0000 (14:53 -0400)]
A+C: Rodrigo Moraes de Oliveira (individual CLA)

Generated by addca.

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

12 years agoos/signal: deflake test
Dmitriy Vyukov [Mon, 11 Mar 2013 18:31:34 +0000 (22:31 +0400)]
os/signal: deflake test
Fixes #4987.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7713043

12 years agonet/http: add a test verifying header case preservation
Brad Fitzpatrick [Mon, 11 Mar 2013 18:10:43 +0000 (11:10 -0700)]
net/http: add a test verifying header case preservation

Fixes #5022

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7712043

12 years agoapi: update next.txt
Brad Fitzpatrick [Mon, 11 Mar 2013 18:04:34 +0000 (11:04 -0700)]
api: update next.txt

Ton of FreeBSD syscall constants.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7476046

12 years agonet/http/httputil: remove hop-by-hop headers in ReverseProxy
Brad Fitzpatrick [Mon, 11 Mar 2013 17:32:32 +0000 (10:32 -0700)]
net/http/httputil: remove hop-by-hop headers in ReverseProxy

Fixes #2735

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

12 years agonet: allow concurrent UNIX socket tests if TMPDIR is unique.
Albert Strasheim [Mon, 11 Mar 2013 17:24:52 +0000 (13:24 -0400)]
net: allow concurrent UNIX socket tests if TMPDIR is unique.

Only clever enough to allow concurrent stress testing.

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

12 years agolib/time: update link in README; draft now an RFC
Russ Cox [Mon, 11 Mar 2013 16:34:55 +0000 (12:34 -0400)]
lib/time: update link in README; draft now an RFC

R=golang-dev, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/7704043

12 years agosync/atomic: make unaligned 64-bit atomics crash on 386
Russ Cox [Mon, 11 Mar 2013 16:21:46 +0000 (12:21 -0400)]
sync/atomic: make unaligned 64-bit atomics crash on 386

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

12 years agospec: typed indices must be of integer type
Robert Griesemer [Mon, 11 Mar 2013 16:20:52 +0000 (09:20 -0700)]
spec: typed indices must be of integer type

The same rules apply for make arguments.

R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/7656043

12 years agospec: result type of a comparison is always untyped bool
Robert Griesemer [Mon, 11 Mar 2013 16:16:29 +0000 (09:16 -0700)]
spec: result type of a comparison is always untyped bool

For details see the cited issue.

Fixes #4793.

R=rsc, r, iant, ken
CC=golang-dev
https://golang.org/cl/7524044

12 years agonet/http: add additional status codes defined in RFC 6585
Jonathan Rudenberg [Mon, 11 Mar 2013 14:43:57 +0000 (07:43 -0700)]
net/http: add additional status codes defined in RFC 6585

428 Precondition Required
429 Too Many Requests
431 Request Header Fields Too Large
511 Network Authentication Required

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

12 years agoA+C: Jonathan Rudenberg (individual CLA)
Brad Fitzpatrick [Mon, 11 Mar 2013 14:43:17 +0000 (07:43 -0700)]
A+C: Jonathan Rudenberg (individual CLA)

Generated by addca.

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

12 years agomath/big: fix comment
Russ Cox [Mon, 11 Mar 2013 14:20:33 +0000 (10:20 -0400)]
math/big: fix comment

The variable is named b not bit.

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

12 years agocmd/ld, runtime/cgo: allow a symbol to be both cgo_export and cgo_import.
Shenghou Ma [Mon, 11 Mar 2013 06:24:51 +0000 (14:24 +0800)]
cmd/ld, runtime/cgo: allow a symbol to be both cgo_export and cgo_import.
Fixes #4878.

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

12 years agocmd/5l: fix build (define stub machoreloc1)
Russ Cox [Mon, 11 Mar 2013 05:27:03 +0000 (01:27 -0400)]
cmd/5l: fix build (define stub machoreloc1)

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

12 years agobuild: enable host linking test for all BSDs
Russ Cox [Mon, 11 Mar 2013 05:12:18 +0000 (01:12 -0400)]
build: enable host linking test for all BSDs

Let's just see what breaks.

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