]> Cypherpunks repositories - gostls13.git/log
gostls13.git
12 years agoruntime: fix build on openbsd, plan9
Russ Cox [Fri, 1 Mar 2013 16:57:50 +0000 (11:57 -0500)]
runtime: fix build on openbsd, plan9

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

12 years agobuild: disable cgo on windows
Russ Cox [Fri, 1 Mar 2013 16:55:00 +0000 (11:55 -0500)]
build: disable cgo on windows

Update #4955.

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

12 years agosyscall: disable TestPassFD on openbsd
Russ Cox [Fri, 1 Mar 2013 16:51:32 +0000 (11:51 -0500)]
syscall: disable TestPassFD on openbsd

Update #4956.

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

12 years agoruntime: start all threads with runtime.mstart
Russ Cox [Fri, 1 Mar 2013 16:44:43 +0000 (11:44 -0500)]
runtime: start all threads with runtime.mstart

Putting the M initialization in multiple places will not scale.
Various code assumes mstart is the start already. Make it so.

R=golang-dev, devon.odell
CC=golang-dev
https://golang.org/cl/7420048

12 years agoruntime: more build fixing
Russ Cox [Fri, 1 Mar 2013 14:24:17 +0000 (09:24 -0500)]
runtime: more build fixing

Move the mstartfn into its own field.
Simpler, more likely to be correct.

R=golang-dev, devon.odell
CC=golang-dev
https://golang.org/cl/7414046

12 years agoruntime: fix new scheduler on freebsd, windows
Russ Cox [Fri, 1 Mar 2013 13:30:11 +0000 (08:30 -0500)]
runtime: fix new scheduler on freebsd, windows

R=devon.odell
CC=golang-dev
https://golang.org/cl/7443046

12 years agocmd/ld: fix windows build
Russ Cox [Fri, 1 Mar 2013 13:03:25 +0000 (05:03 -0800)]
cmd/ld: fix windows build

Fixes #4948.

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

12 years agoruntime/cgo: fix crosscall2 on arm
Russ Cox [Fri, 1 Mar 2013 13:02:41 +0000 (05:02 -0800)]
runtime/cgo: fix crosscall2 on arm

This time for sure.

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

12 years agoruntime: improved scheduler
Dmitriy Vyukov [Fri, 1 Mar 2013 11:49:16 +0000 (13:49 +0200)]
runtime: improved scheduler
Distribute runnable queues, memory cache
and cache of dead G's per processor.
Faster non-blocking syscall enter/exit.
More conservative worker thread blocking/unblocking.

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

12 years agoruntime/cgo: make crosscall2 5a/6a/8a-assembled
Russ Cox [Fri, 1 Mar 2013 06:14:55 +0000 (22:14 -0800)]
runtime/cgo: make crosscall2 5a/6a/8a-assembled

There is a #pragma dynexport crosscall2, to help SWIG,
and 6l cannot export the symbol if it doesn't get to see it.

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

12 years agoruntime/cgo: fix arm build
Russ Cox [Fri, 1 Mar 2013 05:30:19 +0000 (00:30 -0500)]
runtime/cgo: fix arm build

During my global search and replace I forgot to open *.S (capital).

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

12 years agocmd/cgo, cmd/ld: new cgo object file section
Russ Cox [Fri, 1 Mar 2013 05:27:57 +0000 (00:27 -0500)]
cmd/cgo, cmd/ld: new cgo object file section

Switch to new pragma names, but leave old ones available for now.
Merge the three cgo-related sections in the .6 files into a single
cgo section.

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

12 years agoruntime: check the value returned by runtime·SysAlloc
Jan Ziak [Fri, 1 Mar 2013 05:21:08 +0000 (00:21 -0500)]
runtime: check the value returned by runtime·SysAlloc

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

12 years agohtml/template: fix doc typo
Andrew Gerrand [Fri, 1 Mar 2013 03:57:59 +0000 (14:57 +1100)]
html/template: fix doc typo

Fixes #4950.

R=golang-dev, peter
CC=golang-dev
https://golang.org/cl/7415046

12 years agopath/filepath: better error reporting during TestWinSplitListTestsAreValid
Alex Brainman [Fri, 1 Mar 2013 03:49:55 +0000 (14:49 +1100)]
path/filepath: better error reporting during TestWinSplitListTestsAreValid

Fixes #4930.

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

12 years agolibmach: many pe handling fixes
Alex Brainman [Fri, 1 Mar 2013 03:49:23 +0000 (14:49 +1100)]
libmach: many pe handling fixes

- implement windows pread;
- set correct Fhdr.type;
- add ImageBase to all pe "virtual" addresses;
- correct settext parameter order;
- use pclntab/epclntab to find line numbers.

Fixes #4841.
Fixes #4926.

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

12 years agorun.bat: disable race detector test
Alex Brainman [Fri, 1 Mar 2013 03:19:56 +0000 (14:19 +1100)]
run.bat: disable race detector test

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

12 years agogo/types: fix regression in type checking of RangeStmt.
Alan Donovan [Fri, 1 Mar 2013 01:37:25 +0000 (20:37 -0500)]
go/types: fix regression in type checking of RangeStmt.

