]> Cypherpunks repositories - gostls13.git/log
gostls13.git
12 years agogo/build: fix TestBogusDirectory format and maybe Windows failure
Brad Fitzpatrick [Wed, 23 Jan 2013 01:50:12 +0000 (17:50 -0800)]
go/build: fix TestBogusDirectory format and maybe Windows failure

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

12 years agotime: make TestReset more reliable
Brad Fitzpatrick [Wed, 23 Jan 2013 01:25:58 +0000 (17:25 -0800)]
time: make TestReset more reliable

Fixes #4690

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

12 years agonet/url: use bytes.Buffer in (*URL).String
Andrew Gerrand [Wed, 23 Jan 2013 01:17:11 +0000 (12:17 +1100)]
net/url: use bytes.Buffer in (*URL).String

BenchmarkString before:

        11990 ns/op            1621 B/op         73 allocs/op

Using bytes.Buffer:

        8774 ns/op            1994 B/op         40 allocs/op

I also tried making a version of escape() that writes directly to the
bytes.Buffer, but it only saved 1 alloc/op and increased CPU time by
about 10%. Didn't seem worth the extra code path.

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

12 years agonet/url: generate correct Path when hostname empty
Andrew Gerrand [Wed, 23 Jan 2013 00:37:06 +0000 (11:37 +1100)]
net/url: generate correct Path when hostname empty

Parse("file:///foo") previously returned a URL with Scheme "file"
and Path "///foo". Now it returns a URL with Path "/foo",
such that
        &URL{Scheme: "file", Path: "/foo"}.String() == "file:///foo"

This means that parsing and stringifying the URL "file:/foo"
returns "file:///foo", technically a regression but one that only
affects a corner case.

Fixes #4189.

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

12 years agogo/build: ImportDir reject directories that don't exist
Andrew Gerrand [Wed, 23 Jan 2013 00:28:32 +0000 (11:28 +1100)]
go/build: ImportDir reject directories that don't exist

Fixes #3428.

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

12 years agotesting: add Skip/Skipf
Dave Cheney [Tue, 22 Jan 2013 23:22:33 +0000 (10:22 +1100)]
testing: add Skip/Skipf

This proposal adds two methods to *testing.T, Skip(string) and Skipf(format, args...). The intent is to replace the existing log and return idiom which currently has 97 cases in the standard library. A simple example of Skip would be:

func TestSomethingLong(t *testing.T) {
        if testing.Short() {
                t.Skip("skipping test in short mode.")
                // not reached
        }
        ... time consuming work
}

Additionally tests can be skipped anywhere a *testing.T is present. An example adapted from the go.crypto/ssh/test package would be:

// setup performs some before test action and returns a func()
// which should be defered by the caller for cleanup.
func setup(t *testing.T) func() {
        ...
        cmd := exec.Command("sshd", "-f", configfile, "-i")
        if err := cmd.Run(); err != nil {
                t.Skipf("could not execute mock ssh server: %v", err)
        }
        ...
        return func() {
                // stop subprocess and cleanup
        }
}

func TestDialMockServer(t *testing.T) {
        cleanup := setup(t)
        defer cleanup()
        ...
}

In verbose mode tests that are skipped are now reported as a SKIP, rather than PASS.

Link to discussion: https://groups.google.com/d/topic/golang-nuts/BqorNARzt4U/discussion

R=adg, rsc, r, n13m3y3r
CC=golang-dev, minux.ma
https://golang.org/cl/6501094

12 years agoencoding/json: ignore unexported fields in Unmarshal
Rick Arnold [Tue, 22 Jan 2013 22:49:07 +0000 (17:49 -0500)]
encoding/json: ignore unexported fields in Unmarshal

Go 1.0 behavior was to create an UnmarshalFieldError when a json value name matched an unexported field name. This error will no longer be created and the field will be skipped instead.

Fixes #4660.

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

12 years agocmd/api: fix type scrubbing
Brad Fitzpatrick [Tue, 22 Jan 2013 22:29:38 +0000 (14:29 -0800)]
cmd/api: fix type scrubbing

It wasn't removing names from func parameters for func types,
and it was handling "a, b string" as "string", not "string, string".

Fixes #4688

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

12 years agolib9: declare __fixargv0 before use in flag.c
Akshat Kumar [Tue, 22 Jan 2013 22:23:36 +0000 (17:23 -0500)]
lib9: declare __fixargv0 before use in flag.c

The Plan 9 compilers complain about not
having type information for the function,
which sets off type signature problems
during the linking stage.

R=rsc, ality, iant
CC=golang-dev
https://golang.org/cl/7058054

12 years agofmt: Remove dead code and make comments and variables consistent.
Robin Eklind [Tue, 22 Jan 2013 22:12:45 +0000 (17:12 -0500)]
fmt: Remove dead code and make comments and variables consistent.

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

12 years agonet: don't return nil interface address on netbsd
Mikio Hara [Tue, 22 Jan 2013 22:11:22 +0000 (07:11 +0900)]
net: don't return nil interface address on netbsd

