]> Cypherpunks repositories - gostls13.git/log
gostls13.git
11 years agoruntime: make notetsleep() return false if timeout happens
Dmitriy Vyukov [Wed, 29 May 2013 07:49:45 +0000 (11:49 +0400)]
runtime: make notetsleep() return false if timeout happens
This is needed for preemptive scheduler, because during
stoptheworld we want to wait with timeout and re-preempt
M's on timeout.

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

11 years agodoc: Fix typo in approximation of square root
Katrina Owen [Wed, 29 May 2013 03:49:51 +0000 (13:49 +1000)]
doc: Fix typo in approximation of square root

See https://en.wikipedia.org/wiki/Newton%27s_method#Square_root_of_a_number

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

11 years agoA+C: add Katrina Owen (individual CLA)
Andrew Gerrand [Wed, 29 May 2013 03:49:31 +0000 (13:49 +1000)]
A+C: add Katrina Owen (individual CLA)

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

11 years agocmd/5l, cmd/6l, cmd/8l, cmd/gc, runtime: generate and use bitmaps of argument pointer...
Carl Shapiro [Wed, 29 May 2013 00:59:10 +0000 (17:59 -0700)]
cmd/5l, cmd/6l, cmd/8l, cmd/gc, runtime: generate and use bitmaps of argument pointer locations

With this change the compiler emits a bitmap for each function
covering its stack frame arguments area.  If an argument word
is known to contain a pointer, a bit is set.  The garbage
collector reads this information when scanning the stack by
frames and uses it to ignores locations known to not contain a
pointer.

R=golang-dev, bradfitz, daniel.morsing, dvyukov, khr, khr, iant, cshapiro
CC=golang-dev
https://golang.org/cl/9223046

11 years agoruntime: make mheap statically allocated again
Dmitriy Vyukov [Tue, 28 May 2013 18:14:47 +0000 (22:14 +0400)]
runtime: make mheap statically allocated again
This depends on: 9791044: runtime: allocate page table lazily
Once page table is moved out of heap, the heap becomes small.
This removes unnecessary dereferences during heap access.
No logical changes.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/9802043

11 years agoruntime: allocate page table lazily
Dmitriy Vyukov [Tue, 28 May 2013 18:04:34 +0000 (22:04 +0400)]
runtime: allocate page table lazily
This removes the 256MB memory allocation at startup,
which conflicts with ulimit.
Also will allow to eliminate an unnecessary memory dereference in GC,
because the page table is usually mapped at known address.
Update #5049.
Update #5236.

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

11 years agoruntime: allocate internal symbol table eagerly
Dmitriy Vyukov [Tue, 28 May 2013 17:10:10 +0000 (21:10 +0400)]
runtime: allocate internal symbol table eagerly
we need it for GC anyway.

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

11 years agoos/exec: fix test hang
Dmitriy Vyukov [Tue, 28 May 2013 17:09:27 +0000 (21:09 +0400)]
os/exec: fix test hang
Currently the test closes random files descriptors,
which leads to hang (in particular if netpoll fd is closed).
Try to open only fd 3, since the parent process expects it to be fd 3 anyway.
Fixes #5571.

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

11 years agoruntime: fix heap corruption during GC
Dmitriy Vyukov [Tue, 28 May 2013 15:17:47 +0000 (19:17 +0400)]
runtime: fix heap corruption during GC
The 'n' variable is used during rescan initiation in GC_END case,
but it's overwritten with chan capacity in GC_CHAN case.
As the result rescan is done with the wrong object size.
Fixes #5554.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/9831043

11 years agoruntime: use m and g, instead of R9 and R10, in ARM assembly files
Shenghou Ma [Tue, 28 May 2013 12:13:02 +0000 (20:13 +0800)]
runtime: use m and g, instead of R9 and R10, in ARM assembly files
also don't clobber R9 if it is about to crash.

In response to https://golang.org/cl/9251043/#msg2.

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

11 years agoundo CL 9805043 / 776aba85ece8
Dmitriy Vyukov [Tue, 28 May 2013 07:14:39 +0000 (11:14 +0400)]
undo CL 9805043 / 776aba85ece8

multiple failures on amd64

««« original CL description
runtime: introduce helper persistentalloc() function
It is a caching wrapper around SysAlloc() that can allocate small chunks.
Use it for symtab allocations. Reduces number of symtab walks from 4 to 3
(reduces buildfuncs time from 10ms to 7.5ms on a large binary,
reduces initial heap size by 680K on the same binary).
Also can be used for type info allocation, itab allocation.
There are also several places in GC where we do the same thing,
they can be changed to use persistentalloc().
Also can be used in FixAlloc, because each instance of FixAlloc allocates
in 128K regions, which is too eager.

R=golang-dev, daniel.morsing, khr
CC=golang-dev
https://golang.org/cl/9805043
»»»

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

11 years agoruntime: inline MCache_Alloc() into mallocgc()
Dmitriy Vyukov [Tue, 28 May 2013 07:05:55 +0000 (11:05 +0400)]
runtime: inline MCache_Alloc() into mallocgc()
benchmark                    old ns/op    new ns/op    delta
BenchmarkMalloc8                    68           62   -8.63%
BenchmarkMalloc16                   75           69   -7.94%
BenchmarkMallocTypeInfo8           102           98   -3.73%
BenchmarkMallocTypeInfo16          108          103   -4.63%

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