Now that untyped expressions are done in two phases, the
identity of operand.expr is used as a map key; when reusing
operand values we now must be careful to update the
expr field.

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

12 years agonet/http: don't special-case multipart/byteranges responses
Brad Fitzpatrick [Fri, 1 Mar 2013 00:58:26 +0000 (16:58 -0800)]
net/http: don't special-case multipart/byteranges responses

Fixes #4767

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

12 years agonet/http: document net/http/cookiejar on CookieJar
Brad Fitzpatrick [Fri, 1 Mar 2013 00:58:14 +0000 (16:58 -0800)]
net/http: document net/http/cookiejar on CookieJar

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

12 years agodoc/effective_go.html: minor updates, part 1
Rob Pike [Fri, 1 Mar 2013 00:57:55 +0000 (16:57 -0800)]
doc/effective_go.html: minor updates, part 1

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

12 years agodoc: fix root.html styles
Andrew Gerrand [Fri, 1 Mar 2013 00:22:13 +0000 (11:22 +1100)]
doc: fix root.html styles

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

12 years agonet/http/cookiejar: move cookiejar from exp/cookiejar to
Nigel Tao [Fri, 1 Mar 2013 00:15:00 +0000 (11:15 +1100)]
net/http/cookiejar: move cookiejar from exp/cookiejar to
net/http/cookiejar.

This is a straight rename. There are no code changes.

Fixes #1960.

R=rsc, adg
CC=dr.volker.dobler, golang-dev
https://golang.org/cl/7436043

12 years agodoc/articles/image_package.html: fix x/y mistake
Rob Pike [Thu, 28 Feb 2013 23:52:58 +0000 (15:52 -0800)]
doc/articles/image_package.html: fix x/y mistake
Fixes #4942.

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

12 years agogo/types: fix type-checking of shift expressions
Robert Griesemer [Thu, 28 Feb 2013 23:27:52 +0000 (15:27 -0800)]
go/types: fix type-checking of shift expressions

Completely rethought shift expression type checking.
Instead of attempting to type-check them eagerly, now
delay the checking of untyped constant lhs in non-
constant shifts until the final expression type
becomes clear. Once it is clear, update the respective
expression tree with the final (not untyped) type and
check respective shift lhs' where necessary.

This also cleans up another conundrum: How to report
the type of untyped constants as it changes from
untyped to typed. Now, Context.Expr is only called
for an expresion x once x has received its final
(not untyped) type (for constant initializers, the
final type may still be untyped).

With this CL all remaining std lib packages that
did not typecheck due to shift errors pass now.

TODO: There's a lot of residual stuff that needs
to be cleaned up but with this CL all tests pass
now.

R=adonovan, axwalk
CC=golang-dev
https://golang.org/cl/7381052

12 years agoruntime: refactor Syscall benchmark
Dmitriy Vyukov [Thu, 28 Feb 2013 23:10:34 +0000 (01:10 +0200)]
runtime: refactor Syscall benchmark
And add a benchmark where #goroutines>GOMAXPROCS,
because it's the most interesting case.
Current results on darwin/amd64, Intel Core 2 Duo 2.13 GHz, 2 cores:
BenchmarkSyscall 100000000         56.0 ns/op
BenchmarkSyscall-2 50000000         57.2 ns/op
BenchmarkSyscallWork 10000000        635 ns/op
BenchmarkSyscallWork-2 10000000        315 ns/op
BenchmarkSyscallExcess  1000000       2698 ns/op
BenchmarkSyscallExcess-2  5000000       1192 ns/op
BenchmarkSyscallExcessWork  1000000       2832 ns/op
BenchmarkSyscallExcessWork-2  2000000       1966 ns/op

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

12 years agoruntime: add matrix multiplication benchmark
Dmitriy Vyukov [Thu, 28 Feb 2013 22:41:45 +0000 (00:41 +0200)]
runtime: add matrix multiplication benchmark

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

12 years agoos: Plan 9: allocate space for a string in Rename
Akshat Kumar [Thu, 28 Feb 2013 22:20:42 +0000 (14:20 -0800)]
os: Plan 9: allocate space for a string in Rename

The Name field of the stat structure is variable length
and the marshalling code in package syscall requires
a buf long enough to contain the Name as well as the
static data. This change makes sure that the buffer in
os.Rename is allocated with the appropriate length.

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

12 years agoruntime/cgo: move common symbol overrides into 6c-compiled code
Russ Cox [Thu, 28 Feb 2013 21:54:23 +0000 (13:54 -0800)]
runtime/cgo: move common symbol overrides into 6c-compiled code

There are some function pointers declared by 6c in
package runtime without initialization and then also
declared in package runtime/cgo with initialization,
so that if runtime/cgo is linked in, the function pointers
are non-nil, and otherwise they are nil. We depend on
this property for implementing non-essential cgo hooks
in package runtime.

The declarations in package runtime are 6c-compiled
and end up in .6 files. The declarations in package runtime/cgo
are gcc-compiled and end up in .o files. Since 6l links the .6
and .o files together, this all works.

However, when we switch to "external linking" mode,
6l will not see the .o files, and it would be up to the host linker
to resolve the two into a single initialized symbol.
Not all host linkers will do this (in particular OS X gcc will not).