On NetBSD routing sockaddrs for interface address contain sockaddr_dl.

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

12 years agoencoding/xml: simplify copyValue
Russ Cox [Tue, 22 Jan 2013 22:05:45 +0000 (17:05 -0500)]
encoding/xml: simplify copyValue

Delete various complications left over from an earlier reflect API.

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

12 years agocmd/go: suppress extraneous newlines in list
Anthony Martin [Tue, 22 Jan 2013 22:05:13 +0000 (17:05 -0500)]
cmd/go: suppress extraneous newlines in list

Before:
$ go list -f '{{range .Deps}}{{println $.Name .}}{{end}}' math time
math runtime
math unsafe

time errors
time runtime
time sync
time sync/atomic
time syscall
time unsafe

$

After:
$ go list -f '{{range .Deps}}{{println $.Name .}}{{end}}' math time
math runtime
math unsafe
time errors
time runtime
time sync
time sync/atomic
time syscall
time unsafe
$

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

12 years agomime, strconv: Make testdata more consistent.
Robin Eklind [Tue, 22 Jan 2013 21:44:35 +0000 (13:44 -0800)]
mime, strconv: Make testdata more consistent.

All packages place testdata in a specific directory with the name
"testdata". The mime and strconv packages have been updated to use
the same convention.

mime: Move "mime/test.types" to "mime/testdata/test.types". Update test
code accordingly.

strconv: Move "strconv/testfp.txt" to "strconv/testdata/testfp.txt".
Update test code accordingly.

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

12 years agotime: standard time doc fix and format example
Caleb Spare [Tue, 22 Jan 2013 19:44:49 +0000 (14:44 -0500)]
time: standard time doc fix and format example

This fixes the incorrect unix timestamp of the standard time and adds
an example for (Time) Format to clarify how timezones work in format strings.

Fixes #4364.

R=golang-dev, remyoudompheng, kevlar, rsc
CC=golang-dev
https://golang.org/cl/7069046

12 years agocmd/go: add hg ssh support
Dustin Shields-Cloues [Tue, 22 Jan 2013 19:43:37 +0000 (14:43 -0500)]
cmd/go: add hg ssh support

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

12 years agoA+C: Dustin Shields-Cloues (individual CLA)
Russ Cox [Tue, 22 Jan 2013 19:43:25 +0000 (14:43 -0500)]
A+C: Dustin Shields-Cloues (individual CLA)

Generated by addca.

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

12 years agosyscall: fix arithmetic errors in assembly for seek function for 64-bit Plan 9
Akshat Kumar [Tue, 22 Jan 2013 19:03:30 +0000 (14:03 -0500)]
syscall: fix arithmetic errors in assembly for seek function for 64-bit Plan 9

Offsets for return values from seek were miscalculated
and a translation from 32-bit code for error handling
was incorrect.

R=rsc, rminnich, npe
CC=golang-dev
https://golang.org/cl/7181045

12 years agodoc/effective_go.html: add a section about the blank identifier
Russ Cox [Tue, 22 Jan 2013 19:00:10 +0000 (14:00 -0500)]
doc/effective_go.html: add a section about the blank identifier

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

12 years agocrypto/tls: allow the server to enforce its ciphersuite preferences.
Adam Langley [Tue, 22 Jan 2013 15:10:38 +0000 (10:10 -0500)]
crypto/tls: allow the server to enforce its ciphersuite preferences.

Previously, Go TLS servers always took the client's preferences into
account when selecting a ciphersuite. This change adds the option of
using the server's preferences, which can be expressed by setting
tls.Config.CipherSuites.

This mirrors Apache's SSLHonorCipherOrder directive.

R=golang-dev, nightlyone, bradfitz, ality
CC=golang-dev
https://golang.org/cl/7163043

12 years agoruntime: account stop-the-world time in the "other" GOGCTRACE section
Dmitriy Vyukov [Tue, 22 Jan 2013 09:44:49 +0000 (13:44 +0400)]
runtime: account stop-the-world time in the "other" GOGCTRACE section
Currently it's summed to mark phase.
The change makes it easier to diagnose long stop-the-world phases.

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

12 years agodoc/go_spec: cap doesn't apply to maps
Shenghou Ma [Mon, 21 Jan 2013 19:18:20 +0000 (03:18 +0800)]
doc/go_spec: cap doesn't apply to maps
Fixes #4682.

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

12 years agocmd/cgo: doc updates
Shenghou Ma [Mon, 21 Jan 2013 18:52:34 +0000 (02:52 +0800)]
cmd/cgo: doc updates
1. note that to use C.free <stdlib.h> must be included
2. can also extract errno from a void C function

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

12 years agocmd/5l: move offset2 into Adr.u0 union to save 4/8 bytes for Adr/Prog resp.
Shenghou Ma [Mon, 21 Jan 2013 18:50:27 +0000 (02:50 +0800)]
cmd/5l: move offset2 into Adr.u0 union to save 4/8 bytes for Adr/Prog resp.
sizeof(Adr) from 24 bytes down to 20 bytes.
sizeof(Prog) from 84 bytes down to 76 bytes.