11 years agoruntime: introduce helper persistentalloc() function
Dmitriy Vyukov [Tue, 28 May 2013 06:47:35 +0000 (10:47 +0400)]
runtime: introduce helper persistentalloc() function
It is a caching wrapper around SysAlloc() that can allocate small chunks.
Use it for symtab allocations. Reduces number of symtab walks from 4 to 3
(reduces buildfuncs time from 10ms to 7.5ms on a large binary,
reduces initial heap size by 680K on the same binary).
Also can be used for type info allocation, itab allocation.
There are also several places in GC where we do the same thing,
they can be changed to use persistentalloc().
Also can be used in FixAlloc, because each instance of FixAlloc allocates
in 128K regions, which is too eager.

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

11 years agoruntime: fix runtime·netpoll() to call runtime·netpollready() only once per event.
Bill Neubauer [Mon, 27 May 2013 21:03:10 +0000 (05:03 +0800)]
runtime: fix runtime·netpoll() to call runtime·netpollready() only once per event.

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

11 years agoruntime: make arm signal handler call runtime.badsignal
Shenghou Ma [Mon, 27 May 2013 12:46:53 +0000 (20:46 +0800)]
runtime: make arm signal handler call runtime.badsignal
In preparation for CL 9249043 (already submitted).

Fixes #5553.

R=golang-dev, iant, capnm9, dave
CC=golang-dev
https://golang.org/cl/9251043

11 years agoruntime: introduce cnewarray() to simplify allocation of typed arrays
Dmitriy Vyukov [Mon, 27 May 2013 07:29:11 +0000 (11:29 +0400)]
runtime: introduce cnewarray() to simplify allocation of typed arrays

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

11 years agoruntime: flag static variables as no-pointers
Jan Ziak [Mon, 27 May 2013 06:11:59 +0000 (08:11 +0200)]
runtime: flag static variables as no-pointers

Variables in data sections of 32-bit executables interfere with
garbage collector's ability to free objects and/or unnecessarily
slow down the garbage collector.

This changeset moves some static variables to .noptr sections.
'files' in symtab.c is now allocated dynamically.

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

11 years agoeffective_go.html: Fix two links
Brian G. Merrell [Mon, 27 May 2013 01:00:12 +0000 (11:00 +1000)]
effective_go.html: Fix two links
This fixes two intra-page "type assertion" links that were broken in
different ways.

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

11 years agoA+C: Brian G. Merrell (individual CLA)
David Symonds [Mon, 27 May 2013 00:59:34 +0000 (10:59 +1000)]
A+C: Brian G. Merrell (individual CLA)

Generated by addca.

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

11 years agoruntime: update comment on stack allocator
Dmitriy Vyukov [Sat, 25 May 2013 18:47:36 +0000 (22:47 +0400)]
runtime: update comment on stack allocator

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

11 years agocmd/cgo: do not output empty struct for -cdefs
Alex Brainman [Sat, 25 May 2013 10:53:55 +0000 (20:53 +1000)]
cmd/cgo: do not output empty struct for -cdefs

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

11 years agofmt.Printf: introduce notation for random access to arguments.
Rob Pike [Fri, 24 May 2013 22:49:26 +0000 (15:49 -0700)]
fmt.Printf: introduce notation for random access to arguments.
This text is added to doc.go:

        Explicit argument indexes:

        In Printf, Sprintf, and Fprintf, the default behavior is for each
        formatting verb to format successive arguments passed in the call.
        However, the notation [n] immediately before the verb indicates that the
        nth one-indexed argument is to be formatted instead. The same notation
        before a '*' for a width or precision selects the argument index holding
        the value. After processing a bracketed expression [n], arguments n+1,
        n+2, etc. will be processed unless otherwise directed.

        For example,
                fmt.Sprintf("%[2]d %[1]d\n", 11, 22)
        will yield "22, 11", while
                fmt.Sprintf("%[3]*[2].*[1]f", 12.0, 2, 6),
        equivalent to
                fmt.Sprintf("%6.2f", 12.0),
        will yield " 12.00". Because an explicit index affects subsequent verbs,
        this notation can be used to print the same values multiple times
        by resetting the index for the first argument to be repeated:
                fmt.Sprintf("%d %d %#[1]x %#x", 16, 17)
        will yield "16 17 0x10 0x11".

