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

12 years agonet/http/httputil: fix build
Russ Cox [Wed, 6 Mar 2013 21:56:53 +0000 (16:56 -0500)]
net/http/httputil: fix build

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

12 years agoruntime: fix netbsd, windows build
Russ Cox [Wed, 6 Mar 2013 21:55:08 +0000 (16:55 -0500)]
runtime: fix netbsd, windows build

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

12 years agonet/http: change user agent string
Russ Cox [Wed, 6 Mar 2013 21:48:20 +0000 (16:48 -0500)]
net/http: change user agent string

Some IDS somewhere thinks "Go http package" is a virus.
Make it something else for Go 1.1. Dumb but easy.

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

12 years agomake.bash,bat: add -tags gotypes to the build
Rob Pike [Wed, 6 Mar 2013 21:16:43 +0000 (13:16 -0800)]
make.bash,bat: add -tags gotypes to the build
This installs type checking into go vet.
(To be removed before releasing Go 1.1)

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

12 years agocmd/vet: isolate the type checking code into a separate file
Rob Pike [Wed, 6 Mar 2013 20:49:56 +0000 (12:49 -0800)]
cmd/vet: isolate the type checking code into a separate file
We can enable/disable type checking with a build tag.
Should simplify cutting the go1.1 distribution free of go/types.

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

12 years agolib9: add mktempdir, removeall, runprog
Russ Cox [Wed, 6 Mar 2013 20:48:28 +0000 (15:48 -0500)]
lib9: add mktempdir, removeall, runprog

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

12 years agotext/template: improve error reporting for executing an empty template
Rob Pike [Wed, 6 Mar 2013 20:34:19 +0000 (12:34 -0800)]
text/template: improve error reporting for executing an empty template
Fixes #4522.

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

12 years agostrings: remove allocations in Split(s, "")
Ewan Chou [Wed, 6 Mar 2013 20:21:19 +0000 (15:21 -0500)]
strings: remove allocations in Split(s, "")

BenchmarkSplit1     77984460     24131380  -69.06%

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

12 years agoA+C: Ewan Chou (individual CLA)
Russ Cox [Wed, 6 Mar 2013 20:20:24 +0000 (15:20 -0500)]
A+C: Ewan Chou (individual CLA)

Generated by addca.

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

12 years agoruntime,misc/cgo/test: disable broken tests so we can test the rest
Alex Brainman [Wed, 6 Mar 2013 20:19:01 +0000 (15:19 -0500)]
runtime,misc/cgo/test: disable broken tests so we can test the rest

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

12 years agolibmach: fix amd64 pe handling
Alex Brainman [Wed, 6 Mar 2013 20:14:07 +0000 (15:14 -0500)]
libmach: fix amd64 pe handling

Fixes #4841.

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

12 years agomisc/cgo/test: do not stop on first error
Russ Cox [Wed, 6 Mar 2013 20:03:28 +0000 (15:03 -0500)]
misc/cgo/test: do not stop on first error

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

12 years agoruntime: change amd64 startup convention
Russ Cox [Wed, 6 Mar 2013 20:03:04 +0000 (15:03 -0500)]
runtime: change amd64 startup convention

Now the default startup is that the program begins at _rt0_amd64_$GOOS,
which sets DI = argc, SI = argv and jumps to _rt0_amd64.

This makes the _rt0_amd64 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.

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

12 years agomisc/emacs: Add compatibility for GNU Emacs 23 and XEmacs >=21.5.32
Dominik Honnef [Wed, 6 Mar 2013 19:35:29 +0000 (14:35 -0500)]
misc/emacs: Add compatibility for GNU Emacs 23 and XEmacs >=21.5.32

This CL adds compatibility for GNU Emacs 23 (fixing fontification
issues) and XEmacs >=21.5.32 (fixing a lot of issues). Earlier
versions of XEmacs will not be supported because they do not
support POSIX character classes. Because of that, we also make use
of a lot of functions that were added in 21.5.32.

A known and currently unfixable issue with XEmacs is that go-mode
will not always fontify identifiers that use unicode correctly.

All changes for XEmacs are annotated in the diff.

Note: go--position-bytes is not currently used anywhere, but will
be in a future CL.

Fixes #4927.

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

12 years agoapi: update next.txt
Brad Fitzpatrick [Wed, 6 Mar 2013 19:16:58 +0000 (11:16 -0800)]
api: update next.txt

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

12 years agoeffective_go.html: round 3 of minor edits.
Rob Pike [Wed, 6 Mar 2013 18:08:48 +0000 (10:08 -0800)]
effective_go.html: round 3 of minor edits.

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