5l linking cmd/godoc statistics:
Before:
Maximum resident set size (kbytes): 106668
After:
Maximum resident set size (kbytes):  99412

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

12 years agotext/template/parse: don't show itemType in error messages
Shenghou Ma [Mon, 21 Jan 2013 18:48:40 +0000 (02:48 +0800)]
text/template/parse: don't show itemType in error messages
so that the user don't need to decipher something like this:
template: main:1: expected %!s(parse.itemType=14) in end; got "|"
now they get this:
template: main:1: unexpected "|" in end

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

12 years agocrypto/x509: return a better error when we fail to load system roots.
Adam Langley [Mon, 21 Jan 2013 16:25:28 +0000 (11:25 -0500)]
crypto/x509: return a better error when we fail to load system roots.

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

12 years agocrypto/cipher: don't persist errors in StreamWriter.
Adam Langley [Mon, 21 Jan 2013 16:22:08 +0000 (11:22 -0500)]
crypto/cipher: don't persist errors in StreamWriter.

I messed this up from the beginning. The receiver isn't a pointer so
setting Err is useless. In order to maintain the API, just remove the
superfluous code.

Fixes #4657.

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

12 years agoC: add Bill Neubauer's Gmail account
Andrew Gerrand [Sun, 20 Jan 2013 23:53:39 +0000 (10:53 +1100)]
C: add Bill Neubauer's Gmail account

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

12 years agocmd/5l: reduce the size of Prog and Sym
Dave Cheney [Sun, 20 Jan 2013 09:14:24 +0000 (20:14 +1100)]
cmd/5l: reduce the size of Prog and Sym

Prog
* Remove the unused Prog* dlink
* note that align is also unused, but removing it does not help due to alignment issues.

Saves 4 bytes, sizeof(Prog): 84 => 80.

Sym
* Align {u,}char fields on word boundaries

Saves 4 bytes, sizeof(Sym): 136 => 132.

Tested on linux/arm and freebsd/arm.

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

12 years agocmd/api: sort features
Anthony Martin [Sun, 20 Jan 2013 06:20:46 +0000 (22:20 -0800)]
cmd/api: sort features

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

12 years agoundo CL 5687057 / 58bc8aae4abb
Mikio Hara [Sat, 19 Jan 2013 14:13:01 +0000 (23:13 +0900)]
undo CL 5687057 / 58bc8aae4abb

Fortunately we have never seen the panic on sockaddrToTCP
in the past year.

««« original CL description
net: panic if sockaddrToTCP returns nil incorrectly
Part of diagnosing the selfConnect bug
TBR=dsymonds

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

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

12 years agocmd/8l, cmd/6l: avoid zeroing zeroed fields
Dave Cheney [Sat, 19 Jan 2013 09:23:25 +0000 (20:23 +1100)]
cmd/8l, cmd/6l: avoid zeroing zeroed fields

mal() returns zeroed memory, so zeroing these fields is redundant.

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

12 years agocmd/8g, cmd/dist, cmd/gc: fix warnings on Plan 9
Anthony Martin [Sat, 19 Jan 2013 03:08:00 +0000 (19:08 -0800)]
cmd/8g, cmd/dist, cmd/gc: fix warnings on Plan 9

cmd/8g/gsubr.c: unreachable code
cmd/8g/reg.c: overspecifed class
cmd/dist/plan9.c: unused parameter
cmd/gc/fmt.c: stkdelta is now a vlong
cmd/gc/racewalk.c: used but not set

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

12 years agocmd/6c, cmd/8c: fix print format for Prog
Anthony Martin [Sat, 19 Jan 2013 03:00:38 +0000 (19:00 -0800)]
cmd/6c, cmd/8c: fix print format for Prog

The FmtLong flag should only be used with the %D verb
when printing an ATEXT Prog. It was erroneously used
for every Prog except ADATA. This caused a preponderance
of exclamation points, "!!", in the assembly listings.

I also cleaned up the code so that the list.c files look
very similar. Now the real differences are easily spotted
with a simple diff.

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

12 years agodoc: fix effective_go: s/byte array/byte slice/.
Nigel Tao [Sat, 19 Jan 2013 02:36:59 +0000 (13:36 +1100)]
doc: fix effective_go: s/byte array/byte slice/.

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

12 years agoapi: update next.txt
Russ Cox [Fri, 18 Jan 2013 22:57:07 +0000 (17:57 -0500)]
api: update next.txt

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

12 years agomath/big: fix typo
Russ Cox [Fri, 18 Jan 2013 22:30:34 +0000 (17:30 -0500)]
math/big: fix typo

Fixes #4678.

TBR=gri
CC=golang-dev
https://golang.org/cl/7135059

12 years agocmd/6c: Optimize rotate expressions to use rotate instructions.
Matthew Dempsky [Fri, 18 Jan 2013 22:29:53 +0000 (17:29 -0500)]
cmd/6c: Optimize rotate expressions to use rotate instructions.