The notation chosen differs from that in C, but I believe it's easier to read
and to remember (we're indexing the arguments), and compatibility with
C's printf was never a strong goal anyway.

While we're here, change the word "field" to "arg" or "argument" in the
code; it was being misused and was confusing.

R=rsc, bradfitz, rogpeppe, minux.ma, peter.armitage
CC=golang-dev
https://golang.org/cl/9680043

11 years agobuild: fix make.rc on Plan 9
David du Colombier [Fri, 24 May 2013 20:55:19 +0000 (13:55 -0700)]
build: fix make.rc on Plan 9

Set $status as null to prevent rc from exiting
on the last --no-banner argument checking when
used with rc -e. It allows all.rc to not exit
before executing run.rc

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

11 years agodoc: start go 1.2 notes
Russ Cox [Fri, 24 May 2013 20:34:50 +0000 (16:34 -0400)]
doc: start go 1.2 notes

This is a file of hints, not a file of polished text.
Let's not try to do polished text until we start the
release process.

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

11 years agocrypto/x509: harmonise error prefixes.
Adam Langley [Fri, 24 May 2013 20:23:13 +0000 (16:23 -0400)]
crypto/x509: harmonise error prefixes.

crypto/x509 has ended up with a variety of error formats. This change makes them all start with "x509: ".

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

11 years agocmd/cov: delete
Rob Pike [Fri, 24 May 2013 18:06:06 +0000 (11:06 -0700)]
cmd/cov: delete
It doesn't work, it's not portable, it's not part of the released
binaries, and a better tool is due.

Fixes #1319.
Fixes #4621.

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

11 years agopath/filepath: Skip TestEvalSymlinks. Plan 9 doesn't have symlinks.
Christopher Nielsen [Fri, 24 May 2013 18:01:04 +0000 (11:01 -0700)]
path/filepath: Skip TestEvalSymlinks. Plan 9 doesn't have symlinks.

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

11 years agoasn1: Stricter checks for DER encoded booleans
Gerasimos Dimitriadis [Fri, 24 May 2013 16:37:42 +0000 (12:37 -0400)]
asn1: Stricter checks for DER encoded booleans

According to X.690, only 0 and 255 are allowed as values
for encoded booleans. Also added some test for parsing
booleans

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

11 years agoA+C: Gerasimos Dimitriadis (individual CLA)
Adam Langley [Fri, 24 May 2013 16:36:59 +0000 (12:36 -0400)]
A+C: Gerasimos Dimitriadis (individual CLA)

Generated by addca.

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

11 years agolog/syslog: fix deadlock in test
Dmitriy Vyukov [Fri, 24 May 2013 14:35:48 +0000 (18:35 +0400)]
log/syslog: fix deadlock in test
The problem was that server handlers block on done<-,
the goroutine that reads from done blocks on count<-,
and the main goroutine that is supposed to read from count
waits for server handlers to exit.
Fixes #5547.

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

11 years agomisc/cgo/testso: use bash to run test.bash
Dave Cheney [Fri, 24 May 2013 11:56:01 +0000 (07:56 -0400)]
misc/cgo/testso: use bash to run test.bash

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

11 years agocmd/cgo: change GoStringN and GoBytes from intgo to int32
Ian Lance Taylor [Fri, 24 May 2013 06:19:47 +0000 (23:19 -0700)]
cmd/cgo: change GoStringN and GoBytes from intgo to int32

Fixes build.

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

11 years agocmd/cgo: use intgo, not int, for string and slice structures
Ian Lance Taylor [Fri, 24 May 2013 05:51:07 +0000 (22:51 -0700)]
cmd/cgo: use intgo, not int, for string and slice structures

Fixes #5548.

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

11 years agotest/bench/shootout/timing.log: update to Go 1.1
Rob Pike [Fri, 24 May 2013 00:57:28 +0000 (17:57 -0700)]
test/bench/shootout/timing.log: update to Go 1.1

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

11 years agoruntime: faster range on empty map
Frederick Kelly Mayle III [Thu, 23 May 2013 21:17:52 +0000 (14:17 -0700)]
runtime: faster range on empty map

benchmark                old ns/op    new ns/op    delta
BenchmarkMapIter               191          190   -0.52%
BenchmarkMapIterEmpty           22            4  -78.96%

R=golang-dev, minux.ma, dvyukov, iant, khr
CC=golang-dev
https://golang.org/cl/9637043

11 years agoA+C: Frederick Kelly Mayle III (individual CLA)
Brad Fitzpatrick [Thu, 23 May 2013 21:17:32 +0000 (14:17 -0700)]
A+C: Frederick Kelly Mayle III (individual CLA)

Generated by addca.

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

11 years agocodereview: close the head tag
Brad Fitzpatrick [Thu, 23 May 2013 21:13:39 +0000 (14:13 -0700)]
codereview: close the head tag

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

11 years agomisc/emacs: Do not modify kill ring when programmatically deleting text
Dominik Honnef [Thu, 23 May 2013 17:19:03 +0000 (10:19 -0700)]
misc/emacs: Do not modify kill ring when programmatically deleting text

Operations like gofmt and go-remove-unused-imports delete entire
lines of text. Previously this put them on the kill-ring,
negatively affecting user experience.

R=adonovan
CC=gobot, golang-dev
https://golang.org/cl/9605043

11 years agoio: Prioritize WriterTos over ReaderFroms in Copy.
Daniel Morsing [Thu, 23 May 2013 16:29:19 +0000 (18:29 +0200)]
io: Prioritize WriterTos over ReaderFroms in Copy.

This only affects calls where both ReaderFrom and WriterTo are implemented. WriterTo can issue one large write, while ReaderFrom must Read until EOF, potentially reallocating when out of memory. With one large Write, the Writer only needs to allocate once.

This also helps in ioutil.Discard since we can avoid copying memory when the Reader implements WriterTo.

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

11 years agocrypto/rsa: implement PSS signatures.
Nan Deng [Thu, 23 May 2013 15:10:41 +0000 (11:10 -0400)]
crypto/rsa: implement PSS signatures.

This change contains an implementation of the RSASSA-PSS signature
algorithm described in RFC 3447.

R=agl, agl
CC=gobot, golang-dev, r
https://golang.org/cl/9438043

11 years agosyscall: add IPv6 socket options for Unix variants
Mikio Hara [Thu, 23 May 2013 07:22:05 +0000 (16:22 +0900)]
syscall: add IPv6 socket options for Unix variants

This CL adds missing IPv6 socket options which are required
to control IPv6 as described in RFC 3493, RFC 3542.

Update #5538

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

11 years agocmd/go: check GOROOT directory is present before acting
Alex Brainman [Thu, 23 May 2013 04:13:02 +0000 (14:13 +1000)]
cmd/go: check GOROOT directory is present before acting

Fixes #5042.

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

11 years agocodereview.py: improve error message when user is not a committer
Francesc Campoy [Wed, 22 May 2013 23:27:39 +0000 (16:27 -0700)]
codereview.py: improve error message when user is not a committer

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

11 years agogo/doc: fix build
Robert Griesemer [Wed, 22 May 2013 21:22:50 +0000 (14:22 -0700)]
go/doc: fix build

1) go/doc:
   - create correct ast.FuncType
   - use more commonly used variable names in a test case