To fix this, move the cgo declarations into 6c-compiled code,
so that they end up in .6 files, so that 6l gets them no matter what.

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

12 years agodoc: correct some minor HTML errors found by tidy
Rob Pike [Thu, 28 Feb 2013 21:32:36 +0000 (13:32 -0800)]
doc: correct some minor HTML errors found by tidy

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

12 years agoencoding/gob: fix copyright
Russ Cox [Thu, 28 Feb 2013 21:30:59 +0000 (13:30 -0800)]
encoding/gob: fix copyright

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

12 years agoruntime/cgo: make symbol naming consistent
Russ Cox [Thu, 28 Feb 2013 21:24:38 +0000 (16:24 -0500)]
runtime/cgo: make symbol naming consistent

The naming in this package is a disaster.
Make it all consistent.

Remove some 'static' from functions that will
be referred to from other files soon.

This CL is purely renames using global search and replace.

Submitting separately so that real changes will not
be drowned out by these renames in future CLs.

TBR=iant
CC=golang-dev
https://golang.org/cl/7416046

12 years agocmd/ld: fix symbol table sorting
Russ Cox [Thu, 28 Feb 2013 21:21:58 +0000 (16:21 -0500)]
cmd/ld: fix symbol table sorting
runtime: double-check that symbol table is sorted

If the symbol table is unsorted, the binary search in findfunc
will not find its func, which will make stack traces stop early.
When the garbage collector starts using the stack tracer,
that would be a serious problem.

The unsorted symbol addresses came from from two things:

1. The symbols in an ELF object are not necessarily sorted,
   so sort them before adding them to the symbol list.

2. The __i686.get_pc_thunk.bx symbol is present in multiple
   object files and was having its address adjusted multiple
   times, producing an incorrect address in the symbol table.

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

12 years agoall: fix a few more printf arg bugs found by go vet
Rob Pike [Thu, 28 Feb 2013 19:33:08 +0000 (11:33 -0800)]
all: fix a few more printf arg bugs found by go vet

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

12 years agocmd/vet: %b is a valid floating-point format.
Rob Pike [Thu, 28 Feb 2013 19:32:53 +0000 (11:32 -0800)]
cmd/vet: %b is a valid floating-point format.
Also add a report about "invalid type" from gotype, if -v is set.

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

12 years agocgo: fix reference to puts in implementation comment.
Robin Eklind [Thu, 28 Feb 2013 19:31:52 +0000 (11:31 -0800)]
cgo: fix reference to puts in implementation comment.

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

12 years agocmd/cgo: extend implementation comment
Russ Cox [Thu, 28 Feb 2013 18:44:29 +0000 (10:44 -0800)]
cmd/cgo: extend implementation comment

This is the plan for how to make host linking work with
the rest of the system.

There are two complications:

1. It is a goal to preserve the property that pure Go programs
(even ones importing "net") can be compiled without needing
gcc, so that a Go toolchain download works out of the box.
This forces the support for two linking modes: with and without
gcc.

2. It is a goal to allow users with old copies of SWIG to continue
to use those copies. This forces the support for "internal only"
packages. Perhaps it is reasonable to require a new SWIG.
I don't know.

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

12 years agostrconv: use Quote to escape the input string for failed conversion errors
Matt Brown [Thu, 28 Feb 2013 18:08:05 +0000 (10:08 -0800)]
strconv: use Quote to escape the input string for failed conversion errors

This reveals the presence of control and non-printable characters in the
errors returned by the Parse functions.  Also add unit tests for NumError.

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

12 years agoC: add googler Matt Brown mdbrown@google.com
Rob Pike [Thu, 28 Feb 2013 18:06:38 +0000 (10:06 -0800)]
C: add googler Matt Brown mdbrown@google.com

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

12 years agonet/http: fix handling of HEAD in ReadResponse and (*http.Response).Write
John Graham-Cumming [Thu, 28 Feb 2013 17:29:50 +0000 (09:29 -0800)]
net/http: fix handling of HEAD in ReadResponse and (*http.Response).Write

The test suite for ReadResponse was not checking the error return on the io.Copy
on the body. This was masking two errors: the handling of chunked responses to
HEAD requests and the handling of Content-Length > 0 to HEAD.

The former manifested itself as an 'unexpected EOF' when doing the io.Copy
because a chunked reader was assigned but there were no chunks to read. The
latter cause (*http.Response).Write to report an error on HEAD requests
because it saw a Content-Length > 0 and expected a body.

There was also a missing \r\n in one chunked test that meant that the chunked
encoding was malformed. This does not appear to have been intentional.

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

12 years agocmd/go: fix "go run" cgo source when cgo is disabled
Shenghou Ma [Thu, 28 Feb 2013 08:07:26 +0000 (16:07 +0800)]
cmd/go: fix "go run" cgo source when cgo is disabled
also move a cgo-depend test to appropriate source file in runtime.

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

12 years agolog/syslog: fix race in test between channel close and accept.
Rémy Oudompheng [Thu, 28 Feb 2013 06:48:16 +0000 (07:48 +0100)]
log/syslog: fix race in test between channel close and accept.

