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

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

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

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

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

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

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

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

Generated by addca.

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

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

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

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

Fixes #5030.

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

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

Noticed while doing other XML investigations.

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

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

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

Fixes #3803.

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

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

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

Fixes #3359

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fixes #4519.

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

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

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

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

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

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

Fixes #4818.

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

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

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

Fixes #4818.

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

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

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

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

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

Take advantage of the new terminating statement rule.

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

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

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

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

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

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

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

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

Fixes #4861.

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

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

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

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

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

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

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

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

Generated by addca.

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

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

lib9: fix runcmd, removeall, and tempdir functions

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

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

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

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

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

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

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

Fixes #4707.

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

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

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

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

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

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

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

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

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

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

Fixes #4700.

Fixes #4706.

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

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

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

Generated by addca.

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

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

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

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

Fixes #5022

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

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

Ton of FreeBSD syscall constants.

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

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

Fixes #2735

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

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

Only clever enough to allow concurrent stress testing.

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

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

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

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

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

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

The same rules apply for make arguments.

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

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

For details see the cited issue.

Fixes #4793.

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

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

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

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

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

Generated by addca.

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

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

The variable is named b not bit.

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

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

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

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

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

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

Let's just see what breaks.

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

12 years agocmd/ld: darwin support for host linking
Russ Cox [Mon, 11 Mar 2013 04:51:42 +0000 (00:51 -0400)]
cmd/ld: darwin support for host linking

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

12 years agocmd/ld: avoid redundant external relocation calculations
Russ Cox [Mon, 11 Mar 2013 02:07:16 +0000 (19:07 -0700)]
cmd/ld: avoid redundant external relocation calculations

R=ken2, ken
CC=golang-dev
https://golang.org/cl/7483045

12 years agodoc/contribute: add instructions to fix codereview on windows
Rick Arnold [Mon, 11 Mar 2013 01:14:42 +0000 (12:14 +1100)]
doc/contribute: add instructions to fix codereview on windows

Tell Windows users how to update Mercurial's library.zip to add some missing dependencies.

Fixes #4745.

R=golang-dev, patrick.allen.higgins, minux.ma, adg
CC=golang-dev
https://golang.org/cl/7558043

12 years agocmd/go: send output of build and install to stderr
Jeff R. Allen [Mon, 11 Mar 2013 00:31:14 +0000 (11:31 +1100)]
cmd/go: send output of build and install to stderr

"go build" and "go install" were mixing stdout and stderr
from the toolchain, then putting it all on stdout. With this
change, it stays mixed, and is sent to stderr. Because
the toolchain does not create output in a clean compile/install,
sending all output to stderr makese more sense.