2) make ast.FuncType.Pos robust in case of incorrect ASTs

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

11 years agoA+C: Nan Deng (individual CLA)
Adam Langley [Wed, 22 May 2013 21:08:59 +0000 (17:08 -0400)]
A+C: Nan Deng (individual CLA)

Generated by addca.

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

11 years agotest: add test for issue 3888.
Rémy Oudompheng [Wed, 22 May 2013 20:45:38 +0000 (22:45 +0200)]
test: add test for issue 3888.

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

11 years agotest/errchk: use "#!/usr/bin/env perl" shebang line
Shenghou Ma [Wed, 22 May 2013 20:41:22 +0000 (04:41 +0800)]
test/errchk: use "#!/usr/bin/env perl" shebang line
fix test failure of go.tools sub-repo on NetBSD.

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

11 years agobufio: fix SplitFunc docs
Shenghou Ma [Wed, 22 May 2013 20:38:32 +0000 (04:38 +0800)]
bufio: fix SplitFunc docs
Fixes #5532.

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

11 years agogo/ast: fix FuncType.Pos() impl. and FuncType.Params documentation
Robert Griesemer [Wed, 22 May 2013 20:36:43 +0000 (13:36 -0700)]
go/ast: fix FuncType.Pos() impl. and FuncType.Params documentation

As pointed out by adonovan.

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

11 years agodoc: GCC 4.8.1 is not updated to Go 1.1
Ian Lance Taylor [Wed, 22 May 2013 20:05:31 +0000 (13:05 -0700)]
doc: GCC 4.8.1 is not updated to Go 1.1

I will try again for 4.8.2.

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

11 years agolog/syslog: report errors from write
Rob Pike [Wed, 22 May 2013 19:45:52 +0000 (12:45 -0700)]
log/syslog: report errors from write
Fixes #5541.
This time for sure.

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

11 years agocmd/cc: reject unions containing pointers
Daniel Morsing [Wed, 22 May 2013 19:13:30 +0000 (21:13 +0200)]
cmd/cc: reject unions containing pointers

If a union contains a pointer, it will mess up the garbage collector, causing memory corruption.

R=golang-dev, dave, nightlyone, adg, dvyukov, bradfitz, minux.ma, r, iant
CC=golang-dev
https://golang.org/cl/8469043

11 years agoruntime: properly synchronize GC and finalizer goroutine
Dmitriy Vyukov [Wed, 22 May 2013 19:04:46 +0000 (23:04 +0400)]
runtime: properly synchronize GC and finalizer goroutine
This is needed for preemptive scheduler, because the goroutine
can be preempted at surprising points.

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

11 years agoruntime: detect deadlocks in programs using cgo
Dmitriy Vyukov [Wed, 22 May 2013 18:57:47 +0000 (22:57 +0400)]
runtime: detect deadlocks in programs using cgo
When cgo is used, runtime creates an additional M to handle callbacks on threads not created by Go.
This effectively disabled deadlock detection, which is a right thing, because Go program can be blocked
and only serve callbacks on external threads.
This also disables deadlock detection under race detector, because it happens to use cgo.
With this change the additional M is created lazily on first cgo call. So deadlock detector
works for programs that import "C", "net" or "net/http/pprof" but do not use them in fact.
Also fixes deadlock detector under race detector.
It should be fine to create the M later, because C code can not call into Go before first cgo call,
because C code does not know when Go initialization has completed. So a Go program need to call into C
first either to create an external thread, or notify a thread created in global ctor that Go
initialization has completed.
Fixes #4973.
Fixes #5475.

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

11 years agocmd/go: use "go get" instead of "go install" to install vet
Shenghou Ma [Wed, 22 May 2013 18:46:07 +0000 (02:46 +0800)]
cmd/go: use "go get" instead of "go install" to install vet

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

11 years agoundo CL 9658043 / ac7877558dce
Rob Pike [Wed, 22 May 2013 18:42:04 +0000 (11:42 -0700)]
undo CL 9658043 / ac7877558dce

The original code was correct. The count returned must be the length
of the input slice, not the length of the formatted message.

««« original CL description
log/syslog: report errors from Fprintf
Thanks to chiparus for identifying this.

Fixes #5541.

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

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

11 years agoruntime: fix and speedup malloc stats
Dmitriy Vyukov [Wed, 22 May 2013 18:22:57 +0000 (22:22 +0400)]
runtime: fix and speedup malloc stats
Currently per-sizeclass stats are lost for destroyed MCache's. This patch fixes this.
Also, only update mstats.heap_alloc on heap operations, because that's the only
stat that needs to be promptly updated. Everything else needs to be up-to-date only in ReadMemStats().

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