Fixes #4769.

R=golang-dev, dave, adg, bradfitz
CC=fullung, golang-dev
https://golang.org/cl/7322089

12 years agoruntime: fix racefuncenter argument corruption.
Rémy Oudompheng [Thu, 28 Feb 2013 06:32:29 +0000 (07:32 +0100)]
runtime: fix racefuncenter argument corruption.

Revision 6a88e1893941 corrupts the argument to
racefuncenter by pushing the data block pointer
to the stack.

Fixes #4885.

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

12 years agonet: pass tests on Plan 9
Akshat Kumar [Thu, 28 Feb 2013 06:18:02 +0000 (07:18 +0100)]
net: pass tests on Plan 9

Ignore problematic tests and un-ignore one
we can now pass.

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

12 years agonet: fix slow network interface manipulations
Mikio Hara [Thu, 28 Feb 2013 05:58:41 +0000 (14:58 +0900)]
net: fix slow network interface manipulations

This CL reduces unnecessary network facility lookups introduced
by recent changes below.

changeset: 15798:53a4da6a4f4a
net: return correct point-to-point interface address on linux

changeset: 15799:a81ef8e0cc05
net: set up IPv6 scoped addressing zone for network facilities

Also adds a test case for issue 4839.

Benchmark results on linux/amd64, virtual machine:
benchmark                                 old ns/op    new ns/op    delta
BenchmarkInterfaces-2                         80487        80382   -0.13%
BenchmarkInterfaceByIndex-2                   72013        71391   -0.86%
BenchmarkInterfaceByName-2                    79865        80101   +0.30%
BenchmarkInterfaceAddrs-2                     42071       829677  +1872.09%
BenchmarkInterfacesAndAddrs-2                 35016       607622  +1635.27%
BenchmarkInterfacesAndMulticastAddrs-2       169849       169082   -0.45%
old: 15797:9c3930413c1b, new: tip

Benchmark results on linux/amd64, virtual machine:
benchmark                                 old ns/op    new ns/op    delta
BenchmarkInterfaces-2                         80487        81459   +1.21%
BenchmarkInterfaceByIndex-2                   72013        71512   -0.70%
BenchmarkInterfaceByName-2                    79865        80567   +0.88%
BenchmarkInterfaceAddrs-2                     42071       120108  +185.49%
BenchmarkInterfacesAndAddrs-2                 35016        33259   -5.02%
BenchmarkInterfacesAndMulticastAddrs-2       169849        82391  -51.49%
old: 15797:9c3930413c1b, new: tip+CL7400055

Benchmark results on darwin/amd64:
benchmark                                 old ns/op    new ns/op    delta
BenchmarkInterfaces-2                         34402        34231   -0.50%
BenchmarkInterfaceByIndex-2                   13192        12956   -1.79%
BenchmarkInterfaceByName-2                    34791        34388   -1.16%
BenchmarkInterfaceAddrs-2                     36565        63906  +74.77%
BenchmarkInterfacesAndAddrs-2                 17497        31068  +77.56%
BenchmarkInterfacesAndMulticastAddrs-2        25276        66711  +163.93%
old: 15797:9c3930413c1b, new: tip

Benchmark results on darwin/amd64:
benchmark                                 old ns/op    new ns/op    delta
BenchmarkInterfaces-2                         34402        31854   -7.41%
BenchmarkInterfaceByIndex-2                   13192        12950   -1.83%
BenchmarkInterfaceByName-2                    34791        31926   -8.23%
BenchmarkInterfaceAddrs-2                     36565        42144  +15.26%
BenchmarkInterfacesAndAddrs-2                 17497        17329   -0.96%
BenchmarkInterfacesAndMulticastAddrs-2        25276        24870   -1.61%
old: 15797:9c3930413c1b, new: tip+CL7400055

Update #4234.
Fixes #4839 (again).
Fixes #4866.

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

12 years agonet, os, syscall: Plan 9: adjust error handling
Akshat Kumar [Thu, 28 Feb 2013 05:43:21 +0000 (06:43 +0100)]
net, os, syscall: Plan 9: adjust error handling

syscall: Use NewError for all system errors and introduce
        some new errors for compatibility with other packages
        and proper error handling in net. Also introduce
        Temporary and Timeout methods on ErrorString.

net: Make errors from dial, accept, listen functions follow the
        OpError standard and discern whether the underlying
        error came from syscall. Since Plan 9 uses a correspondence
        between file and network operations, all system error
        reporting happens through the underlying file operation.
        In Go code, we go through package os for file operations,
        so there is another level of indirection in error types.
        This change allows us to compare the errors with those in
        package syscall, when appropriate.

os: Just use the error string already present in package os,
        instead of calling out to package syscall.

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

12 years agosyscall: Plan 9: keep a consistent environment array
Akshat Kumar [Thu, 28 Feb 2013 05:39:02 +0000 (06:39 +0100)]
syscall: Plan 9: keep a consistent environment array

Map order is non-deterministic. Introduce a new
environment string array that tracks the env map.
This allows us to produce identical results for
Environ() upon successive calls, as expected by the
TestConsistentEnviron test in package os.

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

