]> Cypherpunks repositories - gostls13.git/log
gostls13.git
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

12 years agogo/types: export QualifiedName.IsSame and NamedType.AstObj
Robert Griesemer [Fri, 11 Jan 2013 22:55:49 +0000 (14:55 -0800)]
go/types: export QualifiedName.IsSame and NamedType.AstObj

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

12 years agodatabase/sql: document args, add a couple examples
Brad Fitzpatrick [Fri, 11 Jan 2013 22:46:49 +0000 (14:46 -0800)]
database/sql: document args, add a couple examples

Fixes #3460

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

12 years agogo/types: Moving from *ast.Objects to types.Objects (step 1).
Robert Griesemer [Fri, 11 Jan 2013 21:53:38 +0000 (13:53 -0800)]
go/types: Moving from *ast.Objects to types.Objects (step 1).

The existing type checker was relying on augmenting ast.Object
fields (empty interfaces) for its purposes. While this worked
for some time now, it has become increasingly brittle. Also,
the need for package information for Fields and Methods would
have required a new field in each ast.Object. Rather than making
them bigger and the code even more subtle, in this CL we are moving
away from ast.Objects.

The types packge now defines its own objects for different
language entities (Const, Var, TypeName, Func), and they
implement the types.Object interface. Imported packages
create a Package object which holds the exported entities
in a types.Scope of types.Objects.

For type-checking, the current package is still using ast.Objects
to make this transition manageable. In a next step, the type-
checker will also use types.Objects instead, which opens the door
door to resolving ASTs entirely by the type checker. As a result,
the AST and type checker become less entangled, and ASTs can be
manipulated "by hand" or programmatically w/o having to worry
about scope and object invariants that are very hard to maintain.

(As a consequence, a future parser can do less work, and a
future AST will not need to define objects and scopes anymore.
Also, object resolution which is now split across the parser,
the ast, (ast.NewPackage), and even the type checker (for composite
literal keys) can be done in a single place which will be simpler
and more efficient.)