11 years agolog/syslog: report errors from Fprintf
Rob Pike [Wed, 22 May 2013 18:03:10 +0000 (11:03 -0700)]
log/syslog: report errors from Fprintf
Thanks to chiparus for identifying this.

Fixes #5541.

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

11 years agoinclude: add a README file
Shenghou Ma [Wed, 22 May 2013 10:51:15 +0000 (18:51 +0800)]
include: add a README file

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

11 years agoruntime: simplify MCache
Dmitriy Vyukov [Wed, 22 May 2013 09:29:17 +0000 (13:29 +0400)]
runtime: simplify MCache
The nlistmin/size thresholds are copied from tcmalloc,
but are unnecesary for Go malloc. We do not do explicit
frees into MCache. For sparse cases when we do (mainly hashmap),
simpler logic will do.

R=rsc, dave, iant
CC=gobot, golang-dev, r, remyoudompheng
https://golang.org/cl/9373043

11 years agocmd/go: support new location for vet
Rob Pike [Wed, 22 May 2013 04:18:10 +0000 (21:18 -0700)]
cmd/go: support new location for vet
Also delete the special case for exp, which isn't necessary any more.

Fixes #5529.

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

11 years agodoc/go_faq: fix example.
David Symonds [Wed, 22 May 2013 02:28:58 +0000 (12:28 +1000)]
doc/go_faq: fix example.

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

11 years agonet/http: add another Hijacker test
Brad Fitzpatrick [Wed, 22 May 2013 01:43:28 +0000 (18:43 -0700)]
net/http: add another Hijacker test

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

11 years agobufio: reuse Writer buffers after Flush
Brad Fitzpatrick [Tue, 21 May 2013 22:51:49 +0000 (15:51 -0700)]
bufio: reuse Writer buffers after Flush

A bufio.Writer.Flush marks the usual end of a Writer's
life. Recycle its internal buffer on those explicit flushes,
but not on normal, as-needed internal flushes.

benchmark               old ns/op    new ns/op    delta
BenchmarkWriterEmpty         1959          727  -62.89%

benchmark              old allocs   new allocs    delta
BenchmarkWriterEmpty            2            1  -50.00%

benchmark               old bytes    new bytes    delta
BenchmarkWriterEmpty         4215           83  -98.03%

R=gri, iant
CC=gobot, golang-dev, voidlogic7
https://golang.org/cl/9459044

11 years agonet/http: don't send Accept-Encoding on HEAD requests
Brad Fitzpatrick [Tue, 21 May 2013 22:21:30 +0000 (15:21 -0700)]
net/http: don't send Accept-Encoding on HEAD requests

Works around a bug in nginx: http://trac.nginx.org/nginx/ticket/358

Fixes #5522

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

11 years agodatabase/sql: remove extra RemoveDep call
Brad Fitzpatrick [Tue, 21 May 2013 21:58:08 +0000 (14:58 -0700)]
database/sql: remove extra RemoveDep call

This should have been removed in 45c12efb4635. Not a correctness
issue, but unnecessary work.

This CL also adds paranoia checks in removeDep so this doesn't
happen again.

Fixes #5502

R=adg
CC=gobot, golang-dev, google
https://golang.org/cl/9543043

11 years agotime: remove Time.FormatAppend
Brad Fitzpatrick [Tue, 21 May 2013 21:32:09 +0000 (14:32 -0700)]
time: remove Time.FormatAppend

undo CL 8478044 / 0d28fd55e721

Lack of consensus.

««« original CL description
time: add Time.FormatAppend

This is a version of Time.Format that doesn't require allocation.

Fixes #5192
Update #5195

R=r
CC=gobot, golang-dev
https://golang.org/cl/8478044
»»»

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

11 years agocmd/gc: fix confusing error with broken types and defer/go
Daniel Morsing [Tue, 21 May 2013 16:35:47 +0000 (18:35 +0200)]
cmd/gc: fix confusing error with broken types and defer/go

Fixes #5172.

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

11 years agocmd/go: fix LDFLAGS handling, enable misc/cgo/testso on Darwin
Shenghou Ma [Tue, 21 May 2013 16:32:03 +0000 (00:32 +0800)]
cmd/go: fix LDFLAGS handling, enable misc/cgo/testso on Darwin
Fixes #5479.

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

11 years agoapi: update next.txt
Brad Fitzpatrick [Tue, 21 May 2013 16:11:11 +0000 (09:11 -0700)]
api: update next.txt

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

11 years agocodereview: add khr as a person
Brad Fitzpatrick [Tue, 21 May 2013 16:02:30 +0000 (09:02 -0700)]
codereview: add khr as a person

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

11 years agocrypto/tls: don't send NPN extension if NextProtos is not set.
Adam Langley [Tue, 21 May 2013 14:47:31 +0000 (10:47 -0400)]
crypto/tls: don't send NPN extension if NextProtos is not set.

This isn't clearly a bug on Go's part, but it triggers a bug in Firefox
which means that crypto/tls and net/http cannot be wired up together
unless NextProtos includes "http/1.1". When net/http sets up the
tls.Config, it does this and so works fine. But anyone setting up the
tls.Config themselves will hit the Firefox bug.

Fixes #5445.

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