Also fix test.bash because of "mktemp: too few X's
in template `testgo'" on Linux.

Fixes #4917.

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

12 years agomisc/dashboard: add go.blog sub-repo to dashboard
Andrew Gerrand [Mon, 11 Mar 2013 00:06:21 +0000 (11:06 +1100)]
misc/dashboard: add go.blog sub-repo to dashboard

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

12 years agocmd/ld: replace dynimpname with extname
Russ Cox [Sun, 10 Mar 2013 22:19:53 +0000 (18:19 -0400)]
cmd/ld: replace dynimpname with extname

Dynimpname was getting too confusing.
Replace flag-like checks with tests of s->type.

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

12 years agocmd/ld: wrap long data lines in -a output
Russ Cox [Sun, 10 Mar 2013 20:32:00 +0000 (16:32 -0400)]
cmd/ld: wrap long data lines in -a output

Also move symbol names onto lines by themselves: some are very long.
Show relocations.

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

12 years agocmd/ld: include full symbol table in Mach-O output
Russ Cox [Sun, 10 Mar 2013 20:24:01 +0000 (16:24 -0400)]
cmd/ld: include full symbol table in Mach-O output

This makes binaries work with OS X nm.

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

12 years agolibmach: fix build
Russ Cox [Sun, 10 Mar 2013 18:45:57 +0000 (14:45 -0400)]
libmach: fix build

I guess it would be too much to ask for gcc on my machine to give
the same errors as gcc on the builder machines.

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

12 years agocmd/ld: make mach-o sections match internal sections
Russ Cox [Sun, 10 Mar 2013 18:17:04 +0000 (14:17 -0400)]
cmd/ld: make mach-o sections match internal sections

This brings Mach-O generation more in line with ELF generation.

Having separate sections for the symtab and pclntab mean that we
can find them that way, instead of using the deprecated debug segments.
(And the host linker will keep separate sections for us, but probably
not the debug segments.)

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

12 years agocmd/ld: add tmpdir flag to preserve temp files
Russ Cox [Sun, 10 Mar 2013 16:50:44 +0000 (12:50 -0400)]
cmd/ld: add tmpdir flag to preserve temp files

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

12 years agoruntime: fix misaligned 64-bit atomic
Dmitriy Vyukov [Sun, 10 Mar 2013 16:46:11 +0000 (20:46 +0400)]
runtime: fix misaligned 64-bit atomic
Fixes #4869.
Fixes #5007.
Update #5005.

R=golang-dev, 0xe2.0x9a.0x9b, bradfitz
CC=golang-dev
https://golang.org/cl/7534044

12 years agonet: evaluate the timeout dial opt's deadline at dial time
Brad Fitzpatrick [Sun, 10 Mar 2013 02:14:00 +0000 (18:14 -0800)]
net: evaluate the timeout dial opt's deadline at dial time

Previously it was evaluated once, so re-using the timeout option
repeatedly would always generate the same deadine.

Also switch to doing just one pass over the options, making
the private interface actually useful.

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

12 years agocmd/8l/obj.c: NetBSD passes the test, Hnetbsd added.
Lucio De Re [Sat, 9 Mar 2013 22:54:56 +0000 (14:54 -0800)]
cmd/8l/obj.c: NetBSD passes the test, Hnetbsd added.

myrtle$ go version
go version devel +d533352b414d Sat Mar 09 05:39:15 2013 +0100 netbsd/386
myrtle$ time go test -ldflags -hostobj ../misc/cgo/test
ok      _/var/project/GoLang/misc/cgo/test      10.962s
   68.63s real    49.60s user    19.06s system
myrtle$ uname -a
NetBSD myrtle.plan9.local 6.0_BETA2 NetBSD 6.0_BETA2 (GENERIC) i386

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

12 years agocgo: enable external linking mode on FreeBSD amd64.
Steve McCoy [Sat, 9 Mar 2013 22:51:57 +0000 (14:51 -0800)]
cgo: enable external linking mode on FreeBSD amd64.

Tested on FreeBSD 9.1 amd64, per rsc's instructions at
https://groups.google.com/d/topic/golang-dev/HjRTLvRsJXo/discussion .

R=golang-dev, lucio.dere, devon.odell, rsc
CC=golang-dev
https://golang.org/cl/7664044

12 years agoA+C: Steve McCoy (individual CLA)
Russ Cox [Sat, 9 Mar 2013 22:50:31 +0000 (17:50 -0500)]
A+C: Steve McCoy (individual CLA)

Generated by addca.

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

12 years agosyscall: add PROT_* and MAP_* constants to freebsd
Dave Cheney [Sat, 9 Mar 2013 05:25:30 +0000 (16:25 +1100)]
syscall: add PROT_* and MAP_* constants to freebsd

Update #4929

Regenerated from FreeBSD-9.1 for amd64 and 386, FreeBSD-CURRENT for arm.

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

12 years agonet: if accept4 returns EINVAL fall back to accept
Ian Lance Taylor [Sat, 9 Mar 2013 05:18:06 +0000 (21:18 -0800)]
net: if accept4 returns EINVAL fall back to accept

R=golang-dev, andybalholm, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7485045

12 years agoruntime: Plan 9: fix errstr
Akshat Kumar [Sat, 9 Mar 2013 04:39:15 +0000 (05:39 +0100)]
runtime: Plan 9: fix errstr

The call to the C function runtime.findnull() requires
that we provide the argument at 0(SP).

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

12 years agocmd/ld: external linking fixes for linux/386
Russ Cox [Sat, 9 Mar 2013 04:22:38 +0000 (20:22 -0800)]
cmd/ld: external linking fixes for linux/386

The sticking point on 386 has been the "PC relative" relocations
used to point the garbage collection metadata at the type info.
These aren't in the code segment, and I don't trust that the linker
isn't doing something special that would be okay in code but
not when interpreting the pointers as data (for example, a PLT
jump table would be terrible).

Solve the problem in two steps:

1. Handle "PC relative" relocations within a section internally,
so that the external linker never sees them.

2. Move the gcdata and gcbss tables into the rodata section,
where the type information lives, so that the relocations can
be handled internally.

(To answer the obvious question, we make the gc->type
references relative so that they need not be relocated
individually when generating a shared object file.)

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

12 years agotext/template: revert minor change to Name method
Rob Pike [Sat, 9 Mar 2013 00:39:54 +0000 (16:39 -0800)]
text/template: revert minor change to Name method
For  better printing, I recently changed Name to return "<unnamed>" for templates
with empty names, but this causes trouble for the many packages that used "" as
the template name, so restore the old behavior.
It's usually printed as a quoted string anyway, so it should be fine.

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

12 years agoruntime: fix integer overflow in amd64 memmove.
Rémy Oudompheng [Fri, 8 Mar 2013 23:41:03 +0000 (00:41 +0100)]
runtime: fix integer overflow in amd64 memmove.

Fixes #4981.

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

12 years agoeffective_go.html: add a section on type assertions
Rob Pike [Fri, 8 Mar 2013 21:53:17 +0000 (13:53 -0800)]
effective_go.html: add a section on type assertions
The information was missing, oddly enough.

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

12 years agoeffective_go.html: move and rework the blank identifier section
Rob Pike [Fri, 8 Mar 2013 18:41:20 +0000 (10:41 -0800)]
effective_go.html: move and rework the blank identifier section
Also rename the relevant examples and make sure the working one compiles.

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

12 years agodatabase/sql: fix Conn leak
Brad Fitzpatrick [Fri, 8 Mar 2013 18:04:17 +0000 (10:04 -0800)]
database/sql: fix Conn leak

Fixes #4902

R=golang-dev, alex.brainman, r, google
CC=golang-dev
https://golang.org/cl/7579045

12 years agoruntime: clear locked bit when goroutine exits
Russ Cox [Fri, 8 Mar 2013 16:26:00 +0000 (11:26 -0500)]
runtime: clear locked bit when goroutine exits

Otherwise the next goroutine run on the m
can get inadvertently locked if it executes a cgo call
that turns on the internal lock.

While we're here, fix the cgo panic unwind to
decrement m->ncgo like the non-panic unwind does.

Fixes #4971.

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

12 years agoruntime: make TestStackMem a little less flaky
Russ Cox [Fri, 8 Mar 2013 16:25:21 +0000 (11:25 -0500)]
runtime: make TestStackMem a little less flaky

Have seen failures with GOMAXPROCS=4 on Windows.

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

12 years agocmd/6l, cmd/8l: fix BSD builds
Russ Cox [Fri, 8 Mar 2013 05:23:59 +0000 (21:23 -0800)]
cmd/6l, cmd/8l: fix BSD builds

Before this CL, running

        cd misc/cgo/test
        go test -c
        readelf --dyn-syms test.test | grep cgoexp

turned up many UNDEF symbols corresponding to symbols actually
in the binary but marked only cgo_export_static. Only symbols
marked cgo_export_dynamic should be listed in this mode.
And if the symbol is going to be listed, it should be listed with its
actual address instead of UNDEF.

The Linux dynamic linker didn't care about the seemingly missing
symbols, but the BSD one did.

This CL eliminates the symbols from the dyn-syms table.

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

12 years agospec: clarify unsafe.Offsetof
Robert Griesemer [Fri, 8 Mar 2013 04:11:37 +0000 (20:11 -0800)]
spec: clarify unsafe.Offsetof

Fixes #4905.

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

12 years agocmd/ld: steps toward 386 host linking
Russ Cox [Fri, 8 Mar 2013 03:57:25 +0000 (19:57 -0800)]
cmd/ld: steps toward 386 host linking

- Introduce MaxAlign constant and use in data layout
and ELF section header.

- Allow up to 16-byte alignment for large objects
(will help Keith's hash changes).

- Emit ELF symbol for .rathole (global /dev/null used by 8c).

- Invoke gcc with -m32/-m64 as appropriate.

- Don't invoke gcc if writing the .o file failed.

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

12 years agoruntime: change 386 startup convention
Russ Cox [Fri, 8 Mar 2013 03:57:10 +0000 (19:57 -0800)]
runtime: change 386 startup convention

Now the default startup is that the program begins at _rt0_386_$GOOS,
which behaves as if calling main(argc, argv). Main jumps to _rt0_386.

This makes the _rt0_386 entry match the expected semantics for
the standard C "main" function, which we can now provide for use when
linking against a standard C library.

386 analogue of https://golang.org/cl/7525043

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

12 years agonet/http: Transport socket late binding
Brad Fitzpatrick [Fri, 8 Mar 2013 01:56:00 +0000 (17:56 -0800)]
net/http: Transport socket late binding

Implement what Chrome calls socket "late binding". See:
https://insouciant.org/tech/connection-management-in-chromium/

In a nutshell, if our HTTP client needs a TCP connection to a
remote host and there's not an idle one available, rather than
kick off a dial and wait for that specific dial, we instead
kick off a dial and wait for either our own dial to finish, or
any other TCP connection to that same host to become
available.

The implementation looks like a classic "Learning Go
Concurrency" slide.

Chrome's commit and numbers:
http://src.chromium.org/viewvc/chrome?view=rev&revision=36230

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

12 years agosyscall: Plan 9: use lightweight errstr in entersyscall mode
Akshat Kumar [Thu, 7 Mar 2013 23:54:44 +0000 (00:54 +0100)]
syscall: Plan 9: use lightweight errstr in entersyscall mode

Change 231af8ac63aa (CL 7314062) made runtime.enteryscall()
set m->mcache = nil, which means that we can no longer use
syscall.errstr in syscall.Syscall and syscall.Syscall6, since it
requires a new buffer to be allocated for holding the error string.
Instead, we use pre-allocated per-M storage to hold error strings
from syscalls made while in entersyscall mode, and call
runtime.findnull to calculate the lengths.

Fixes #4994.

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

12 years agonet: fix multicast listener tests
Mikio Hara [Thu, 7 Mar 2013 21:51:06 +0000 (06:51 +0900)]
net: fix multicast listener tests

This CL splits multicast listener tests into two; for IPv4 and
for IPv6. It also removes redundant test inputs and makes sure
that assignment of multicast interface to stablize the tests.

Fixes #4059.

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

12 years agocmd/6a, cmd/8a, cmd/6l, cmd/8l: add AES instructions
Keith Randall [Thu, 7 Mar 2013 20:54:00 +0000 (12:54 -0800)]
cmd/6a, cmd/8a, cmd/6l, cmd/8l: add AES instructions

Instructions for use in AES hashing.  See CL#7543043

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

12 years agocmd/8g: fix code generation of int64(0) == int64(0).
Rémy Oudompheng [Thu, 7 Mar 2013 20:47:45 +0000 (21:47 +0100)]
cmd/8g: fix code generation of int64(0) == int64(0).

The code would violate the contract of cmp64.

Fixes #5002.

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

12 years agoC: add Keith Randall (Google CLA)
Brad Fitzpatrick [Thu, 7 Mar 2013 20:46:44 +0000 (12:46 -0800)]
C: add Keith Randall (Google CLA)

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

12 years agolib9: fix windows build (don't use runesmprint)
Russ Cox [Thu, 7 Mar 2013 19:38:49 +0000 (14:38 -0500)]
lib9: fix windows build (don't use runesmprint)

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

12 years agogo/types: more internal cleanups
Robert Griesemer [Thu, 7 Mar 2013 19:17:30 +0000 (11:17 -0800)]
go/types: more internal cleanups

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

12 years ago misc/emacs: Rewrite gofmt to use own function for applying patch instead of using...
Dominik Honnef [Thu, 7 Mar 2013 18:12:37 +0000 (13:12 -0500)]
misc/emacs: Rewrite gofmt to use own function for applying patch instead of using diff-mode.

    Instead of relying on gofmt's diff output (which is a unified
    diff), we manually invoke diff -n and produce an RCS format diff,
    which can easily be parsed in Emacs, with the go--apply-rcs-patch
    function.

    This fixes undocumented issues with the old implementation such as
    skipping over hunks of changes, and it fixes the documented issue
    of not being able to handle file names that include whitespace.

    It can also apply the patch on a buffer that has no file name
    attached at all.

    Last but not least, it greatly simplifies the gofmt function
    itself.

Fixes #4766.
Fixes #4475.

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

12 years agonet: more refactoring in preparation for runtime integrated pollster
Dmitriy Vyukov [Thu, 7 Mar 2013 17:44:24 +0000 (21:44 +0400)]
net: more refactoring in preparation for runtime integrated pollster
Move pollServer from fd_unix.go to fd_poll_unix.go.
Add pollServerInit(*NetFD) to allow custom initialization.
Add pollServer.Close(*NetFD) to allow custom finalization.
Move setDeadline() to fd_poll_unix.go to allow custom handling of deadlines.
Move newPollServer() to fd_poll_unix.go to allow custom initialization.
No logical code changes.
The next step will be to turn off fd_poll_unix.go for some platform
(I have changes for darwin/linux) and redirect it into runtime. See:
https://golang.org/cl/7569043/diff/2001/src/pkg/net/fd_poll_runtime.go

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

12 years agoruntime: fix deadlock
Dmitriy Vyukov [Thu, 7 Mar 2013 17:39:59 +0000 (21:39 +0400)]
runtime: fix deadlock
The deadlock episodically occurs on misc/cgo/test/TestCthread.
The problem is that starttheworld() leaves some P's with local work
without M's. Then all active M's enter into syscalls, but reject to
wake another M's due to the following check (both in entersyscallblock() and in retake()):
if(p->runqhead == p->runqtail &&
        runtime·atomicload(&runtime·sched.nmspinning) +
        runtime·atomicload(&runtime·sched.npidle) > 0)
        continue;

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

12 years agocmd/ld: host linking support for linux/amd64
Russ Cox [Thu, 7 Mar 2013 14:19:02 +0000 (09:19 -0500)]
cmd/ld: host linking support for linux/amd64

Still to do: non-linux and non-amd64.
It may work on other ELF-based amd64 systems too, but untested.

"go test -ldflags -hostobj $GOROOT/misc/cgo/test" passes.

Much may yet change, but this seems a reasonable checkpoint.

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

12 years agoruntime: fix cgo callbacks on windows
Russ Cox [Thu, 7 Mar 2013 14:18:48 +0000 (09:18 -0500)]
runtime: fix cgo callbacks on windows

Fixes #4955.

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

12 years agonet: fix accept/connect deadline handling
Dmitriy Vyukov [Thu, 7 Mar 2013 13:03:40 +0000 (17:03 +0400)]
net: fix accept/connect deadline handling
Ensure that accept/connect respect deadline,
even if the operation can be executed w/o blocking.
Note this changes external behavior, but it makes
it consistent with read/write.
Factor out deadline check into pollServer.PrepareRead/Write,
in preparation for edge triggered pollServer.
Ensure that pollServer.WaitRead/Write are not called concurrently
by adding rio/wio locks around connect/accept.

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

12 years agonet: fix typo in skip message
Mikio Hara [Thu, 7 Mar 2013 10:17:18 +0000 (19:17 +0900)]
net: fix typo in skip message

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

12 years agonet: fix plan9 build
Mikio Hara [Thu, 7 Mar 2013 10:15:00 +0000 (19:15 +0900)]
net: fix plan9 build

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

12 years agocmd/fix: remove redundant 0 port
Tyler Bunnell [Thu, 7 Mar 2013 10:06:19 +0000 (19:06 +0900)]
cmd/fix: remove redundant 0 port

Fixes #4505.

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

12 years agoall: delete a couple of mentions of the exp and old trees
Rob Pike [Thu, 7 Mar 2013 00:52:03 +0000 (16:52 -0800)]
all: delete a couple of mentions of the exp and old trees

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

12 years agogo/types: implement constant string(x) conversions
Robert Griesemer [Thu, 7 Mar 2013 00:15:04 +0000 (16:15 -0800)]
go/types: implement constant string(x) conversions

Fixes #4982.

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

12 years agogo/types: cleanup of assignment checks
Robert Griesemer [Thu, 7 Mar 2013 00:14:07 +0000 (16:14 -0800)]
go/types: cleanup of assignment checks

Also:
- cleaner handling of constants w/ unknown value
- removed several TODOs

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

12 years agoall: Skip AllocsPerRun tests if GOMAXPROCS>1.
Albert Strasheim [Wed, 6 Mar 2013 23:52:32 +0000 (15:52 -0800)]
all: Skip AllocsPerRun tests if GOMAXPROCS>1.

Fixes #4974.

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

12 years agodoc/effective_go.html: unify and expand the discussion of Sprintf and String
Rob Pike [Wed, 6 Mar 2013 23:47:49 +0000 (15:47 -0800)]
doc/effective_go.html: unify and expand the discussion of Sprintf and String
It's a common mistake to build a recursive String method; explain it well and
show how to avoid it.

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

12 years agoexp/norm: delete, part of moving to go.text
Rob Pike [Wed, 6 Mar 2013 22:34:03 +0000 (14:34 -0800)]
exp/norm: delete, part of moving to go.text
See also https://golang.org/cl/7520044

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

12 years agonet/http: remove allocations in HeaderWriteSubset
Brad Fitzpatrick [Wed, 6 Mar 2013 22:10:47 +0000 (14:10 -0800)]
net/http: remove allocations in HeaderWriteSubset

Before:
BenchmarkHeaderWriteSubset  500000  2354 ns/op  197 B/op  2 allocs/op
After:
BenchmarkHeaderWriteSubset 1000000  2085 ns/op    0 B/op  0 allocs/op

Fixes #3761

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

12 years agocmd/cgo: split cgo_export into cgo_export_static and cgo_export_dynamic
Russ Cox [Wed, 6 Mar 2013 21:57:14 +0000 (16:57 -0500)]
cmd/cgo: split cgo_export into cgo_export_static and cgo_export_dynamic

Also emit cgo_ldflag pragmas.

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