12 years agomisc/dist: handle previous installation
Tyler Bunnell [Thu, 28 Feb 2013 05:09:48 +0000 (16:09 +1100)]
misc/dist: handle previous installation

The installer package will now detect a previous installation and warn the user
that the previous installation will be deleted. If the user continues, the
installer will delete the previous installation and install the package as
usual.

Fixes #4293.

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

12 years agoA+C: Tyler Bunnell (individual CLA)
Andrew Gerrand [Thu, 28 Feb 2013 05:09:32 +0000 (16:09 +1100)]
A+C: Tyler Bunnell (individual CLA)

Generated by addca.

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

12 years agocmd/cgo: add implementation comment
Russ Cox [Thu, 28 Feb 2013 04:55:01 +0000 (20:55 -0800)]
cmd/cgo: add implementation comment

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

12 years agoexp/cookiejar: eliminate some "."+str garbage.
Nigel Tao [Thu, 28 Feb 2013 02:46:26 +0000 (13:46 +1100)]
exp/cookiejar: eliminate some "."+str garbage.

It's not a big deal, but it's easy to fix.

R=dsymonds
CC=dr.volker.dobler, golang-dev
https://golang.org/cl/7425043

12 years agoexp/cookiejar: add some more tests
Volker Dobler [Thu, 28 Feb 2013 00:18:39 +0000 (11:18 +1100)]
exp/cookiejar: add some more tests

New tests added for port handling and IDNA domains.
A new test case contains several redundant
tests but provides a nice documentation of the
implemented rules for domain handling.

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

12 years agonet/http: don't drop error on request write
Gustavo Niemeyer [Thu, 28 Feb 2013 00:15:36 +0000 (21:15 -0300)]
net/http: don't drop error on request write

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

12 years agobuiltin: document appending a string to a byte slice
Rob Pike [Thu, 28 Feb 2013 00:11:17 +0000 (16:11 -0800)]
builtin: document appending a string to a byte slice
Fixes #4873.

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

12 years agosyscall: add MSG_FASTOPEN to Linux
Brad Fitzpatrick [Wed, 27 Feb 2013 23:51:51 +0000 (15:51 -0800)]
syscall: add MSG_FASTOPEN to Linux

Update #4842

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

12 years agocmd/vet: continue past first error
Rob Pike [Wed, 27 Feb 2013 23:43:33 +0000 (15:43 -0800)]
cmd/vet: continue past first error
Also delete bogus tests for f.pkg (does the file have a package) since all
files have a package attached. The tests for pkg.types and pkg.values
suffice.

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

12 years agomisc/osx: remove legacy packaging scripts
Andrew Gerrand [Wed, 27 Feb 2013 23:39:09 +0000 (10:39 +1100)]
misc/osx: remove legacy packaging scripts

These are superseded by the tool at misc/dist.

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

12 years agogo/types: don't crash if there are no hints
Robert Griesemer [Wed, 27 Feb 2013 23:22:14 +0000 (15:22 -0800)]
go/types: don't crash if there are no hints

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

12 years agonet/http: add Transport.CancelRequest
Brad Fitzpatrick [Wed, 27 Feb 2013 23:20:13 +0000 (15:20 -0800)]
net/http: add Transport.CancelRequest

Permits all sorts of custom HTTP timeout policies without
adding a new Transport timeout Duration for each combination
of HTTP phases.

This keeps track internally of which TCP connection a given
Request is on, and lets callers forcefully close the TCP
connection for a given request, without actually getting
the net.Conn directly.

Additionally, a future CL will implement res.Body.Close (Issue
3672) in terms of this.

Update #3362
Update #3672

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

12 years agoapi: update next.txt
Brad Fitzpatrick [Wed, 27 Feb 2013 23:19:59 +0000 (15:19 -0800)]
api: update next.txt

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

12 years agodoc/effective_go.html: use correct name in Interface Checks section
Rob Pike [Wed, 27 Feb 2013 22:42:53 +0000 (14:42 -0800)]
doc/effective_go.html: use correct name in Interface Checks section
Fixes #4897.

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

12 years agogo/types: don't crash when assigning to undefined variables
Robert Griesemer [Wed, 27 Feb 2013 22:24:41 +0000 (14:24 -0800)]
go/types: don't crash when assigning to undefined variables

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

12 years agoexp/ssa: fix *bsd breakage.
Alan Donovan [Wed, 27 Feb 2013 22:00:02 +0000 (17:00 -0500)]
exp/ssa: fix *bsd breakage.

Use portable ReadDirent, not linux Getdents.

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

12 years agoexp/ssa: a number of bug fixes.
Alan Donovan [Wed, 27 Feb 2013 21:43:16 +0000 (16:43 -0500)]
exp/ssa: a number of bug fixes.

ssadump:
- permit naming a package (not just *.go files) on command line.
- set BuildSerially flag when setting Log* flags
  (Q. should instead the logging functions take a lock?)

Builder:
- fixed bug when calling variadic function with zero '...'-params.
  Added regression test.

interp:
- more external functions:
   the 'error' interface
   bytes.{Equal,IndexByte}
   reflect.(Value).{Bool,NumOut,Out}
   syscall.{Close,Fstat,Read,Open,Stat,Lstat,Fstat,
     Getdents,ParseDirents,Getwd}