11 years agocmd/api: add more platforms
Shenghou Ma [Tue, 21 May 2013 13:47:32 +0000 (21:47 +0800)]
cmd/api: add more platforms
as OpenBSD lacks 4 errno constants, api/go1.txt is updated so that
api check won't fail.

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

11 years agonet/http: use WriteString directly when possible
Brad Fitzpatrick [Tue, 21 May 2013 02:26:26 +0000 (19:26 -0700)]
net/http: use WriteString directly when possible

Several places used io.WriteString unnecessarily when the
static type already implemented WriteString. No need to
check for it at runtime.

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

11 years agocmd/gc: clear n->list of OFOR range loop after walk.
Rémy Oudompheng [Mon, 20 May 2013 21:45:22 +0000 (23:45 +0200)]
cmd/gc: clear n->list of OFOR range loop after walk.

It contains the LHS of the range clause and gets
instrumented by racewalk, but it doesn't have any meaning.

Fixes #5446.

R=golang-dev, dvyukov, daniel.morsing, r
CC=golang-dev
https://golang.org/cl/9560044

11 years agocmd/gc: eliminate a useless bounds check in inlined append().
Rémy Oudompheng [Mon, 20 May 2013 21:19:41 +0000 (23:19 +0200)]
cmd/gc: eliminate a useless bounds check in inlined append().

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

11 years agospec: removed old or invalid TODOs
Robert Griesemer [Mon, 20 May 2013 21:01:07 +0000 (14:01 -0700)]
spec: removed old or invalid TODOs

Several old TODOs are either resolved now (e.g. when is a return
needed), or are from a time the language wasn't frozen (^ for uints
only). Consolidated the others.

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

11 years agospec: fix language about "range" clause
Robert Griesemer [Mon, 20 May 2013 20:27:53 +0000 (13:27 -0700)]
spec: fix language about "range" clause

Fixes #5434.

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

11 years agomisc/dashboard/builder: handle Plan 9 in defaultSuffix()
Shenghou Ma [Mon, 20 May 2013 19:22:52 +0000 (03:22 +0800)]
misc/dashboard/builder: handle Plan 9 in defaultSuffix()

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

11 years agocrypto/x509: provide better error messages for X.509 verify failures.
Adam Langley [Mon, 20 May 2013 18:20:26 +0000 (14:20 -0400)]
crypto/x509: provide better error messages for X.509 verify failures.

Failures caused by errors like invalid signatures or missing hash
functions cause rather generic, unhelpful error messages because no
trust chain can be constructed: "x509: certificate signed by unknown
authority."

With this change, authority errors may contain the reason why an
arbitary candidate step in the chain was rejected. For example, in the
event of a missing hash function the error looks like:

x509: certificate signed by unknown authority (possibly because of
"crypto/x509: cannot verify signature: algorithm unimplemented" while
trying to verify candidate authority certificate 'Thawte SGC CA')

Fixes 5058.

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

11 years agotest: do not run the test that relies on precise GC on 32-bits
Dmitriy Vyukov [Mon, 20 May 2013 17:53:16 +0000 (21:53 +0400)]
test: do not run the test that relies on precise GC on 32-bits
Currently most of the 32-bit builder are broken.
Fixes #5516.

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

11 years agonet/http: simplify transfer body; reduces allocations too
Brad Fitzpatrick [Mon, 20 May 2013 14:23:59 +0000 (07:23 -0700)]
net/http: simplify transfer body; reduces allocations too

benchmark                                   old ns/op    new ns/op    delta
BenchmarkServerFakeConnNoKeepAlive              14431        14247   -1.28%
BenchmarkServerFakeConnWithKeepAlive            11618        11357   -2.25%
BenchmarkServerFakeConnWithKeepAliveLite         6735         6427   -4.57%
BenchmarkServerHandlerTypeLen                    8842         8740   -1.15%
BenchmarkServerHandlerNoLen                      8001         7828   -2.16%
BenchmarkServerHandlerNoType                     8270         8227   -0.52%
BenchmarkServerHandlerNoHeader                   6148         5920   -3.71%

benchmark                                  old allocs   new allocs    delta
BenchmarkServerFakeConnNoKeepAlive                 30           29   -3.33%
BenchmarkServerFakeConnWithKeepAlive               25           24   -4.00%
BenchmarkServerFakeConnWithKeepAliveLite           10            9  -10.00%
BenchmarkServerHandlerTypeLen                      18           17   -5.56%
BenchmarkServerHandlerNoLen                        15           14   -6.67%
BenchmarkServerHandlerNoType                       16           15   -6.25%
BenchmarkServerHandlerNoHeader                     10            9  -10.00%

benchmark                                   old bytes    new bytes    delta
BenchmarkServerFakeConnNoKeepAlive               2557         2492   -2.54%
BenchmarkServerFakeConnWithKeepAlive             2260         2194   -2.92%
BenchmarkServerFakeConnWithKeepAliveLite         1092         1026   -6.04%
BenchmarkServerHandlerTypeLen                    1941         1875   -3.40%
BenchmarkServerHandlerNoLen                      1898         1832   -3.48%
BenchmarkServerHandlerNoType                     1906         1840   -3.46%
BenchmarkServerHandlerNoHeader                   1092         1026   -6.04%

Update #5195

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