For simplicity, only recognizes expressions of the exact form
"(x << a) | (x >> b)" where x is a variable and a and b are
integer constant expressions that add to x's bit width.

Fixes #4629.

$ cat rotate.c
unsigned int
rotate(unsigned int x)
{
        x = (x << 3) | (x >> (sizeof(x) * 8 - 3));
        return x;
}

## BEFORE
$ go tool 6c -S rotate.c
(rotate.c:2) TEXT rotate+0(SB),$0-8
(rotate.c:2) MOVL x+0(FP),!!DX
(rotate.c:4) MOVL DX,!!AX
(rotate.c:4) SALL $3,!!AX
(rotate.c:4) MOVL DX,!!CX
(rotate.c:4) SHRL $29,!!CX
(rotate.c:4) ORL CX,!!AX
(rotate.c:5) RET ,!!
(rotate.c:5) RET ,!!
(rotate.c:5) END ,!!

## AFTER
$ go tool 6c -S rotate.c
(rotate.c:2) TEXT rotate+0(SB),$0-8
(rotate.c:4) MOVL x+0(FP),!!AX
(rotate.c:4) ROLL $3,!!AX
(rotate.c:5) RET ,!!
(rotate.c:5) RET ,!!
(rotate.c:5) END ,!!

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

12 years agoencoding/xml: fix decoding of attributes in to pointer fields.
Kamil Kisiel [Fri, 18 Jan 2013 22:07:34 +0000 (17:07 -0500)]
encoding/xml: fix decoding of attributes in to pointer fields.
Fixes #3719.

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

12 years agospec: clarify lhs syntax for range and select
Robert Griesemer [Fri, 18 Jan 2013 21:59:25 +0000 (13:59 -0800)]
spec: clarify lhs syntax for range and select

Fixes #4653.

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

12 years agoruntime: try to determine the actual type during garbage collection
Jan Ziak [Fri, 18 Jan 2013 21:56:17 +0000 (16:56 -0500)]
runtime: try to determine the actual type during garbage collection

If the scanned block has no typeinfo the garbage collector will attempt
to get the actual type of the block.

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

12 years agotest: re-enable issue4348.go.
Rémy Oudompheng [Fri, 18 Jan 2013 21:54:27 +0000 (22:54 +0100)]
test: re-enable issue4348.go.

The test array is too large to fit a stack frame
but can be a global.

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

12 years agocmd/gc: more robust checking of OIND nodes.
Daniel Morsing [Fri, 18 Jan 2013 21:46:10 +0000 (22:46 +0100)]
cmd/gc: more robust checking of OIND nodes.

Fixes #4610.

R=golang-dev, remyoudompheng, rsc
CC=golang-dev, nigeltao
https://golang.org/cl/7058057

12 years agosyscall, os: fix a fork-exec/wait race in Plan 9.
Akshat Kumar [Fri, 18 Jan 2013 21:43:25 +0000 (16:43 -0500)]
syscall, os: fix a fork-exec/wait race in Plan 9.

On Plan 9, only the parent of a given process can enter its wait
queue. When a Go program tries to fork-exec a child process
and subsequently waits for it to finish, the goroutines doing
these two tasks do not necessarily tie themselves to the same
(or any single) OS thread. In the case that the fork and the wait
system calls happen on different OS threads (say, due to a
goroutine being rescheduled somewhere along the way), the
wait() will either return an error or end up waiting for a
completely different child than was intended.

This change forces the fork and wait syscalls to happen in the
same goroutine and ties that goroutine to its OS thread until
the child exits. The PID of the child is recorded upon fork and
exit, and de-queued once the child's wait message has been read.
The Wait API, then, is translated into a synthetic implementation
that simply waits for the requested PID to show up in the queue
and then reads the associated stats.

R=rsc, rminnich, npe, mirtchovski, ality
CC=golang-dev
https://golang.org/cl/6545051

12 years agocmd/gc: fix handling of struct padding in hash/eq.
Rémy Oudompheng [Fri, 18 Jan 2013 21:40:32 +0000 (22:40 +0100)]
cmd/gc: fix handling of struct padding in hash/eq.

The test case of issue 4585 was not passing due to
miscalculation of memequal args, and the previous fix
does not handle padding at the end of a struct.

Handling of padding at end of structs also fixes the case
of [n]T where T is such a padded struct.

Fixes #4585.
(again)

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

12 years agocmd/5a, cmd/5c, cmd/6a, cmd/6c, cmd/8a, cmd/8c, cmd/ld: update reference
Carl Shapiro [Fri, 18 Jan 2013 21:39:53 +0000 (13:39 -0800)]
cmd/5a, cmd/5c, cmd/6a, cmd/6c, cmd/8a, cmd/8c, cmd/ld: update reference

Reference the 80386 compiler documentation now that the
documentation for the 68020 is offline.

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

12 years agoruntime: faster mcentral alloc.
Sébastien Paolacci [Fri, 18 Jan 2013 21:39:22 +0000 (16:39 -0500)]
runtime: faster mcentral alloc.