- permit comparisons between *Function and *closure.

With this CL, ssadump can now interpret ssadump itself (!),
loading, parsing, typing, SSA-building, and running
println("Hello, World!").  While a fmt-based equivalent still
lacks some external routines, e.g. math/big, I think there are
diminishing returns in expanding the interpreter (and
debugging it is starting to feel like "Inception").

I'm pretty confident this package is now good enough for wider use.

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

12 years agonet: fix windows build
Brad Fitzpatrick [Wed, 27 Feb 2013 20:42:26 +0000 (12:42 -0800)]
net: fix windows build

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

12 years agonet: add DialOpt, the extensible Dial w/ options dialer
Brad Fitzpatrick [Wed, 27 Feb 2013 19:59:36 +0000 (11:59 -0800)]
net: add DialOpt, the extensible Dial w/ options dialer

Add DialOpt. So we have:

func Dial(net, addr string) (Conn, error)
func DialTimeout(net, addr string, timeout time.Duration) (Conn, error)
func DialOpt(addr string, opts ...DialOption) (Conn, error)

DialTimeout (and Dial) are regrettable in retrospect. Maybe
in a future Go we'll be back down to one Dial, with DialOpt
becoming Dial.

DialOpt looks like:

c, err := net.DialOpt("google.com:80")  // tcp is default
c, err := net.DialOpt("google.com:80", net.Timeout(30 * time.Second))
c, err := net.DialOpt("google.com:80", net.TCPFastOpen())
c, err := net.DialOpt("google.com:80", net.LocalAddr(..))
c, err := net.DialOpt("google.com:53", net.Network("udp6"))

And then: (clustered in godoc)

type DialOption interface { /* private only */ }
  func Deadline(time.Time) DialOption
  func LocalAddr(Addr) DialOption
  func Network(string) DialOption
  func TCPFastOpen() DialOption
  func Timeout(time.Duration) DialOption

I'm pretty confident we could add Happy Eyeballs to this too.

Fixes #3097
Update #3610
Update #4842

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

12 years agoruntime: more changes in preparation to the new scheduler
Dmitriy Vyukov [Wed, 27 Feb 2013 19:17:53 +0000 (21:17 +0200)]
runtime: more changes in preparation to the new scheduler
add per-P cache of dead G's
add global runnable queue (not used for now)
add list of idle P's (not used for now)

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

12 years agocmd/gc: don't emit type instructions for nonexisting locals
Daniel Morsing [Wed, 27 Feb 2013 18:47:14 +0000 (19:47 +0100)]
cmd/gc: don't emit type instructions for nonexisting locals

If all locals are optimized away, the type instructions would stay in the instruction stream. Call fixautoused to scrub the output.

Fixes #4915.

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

12 years agosort: use proper mass unit in example
Volker Dobler [Wed, 27 Feb 2013 18:44:50 +0000 (10:44 -0800)]
sort: use proper mass unit in example

The values for the planet masses are given in
earth mass, not solar mass.

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

12 years agonet/http: add Transport.ResponseHeaderTimeout
Brad Fitzpatrick [Wed, 27 Feb 2013 16:47:08 +0000 (08:47 -0800)]
net/http: add Transport.ResponseHeaderTimeout

Update #3362

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

12 years agoexp/ssa: resolve botched merge.
Alan Donovan [Wed, 27 Feb 2013 16:39:39 +0000 (11:39 -0500)]
exp/ssa: resolve botched merge.

While submitting CL 7371051 I accidentally reverted much of CL
7395052.  This change restores it.

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

12 years agoruntime: improve precision of GC_REGION
Jan Ziak [Wed, 27 Feb 2013 16:28:53 +0000 (08:28 -0800)]
runtime: improve precision of GC_REGION

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

12 years agoexp/ssa: make invokation of deferred procedure calls explicit.
Alan Donovan [Wed, 27 Feb 2013 15:35:23 +0000 (10:35 -0500)]
exp/ssa: make invokation of deferred procedure calls explicit.

The correct semantics of named result parameters and deferred
procedures cannot be implemented with the existing Ret
instruction alone, since the required sequence is:
(1) evaluate return operands and parallel-assign them to
    named result parameters
(2) invoke deferred procedures
(3) load named result parameters to form result tuple.

We introduce a new 'rundefers' instruction that explicitly
invokes the deferred procedure calls, and we generate code
that follows the sequence above.

Most functions do not use deferred procedures but this cannot
be known in a single pass.  So, we add an optimisation to
eliminate redundant 'rundefers'; it is piggybacked on the
existing pass done for "lifting".

Added tests.

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

12 years agoexp/ssa: perform all packages' BUILD phases in parallel.
Alan Donovan [Wed, 27 Feb 2013 15:26:24 +0000 (10:26 -0500)]
exp/ssa: perform all packages' BUILD phases in parallel.

Details:
- move Builder.nTo1Vars into package => thread-safe.
- add BuildSerially builder mode flag to disable concurrency.
- add Builder.BuildAllPackages method.