11 years agosyscall: prefer PATH environment variable in bootstrap scripts
Mikio Hara [Mon, 20 May 2013 14:18:52 +0000 (23:18 +0900)]
syscall: prefer PATH environment variable in bootstrap scripts

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

11 years agoruntime: integrated network poller for freebsd/amd64,386, openbsd/amd64,386
Mikio Hara [Mon, 20 May 2013 10:25:32 +0000 (19:25 +0900)]
runtime: integrated network poller for freebsd/amd64,386, openbsd/amd64,386

Update #5199

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

11 years agonet: move system common global variables into fd_unix.go
Alex Brainman [Mon, 20 May 2013 05:23:45 +0000 (15:23 +1000)]
net: move system common global variables into fd_unix.go

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

11 years agoruntime: zeroize g->fnstart to not prevent GC of the closure
Dmitriy Vyukov [Mon, 20 May 2013 04:17:21 +0000 (08:17 +0400)]
runtime: zeroize g->fnstart to not prevent GC of the closure
Fixes #5493.

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

11 years agonet/http: fewer allocations in the server path
Brad Fitzpatrick [Mon, 20 May 2013 03:15:40 +0000 (20:15 -0700)]
net/http: fewer allocations in the server path

Don't allocate for the Date or Content-Length headers.
A custom Date header formatter replaces use of time.Format.

benchmark                                   old ns/op    new ns/op    delta
BenchmarkClientServer                           67791        64424   -4.97%
BenchmarkClientServerParallel4                  62956        58533   -7.03%
BenchmarkClientServerParallel64                 62043        54789  -11.69%
BenchmarkServer                                254609       229060  -10.03%
BenchmarkServerFakeConnNoKeepAlive              17038        16316   -4.24%
BenchmarkServerFakeConnWithKeepAlive            14184        13226   -6.75%
BenchmarkServerFakeConnWithKeepAliveLite         8591         7532  -12.33%
BenchmarkServerHandlerTypeLen                   10750         9961   -7.34%
BenchmarkServerHandlerNoLen                      9535         8935   -6.29%
BenchmarkServerHandlerNoType                     9858         9362   -5.03%
BenchmarkServerHandlerNoHeader                   7754         6856  -11.58%

benchmark                                  old allocs   new allocs    delta
BenchmarkClientServer                              68           66   -2.94%
BenchmarkClientServerParallel4                     68           66   -2.94%
BenchmarkClientServerParallel64                    68           66   -2.94%
BenchmarkServer                                    21           19   -9.52%
BenchmarkServerFakeConnNoKeepAlive                 32           30   -6.25%
BenchmarkServerFakeConnWithKeepAlive               27           25   -7.41%
BenchmarkServerFakeConnWithKeepAliveLite           12           10  -16.67%
BenchmarkServerHandlerTypeLen                      19           18   -5.26%
BenchmarkServerHandlerNoLen                        17           15  -11.76%
BenchmarkServerHandlerNoType                       17           16   -5.88%
BenchmarkServerHandlerNoHeader                     12           10  -16.67%

Update #5195

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

11 years agoruntime: change PollDesc.fd from int32 to uintptr
Alex Brainman [Mon, 20 May 2013 02:55:50 +0000 (12:55 +1000)]
runtime: change PollDesc.fd from int32 to uintptr

This is in preparation for netpoll windows version.

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

11 years agoruntime: properly set G status after syscall
Dmitriy Vyukov [Sun, 19 May 2013 15:35:09 +0000 (19:35 +0400)]
runtime: properly set G status after syscall

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

11 years agomisc/dashboard: add go.tools to list of subrepos
Dave Cheney [Sun, 19 May 2013 00:04:23 +0000 (10:04 +1000)]
misc/dashboard: add go.tools to list of subrepos

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

11 years agoruntime, cmd/gc: clean up function protoypes
Anthony Martin [Sat, 18 May 2013 22:49:23 +0000 (15:49 -0700)]
runtime, cmd/gc: clean up function protoypes

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

11 years agoruntime: mark usleep as NOSPLIT on Plan 9
Anthony Martin [Sat, 18 May 2013 22:47:49 +0000 (15:47 -0700)]
runtime: mark usleep as NOSPLIT on Plan 9

Usleep is called from lockextra, also marked NOSPLIT.

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

11 years agoruntime: fix newproc debugging print
Anthony Martin [Sat, 18 May 2013 22:47:15 +0000 (15:47 -0700)]
runtime: fix newproc debugging print

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

11 years agocompress/flate: faster version of forwardCopy
Keith Randall [Sat, 18 May 2013 22:28:27 +0000 (15:28 -0700)]
compress/flate: faster version of forwardCopy