12 years agonet/http: close TCP connection on Response.Body.Close
Brad Fitzpatrick [Wed, 6 Mar 2013 02:47:27 +0000 (18:47 -0800)]
net/http: close TCP connection on Response.Body.Close

Previously the HTTP client's (*Response).Body.Close would try
to keep reading until EOF, hoping to reuse the keep-alive HTTP
connection, but the EOF might never come, or it might take a
long time. Now we immediately close the TCP connection if we
haven't seen EOF.

This shifts the burden onto clients to read their whole response
bodies if they want the advantage of reusing TCP connections.

In the future maybe we could decide on heuristics to read some
number of bytes for some max amount of time before forcefully
closing, but I'd rather not for now.

Statistically, touching this code makes things regress, so I
wouldn't be surprised if this introduces new bugs, but all the
tests pass, and I think the code is simpler now too. Maybe.

Please test your HTTP client code before Go 1.1.

Fixes #3672

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

12 years agoimage/jpeg: for progressive JPEGs, the first SOS segment doesn't
Nigel Tao [Tue, 5 Mar 2013 23:08:46 +0000 (10:08 +1100)]
image/jpeg: for progressive JPEGs, the first SOS segment doesn't
necessarily contain all components.

Fixes #4975.

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

12 years agovet: check for useless assignments.
David Symonds [Tue, 5 Mar 2013 22:55:04 +0000 (09:55 +1100)]
vet: check for useless assignments.

The only check so far is for self-assignments of the form "expr = expr",
but even that found one instance in the standard library.

R=r, adg, mtj, rsc
CC=golang-dev
https://golang.org/cl/7455048

12 years agocmd/vet: change some warnings to errors for consistency.
Rob Pike [Tue, 5 Mar 2013 22:31:17 +0000 (14:31 -0800)]
cmd/vet: change some warnings to errors for consistency.
Fixes #4980.

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

12 years agodoc/effective_go.html: update slices and maps.
Rob Pike [Tue, 5 Mar 2013 22:13:53 +0000 (14:13 -0800)]
doc/effective_go.html: update slices and maps.
Drop the phrase "reference types", which has caused confusion.
Add a section about 2D arrays, a common newbie question.

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

12 years agoundo CL 7301062 / 9742f722b558
Russ Cox [Tue, 5 Mar 2013 20:36:40 +0000 (15:36 -0500)]
undo CL 7301062 / 9742f722b558

broke arm garbage collector

traceback_arm fails with a missing pc. It needs CL 7494043.
But that only makes the build break later, this time with
"invalid freelist". Roll back until it can be fixed correctly.

««« original CL description
runtime: restrict stack root scan to locals and arguments

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

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

12 years agogo/types: add test typechecking std lib
Robert Griesemer [Tue, 5 Mar 2013 19:42:43 +0000 (11:42 -0800)]
go/types: add test typechecking std lib

- run time is limited if -short is set
- also added missing TODO to unrelated file return.go

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

12 years agosyscall: handle getsockname for unix sockets on openbsd 5.2
Joel Sing [Tue, 5 Mar 2013 10:40:37 +0000 (21:40 +1100)]
syscall: handle getsockname for unix sockets on openbsd 5.2

On OpenBSD 5.2, calling getsockname on an unbound Unix domain socket
results in a successful syscall, however the AF is unset and the length
is returned as zero. This has been changed to more portable behaviour,
which will be included in the OpenBSD 5.3 release.

For now, work around this by treating a successful getsockname() call
that returns a family of AF_UNSPEC and length of zero as a AF_UNIX
socket.

Makes TestPassFD work on OpenBSD 5.2.

Fixes #4956.

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

12 years agoruntime: add atomic xchg64
Dmitriy Vyukov [Tue, 5 Mar 2013 07:46:52 +0000 (09:46 +0200)]
runtime: add atomic xchg64
It will be handy for network poller.

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

12 years agoruntime: fix false positive deadlock when using runtime.Goexit
Dmitriy Vyukov [Tue, 5 Mar 2013 07:40:17 +0000 (09:40 +0200)]
runtime: fix false positive deadlock when using runtime.Goexit
Fixes #4893.
Actually it's fixed by cl/7314062 (improved scheduler),
just submitting the test.

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