Benchmark: BuildAllPackages for $GOROOT/test/append.go drops
to 83ms from 190ms (GOMAXPROCS=8).

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

12 years agoexp/locale/collate: fixed go vet error.
Marcel van Lohuizen [Wed, 27 Feb 2013 13:09:42 +0000 (14:09 +0100)]
exp/locale/collate: fixed go vet error.

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

12 years agoexp/locale/collate: several changes based on comments on CL 7060051
Marcel van Lohuizen [Wed, 27 Feb 2013 10:08:18 +0000 (11:08 +0100)]
exp/locale/collate: several changes based on comments on CL 7060051
which was submitted earlier.

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

12 years agosyscall: Fix FD passing on OpenBSD
Matthew Dempsky [Wed, 27 Feb 2013 04:19:23 +0000 (15:19 +1100)]
syscall: Fix FD passing on OpenBSD

Fixes #3349.

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

12 years agolibmach: fix build (set and not used)
Russ Cox [Wed, 27 Feb 2013 03:51:47 +0000 (22:51 -0500)]
libmach: fix build (set and not used)

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

12 years agocmd/ld: change GC_CALL to 32-bit relative address
Russ Cox [Wed, 27 Feb 2013 03:42:56 +0000 (19:42 -0800)]
cmd/ld: change GC_CALL to 32-bit relative address

The current code uses 64-bit pc-relative on 64-bit systems,
but in ELF linkers there is no such thing, so we cannot
express this in a .o file. Change to 32-bit.

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

12 years agocmd/ld, runtime: adjust symbol table representation
Russ Cox [Wed, 27 Feb 2013 03:38:14 +0000 (22:38 -0500)]
cmd/ld, runtime: adjust symbol table representation

This CL changes the encoding used for the Go symbol table,
stored in the binary and used at run time. It does not change
any of the semantics or structure: the bits are just packed
a little differently.

The comment at the top of runtime/symtab.c describes the new format.

Compared to the Go 1.0 format, the main changes are:

* Store symbol addresses as full-pointer-sized host-endian values.
  (For 6g, this means addresses are 64-bit little-endian.)

* Store other values (frame sizes and so on) varint-encoded.

The second change more than compensates for the first:
for the godoc binary on OS X/amd64, the new symbol table
is 8% smaller than the old symbol table (1,425,668 down from 1,546,276).

This is a required step for allowing the host linker (gcc) to write
the final Go binary, since it will have to fill in the symbol address slots
(so the slots must be host-endian) and on 64-bit systems it may
choose addresses above 4 GB.

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

12 years agoexp/cookiejar: add a test for canonicalHost errors.
Nigel Tao [Wed, 27 Feb 2013 02:05:57 +0000 (13:05 +1100)]
exp/cookiejar: add a test for canonicalHost errors.

R=dr.volker.dobler
CC=golang-dev
https://golang.org/cl/7389048

12 years agosort: add an example showing sorting struct by different keys
Rob Pike [Wed, 27 Feb 2013 01:17:44 +0000 (17:17 -0800)]
sort: add an example showing sorting struct by different keys

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

12 years agonet/http: fix a bunch of test leaks
Brad Fitzpatrick [Wed, 27 Feb 2013 01:12:50 +0000 (17:12 -0800)]
net/http: fix a bunch of test leaks

And one real leak in TimeoutHandler.

Fixes #4821

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

12 years agogo/types: be more robust in presence of multiple errors
Robert Griesemer [Tue, 26 Feb 2013 22:33:24 +0000 (14:33 -0800)]
go/types: be more robust in presence of multiple errors

- better documentation of Check
- better handling of (explicit) internal panics
- gotype: don't stop after 1st error

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

12 years agosyscall: fix FD passing on FreeBSD and NetBSD
Dave Cheney [Tue, 26 Feb 2013 22:13:15 +0000 (09:13 +1100)]
syscall: fix FD passing on FreeBSD and NetBSD

Fixes #3348.

R=devon.odell, minux.ma, bradfitz, mdempsky
CC=golang-dev
https://golang.org/cl/7406050

12 years agoexp/ssa: support multiple labels on same statement.
Alan Donovan [Tue, 26 Feb 2013 19:07:03 +0000 (14:07 -0500)]
exp/ssa: support multiple labels on same statement.

Actually it already worked since the spec only requires that
the one immediately preceding a for/switch/... be usable as
the target of a break or continue statement.

Added a test.
Also: allocate Function.lblocks on first use.

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

12 years agomisc/emacs: Greatly improve go-mode for Emacs.
Dominik Honnef [Tue, 26 Feb 2013 18:48:32 +0000 (13:48 -0500)]
misc/emacs: Greatly improve go-mode for Emacs.

The original go-mode is plagued with odd behaviour, lack of
behaviour typical to modes in Emacs and bugs.

This change rewrites great parts of go-mode (basically only
keeping the gofmt and godoc functions).

Additionally it adds new features such as manipulating package
imports.

For more information please see
https://groups.google.com/group/golang-nuts/browse_frm/thread/3a9d6dae3369c0b5/1efe65e2f7afb190

Fixes #3618.
Fixes #4240.
Fixes #4322.
Fixes #4671.
Fixes #4726.