benchmark                           old ns/op    new ns/op    delta
BenchmarkDecodeDigitsSpeed1e4          197767       203490   +2.89%
BenchmarkDecodeDigitsSpeed1e5         1873969      1912761   +2.07%
BenchmarkDecodeDigitsSpeed1e6        18922760     19021056   +0.52%
BenchmarkDecodeDigitsDefault1e4        194975       197054   +1.07%
BenchmarkDecodeDigitsDefault1e5       1704262      1719988   +0.92%
BenchmarkDecodeDigitsDefault1e6      16618354     16351957   -1.60%
BenchmarkDecodeDigitsCompress1e4       195281       194626   -0.34%
BenchmarkDecodeDigitsCompress1e5      1694364      1702372   +0.47%
BenchmarkDecodeDigitsCompress1e6     16463347     16492126   +0.17%
BenchmarkDecodeTwainSpeed1e4           200653       200127   -0.26%
BenchmarkDecodeTwainSpeed1e5          1861385      1759632   -5.47%
BenchmarkDecodeTwainSpeed1e6         18255769     17186679   -5.86%
BenchmarkDecodeTwainDefault1e4         189080       185157   -2.07%
BenchmarkDecodeTwainDefault1e5        1559222      1461465   -6.27%
BenchmarkDecodeTwainDefault1e6       14792125     13879051   -6.17%
BenchmarkDecodeTwainCompress1e4        188881       185151   -1.97%
BenchmarkDecodeTwainCompress1e5       1537031      1456945   -5.21%
BenchmarkDecodeTwainCompress1e6      14805972     13405094   -9.46%
BenchmarkPaeth                          4            4   -0.89%
BenchmarkDecodeGray                964679       937244   -2.84%
BenchmarkDecodeNRGBAGradient      3753769      3646416   -2.86%
BenchmarkDecodeNRGBAOpaque        3165856      2981300   -5.83%
BenchmarkDecodePaletted            713950       691984   -3.08%
BenchmarkDecodeRGB                3051718      2924260   -4.18%

R=nigeltao, bradfitz
CC=golang-dev, raph
https://golang.org/cl/9425046

11 years agocmd/go: Update documentation of go run to match current behaviour.
Dominik Honnef [Sat, 18 May 2013 11:22:30 +0000 (19:22 +0800)]
cmd/go: Update documentation of go run to match current behaviour.

Fixes #5511.

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

11 years agobufio: make Reader buffer transient
Brad Fitzpatrick [Fri, 17 May 2013 22:16:06 +0000 (15:16 -0700)]
bufio: make Reader buffer transient

Share garbage between different bufio Readers. When a Reader
has zero buffered data, put its buffer into a pool.

This acknowledges that most bufio.Readers eventually get
read to completion, and their buffers are then no longer
needed.

benchmark               old ns/op    new ns/op    delta
BenchmarkReaderEmpty         2993         1058  -64.65%

benchmark              old allocs   new allocs    delta
BenchmarkReaderEmpty            3            2  -33.33%

benchmark               old bytes    new bytes    delta
BenchmarkReaderEmpty         4278          133  -96.89%

Update #5100

R=r
CC=adg, dvyukov, gobot, golang-dev, rogpeppe
https://golang.org/cl/8819049

11 years agocmd/vet: delete; it now lives in the go.tools subrepo
Rob Pike [Fri, 17 May 2013 20:53:22 +0000 (13:53 -0700)]
cmd/vet: delete; it now lives in the go.tools subrepo

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

12 years agoruntime: faster x86 memmove (a.k.a. built-in copy())
Keith Randall [Fri, 17 May 2013 19:53:49 +0000 (12:53 -0700)]
runtime: faster x86 memmove (a.k.a. built-in copy())

REP instructions have a high startup cost, so we handle small
sizes with some straightline code.  The REP MOVSx instructions
are really fast for large sizes.  The cutover is approximately
1K.  We implement up to 128/256 because that is the maximum
SSE register load (loading all data into registers before any
stores lets us ignore copy direction).

(on a Sandy Bridge E5-1650 @ 3.20GHz)
benchmark               old ns/op    new ns/op    delta
BenchmarkMemmove0               3            3   +0.86%
BenchmarkMemmove1               5            5   +5.40%
BenchmarkMemmove2              18            8  -56.84%
BenchmarkMemmove3              18            7  -58.45%
BenchmarkMemmove4              36            7  -78.63%
BenchmarkMemmove5              36            8  -77.91%
BenchmarkMemmove6              36            8  -77.76%
BenchmarkMemmove7              36            8  -77.82%
BenchmarkMemmove8              18            8  -56.33%
BenchmarkMemmove9              18            7  -58.34%
BenchmarkMemmove10             18            7  -58.34%
BenchmarkMemmove11             18            7  -58.45%
BenchmarkMemmove12             36            7  -78.51%
BenchmarkMemmove13             36            7  -78.48%
BenchmarkMemmove14             36            7  -78.56%
BenchmarkMemmove15             36            7  -78.56%
BenchmarkMemmove16             18            7  -58.24%
BenchmarkMemmove32             18            8  -54.33%
BenchmarkMemmove64             18            8  -53.37%
BenchmarkMemmove128            20            9  -55.93%
BenchmarkMemmove256            25           11  -55.16%
BenchmarkMemmove512            33           33   -1.19%
BenchmarkMemmove1024           43           44   +2.06%
BenchmarkMemmove2048           61           61   +0.16%
BenchmarkMemmove4096           95           95   +0.00%

R=golang-dev, bradfitz, remyoudompheng, khr, iant, dominik.honnef
CC=golang-dev
https://golang.org/cl/9038048

12 years agomisc/cgo/test: deflake TestParallelSleep once more
Shenghou Ma [Fri, 17 May 2013 18:55:44 +0000 (02:55 +0800)]
misc/cgo/test: deflake TestParallelSleep once more
Fixes #5480.

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

12 years agocmd/ld: emit .tbss section when doing dynamic internal linking
Shenghou Ma [Fri, 17 May 2013 18:41:49 +0000 (02:41 +0800)]
cmd/ld: emit .tbss section when doing dynamic internal linking
Fixes #5200.

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