12 years agoruntime: declare addtimer/deltimer in runtime.h
Dmitriy Vyukov [Tue, 5 Mar 2013 07:38:15 +0000 (09:38 +0200)]
runtime: declare addtimer/deltimer in runtime.h
In preparation for integrated network poller
(https://golang.org/cl/7326051),
this is required to handle deadlines.

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

12 years agoruntime: restrict stack root scan to locals and arguments
Carl Shapiro [Tue, 5 Mar 2013 03:48:50 +0000 (19:48 -0800)]
runtime: restrict stack root scan to locals and arguments

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

12 years agotext/template/parse: remove self-assignment.
David Symonds [Tue, 5 Mar 2013 00:16:58 +0000 (11:16 +1100)]
text/template/parse: remove self-assignment.

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

12 years agovet: clean up taglit error print when typechecking fails.
David Symonds [Mon, 4 Mar 2013 22:56:46 +0000 (09:56 +1100)]
vet: clean up taglit error print when typechecking fails.

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

12 years agogo/types: "missing return" check
Robert Griesemer [Mon, 4 Mar 2013 22:40:12 +0000 (14:40 -0800)]
go/types: "missing return" check

Implementation closely based on Russ' CL 7440047.

Future work: The error messages could be better
(e.g., instead of "missing return" it might say
"missing return (no default in switch)", etc.).

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

12 years agocmd/gc: implement new return requirements
Russ Cox [Mon, 4 Mar 2013 22:02:04 +0000 (17:02 -0500)]
cmd/gc: implement new return requirements

Fixes #65.

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

12 years agospec: terminating statements for functions
Robert Griesemer [Mon, 4 Mar 2013 21:55:35 +0000 (13:55 -0800)]
spec: terminating statements for functions

The only functional change is the new section
on terminating statements.

There is a minor syntax rewrite (not change)
of function declarations to make it easier to
refer to the notion of a function from all places
where it is used (function decls, method decls,
and function literals).

Includes some minor fixes/additions of missing links.

Based closely on Russ' proposal.

Fixes #65.

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

12 years agospec: cyclic imports are illegal
Robert Griesemer [Mon, 4 Mar 2013 20:59:40 +0000 (12:59 -0800)]
spec: cyclic imports are illegal

Fixes #4976.

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

12 years agomisc/emacs: Add tab completion for godoc command, completing from known installed...
Dominik Honnef [Mon, 4 Mar 2013 20:31:57 +0000 (15:31 -0500)]
misc/emacs: Add tab completion for godoc command, completing from known installed packages

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

12 years agotest/bench/go1: use raw string instead of string addition
Shenghou Ma [Mon, 4 Mar 2013 20:23:37 +0000 (04:23 +0800)]
test/bench/go1: use raw string instead of string addition
to reduce compile time memory/stack usage.
Update #4970
$ go test -c ../test/bench/go1
before:
0.36user 0.07system 0:00.44elapsed 100%CPU
(0avgtext+0avgdata 540720maxresident)k
0inputs+19840outputs (0major+56451minor)pagefaults 0swaps
after:
0.33user 0.05system 0:00.39elapsed 100%CPU
(0avgtext+0avgdata 289936maxresident)k
0inputs+19864outputs (0major+29615minor)pagefaults 0swaps

And stack usage is reduced to below 1MiB.

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

12 years agonet: make some tests less flaky
Brad Fitzpatrick [Mon, 4 Mar 2013 19:55:27 +0000 (11:55 -0800)]
net: make some tests less flaky

Fixes #4969

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

12 years agocmd/cgo: use explicit flag to emit dynamic linker path
Russ Cox [Mon, 4 Mar 2013 16:23:17 +0000 (11:23 -0500)]
cmd/cgo: use explicit flag to emit dynamic linker path

Using -import_runtime_cgo would have worked great except
that it doesn't get passed to the second invocation of cgo,
and that's the one that writes the relevant file.

Fixes ARM build on systems with a different dynamic linker
than the one 5l assumes (like Gentoo).

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

12 years agonet/http/cgi: maybe improve darwin test reliability
Brad Fitzpatrick [Mon, 4 Mar 2013 16:13:39 +0000 (08:13 -0800)]
net/http/cgi: maybe improve darwin test reliability

Use a 17 MB payload instead of a 1 MB payload, since
OS X can apparently buffer up to 16 MB in its pipes.

Fixes #4958 maybe

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

12 years agocmd/gc: disallow selectors to the blank identifier
Daniel Morsing [Mon, 4 Mar 2013 16:01:42 +0000 (17:01 +0100)]
cmd/gc: disallow selectors to the blank identifier

Fixes #4941.

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

12 years agoruntime: add garbage collector statistics
Jan Ziak [Mon, 4 Mar 2013 15:54:37 +0000 (16:54 +0100)]
runtime: add garbage collector statistics

If the constant CollectStats is non-zero and GOGCTRACE=1
the garbage collector will print basic statistics about executed
GC instructions.

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