R=golang-dev, fullung, sameer, cw, arthur, proppy, adonovan, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/7314113

12 years agocmd/vet: fix printf test for unsafe Pointer
Rob Pike [Tue, 26 Feb 2013 18:36:13 +0000 (10:36 -0800)]
cmd/vet: fix printf test for unsafe Pointer
And fix test. Pointer to unsafe.Pointer tests nothing important...
Also identify the incorrect type: go/types.Type is a Stringer.

Also fix a couple of incorrect format verbs found by new printf checker,
now that we can run it on more files.

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

12 years agoexp/ssa: reimplement logic for field selection.
Alan Donovan [Tue, 26 Feb 2013 18:32:22 +0000 (13:32 -0500)]
exp/ssa: reimplement logic for field selection.

The previous approach desugared the ast.SelectorExpr
to make implicit field selections explicit.  But:
1) it was clunky since it required allocating temporary
   syntax trees.
2) it was not thread-safe since it required poking
   types into the shared type map for the new ASTs.
3) the desugared syntax had no place to represent the
   package lexically enclosing each implicit field
   selection, so it was as if they all occurred in the
   same package as the explicit field selection.
   This meant unexported field names changed meaning.

This CL does what I should have done all along: just
generate the SSA instructions directly from the original
AST and the promoted field information.

Also:
- add logStack util for paired start/end log messages.
  Useful for debugging crashes.

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

12 years agoA+C: Dominik Honnef (individual CLA)
Brad Fitzpatrick [Tue, 26 Feb 2013 18:27:02 +0000 (10:27 -0800)]
A+C: Dominik Honnef (individual CLA)

Generated by addca (mostly, until codereview
blew up)

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

12 years agoruntime: fix stack cache typos
Anthony Martin [Tue, 26 Feb 2013 17:59:17 +0000 (09:59 -0800)]
runtime: fix stack cache typos

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

12 years agoall: clean up C function prototypes
Anthony Martin [Tue, 26 Feb 2013 17:51:33 +0000 (09:51 -0800)]
all: clean up C function prototypes

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

12 years agoos/exec: Pass tests on Plan 9
Akshat Kumar [Tue, 26 Feb 2013 17:40:55 +0000 (09:40 -0800)]
os/exec: Pass tests on Plan 9

Adjust the exit status string for Plan 9.

Upon allocating >100 file descriptors, Plan 9
raises a warning. Moreover, the Go runtime for
32-bit version of Plan 9 keeps /dev/bintime
open for its implementation of runtime.nanotime().
This change accounts for these things in
TestExtraFiles.

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

12 years agobuild: do not set GOBIN on Plan 9
Anthony Martin [Tue, 26 Feb 2013 17:25:46 +0000 (09:25 -0800)]
build: do not set GOBIN on Plan 9

Also, I synced the rc files with changes
that have been made to make.bash, etc.

R=seed, rminnich, r
CC=golang-dev
https://golang.org/cl/7389049

12 years agocmd/go: do not print GCC environment variables on Plan 9
Anthony Martin [Tue, 26 Feb 2013 16:34:47 +0000 (08:34 -0800)]
cmd/go: do not print GCC environment variables on Plan 9

R=seed, rminnich, r, minux.ma
CC=golang-dev
https://golang.org/cl/7397059

12 years agogo/types: fix sizeof computations
Robert Griesemer [Tue, 26 Feb 2013 06:06:58 +0000 (22:06 -0800)]
go/types: fix sizeof computations

Context.Alignof/Offsetsof/Sizeof now provide means
to customize the type checker for a given platform.

- provide Context.Offsetsof to specify the
  offsets of struct fields
- use the correct sizes for ints, uint, uintptrs
  in constant computations
- moved all size computations into separate file
  (sizes.go)
- fixed a bug with string constant slicing

R=adonovan, axwalk
CC=golang-dev
https://golang.org/cl/7363054

12 years agogo/types: more robust imports
Robert Griesemer [Tue, 26 Feb 2013 04:43:35 +0000 (20:43 -0800)]
go/types: more robust imports

- imported objects don't have position information
- gc exported data contains non-exported objects at
  the top-level, guard against them
- better error message when dot-imports conflict
  with local declarations

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

12 years agogo/types: embedded fields can be predeclared types
Robert Griesemer [Tue, 26 Feb 2013 04:42:29 +0000 (20:42 -0800)]
go/types: embedded fields can be predeclared types

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

12 years agocmd/godoc: add support for display Notes parsed by pkg/go/doc
Cosmos Nicolaou [Tue, 26 Feb 2013 04:34:09 +0000 (20:34 -0800)]
cmd/godoc: add support for display Notes parsed by pkg/go/doc
pkg/go/doc: move BUG notes from Package.Bugs to the general Package.Notes field.
Removing .Bugs would break existing code so it's left in for now.

R=gri, gri, gary.burd, dsymonds, rsc, kevlar
CC=golang-dev
https://golang.org/cl/7341053

12 years agoos: use windows ReadConsole to read from console
Alex Brainman [Tue, 26 Feb 2013 03:18:48 +0000 (14:18 +1100)]
os: use windows ReadConsole to read from console

Fixes #4760.

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