Reduce individual object handling by anticipating how much of them are servable.

Not a chunked transfer cache, but decent enough to make sure the bottleneck is not here.

Mac OSX, median of 10 runs:

benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    5358937333   4892813012   -8.70%
BenchmarkFannkuch11      3257752475   3315436116   +1.77%
BenchmarkGobDecode         23277349     23001114   -1.19%
BenchmarkGobEncode         14367327     14262925   -0.73%
BenchmarkGzip             441045541    440451719   -0.13%
BenchmarkGunzip           139117663    139622494   +0.36%
BenchmarkJSONEncode        45715854     45687802   -0.06%
BenchmarkJSONDecode       103949570    106530032   +2.48%
BenchmarkMandelbrot200      4542462      4548290   +0.13%
BenchmarkParse              7790558      7557540   -2.99%
BenchmarkRevcomp          831436684    832510381   +0.13%
BenchmarkTemplate         133789824    133007337   -0.58%

benchmark                  old MB/s     new MB/s  speedup
BenchmarkGobDecode            32.82        33.33    1.02x
BenchmarkGobEncode            53.42        53.86    1.01x
BenchmarkGzip                 43.70        44.01    1.01x
BenchmarkGunzip              139.09       139.14    1.00x
BenchmarkJSONEncode           42.69        42.56    1.00x
BenchmarkJSONDecode           18.78        17.91    0.95x
BenchmarkParse                 7.37         7.67    1.04x
BenchmarkRevcomp             306.83       305.70    1.00x
BenchmarkTemplate             14.57        14.56    1.00x

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

12 years agocmd/gc, cmd/6g: fix error on large stacks.
Rémy Oudompheng [Fri, 18 Jan 2013 21:36:43 +0000 (22:36 +0100)]
cmd/gc, cmd/6g: fix error on large stacks.

Fixes #4666.

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

12 years agocmd/6c: Improve peep hole optimization of rotate and shift instructions.
Matthew Dempsky [Fri, 18 Jan 2013 21:33:25 +0000 (16:33 -0500)]
cmd/6c: Improve peep hole optimization of rotate and shift instructions.

Update #4629.

$ cat shift2.c
unsigned int
shift(unsigned int x, unsigned int y)
{
        x = (x << 3);
        y = (y << 5);
        x = (x << 7);
        y = (y << 9);
        return x ^ y;
}

## BEFORE
$ go tool 6c -S shift2.c
(shift2.c:2) TEXT shift+0(SB),$0-8
(shift2.c:4) MOVL x+0(FP),!!AX
(shift2.c:4) SALL $3,!!AX
(shift2.c:4) MOVL AX,!!DX
(shift2.c:5) MOVL y+4(FP),!!AX
(shift2.c:5) SALL $5,!!AX
(shift2.c:5) MOVL AX,!!CX
(shift2.c:6) MOVL DX,!!AX
(shift2.c:6) SALL $7,!!AX
(shift2.c:6) MOVL AX,!!DX
(shift2.c:7) MOVL CX,!!AX
(shift2.c:7) SALL $9,!!AX
(shift2.c:7) MOVL AX,!!CX
(shift2.c:8) MOVL DX,!!AX
(shift2.c:8) XORL CX,!!AX
(shift2.c:8) RET ,!!
(shift2.c:8) RET ,!!
(shift2.c:8) END ,!!

## AFTER
$ go tool 6c -S shift2.c
(shift2.c:2) TEXT shift+0(SB),$0-8
(shift2.c:4) MOVL x+0(FP),!!AX
(shift2.c:4) SALL $3,!!AX
(shift2.c:5) MOVL y+4(FP),!!CX
(shift2.c:5) SALL $5,!!CX
(shift2.c:6) SALL $7,!!AX
(shift2.c:7) SALL $9,!!CX
(shift2.c:8) XORL CX,!!AX
(shift2.c:8) RET ,!!
(shift2.c:8) RET ,!!
(shift2.c:8) END ,!!

R=rsc, minux.ma, dave, nigeltao
CC=golang-dev
https://golang.org/cl/7066055

12 years agocmd/gc: allow registerization of temporaries created by inlining.
Rémy Oudompheng [Fri, 18 Jan 2013 21:25:17 +0000 (22:25 +0100)]
cmd/gc: allow registerization of temporaries created by inlining.

Names beginning with a dot are ignored by optimizers.

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

12 years agocmd/go: diagnose un-bootstrapped runtime
Russ Cox [Fri, 18 Jan 2013 21:24:00 +0000 (16:24 -0500)]
cmd/go: diagnose un-bootstrapped runtime

Fixes #4665.

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

12 years agotime: add note about Parse()'s choice of default year
Shenghou Ma [Fri, 18 Jan 2013 20:57:31 +0000 (04:57 +0800)]
time: add note about Parse()'s choice of default year

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

12 years agocmd/dist: update for new flag parsing on Plan 9
Anthony Martin [Fri, 18 Jan 2013 20:19:51 +0000 (15:19 -0500)]
cmd/dist: update for new flag parsing on Plan 9

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