Change details:
- Check now takes a []*ast.File instead of a map[string]*ast.File.
It's easier to handle (I deleted code at all use sites) and does
not suffer from undefined order (which is a pain for testing).
- ast.Object.Data is now a *types.Package rather then an *ast.Scope
if the object is a package (obj.Kind == ast.Pkg). Eventually this
will go away altogether.
- Instead of an ast.Importer, Check now uses a types.Importer
(which returns a *types.Package).
- types.NamedType has two object fields (Obj Object and obj *ast.Object);
eventually there will be only Obj. The *ast.Object is needed during
this transition since a NamedType may refer to either an imported
(using types.Object) or locally defined (using *ast.Object) type.
- ast.NewPackage is not used anymore - there's a local copy for
package-level resolution of imports.
- struct fields now take the package origin into account.
- The GcImporter is now returning a *types.Package. It cannot be
used with ast.NewPackage anymore. If that functionality is still
used, a copy of the old GcImporter should be made locally (note
that GcImporter was part of exp/types and it's API was not frozen).
- dot-imports are not handled for the time being (this will come back).

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

12 years agotest: add rotate.go and fixedbugs/bug313
Rémy Oudompheng [Fri, 11 Jan 2013 21:42:55 +0000 (22:42 +0100)]
test: add rotate.go and fixedbugs/bug313

Update #4139.

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

12 years agodatabase/sql: check NumInput on Stmt.Exec
Gwenael Treguier [Fri, 11 Jan 2013 21:28:33 +0000 (13:28 -0800)]
database/sql: check NumInput on Stmt.Exec

Fixes #3678.

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

12 years agotest: adapt old-style tests to new flag parsing.
Rémy Oudompheng [Fri, 11 Jan 2013 21:05:46 +0000 (22:05 +0100)]
test: adapt old-style tests to new flag parsing.

The -I. syntax now needs a space to be recognized in the
compiler.

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

12 years agotest: make rundir match compiledir/errorcheckdir.
Rémy Oudompheng [Fri, 11 Jan 2013 21:00:48 +0000 (22:00 +0100)]
test: make rundir match compiledir/errorcheckdir.

This allows test/dwarf to be supported by run.go.

Update #4139.

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

12 years agonet/http: buffer before chunking
Brad Fitzpatrick [Fri, 11 Jan 2013 18:03:43 +0000 (10:03 -0800)]
net/http: buffer before chunking

This introduces a buffer between writing from a handler and
writing chunks.  Further, it delays writing the header until
the first full chunk is ready.  In the case where the first
full chunk is also the final chunk (for small responses), that
means we can also compute a Content-Length, which is a nice
side effect for certain benchmarks.

Fixes #2357

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

12 years agoos: use syscall.Pipe2 on Linux
Georg Reinke [Fri, 11 Jan 2013 16:30:25 +0000 (08:30 -0800)]
os: use syscall.Pipe2 on Linux

Update #2656

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

12 years agocmd/6g, cmd/8g: Allow optimization of return registers.
Daniel Morsing [Fri, 11 Jan 2013 14:44:42 +0000 (15:44 +0100)]
cmd/6g, cmd/8g: Allow optimization of return registers.

The peephole optimizer would keep hands off AX and X0 during returns, even though go doesn't return through registers.

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

12 years agobytes: fix UnreadByte failure after ReadBytes
Stéphane Travostino [Fri, 11 Jan 2013 06:02:21 +0000 (17:02 +1100)]
bytes: fix UnreadByte failure after ReadBytes

Fixes #4583.

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

12 years agocmd/gc, cmd/ld: update doc.go for -race
Shenghou Ma [Fri, 11 Jan 2013 04:35:58 +0000 (12:35 +0800)]
cmd/gc, cmd/ld: update doc.go for -race

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

12 years agocmd/5g: allow optimization of return registers.
Shenghou Ma [Fri, 11 Jan 2013 04:29:14 +0000 (12:29 +0800)]
cmd/5g: allow optimization of return registers.
Modeled after CL 7030046 by daniel.morsing.

example program:
func f(x int) int { x -= 10; return x }

5g -S difference:
 --- prog list "f" ---
 0011 (x.go:7) TEXT    add+0(SB),$0-8
 0012 (x.go:7) MOVW    x+0(FP),R0
-0013 (x.go:7) SUB     $10,R0,R2
-0014 (x.go:7) MOVW    R2,R0
-0015 (x.go:7) MOVW    R2,.noname+4(FP)
-0016 (x.go:7) RET     ,
+0013 (x.go:7) SUB     $10,R0
+0014 (x.go:7) MOVW    R0,.noname+4(FP)
+0015 (x.go:7) RET     ,

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

12 years agocmd/5l: support -Z (zero stack frame at function entry)
Shenghou Ma [Fri, 11 Jan 2013 04:24:28 +0000 (12:24 +0800)]
cmd/5l: support -Z (zero stack frame at function entry)
also added appropriate docs to cmd/ld/doc.go
(largely copied from Russ's CL 6938073).

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

12 years agoencoding/json: improve performance of Unmarshal on primitive types
Rick Arnold [Fri, 11 Jan 2013 01:58:45 +0000 (17:58 -0800)]
encoding/json: improve performance of Unmarshal on primitive types

Skip most of the scanning and parsing logic for simple (non-object/array) JSON values.

benchmark                   old ns/op    new ns/op    delta
BenchmarkUnmarshalInt             948          436  -54.01%
BenchmarkUnmarshalUint            930          427  -54.09%
BenchmarkUnmarshalString         1407          715  -49.18%
BenchmarkUnmarshalFloat          1114          536  -51.89%
BenchmarkUnmarshalBool            759          266  -64.95%
BenchmarkUnmarshalStruct         8165         8181   +0.20%

No significant effects on the go1 benchmarks:

benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    9647362752   9596196417   -0.53%
BenchmarkFannkuch11      5623613048   5518694872   -1.87%
BenchmarkGobDecode         32944041     33165434   +0.67%
BenchmarkGobEncode         21237482     21080554   -0.74%
BenchmarkGzip             750955920    749861980   -0.15%
BenchmarkGunzip           197369742    197886192   +0.26%
BenchmarkJSONEncode        79274091     78891137   -0.48%
BenchmarkJSONDecode       180257802    175280358   -2.76%
BenchmarkMandelbrot200      7396666      7388266   -0.11%
BenchmarkParse             11446460     11386550   -0.52%
BenchmarkRevcomp         1605152523   1599512029   -0.35%
BenchmarkTemplate         204538247    207765574   +1.58%

benchmark                  old MB/s     new MB/s  speedup
BenchmarkGobDecode            23.30        23.14    0.99x
BenchmarkGobEncode            36.14        36.41    1.01x
BenchmarkGzip                 25.84        25.88    1.00x
BenchmarkGunzip               98.32        98.06    1.00x
BenchmarkJSONEncode           24.48        24.60    1.00x
BenchmarkJSONDecode           10.76        11.07    1.03x
BenchmarkParse                 5.06         5.09    1.01x
BenchmarkRevcomp             158.34       158.90    1.00x
BenchmarkTemplate              9.49         9.34    0.98x

Fixes #3949.

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

12 years agonet: use windows ConnectEx to dial (when possible)
Alex Brainman [Fri, 11 Jan 2013 01:42:09 +0000 (12:42 +1100)]
net: use windows ConnectEx to dial (when possible)

Update #2631.
Update #3097.

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

12 years agosyscall: implement Pipe2 on Linux and use it in ForkExec
Georg Reinke [Fri, 11 Jan 2013 01:04:55 +0000 (17:04 -0800)]
syscall: implement Pipe2 on Linux and use it in ForkExec

Fixes #2656.

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

12 years agoruntime: work around 5c bug in GC code.
Rémy Oudompheng [Thu, 10 Jan 2013 23:59:44 +0000 (00:59 +0100)]
runtime: work around 5c bug in GC code.

5c miscompiles *p++ = struct_literal.

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

12 years agoruntime: interpret type information during garbage collection
Jan Ziak [Thu, 10 Jan 2013 20:45:46 +0000 (15:45 -0500)]
runtime: interpret type information during garbage collection

R=rsc, dvyukov, remyoudompheng, dave, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/6945069

12 years agoA+C: Georg Reinke (individual CLA)
Ian Lance Taylor [Thu, 10 Jan 2013 19:37:52 +0000 (11:37 -0800)]
A+C: Georg Reinke (individual CLA)

Generated by addca.

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

12 years agoruntime: faster segmented stacks
Dmitriy Vyukov [Thu, 10 Jan 2013 07:36:40 +0000 (11:36 +0400)]
runtime: faster segmented stacks
benchmark                      old ns/op    new ns/op    delta
BenchmarkStackGrowth                 665          548  -17.59%
BenchmarkStackGrowth-2               333          274  -17.72%
BenchmarkStackGrowth-4               224          168  -25.00%
BenchmarkStackGrowth-8               124           91  -26.21%
BenchmarkStackGrowth-16               82           70  -14.55%
BenchmarkStackGrowth-32               73           59  -19.49%

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

12 years agoruntime: less aggressive per-thread stack segment caching
Dmitriy Vyukov [Thu, 10 Jan 2013 05:57:06 +0000 (09:57 +0400)]
runtime: less aggressive per-thread stack segment caching
Introduce global stack segment cache and limit per-thread cache size.
This greatly reduces StackSys memory on workloads that create lots of threads.

benchmark                      old ns/op    new ns/op    delta
BenchmarkStackGrowth                 665          656   -1.35%
BenchmarkStackGrowth-2               333          328   -1.50%
BenchmarkStackGrowth-4               224          172  -23.21%
BenchmarkStackGrowth-8               124           91  -26.13%
BenchmarkStackGrowth-16               82           47  -41.94%
BenchmarkStackGrowth-32               73           40  -44.79%

BenchmarkStackGrowthDeep           97231        94391   -2.92%
BenchmarkStackGrowthDeep-2         47230        58562  +23.99%
BenchmarkStackGrowthDeep-4         24993        49356  +97.48%
BenchmarkStackGrowthDeep-8         15105        30072  +99.09%
BenchmarkStackGrowthDeep-16        10005        15623  +56.15%
BenchmarkStackGrowthDeep-32        12517        13069   +4.41%

TestStackMem#1,MB                  310          12       -96.13%
TestStackMem#2,MB                  296          14       -95.27%
TestStackMem#3,MB                  479          14       -97.08%

TestStackMem#1,sec                 3.22         2.26     -29.81%
TestStackMem#2,sec                 2.43         2.15     -11.52%
TestStackMem#3,sec                 2.50         2.38      -4.80%

R=sougou, no.smile.face, rsc
CC=golang-dev, msolomon
https://golang.org/cl/7029044

12 years agodoc/contribute: Link to IssueTracker docs for more "special sentences"
Matthew Dempsky [Thu, 10 Jan 2013 03:17:20 +0000 (14:17 +1100)]
doc/contribute: Link to IssueTracker docs for more "special sentences"

Update #4582.

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

12 years agocmd/cgo: for gccgo: use intgo, don't use slice as void return type
Ian Lance Taylor [Wed, 9 Jan 2013 23:25:46 +0000 (15:25 -0800)]
cmd/cgo: for gccgo: use intgo, don't use slice as void return type

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

12 years agocontainer/list: avoid memory leaks
Robert Griesemer [Wed, 9 Jan 2013 23:22:48 +0000 (15:22 -0800)]
container/list: avoid memory leaks

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

12 years agocmd/ld: fix incompatible type signatures on Plan 9
Anthony Martin [Wed, 9 Jan 2013 23:05:22 +0000 (15:05 -0800)]
cmd/ld: fix incompatible type signatures on Plan 9

Changeset f483bfe81114 moved ELF generation to the architecture
independent code and in doing so added a Section* to the Sym
type and an Elf64_Shdr* to the Section type.

This caused the Plan 9 compilers to complain about incompatible
type signatures in the many files that reference the Sym type.

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

12 years agocmd/go: remove $GOROOT as a go get target
Dave Cheney [Wed, 9 Jan 2013 22:57:01 +0000 (09:57 +1100)]
cmd/go: remove $GOROOT as a go get target

Fixes #4186.

Back in the day, before the Go 1.0 release, $GOROOT was mandatory for building from source. Fast forward to now and $GOPATH is mandatory and $GOROOT is optional, and mainly used by those who use the binary distribution in uncommon places.

For example, most novices at least know about `sudo` as they would have used it to install the binary tarball into /usr/local. It is logical they would use the `sudo` hammer to `go get` other Go packages when faced with a permission error talking about the path they just had to use `sudo` on last time.

Even if they had read the documentation and set $GOPATH, go get will not work as expected as `sudo` masks most environment variables.

llucky(~) % ~/go/bin/go env | grep GOPATH
GOPATH="/home/dfc"
lucky(~) % sudo ~/go/bin/go env | grep GOPATH
GOPATH=""

This CL therefore proposes to remove support for using `go get` to download source into $GOROOT.

This CL also proposes an error when GOPATH=$GOROOT, as this is another place where new Go users can get stuck.

Further discussion: https://groups.google.com/d/topic/golang-nuts/VIg3fjHiHRI/discussion

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

12 years agocmd/go: get -m options from GOARCH when using gccgo
Ian Lance Taylor [Wed, 9 Jan 2013 22:45:03 +0000 (14:45 -0800)]
cmd/go: get -m options from GOARCH when using gccgo

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

12 years agogo/types: don't parse imported packages multiple times.
Rémy Oudompheng [Wed, 9 Jan 2013 21:03:41 +0000 (22:03 +0100)]
go/types: don't parse imported packages multiple times.

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

12 years agocmd/gc: add space to export data to match linker expectations
Rémy Oudompheng [Wed, 9 Jan 2013 21:02:53 +0000 (22:02 +0100)]
cmd/gc: add space to export data to match linker expectations

The linker split PKGDEF into (prefix, name, def) pairs,
and defines def to begin after a space following the identifier.
This is totally wrong for the following export data:

        func "".FunctionName()
        var SomethingCompletelyUnrelated int

The linker would parse
    name=`"".FunctionName()\n\tvar`
    def=`SomethingCompletelyUnrelated int`
since there is no space after FunctionName.

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

12 years agocmd/dist: drop unneeded clang flags
Dave Cheney [Wed, 9 Jan 2013 21:00:03 +0000 (08:00 +1100)]
cmd/dist: drop unneeded clang flags

Our source no longer needs these flags set to build cleanly using clang.

Tested with

* Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0) on i386
* clang version 3.2 (tags/RELEASE_32/final) on amd64 cross compiling all platforms

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

12 years agogo/printer, gofmt: don't print unneeded parentheses around parameter types
Robert Griesemer [Wed, 9 Jan 2013 19:32:16 +0000 (11:32 -0800)]
go/printer, gofmt: don't print unneeded parentheses around parameter types

Fixes #4624.

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

12 years agogo/parser: better error message for declaration error
Robert Griesemer [Wed, 9 Jan 2013 19:31:57 +0000 (11:31 -0800)]
go/parser: better error message for declaration error

Fixes #4616.

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

12 years agospec: clarify short variable declaration corner cases
Robert Griesemer [Wed, 9 Jan 2013 19:31:32 +0000 (11:31 -0800)]
spec: clarify short variable declaration corner cases

Fixes #4612.

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

12 years agoutf8: fix typo.
Andrey Mirtchovski [Wed, 9 Jan 2013 19:07:13 +0000 (11:07 -0800)]
utf8: fix typo.

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

12 years agonet/http: don't buffer request writing if dest is already buffered
Brad Fitzpatrick [Wed, 9 Jan 2013 18:33:46 +0000 (10:33 -0800)]
net/http: don't buffer request writing if dest is already buffered

The old code made it impossible to implement a reverse proxy
with anything less than 4k write granularity to the backends.

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

12 years agodoc: Mention godoc's handling of example functions.
Matthew Dempsky [Wed, 9 Jan 2013 15:31:25 +0000 (07:31 -0800)]
doc: Mention godoc's handling of example functions.

Fixes #4625.

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

12 years agomisc/emacs: update go-mode syntax table and comment handling as
Sameer Ajmani [Wed, 9 Jan 2013 15:26:34 +0000 (10:26 -0500)]
misc/emacs: update go-mode syntax table and comment handling as
suggested by pkleiweg.

Fixes #3471.

R=adonovan, pkleiweg, rsc
CC=golang-dev
https://golang.org/cl/7060056

12 years agogo/types: "inherit" type in constant declarations w/o initialization expressions...
Robert Griesemer [Tue, 8 Jan 2013 23:03:30 +0000 (15:03 -0800)]
go/types: "inherit" type in constant declarations w/o initialization expressions (bug fix)

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