12 years agobuild: change GO386=sse to GO386=sse2
Russ Cox [Fri, 18 Jan 2013 20:10:36 +0000 (15:10 -0500)]
build: change GO386=sse to GO386=sse2

sse2 is a more precise description of the requirement,
and it matches what people will see in, for example
        grep sse2 /proc/cpuinfo # linux
        sysctl hw.optional.sse2 # os x

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

12 years agocompress/flate: Performance improvement for inflate
Raph Levien [Fri, 18 Jan 2013 20:09:42 +0000 (15:09 -0500)]
compress/flate: Performance improvement for inflate

Decode as much as possible of a Huffman symbol in a single table
lookup (much like the zlib implementation), filling more bits
(conservatively, so we don't consume past the end of the stream)
when the code prefix indicates more bits are needed. This
results in about a 50% performance gain in speed benchmarks.
The following set is benchcmp done on a retina MacBook Pro:

benchmark                            old MB/s     new MB/s  speedup
BenchmarkDecodeDigitsSpeed1e4           28.41        42.79    1.51x
BenchmarkDecodeDigitsSpeed1e5           30.18        47.62    1.58x
BenchmarkDecodeDigitsSpeed1e6           30.81        48.14    1.56x
BenchmarkDecodeDigitsDefault1e4         30.28        44.61    1.47x
BenchmarkDecodeDigitsDefault1e5         32.18        51.94    1.61x
BenchmarkDecodeDigitsDefault1e6         35.57        53.28    1.50x
BenchmarkDecodeDigitsCompress1e4        30.39        44.83    1.48x
BenchmarkDecodeDigitsCompress1e5        33.05        51.64    1.56x
BenchmarkDecodeDigitsCompress1e6        35.69        53.04    1.49x
BenchmarkDecodeTwainSpeed1e4            25.90        43.04    1.66x
BenchmarkDecodeTwainSpeed1e5            29.97        48.19    1.61x
BenchmarkDecodeTwainSpeed1e6            31.36        49.43    1.58x
BenchmarkDecodeTwainDefault1e4          28.79        45.02    1.56x
BenchmarkDecodeTwainDefault1e5          37.12        55.65    1.50x
BenchmarkDecodeTwainDefault1e6          39.28        58.16    1.48x
BenchmarkDecodeTwainCompress1e4         28.64        44.90    1.57x
BenchmarkDecodeTwainCompress1e5         37.40        55.98    1.50x
BenchmarkDecodeTwainCompress1e6         39.35        58.06    1.48x

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

12 years agodoc/contribute.html: mention hg mail during hg change discussion
Russ Cox [Fri, 18 Jan 2013 19:08:42 +0000 (14:08 -0500)]
doc/contribute.html: mention hg mail during hg change discussion

People keep not reading all the way to the bottom of the doc
and not running hg mail.

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

12 years agocmd/gc: don't hash nor compare struct padding or blank fields.
Rémy Oudompheng [Fri, 18 Jan 2013 17:26:43 +0000 (18:26 +0100)]
cmd/gc: don't hash nor compare struct padding or blank fields.

Fixes #4585.

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

12 years agolib/godoc: link to Projects wiki page instead of dashboard
Andrew Gerrand [Fri, 18 Jan 2013 08:25:45 +0000 (19:25 +1100)]
lib/godoc: link to Projects wiki page instead of dashboard

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

12 years agotime: Sleep does better job then runtime.Gosched in TestAfterStress
Alex Brainman [Fri, 18 Jan 2013 04:31:01 +0000 (15:31 +1100)]
time: Sleep does better job then runtime.Gosched in TestAfterStress

for slow windows-386 builder

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

12 years agomisc/dashboard/godashboard: delete
Andrew Gerrand [Fri, 18 Jan 2013 02:47:01 +0000 (13:47 +1100)]
misc/dashboard/godashboard: delete

This code is obsolete and unmaintained.

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

12 years agotesting: allow examples to pass (fix build)
Andrew Gerrand [Fri, 18 Jan 2013 01:25:41 +0000 (12:25 +1100)]
testing: allow examples to pass (fix build)

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

12 years agohtml/template: remove noescape support
Andrew Gerrand [Thu, 17 Jan 2013 23:30:12 +0000 (10:30 +1100)]
html/template: remove noescape support

This was never documented or properly implemented.

Fixes #3528.

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

12 years agotesting: catch panicking example and report, just like tests
Andrew Gerrand [Thu, 17 Jan 2013 23:28:18 +0000 (10:28 +1100)]
testing: catch panicking example and report, just like tests

Fixes #4670.

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

12 years agoC: add Carl Shapiro (Google CLA).
David Symonds [Thu, 17 Jan 2013 23:25:23 +0000 (10:25 +1100)]
C: add Carl Shapiro (Google CLA).

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

12 years agoall: remove exec bit on files
Shenghou Ma [Thu, 17 Jan 2013 18:41:17 +0000 (02:41 +0800)]
all: remove exec bit on files

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

12 years agocmd/vet: don't complain about Error()
Shenghou Ma [Thu, 17 Jan 2013 18:24:12 +0000 (02:24 +0800)]
cmd/vet: don't complain about Error()
Fixes #4598.

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

12 years agodoc/go_spec.html: clarification about insertion during map iteration
Shenghou Ma [Thu, 17 Jan 2013 15:11:25 +0000 (23:11 +0800)]
doc/go_spec.html: clarification about insertion during map iteration

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

12 years agocmd/godoc: when redirecting don't clear query string
Shenghou Ma [Thu, 17 Jan 2013 10:50:49 +0000 (18:50 +0800)]
cmd/godoc: when redirecting don't clear query string
so that http://golang.org/pkg/runtime?m=all works.

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

12 years agoos: use SameFile in TestStartProcess
Shenghou Ma [Thu, 17 Jan 2013 10:48:11 +0000 (18:48 +0800)]
os: use SameFile in TestStartProcess
Fixes #4650.

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

12 years agotesting: introduce (*B).ReportAllocs()
Shenghou Ma [Thu, 17 Jan 2013 10:45:49 +0000 (18:45 +0800)]
testing: introduce (*B).ReportAllocs()
Calling it will show memory allocation statistics for that
single benchmark (if -test.benchmem is not provided)

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

12 years agodoc/articles/json_and_go: fix some format.
Oling Cat [Thu, 17 Jan 2013 04:08:20 +0000 (15:08 +1100)]
doc/articles/json_and_go: fix some format.

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

12 years agotime: add Timer.Reset
Volker Dobler [Thu, 17 Jan 2013 03:41:53 +0000 (14:41 +1100)]
time: add Timer.Reset

Fixes #4412.

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

12 years agoexp/html: remove "INCOMPLETE" comment
Andrew Balholm [Thu, 17 Jan 2013 01:06:04 +0000 (12:06 +1100)]
exp/html: remove "INCOMPLETE" comment

I think that the parser is complete enough to take that warning out.
It passes the test suite.
There may be incompatible API changes, but being in the exp directory
is warning enough for that.

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

12 years agogo/types: correct result type for append (bug fix)
Robert Griesemer [Wed, 16 Jan 2013 23:08:19 +0000 (15:08 -0800)]
go/types: correct result type for append (bug fix)

Rewrote existing code to prevent similar mistakes.

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

12 years agonet/http: Serve creates service goroutines, not service threads
Matthew Dempsky [Wed, 16 Jan 2013 22:05:41 +0000 (14:05 -0800)]
net/http: Serve creates service goroutines, not service threads

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

12 years agonet/http: fix racy test
Brad Fitzpatrick [Tue, 15 Jan 2013 17:13:05 +0000 (09:13 -0800)]
net/http: fix racy test

We need to wait for the handler to actually finish running,
not almost be done running.

This was always a bug, but now that handler output is buffered
it shows up easily on GOMAXPROCS >1 systems.

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

12 years agodoc: fix various fragment links
Andrew Gerrand [Tue, 15 Jan 2013 08:25:16 +0000 (19:25 +1100)]
doc: fix various fragment links

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

12 years agonet: simplify ListenMulticastUDP
Mikio Hara [Mon, 14 Jan 2013 23:53:12 +0000 (08:53 +0900)]
net: simplify ListenMulticastUDP

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

12 years agosyscall: simplify socket control messages
Mikio Hara [Mon, 14 Jan 2013 23:52:22 +0000 (08:52 +0900)]
syscall: simplify socket control messages

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

12 years agogo/types: set type of lhs ident in type switch guards
Robert Griesemer [Mon, 14 Jan 2013 23:25:42 +0000 (15:25 -0800)]
go/types: set type of lhs ident in type switch guards

(bug fix)

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

12 years agogo/types: various minor fixes
Robert Griesemer [Mon, 14 Jan 2013 23:19:32 +0000 (15:19 -0800)]
go/types: various minor fixes

- always set the Pkg field in QualifiedIdents
- call Context.Ident for all identifiers in the AST that denote
  a types.Object (bug fix)
- added test that Context.Ident is called for all such identifiers

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

12 years agotime: fix race
Brad Fitzpatrick [Mon, 14 Jan 2013 22:09:42 +0000 (14:09 -0800)]
time: fix race

Fixes #4622

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

12 years agogo/types: mark completely imported packages as such
Robert Griesemer [Mon, 14 Jan 2013 19:01:27 +0000 (11:01 -0800)]
go/types: mark completely imported packages as such

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

12 years agogo/types: callback for *ast.Ident -> Object mapping
Robert Griesemer [Mon, 14 Jan 2013 17:43:27 +0000 (09:43 -0800)]
go/types: callback for *ast.Ident -> Object mapping

Also re-enabled resolver test.

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

12 years agohtml/template: Clarifying references to "text/template" in the documentation.
Francesc Campoy [Mon, 14 Jan 2013 12:11:22 +0000 (12:11 +0000)]
html/template: Clarifying references to "text/template" in the documentation.

Fixes #4634.

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

12 years agosyscall: simplify netlink sockets
Mikio Hara [Mon, 14 Jan 2013 10:29:03 +0000 (19:29 +0900)]
syscall: simplify netlink sockets

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

12 years agoencoding/json: fix panics on type mismatches.
Rémy Oudompheng [Mon, 14 Jan 2013 07:44:16 +0000 (08:44 +0100)]
encoding/json: fix panics on type mismatches.

Fixes #4222.
Fixes #4628.

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

12 years agoencoding/gob: fix broken test (fix build)
Alex Brainman [Mon, 14 Jan 2013 06:03:19 +0000 (17:03 +1100)]
encoding/gob: fix broken test (fix build)

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

12 years agoencoding/gob: handle encoding of different indirects of GobEncoder
Kyle Lemons [Mon, 14 Jan 2013 05:07:11 +0000 (16:07 +1100)]
encoding/gob: handle encoding of different indirects of GobEncoder

Fixes #4647.

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

12 years agomisc/dashboard/codereview: add campoy to list of gophers
Andrew Gerrand [Sun, 13 Jan 2013 22:54:56 +0000 (09:54 +1100)]
misc/dashboard/codereview: add campoy to list of gophers

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

12 years agocmd/godoc: support m=text parameter for text files
Andrew Gerrand [Sun, 13 Jan 2013 22:35:04 +0000 (09:35 +1100)]
cmd/godoc: support m=text parameter for text files

It's possible to view the package docs in plain text, eg:
        http://golang.org/pkg/time/?m=text
and this CL introduces the ability to do the same for files:
        http://golang.org/src/pkg/time/time.go?m=text

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

12 years agogo/types: Moving from *ast.Objects to types.Objects (step 2).
Robert Griesemer [Sun, 13 Jan 2013 18:33:08 +0000 (10:33 -0800)]
go/types: Moving from *ast.Objects to types.Objects (step 2).

Completely removed *ast.Objects from being exposed by the
types API. *ast.Objects are still required internally for
resolution, but now the door is open for an internal-only
rewrite of identifier resolution entirely at type-check
time. Once that is done, ASTs can be type-checked whether
they have been created via the go/parser or otherwise,
and type-checking does not require *ast.Object or scope
invariants to be maintained externally.

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

12 years agocmd/5l: fix invalid executable header on Plan 9
Anthony Martin [Sat, 12 Jan 2013 11:13:55 +0000 (03:13 -0800)]
cmd/5l: fix invalid executable header on Plan 9

R=minux.ma, lucio.dere
CC=golang-dev
https://golang.org/cl/7094048

12 years agocmd/5c: fix handling of side effects when assigning a struct literal.
Rémy Oudompheng [Sat, 12 Jan 2013 08:16:50 +0000 (09:16 +0100)]
cmd/5c: fix handling of side effects when assigning a struct literal.

Also undo revision a5b96b602690 used to workaround the bug.

Fixes #4643.

R=rsc, golang-dev, dave, minux.ma, lucio.dere, bradfitz
CC=golang-dev
https://golang.org/cl/7090043

12 years agotest: limit runoutput tests on arm platforms
Dave Cheney [Sat, 12 Jan 2013 06:52:52 +0000 (17:52 +1100)]
test: limit runoutput tests on arm platforms

runoutput styles tests generally consume a lot of memory. On arm platforms rotate?.go consume around 200mb each to compile, and as tests are sorted alphabetically, they all tend to run at once.

This change limits the number of runoutput jobs to 2 on arm platforms.

R=minux.ma, remyoudompheng, bradfitz, lucio.dere
CC=golang-dev
https://golang.org/cl/7099047

12 years agobuild: add missing function declarations for Plan 9
Lucio De Re [Sat, 12 Jan 2013 00:58:46 +0000 (16:58 -0800)]
build: add missing function declarations for Plan 9

R=golang-dev, minux.ma, rsc, ality, seed
CC=golang-dev
https://golang.org/cl/7034052

12 years ago testing: document whitespace trimming of example expected/actual output.
Caleb Spare [Sat, 12 Jan 2013 00:18:15 +0000 (11:18 +1100)]
  testing: document whitespace trimming of example expected/actual output.

Fixes #4642.

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

12 years agotext/template: Document that range can be used on chan types.
Kamil Kisiel [Sat, 12 Jan 2013 00:06:13 +0000 (11:06 +1100)]
text/template: Document that range can be used on chan types.

Fixes #4640.

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

12 years agotesting: in example, empty output not distinguished from missing output
Ryan Slade [Sat, 12 Jan 2013 00:05:53 +0000 (11:05 +1100)]
testing: in example, empty output not distinguished from missing output

Fixes #4485.

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

12 years agonet/http/cgi: fix test case sensitivity on Windows
Brad Fitzpatrick [Fri, 11 Jan 2013 23:11:08 +0000 (15:11 -0800)]
net/http/cgi: fix test case sensitivity on Windows

Fixes #4645

R=golang-dev, alex.brainman, minux.ma
CC=golang-dev
https://golang.org/cl/7105047