]> Cypherpunks repositories - gostls13.git/log
gostls13.git
11 years agoruntime: correctly handle signals received on foreign threads
Shenghou Ma [Thu, 11 Jul 2013 20:39:39 +0000 (04:39 +0800)]
runtime: correctly handle signals received on foreign threads
Fixes #3250.

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

11 years agocmd/cgo: silence two gcc warnings for *.cgo2.c
Shenghou Ma [Thu, 11 Jul 2013 20:35:53 +0000 (04:35 +0800)]
cmd/cgo: silence two gcc warnings for *.cgo2.c
1. "int e;" is unused, generating "unused variable" error.
2. a->e was typed void *[2], but was accessed with *(int *)(a->e), this
generated "dereferencing type-punned pointer will break strict-aliasing rules" error.

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

11 years agosyscall: implement Sendfile for Darwin.
Shenghou Ma [Thu, 11 Jul 2013 20:34:54 +0000 (04:34 +0800)]
syscall: implement Sendfile for Darwin.
Update #5847
Summary: syscall: implement Sendfile for OpenBSD and NetBSD

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

11 years agocmd/cgo: clarify the underscore prefix rule and C union representation in Go.
Shenghou Ma [Thu, 11 Jul 2013 20:34:04 +0000 (04:34 +0800)]
cmd/cgo: clarify the underscore prefix rule and C union representation in Go.

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

11 years agoruntime: fix CPU underutilization
Dmitriy Vyukov [Thu, 11 Jul 2013 19:57:36 +0000 (15:57 -0400)]
runtime: fix CPU underutilization
runtime.newproc/ready are deliberately sloppy about waking new M's,
they only ensure that there is at least 1 spinning M.
Currently to compensate for that, schedule() checks if the current P
has local work and there are no spinning M's, it wakes up another one.
It does not work if goroutines do not call schedule.
With this change a spinning M wakes up another M when it finds work to do.
It's also not ideal, but it fixes the underutilization.
A proper check would require to know the exact number of runnable G's,
but it's too expensive to maintain.
Fixes #5586.
This is reincarnation of cl/9776044 with the bug fixed.
The bug was due to code added after cl/9776044 was created:
if(tick - (((uint64)tick*0x4325c53fu)>>36)*61 == 0 && runtime·sched.runqsize > 0) {
        runtime·lock(&runtime·sched);
        gp = globrunqget(m->p, 1);
        runtime·unlock(&runtime·sched);
}
If M gets gp from global runq here, it does not reset m->spinning.

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

11 years agonet/rpc: fix a test bug
ChaiShushan [Thu, 11 Jul 2013 19:55:08 +0000 (15:55 -0400)]
net/rpc: fix a test bug

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

11 years agoruntime: adjust traceback for new preemptive reality
Dmitriy Vyukov [Thu, 11 Jul 2013 17:52:20 +0000 (13:52 -0400)]
runtime: adjust traceback for new preemptive reality
Currently it crashes as follows:
fatal error: unknown pc
...
goroutine 71698 [runnable]:
runtime.racegoend()
        src/pkg/runtime/race.c:171
runtime.goexit()
        src/pkg/runtime/proc.c:1276 +0x9
created by runtime_test.testConcurrentReadsAfterGrowth
        src/pkg/runtime/map_test.go:264 +0x332

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

11 years agoimage/draw: add the Quantizer type.
Nigel Tao [Thu, 11 Jul 2013 05:17:32 +0000 (15:17 +1000)]
image/draw: add the Quantizer type.

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

11 years agocmd/ld: correct assignment of sizes to mach-o symbols
Russ Cox [Thu, 11 Jul 2013 02:06:52 +0000 (22:06 -0400)]
cmd/ld: correct assignment of sizes to mach-o symbols

If you compute the size by subtraction from the address
of the next symbol, it helps to wait until the symbols have
been sorted by address.

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

11 years agoimage/draw: add Drawer, FloydSteinberg and the op.Draw method.
Nigel Tao [Wed, 10 Jul 2013 22:47:29 +0000 (08:47 +1000)]
image/draw: add Drawer, FloydSteinberg and the op.Draw method.

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

11 years agogo/format: fix failing test (fix build)
Robert Griesemer [Wed, 10 Jul 2013 21:19:35 +0000 (14:19 -0700)]
go/format: fix failing test (fix build)

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

11 years agogo/parser: more tolerant parsing of const and var decls
Robert Griesemer [Wed, 10 Jul 2013 19:01:07 +0000 (12:01 -0700)]
go/parser: more tolerant parsing of const and var decls

Instead, rely on the type checker.

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

11 years agohtml: add escaping tests
Andrew Gerrand [Wed, 10 Jul 2013 07:31:46 +0000 (17:31 +1000)]
html: add escaping tests

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

11 years agotime: find correct zone abbreviations even on non-English windows systems
Alex Brainman [Wed, 10 Jul 2013 05:34:24 +0000 (15:34 +1000)]
time: find correct zone abbreviations even on non-English windows systems

Fixes #5783

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

11 years agospec: define notion of named type
Robert Griesemer [Wed, 10 Jul 2013 04:12:53 +0000 (21:12 -0700)]
spec: define notion of named type

The notion of a named type is crucial for the definition
of type identity, assignability, definitions of methods.
Explicitly introduce the notion with an extra sentence.

Fixes #5682.

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

11 years agonet/http: in ServeContent, don't seek on content until necessary
Brad Fitzpatrick [Wed, 10 Jul 2013 03:29:52 +0000 (13:29 +1000)]
net/http: in ServeContent, don't seek on content until necessary

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

11 years agoencoding/xml: fix typo in docs
Andrew Gerrand [Wed, 10 Jul 2013 00:14:31 +0000 (10:14 +1000)]
encoding/xml: fix typo in docs

Fixes #5843.

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

11 years agocmd/go: fix a couple of bugs in coverage tooling
Rob Pike [Tue, 9 Jul 2013 23:52:36 +0000 (09:52 +1000)]
cmd/go: fix a couple of bugs in coverage tooling
Merging a couple of CLs into one, since they collided in my client
and I'm lazy.

1) Fix up output in "go test -cover" case.
We need to tell the testing package the name of the package being tested
and the name of the package being covered. It can then sort out the report.

2) Filter out the _test.go files from coverage processing. We want to measure
what the tests cover, not what's covered in the tests,
The coverage for encoding/gob goes from 82.2% to 88.4%.
There may be a cleaner way to do this - suggestions welcome - but ça suffit.

Fixes #5810.

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

11 years agobuiltin: document print and println
Robert Griesemer [Tue, 9 Jul 2013 23:20:19 +0000 (16:20 -0700)]
builtin: document print and println

Fixes #5787.

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

11 years agoimage/color: add Plan9Palette and WebSafePalette.
Nigel Tao [Tue, 9 Jul 2013 09:17:17 +0000 (19:17 +1000)]
image/color: add Plan9Palette and WebSafePalette.

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

11 years agocmd/ld: trivial: fix unhandled switch case
Dave Cheney [Tue, 9 Jul 2013 02:14:32 +0000 (21:14 -0500)]
cmd/ld: trivial: fix unhandled switch case

Fix warning found by clang 3.3.

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

11 years agonet/rpc: use log.Print and return error instead log.Fatal
ChaiShushan [Tue, 9 Jul 2013 01:12:05 +0000 (11:12 +1000)]
net/rpc: use log.Print and return error instead log.Fatal

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

11 years agomisc/dist: clean files from GOPATH after building tour
Andrew Gerrand [Mon, 8 Jul 2013 01:45:33 +0000 (11:45 +1000)]
misc/dist: clean files from GOPATH after building tour

Fixes #5503.

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

11 years agocmd/go: fix "go get -u" for git repositories.
Shenghou Ma [Sun, 7 Jul 2013 15:06:30 +0000 (23:06 +0800)]
cmd/go: fix "go get -u" for git repositories.
CL 10869046 changed cmd/go to checkout master branch, so
for "go get -u" to work, it must "git pull" instead of
"git fetch". Added "--ff-only" so that it won't accidentally
overwrite user changes.

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

11 years agocmd/6g, cmd/8g: prevent constant propagation of non-constant LEA.
Daniel Morsing [Fri, 5 Jul 2013 14:11:22 +0000 (16:11 +0200)]
cmd/6g, cmd/8g: prevent constant propagation of non-constant LEA.

Fixes #5809.

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

11 years agoencoding/json: Correct description of stateNeg function.
Oliver Hookins [Fri, 5 Jul 2013 04:26:09 +0000 (14:26 +1000)]
encoding/json: Correct description of stateNeg function.

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

11 years agosyscall: reduce duplication between *bsd and linux
Dave Cheney [Fri, 5 Jul 2013 03:25:23 +0000 (13:25 +1000)]
syscall: reduce duplication between *bsd and linux

Part 3 of several.

* Linux has grown a SetsockoptByte.
* SetsockoptIPMreqn is handled directly by syscall_linux.go and syscall_freebsd.go.

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

11 years agoA+C: Oliver Hookins (individual CLA)
Andrew Gerrand [Fri, 5 Jul 2013 02:53:01 +0000 (12:53 +1000)]
A+C: Oliver Hookins (individual CLA)

Generated by addca.

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

11 years agoimage/gif: close the lzw.Reader we create.
Nigel Tao [Fri, 5 Jul 2013 00:12:13 +0000 (10:12 +1000)]
image/gif: close the lzw.Reader we create.

The lzw.NewReader doc comment says, "It is the caller's responsibility
to call Close on the ReadCloser when finished reading."

Thanks to Andrew Bonventre for noticing this.

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

11 years agodoc: update playground.js
Andrew Gerrand [Thu, 4 Jul 2013 04:24:21 +0000 (14:24 +1000)]
doc: update playground.js

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

11 years agogo/parser: accept optional indices for all parts of an index expression
Robert Griesemer [Wed, 3 Jul 2013 17:43:24 +0000 (10:43 -0700)]
go/parser: accept optional indices for all parts of an index expression

Instead, leave the error testing to the type checker, eventually.

Fixes #5827.

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

11 years agonet/textproto: reduce allocations in ReadMIMEHeader
Brad Fitzpatrick [Wed, 3 Jul 2013 05:37:19 +0000 (22:37 -0700)]
net/textproto: reduce allocations in ReadMIMEHeader

ReadMIMEHeader is used by net/http, net/mail, and
mime/multipart.

Don't do so many small allocations. Calculate up front
how much we'll probably need.

benchmark                  old ns/op    new ns/op    delta
BenchmarkReadMIMEHeader         8433         7467  -11.45%

benchmark                 old allocs   new allocs    delta
BenchmarkReadMIMEHeader           23           14  -39.13%

benchmark                  old bytes    new bytes    delta
BenchmarkReadMIMEHeader         1705         1343  -21.23%

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

11 years agoA+C: Brian Gitonga Marete (individual CLA)
Brad Fitzpatrick [Wed, 3 Jul 2013 03:35:44 +0000 (20:35 -0700)]
A+C: Brian Gitonga Marete (individual CLA)

Generated by addca.

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

11 years agocmd/go: git checkout the correct default branch.
David Symonds [Wed, 3 Jul 2013 01:56:02 +0000 (11:56 +1000)]
cmd/go: git checkout the correct default branch.

origin/master is always a remote branch, and it doesn't make sense to
switch to a remote branch. master is the default branch that tracks it.

R=adg
CC=golang-dev, matt.jibson
https://golang.org/cl/10869046

11 years agodoc/go1.2.txt: stable sort
Rob Pike [Wed, 3 Jul 2013 01:46:09 +0000 (11:46 +1000)]
doc/go1.2.txt: stable sort

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

11 years agonet/rpc: remove unnecessary code
ChaiShushan [Wed, 3 Jul 2013 00:29:21 +0000 (17:29 -0700)]
net/rpc: remove unnecessary code

Fixes #5760.

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

11 years agocrypto/tls: implement TLS 1.2.
Adam Langley [Tue, 2 Jul 2013 23:58:56 +0000 (19:58 -0400)]
crypto/tls: implement TLS 1.2.

This does not include AES-GCM yet. Also, it assumes that the handshake and
certificate signature hash are always SHA-256, which is true of the ciphersuites
that we currently support.

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

11 years agogo/ast: improve doc for FuncDecl's Type field.
David Symonds [Tue, 2 Jul 2013 22:16:08 +0000 (08:16 +1000)]
go/ast: improve doc for FuncDecl's Type field.

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

11 years agoruntime: fix runtime.sigreturn_tramp for NetBSD/ARM
Shenghou Ma [Tue, 2 Jul 2013 16:33:38 +0000 (00:33 +0800)]
runtime: fix runtime.sigreturn_tramp for NetBSD/ARM
using m->tls[0] to save ucontext pointer is not re-entry safe, and
the old code didn't set it before the early return when signal is
received on non-Go threads.

so misc/cgo/test used to hang when testing issue 5337.

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

11 years agocmd/gc: fix issue with method wrappers not having escape analysis run on them.
Daniel Morsing [Tue, 2 Jul 2013 15:12:08 +0000 (17:12 +0200)]
cmd/gc: fix issue with method wrappers not having escape analysis run on them.

Escape analysis needs the right curfn value on a dclfunc node, otherwise it will not analyze the function.
When generating method value wrappers, we forgot to set the curfn correctly.

Fixes #5753.

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

11 years agocmd/gc: fix computation of equality class of types.
Rémy Oudompheng [Tue, 2 Jul 2013 07:08:43 +0000 (09:08 +0200)]
cmd/gc: fix computation of equality class of types.

A struct with a single field was considered as equivalent to the
field type, which is incorrect is the field is blank.

Fields with padding could make the compiler think some
types are comparable when they are not.

Fixes #5698.

R=rsc, golang-dev, daniel.morsing, bradfitz, gri, r
CC=golang-dev
https://golang.org/cl/10271046

11 years agomisc/vim: Allow multiple GOOS/GOARCH.
Yasuhiro Matsumoto [Tue, 2 Jul 2013 05:24:09 +0000 (15:24 +1000)]
misc/vim: Allow multiple GOOS/GOARCH.

R=golang-dev, dsymonds, dominik.honnef
CC=golang-dev
https://golang.org/cl/9293043

11 years agosort: fix 32-bit build
Russ Cox [Tue, 2 Jul 2013 01:44:14 +0000 (21:44 -0400)]
sort: fix 32-bit build

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

11 years agotime: prevent a panic from leaving the timer mutex held
Jeff R. Allen [Tue, 2 Jul 2013 01:42:29 +0000 (21:42 -0400)]
time: prevent a panic from leaving the timer mutex held

When deleting a timer, a panic due to nil deref
would leave a lock held, possibly leading to a deadlock
in a defer. Instead return false on a nil timer.

Fixes #5745.

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

11 years agonet/rpc/jsonrpc: remove unused serverCodec.resp field
ChaiShushan [Tue, 2 Jul 2013 01:20:42 +0000 (21:20 -0400)]
net/rpc/jsonrpc: remove unused serverCodec.resp field

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

11 years agosort: implement stable sorting
Volker Dobler [Tue, 2 Jul 2013 01:20:33 +0000 (21:20 -0400)]
sort: implement stable sorting

This CL provides stable in-place sorting by use of
bottom up merge sort with in-place merging done by
the SymMerge algorithm from P.-S. Kim and A. Kutzner.

The additional space needed for stable sorting (in the form of
stack space) is logarithmic in the inputs size n.
Number of calls to Less and Swap grow like O(n * log n) and
O(n * log n * log n):
Stable sorting random data uses significantly more calls
to Swap than the unstable quicksort implementation (5 times more
on n=100, 10 times more on n=1e4 and 23 times more on n=1e8).
The number of calls to Less is practically the same for Sort and
Stable.

Stable sorting 1 million random integers takes 5 times longer
than using Sort.

BenchmarkSortString1K      50000       328662 ns/op
BenchmarkStableString1K    50000       380231 ns/op  1.15 slower
BenchmarkSortInt1K         50000       157336 ns/op
BenchmarkStableInt1K       50000       191167 ns/op  1.22 slower
BenchmarkSortInt64K         1000     14466297 ns/op
BenchmarkStableInt64K        500     16190266 ns/op  1.12 slower

BenchmarkSort1e2          200000        64923 ns/op
BenchmarkStable1e2         50000       167128 ns/op  2.57 slower
BenchmarkSort1e4            1000     14540613 ns/op
BenchmarkStable1e4           100     58117289 ns/op  4.00 slower
BenchmarkSort1e6               5   2429631508 ns/op
BenchmarkStable1e6             1  12077036952 ns/op  4.97 slower

R=golang-dev, bradfitz, iant, 0xjnml, rsc
CC=golang-dev
https://golang.org/cl/9612044

11 years agoreflect: add Value.Slice3 and Value.SetCap methods, to match x[i:j:k]
Russ Cox [Tue, 2 Jul 2013 00:32:53 +0000 (20:32 -0400)]
reflect: add Value.Slice3 and Value.SetCap methods, to match x[i:j:k]

Design doc at golang.org/s/go12slice.

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

11 years agocmd/gc: support x[i:j:k]
Russ Cox [Tue, 2 Jul 2013 00:32:36 +0000 (20:32 -0400)]
cmd/gc: support x[i:j:k]

Design doc at golang.org/s/go12slice.
This is an experimental feature and may not be included in the release.

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

11 years agocmd/godoc: set up playground for examples that are already visible
Andrew Gerrand [Mon, 1 Jul 2013 22:44:25 +0000 (08:44 +1000)]
cmd/godoc: set up playground for examples that are already visible

This fixes an issue where linking directly to an example makes it not
runnable and visible only in a tiny window. To see the bug in action,
link: http://golang.org/pkg/strings/#example_Map
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/10679050

11 years agoruntime: disable preemption test (fix build)
Russ Cox [Mon, 1 Jul 2013 22:10:03 +0000 (18:10 -0400)]
runtime: disable preemption test (fix build)

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

11 years agoruntime: disable preemption
Russ Cox [Mon, 1 Jul 2013 21:57:09 +0000 (17:57 -0400)]
runtime: disable preemption

There are various problems, and both Dmitriy and I
will be away for the next week. Make the runtime a bit
more stable while we're gone.

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

11 years agoruntime: fix memory leaks due to defers
Dmitriy Vyukov [Mon, 1 Jul 2013 21:36:08 +0000 (17:36 -0400)]
runtime: fix memory leaks due to defers
fn can clearly hold a closure in memory.
argp/pc point into stack and so can hold
in memory a block that was previously
a large stack serment.

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

11 years agosync/atomic: remove test dependency on net/http
Russ Cox [Mon, 1 Jul 2013 21:27:19 +0000 (17:27 -0400)]
sync/atomic: remove test dependency on net/http

Depending on net/http means depending on cgo.
When the tree is in a shaky state it's nice to see sync/atomic
pass even if cgo or net causes broken binaries.

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

11 years agomisc/vim: Add compiler plugin for Go
David Bürgin [Mon, 1 Jul 2013 06:20:50 +0000 (16:20 +1000)]
misc/vim: Add compiler plugin for Go

This change adds a basic compiler plugin for Go. The plugin
integrates "go build" with Vim's ":make" command and the
quickfix list.

Fixes #5751.

R=golang-dev, dsymonds, niklas.schnelle, 0xjnml
CC=golang-dev
https://golang.org/cl/10466043

11 years agoimage/gif: do not allow pixels outside the current palette
Jeff R. Allen [Mon, 1 Jul 2013 04:11:45 +0000 (14:11 +1000)]
image/gif: do not allow pixels outside the current palette

After loading a frame of a GIF, check that each pixel
is inside the frame's palette.

Fixes #5401.

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

11 years agolib9: restore printing of signed integers
Russ Cox [Sun, 30 Jun 2013 23:53:36 +0000 (19:53 -0400)]
lib9: restore printing of signed integers

A casualty of https://golang.org/cl/10195044.

If x is an 32-bit int and u is a 64-bit ulong,
        u = (uint)x // converts to uint before extension, so zero fills
        u = (ulong)x // sign-extends

TBR=iant, r
CC=golang-dev
https://golang.org/cl/10814043

11 years agocmd/gc: fix missing export data for inlining in a few other cases.
Rémy Oudompheng [Fri, 28 Jun 2013 21:29:13 +0000 (23:29 +0200)]
cmd/gc: fix missing export data for inlining in a few other cases.

Exported inlined functions that perform a string conversion
using a non-exported named type may miss it in export data.

Fixes #5755.

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

11 years agotest: match gccgo error strings.
Rémy Oudompheng [Fri, 28 Jun 2013 21:08:07 +0000 (23:08 +0200)]
test: match gccgo error strings.

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

11 years agoruntime: shorten hash lookup stack frames
Russ Cox [Fri, 28 Jun 2013 20:37:07 +0000 (13:37 -0700)]
runtime: shorten hash lookup stack frames

On amd64 the frames are very close to the limit for a
nosplit (textflag 7) function, in part because the C compiler
does not make any attempt to reclaim space allocated for
completely registerized variables. Avoid a few short-lived
variables to reclaim two words.

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

11 years agonet/http: fix memory leak in Transport
Brad Fitzpatrick [Fri, 28 Jun 2013 19:57:54 +0000 (12:57 -0700)]
net/http: fix memory leak in Transport

Fixes #5794

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

11 years agonet/smtp: preserve Auth errors
Rick Arnold [Fri, 28 Jun 2013 19:24:45 +0000 (12:24 -0700)]
net/smtp: preserve Auth errors

If authentication failed, the initial error was being thrown away.

Fixes #5700.

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

11 years agoinclude/plan9: define size_t to fix build breakage
Ian Lance Taylor [Fri, 28 Jun 2013 19:16:33 +0000 (12:16 -0700)]
include/plan9: define size_t to fix build breakage

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

11 years agocmd/5g, cmd/6g, cmd/8g: fix comment
Russ Cox [Fri, 28 Jun 2013 19:06:25 +0000 (12:06 -0700)]
cmd/5g, cmd/6g, cmd/8g: fix comment

Keeping the string "compactframe" because that's what
I always search for to find this code. But point to the real place too.

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

11 years agoruntime: introduce GODEBUG env var
Dmitriy Vyukov [Fri, 28 Jun 2013 14:37:06 +0000 (18:37 +0400)]
runtime: introduce GODEBUG env var
Currently it replaces GOGCTRACE env var (GODEBUG=gctrace=1).
The plan is to extend it with other type of debug tracing,
e.g. GODEBUG=gctrace=1,schedtrace=100.

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

11 years agoruntime: preempt goroutines for GC
Dmitriy Vyukov [Fri, 28 Jun 2013 13:52:17 +0000 (17:52 +0400)]
runtime: preempt goroutines for GC
The last patch for preemptive scheduler,
with this change stoptheworld issues preemption
requests every 100us.
Update #543.

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

11 years agoruntime: remove declaration of function that does not exist
Ian Lance Taylor [Fri, 28 Jun 2013 05:43:30 +0000 (22:43 -0700)]
runtime: remove declaration of function that does not exist

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

11 years agoflag: add Getter interface; implement for all Value types
Rick Arnold [Thu, 27 Jun 2013 22:30:45 +0000 (15:30 -0700)]
flag: add Getter interface; implement for all Value types

Fixes #5383.

R=golang-dev, 0xjnml, r, rsc
CC=golang-dev
https://golang.org/cl/10472043

11 years agocrypto/x509: Added RFC 5280, section 4.2.2.1 Authority Information Access
Paul van Brouwershaven [Thu, 27 Jun 2013 21:16:25 +0000 (17:16 -0400)]
crypto/x509: Added RFC 5280, section 4.2.2.1 Authority Information Access

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

11 years agocmd/go: add -coverpkg
Russ Cox [Thu, 27 Jun 2013 21:04:39 +0000 (17:04 -0400)]
cmd/go: add -coverpkg

The new -coverpkg flag allows computing coverage in
one set of packages while running the tests of a different set.

Also clean up some of the previous CL's recompileForTest,
using packageList to avoid the clumsy recursion.

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

11 years agoruntime: use gp->sched.sp for stack overflow check
Russ Cox [Thu, 27 Jun 2013 20:51:06 +0000 (16:51 -0400)]
runtime: use gp->sched.sp for stack overflow check

On x86 it is a few words lower on the stack than m->morebuf.sp
so it is a more precise check. Enabling the check requires recording
a valid gp->sched in reflect.call too. This is a good thing in general,
since it will make stack traces during reflect.call work better, and it
may be useful for preemption too.

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

11 years agoruntime: fix goroutine status corruption
Dmitriy Vyukov [Thu, 27 Jun 2013 20:49:53 +0000 (00:49 +0400)]
runtime: fix goroutine status corruption
runtime.entersyscall() sets g->status = Gsyscall,
then calls runtime.lock() which causes stack split.
runtime.newstack() resets g->status to Grunning.
This will lead to crash during GC (world is not stopped) or GC will scan stack incorrectly.

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

11 years agocrypto/tls: Change TLS version to 1.1 in the package comment.
Frithjof Schulze [Thu, 27 Jun 2013 18:23:55 +0000 (11:23 -0700)]
crypto/tls: Change TLS version to 1.1 in the package comment.

Also use 2048-bit RSA keys as default in generate_cert.go,
as recommended by the NIST.

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

11 years agoA+C: Frithjof Schulze (individual CLA) other email
Brad Fitzpatrick [Thu, 27 Jun 2013 18:23:26 +0000 (11:23 -0700)]
A+C: Frithjof Schulze (individual CLA) other email

Generated by addca, but then manually merged
the two lines onto one.

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

11 years agocrypto/elliptic: add constant-time, P-256 implementation.
Adam Langley [Thu, 27 Jun 2013 17:31:05 +0000 (13:31 -0400)]
crypto/elliptic: add constant-time, P-256 implementation.

On my 64-bit machine, despite being 32-bit code, fixed-base
multiplications are 7.1x faster and arbitary multiplications are 2.6x
faster.

It is difficult to review this change. However, the code is essentially
the same as code that has been open-sourced in Chromium. There it has
been successfully performing P-256 operations for several months on
many machines so the arithmetic of the code should be sound.

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

11 years agoundo CL 9776044 / 1e280889f997
Dmitriy Vyukov [Thu, 27 Jun 2013 17:03:35 +0000 (21:03 +0400)]
undo CL 9776044 / 1e280889f997

Failure on bot:
http://build.golang.org/log/f4c648906e1289ec2237c1d0880fb1a8b1852a08

««« original CL description
runtime: fix CPU underutilization
runtime.newproc/ready are deliberately sloppy about waking new M's,
they only ensure that there is at least 1 spinning M.
Currently to compensate for that, schedule() checks if the current P
has local work and there are no spinning M's, it wakes up another one.
It does not work if goroutines do not call schedule.
With this change a spinning M wakes up another M when it finds work to do.
It's also not ideal, but it fixes the underutilization.
A proper check would require to know the exact number of runnable G's,
but it's too expensive to maintain.
Fixes #5586.

R=rsc
TBR=rsc
CC=gobot, golang-dev
https://golang.org/cl/9776044
»»»

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

11 years agoruntime: fix CPU underutilization
Dmitriy Vyukov [Thu, 27 Jun 2013 16:52:12 +0000 (20:52 +0400)]
runtime: fix CPU underutilization
runtime.newproc/ready are deliberately sloppy about waking new M's,
they only ensure that there is at least 1 spinning M.
Currently to compensate for that, schedule() checks if the current P
has local work and there are no spinning M's, it wakes up another one.
It does not work if goroutines do not call schedule.
With this change a spinning M wakes up another M when it finds work to do.
It's also not ideal, but it fixes the underutilization.
A proper check would require to know the exact number of runnable G's,
but it's too expensive to maintain.
Fixes #5586.

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

11 years agoruntime: fix argument printing during traceback
Dmitriy Vyukov [Thu, 27 Jun 2013 16:43:43 +0000 (20:43 +0400)]
runtime: fix argument printing during traceback
Current code can print more arguments than necessary
and also incorrectly prints "...".
Update #5723.

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

11 years agodoc/go1.2.txt: cmd/go and coverage; simple hash Sum functions
Rob Pike [Thu, 27 Jun 2013 16:20:02 +0000 (09:20 -0700)]
doc/go1.2.txt: cmd/go and coverage; simple hash Sum functions

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

11 years agoruntime: record proper goroutine state during stack split
Russ Cox [Thu, 27 Jun 2013 15:32:01 +0000 (11:32 -0400)]
runtime: record proper goroutine state during stack split

Until now, the goroutine state has been scattered during the
execution of newstack and oldstack. It's all there, and those routines
know how to get back to a working goroutine, but other pieces of
the system, like stack traces, do not. If something does interrupt
the newstack or oldstack execution, the rest of the system can't
understand the goroutine. For example, if newstack decides there
is an overflow and calls throw, the stack tracer wouldn't dump the
goroutine correctly.

For newstack to save a useful state snapshot, it needs to be able
to rewind the PC in the function that triggered the split back to
the beginning of the function. (The PC is a few instructions in, just
after the call to morestack.) To make that possible, we change the
prologues to insert a jmp back to the beginning of the function
after the call to morestack. That is, the prologue used to be roughly:

        TEXT myfunc
                check for split
                jmpcond nosplit
                call morestack
        nosplit:
                sub $xxx, sp

Now an extra instruction is inserted after the call:

        TEXT myfunc
        start:
                check for split
                jmpcond nosplit
                call morestack
                jmp start
        nosplit:
                sub $xxx, sp

The jmp is not executed directly. It is decoded and simulated by
runtime.rewindmorestack to discover the beginning of the function,
and then the call to morestack returns directly to the start label
instead of to the jump instruction. So logically the jmp is still
executed, just not by the cpu.

The prologue thus repeats in the case of a function that needs a
stack split, but against the cost of the split itself, the extra few
instructions are noise. The repeated prologue has the nice effect of
making a stack split double-check that the new stack is big enough:
if morestack happens to return on a too-small stack, we'll now notice
before corruption happens.

The ability for newstack to rewind to the beginning of the function
should help preemption too. If newstack decides that it was called
for preemption instead of a stack split, it now has the goroutine state
correctly paused if rescheduling is needed, and when the goroutine
can run again, it can return to the start label on its original stack
and re-execute the split check.

Here is an example of a split stack overflow showing the full
trace, without any special cases in the stack printer.
(This one was triggered by making the split check incorrect.)

runtime: newstack framesize=0x0 argsize=0x18 sp=0x6aebd0 stack=[0x6b0000, 0x6b0fa0]
        morebuf={pc:0x69f5b sp:0x6aebd8 lr:0x0}
        sched={pc:0x68880 sp:0x6aebd0 lr:0x0 ctxt:0x34e700}
runtime: split stack overflow: 0x6aebd0 < 0x6b0000
fatal error: runtime: split stack overflow

goroutine 1 [stack split]:
runtime.mallocgc(0x290, 0x100000000, 0x1)
        /Users/rsc/g/go/src/pkg/runtime/zmalloc_darwin_amd64.c:21 fp=0x6aebd8
runtime.new()
        /Users/rsc/g/go/src/pkg/runtime/zmalloc_darwin_amd64.c:682 +0x5b fp=0x6aec08
go/build.(*Context).Import(0x5ae340, 0xc210030c71, 0xa, 0xc2100b4380, 0x1b, ...)
        /Users/rsc/g/go/src/pkg/go/build/build.go:424 +0x3a fp=0x6b00a0
main.loadImport(0xc210030c71, 0xa, 0xc2100b4380, 0x1b, 0xc2100b42c0, ...)
        /Users/rsc/g/go/src/cmd/go/pkg.go:249 +0x371 fp=0x6b01a8
main.(*Package).load(0xc21017c800, 0xc2100b42c0, 0xc2101828c0, 0x0, 0x0, ...)
        /Users/rsc/g/go/src/cmd/go/pkg.go:431 +0x2801 fp=0x6b0c98
main.loadPackage(0x369040, 0x7, 0xc2100b42c0, 0x0)
        /Users/rsc/g/go/src/cmd/go/pkg.go:709 +0x857 fp=0x6b0f80
----- stack segment boundary -----
main.(*builder).action(0xc2100902a0, 0x0, 0x0, 0xc2100e6c00, 0xc2100e5750, ...)
        /Users/rsc/g/go/src/cmd/go/build.go:539 +0x437 fp=0x6b14a0
main.(*builder).action(0xc2100902a0, 0x0, 0x0, 0xc21015b400, 0x2, ...)
        /Users/rsc/g/go/src/cmd/go/build.go:528 +0x1d2 fp=0x6b1658
main.(*builder).test(0xc2100902a0, 0xc210092000, 0x0, 0x0, 0xc21008ff60, ...)
        /Users/rsc/g/go/src/cmd/go/test.go:622 +0x1b53 fp=0x6b1f68
----- stack segment boundary -----
main.runTest(0x5a6b20, 0xc21000a020, 0x2, 0x2)
        /Users/rsc/g/go/src/cmd/go/test.go:366 +0xd09 fp=0x6a5cf0
main.main()
        /Users/rsc/g/go/src/cmd/go/main.go:161 +0x4f9 fp=0x6a5f78
runtime.main()
        /Users/rsc/g/go/src/pkg/runtime/proc.c:183 +0x92 fp=0x6a5fa0
runtime.goexit()
        /Users/rsc/g/go/src/pkg/runtime/proc.c:1266 fp=0x6a5fa8

And here is a seg fault during oldstack:

SIGSEGV: segmentation violation
PC=0x1b2a6

runtime.oldstack()
        /Users/rsc/g/go/src/pkg/runtime/stack.c:159 +0x76
runtime.lessstack()
        /Users/rsc/g/go/src/pkg/runtime/asm_amd64.s:270 +0x22

goroutine 1 [stack unsplit]:
fmt.(*pp).printArg(0x2102e64e0, 0xe5c80, 0x2102c9220, 0x73, 0x0, ...)
        /Users/rsc/g/go/src/pkg/fmt/print.go:818 +0x3d3 fp=0x221031e6f8
fmt.(*pp).doPrintf(0x2102e64e0, 0x12fb20, 0x2, 0x221031eb98, 0x1, ...)
        /Users/rsc/g/go/src/pkg/fmt/print.go:1183 +0x15cb fp=0x221031eaf0
fmt.Sprintf(0x12fb20, 0x2, 0x221031eb98, 0x1, 0x1, ...)
        /Users/rsc/g/go/src/pkg/fmt/print.go:234 +0x67 fp=0x221031eb40
flag.(*stringValue).String(0x2102c9210, 0x1, 0x0)
        /Users/rsc/g/go/src/pkg/flag/flag.go:180 +0xb3 fp=0x221031ebb0
flag.(*FlagSet).Var(0x2102f6000, 0x293d38, 0x2102c9210, 0x143490, 0xa, ...)
        /Users/rsc/g/go/src/pkg/flag/flag.go:633 +0x40 fp=0x221031eca0
flag.(*FlagSet).StringVar(0x2102f6000, 0x2102c9210, 0x143490, 0xa, 0x12fa60, ...)
        /Users/rsc/g/go/src/pkg/flag/flag.go:550 +0x91 fp=0x221031ece8
flag.(*FlagSet).String(0x2102f6000, 0x143490, 0xa, 0x12fa60, 0x0, ...)
        /Users/rsc/g/go/src/pkg/flag/flag.go:563 +0x87 fp=0x221031ed38
flag.String(0x143490, 0xa, 0x12fa60, 0x0, 0x161950, ...)
        /Users/rsc/g/go/src/pkg/flag/flag.go:570 +0x6b fp=0x221031ed80
testing.init()
        /Users/rsc/g/go/src/pkg/testing/testing.go:-531 +0xbb fp=0x221031edc0
strings_test.init()
        /Users/rsc/g/go/src/pkg/strings/strings_test.go:1115 +0x62 fp=0x221031ef70
main.init()
        strings/_test/_testmain.go:90 +0x3d fp=0x221031ef78
runtime.main()
        /Users/rsc/g/go/src/pkg/runtime/proc.c:180 +0x8a fp=0x221031efa0
runtime.goexit()
        /Users/rsc/g/go/src/pkg/runtime/proc.c:1269 fp=0x221031efa8

goroutine 2 [runnable]:
runtime.MHeap_Scavenger()
        /Users/rsc/g/go/src/pkg/runtime/mheap.c:438
runtime.goexit()
        /Users/rsc/g/go/src/pkg/runtime/proc.c:1269
created by runtime.main
        /Users/rsc/g/go/src/pkg/runtime/proc.c:166

rax     0x23ccc0
rbx     0x23ccc0
rcx     0x0
rdx     0x38
rdi     0x2102c0170
rsi     0x221032cfe0
rbp     0x221032cfa0
rsp     0x7fff5fbff5b0
r8      0x2102c0120
r9      0x221032cfa0
r10     0x221032c000
r11     0x104ce8
r12     0xe5c80
r13     0x1be82baac718
r14     0x13091135f7d69200
r15     0x0
rip     0x1b2a6
rflags  0x10246
cs      0x2b
fs      0x0
gs      0x0

Fixes #5723.

R=r, dvyukov, go.peter.90, dave, iant
CC=golang-dev
https://golang.org/cl/10360048

11 years agocrypto/sha512: update comment for the Sum512 function.
Robin Eklind [Thu, 27 Jun 2013 10:51:46 +0000 (20:51 +1000)]
crypto/sha512: update comment for the Sum512 function.

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

11 years agoruntime: remove unused typedef
Ian Lance Taylor [Thu, 27 Jun 2013 05:02:32 +0000 (22:02 -0700)]
runtime: remove unused typedef

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

11 years agosyscall: handle empty environment variable values properly on windows
Alex Brainman [Thu, 27 Jun 2013 00:11:30 +0000 (10:11 +1000)]
syscall: handle empty environment variable values properly on windows

Setenv("AN_ENV_VAR", "") deletes AN_ENV_VAR instead of setting it
to "" at this moment. Also Getenv("AN_ENV_VAR") returns "not found",
if AN_ENV_VAR is "". Change it, so they behave like unix.

Fixes #5610

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

11 years agomisc/emacs: fix godef-jump on Windows.
Charles Lee [Wed, 26 Jun 2013 20:59:25 +0000 (13:59 -0700)]
misc/emacs: fix godef-jump on Windows.

Fixes #5555.

R=adonovan, dominik.honnef, iant
CC=gobot, golang-dev
https://golang.org/cl/9762045

11 years agoA+C: Charles Lee (individual CLA)
Ian Lance Taylor [Wed, 26 Jun 2013 20:59:15 +0000 (13:59 -0700)]
A+C: Charles Lee (individual CLA)

Generated by addca.

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

11 years agocrypto/sha512: provide top-level Sum512 and Sum384 functions
Rob Pike [Wed, 26 Jun 2013 20:14:11 +0000 (13:14 -0700)]
crypto/sha512: provide top-level Sum512 and Sum384 functions
Makes it easy to ask the simple question, what is the hash of this data?
Also fix the commentary and prints in Sum256.

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

11 years agocrypto/sha256: provide top-level Sum and Sum224 functions
Rob Pike [Wed, 26 Jun 2013 18:36:18 +0000 (11:36 -0700)]
crypto/sha256: provide top-level Sum and Sum224 functions
Makes it easy to ask the simple question, what is the hash of this data?

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

11 years agocmd/go: proper rebuild of affected packages during go test
Russ Cox [Wed, 26 Jun 2013 18:31:12 +0000 (14:31 -0400)]
cmd/go: proper rebuild of affected packages during go test

With this CL, go test -short -cover std successfully builds and
runs all the standard package tests. The tests that look a file
line numbers (log and runtime/debug) fail, because cover is
not inserting //line directives. Everything else passes.

ok   cmd/api 0.038s coverage: 66.6% of statements
?    cmd/cgo [no test files]
ok   cmd/fix 0.043s coverage: 27.2% of statements
ok   cmd/go 0.063s coverage: 2.4% of statements
?    cmd/godoc [no test files]
ok   cmd/gofmt 0.085s coverage: 61.3% of statements
?    cmd/yacc [no test files]
ok   archive/tar 0.023s coverage: 74.2% of statements
ok   archive/zip 0.075s coverage: 71.8% of statements
ok   bufio 0.149s coverage: 88.2% of statements
ok   bytes 0.135s coverage: 90.4% of statements
ok   compress/bzip2 0.087s coverage: 85.1% of statements
ok   compress/flate 0.632s coverage: 79.3% of statements
ok   compress/gzip 0.027s coverage: 76.7% of statements
ok   compress/lzw 0.141s coverage: 71.2% of statements
ok   compress/zlib 1.123s coverage: 77.2% of statements
ok   container/heap 0.020s coverage: 85.8% of statements
ok   container/list 0.021s coverage: 92.5% of statements
ok   container/ring 0.030s coverage: 86.5% of statements
?    crypto [no test files]
ok   crypto/aes 0.054s coverage: 54.3% of statements
ok   crypto/cipher 0.027s coverage: 68.8% of statements
ok   crypto/des 0.041s coverage: 83.8% of statements
ok   crypto/dsa 0.027s coverage: 33.1% of statements
ok   crypto/ecdsa 0.048s coverage: 48.7% of statements
ok   crypto/elliptic 0.030s coverage: 91.6% of statements
ok   crypto/hmac 0.019s coverage: 83.3% of statements
ok   crypto/md5 0.020s coverage: 78.7% of statements
ok   crypto/rand 0.057s coverage: 20.8% of statements
ok   crypto/rc4 0.092s coverage: 70.8% of statements
ok   crypto/rsa 0.261s coverage: 80.8% of statements
ok   crypto/sha1 0.019s coverage: 83.9% of statements
ok   crypto/sha256 0.021s coverage: 89.0% of statements
ok   crypto/sha512 0.023s coverage: 88.7% of statements
ok   crypto/subtle 0.027s coverage: 83.9% of statements
ok   crypto/tls 0.833s coverage: 79.7% of statements
ok   crypto/x509 0.961s coverage: 74.9% of statements
?    crypto/x509/pkix [no test files]
ok   database/sql 0.033s coverage: 75.0% of statements
ok   database/sql/driver 0.020s coverage: 46.2% of statements
ok   debug/dwarf 0.023s coverage: 71.5% of statements
ok   debug/elf 0.035s coverage: 58.2% of statements
ok   debug/gosym 0.022s coverage: 1.8% of statements
ok   debug/macho 0.023s coverage: 63.7% of statements
ok   debug/pe 0.024s coverage: 50.5% of statements
ok   encoding/ascii85 0.021s coverage: 89.7% of statements
ok   encoding/asn1 0.022s coverage: 77.9% of statements
ok   encoding/base32 0.022s coverage: 91.4% of statements
ok   encoding/base64 0.020s coverage: 90.7% of statements
ok   encoding/binary 0.022s coverage: 66.2% of statements
ok   encoding/csv 0.022s coverage: 88.5% of statements
ok   encoding/gob 0.064s coverage: 82.2% of statements
ok   encoding/hex 0.019s coverage: 86.3% of statements
ok   encoding/json 0.047s coverage: 77.3% of statements
ok   encoding/pem 0.026s coverage: 80.5% of statements
ok   encoding/xml 0.039s coverage: 85.0% of statements
ok   errors 0.022s coverage: 100.0% of statements
ok   expvar 0.048s coverage: 72.0% of statements
ok   flag 0.019s coverage: 86.9% of statements
ok   fmt 0.062s coverage: 91.2% of statements
ok   go/ast 0.028s coverage: 46.3% of statements
ok   go/build 0.190s coverage: 75.4% of statements
ok   go/doc 0.095s coverage: 76.7% of statements
ok   go/format 0.036s coverage: 79.8% of statements
ok   go/parser 0.075s coverage: 82.0% of statements
ok   go/printer 0.733s coverage: 88.6% of statements
ok   go/scanner 0.031s coverage: 86.5% of statements
ok   go/token 0.062s coverage: 79.7% of statements
?    hash [no test files]
ok   hash/adler32 0.029s coverage: 49.0% of statements
ok   hash/crc32 0.020s coverage: 64.2% of statements
ok   hash/crc64 0.021s coverage: 53.5% of statements
ok   hash/fnv 0.018s coverage: 75.5% of statements
ok   html 0.022s coverage: 4.5% of statements
ok   html/template 0.087s coverage: 83.9% of statements
ok   image 0.108s coverage: 67.1% of statements
ok   image/color 0.026s coverage: 20.1% of statements
ok   image/draw 0.049s coverage: 69.6% of statements
ok   image/gif 0.019s coverage: 65.2% of statements
ok   image/jpeg 0.197s coverage: 78.6% of statements
ok   image/png 0.055s coverage: 56.5% of statements
ok   index/suffixarray 0.027s coverage: 82.4% of statements
ok   io 0.037s coverage: 83.4% of statements
ok   io/ioutil 0.022s coverage: 70.1% of statements
FAIL log 0.020s
ok   log/syslog 2.063s coverage: 71.1% of statements
ok   math 0.023s coverage: 76.5% of statements
ok   math/big 0.235s coverage: 79.2% of statements
ok   math/cmplx 0.020s coverage: 66.5% of statements
ok   math/rand 0.031s coverage: 69.9% of statements
ok   mime 0.022s coverage: 83.0% of statements
ok   mime/multipart 0.389s coverage: 76.1% of statements
ok   net 2.219s coverage: 58.0% of statements
ok   net/http 4.744s coverage: 82.9% of statements
ok   net/http/cgi 0.593s coverage: 68.5% of statements
ok   net/http/cookiejar 0.038s coverage: 90.3% of statements
ok   net/http/fcgi 0.047s coverage: 37.6% of statements
ok   net/http/httptest 0.068s coverage: 68.9% of statements
ok   net/http/httputil 0.058s coverage: 52.8% of statements
?    net/http/pprof [no test files]
ok   net/mail 0.025s coverage: 80.3% of statements
ok   net/rpc 0.063s coverage: 71.5% of statements
ok   net/rpc/jsonrpc 0.047s coverage: 81.3% of statements
ok   net/smtp 0.032s coverage: 74.1% of statements
ok   net/textproto 0.023s coverage: 66.0% of statements
ok   net/url 0.020s coverage: 78.2% of statements
ok   os 4.729s coverage: 73.3% of statements
ok   os/exec 39.620s coverage: 65.1% of statements
ok   os/signal 0.541s coverage: 89.9% of statements
ok   os/user 0.022s coverage: 62.2% of statements
ok   path 0.018s coverage: 90.8% of statements
ok   path/filepath 10.834s coverage: 88.4% of statements
ok   reflect 0.055s coverage: 83.2% of statements
ok   regexp 0.084s coverage: 75.5% of statements
ok   regexp/syntax 0.547s coverage: 85.2% of statements
ok   runtime 4.755s coverage: 75.9% of statements
?    runtime/cgo [no test files]
FAIL runtime/debug 0.018s
ok   runtime/pprof 0.368s coverage: 8.5% of statements
?    runtime/race [no test files]
ok   sort 0.059s coverage: 97.7% of statements
ok   strconv 0.315s coverage: 95.6% of statements
ok   strings 0.147s coverage: 96.1% of statements
ok   sync 0.083s coverage: 56.7% of statements
ok   sync/atomic 0.035s coverage: 0.0% of statements
ok   syscall 0.043s coverage: 24.0% of statements
ok   testing 0.018s coverage: 24.0% of statements
?    testing/iotest [no test files]
ok   testing/quick 0.062s coverage: 83.2% of statements
ok   text/scanner 0.020s coverage: 91.5% of statements
ok   text/tabwriter 0.021s coverage: 90.4% of statements
ok   text/template 0.052s coverage: 81.1% of statements
ok   text/template/parse 0.024s coverage: 86.1% of statements
ok   time 2.431s coverage: 88.8% of statements
ok   unicode 0.024s coverage: 92.1% of statements
ok   unicode/utf16 0.017s coverage: 97.3% of statements
ok   unicode/utf8 0.019s coverage: 97.4% of statements
?    unsafe [no test files]

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

11 years agocrypto/md5: provide a top-level Sum function
Rob Pike [Wed, 26 Jun 2013 18:29:30 +0000 (11:29 -0700)]
crypto/md5: provide a top-level Sum function
Makes it easy to ask the simple question, what is the hash of this data?
Also mark block as non-escaping.

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

11 years agocmd/go: log compilation errors when scanning directories and packages
Rob Pike [Wed, 26 Jun 2013 17:48:04 +0000 (10:48 -0700)]
cmd/go: log compilation errors when scanning directories and packages
Before, some packages disappear silently if the package cannot be imported,
such as if the import statement is unparseable.
Before:
        % ls src
        foo   issue
        % go list ./...
        _/home/r/bug/src/foo
        %
After:
        % go list ./...
        src/issue/issue.go:3:5: expected 'STRING', found newline
        _/home/r/bug/src/foo
        %

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

11 years agomisc/dashboard: show all race builders as "race"
Dmitriy Vyukov [Wed, 26 Jun 2013 17:20:53 +0000 (21:20 +0400)]
misc/dashboard: show all race builders as "race"
race is more important than arch (moreover race implies x64)
don't know how to test it

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

11 years agotest: match gccgo error strings.
Rémy Oudompheng [Wed, 26 Jun 2013 16:05:02 +0000 (18:05 +0200)]
test: match gccgo error strings.

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

11 years agotest/shift1.go: recognize gccgo errors
Ian Lance Taylor [Wed, 26 Jun 2013 15:23:52 +0000 (08:23 -0700)]
test/shift1.go: recognize gccgo errors

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

11 years agocrypto/sha1: provide a top-level Sum function
Rob Pike [Wed, 26 Jun 2013 00:04:18 +0000 (17:04 -0700)]
crypto/sha1: provide a top-level Sum function
Makes it easy to ask the simple question, what is the hash of this data?

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

11 years agocmd/gc: fix escape analysis ordering
Russ Cox [Tue, 25 Jun 2013 21:28:49 +0000 (17:28 -0400)]
cmd/gc: fix escape analysis ordering

Functions without bodies were excluded from the ordering logic,
because when I wrote the ordering logic there was no reason to
analyze them.

But then we added //go:noescape tags that need analysis, and we
didn't update the ordering logic.

So in the absence of good ordering, //go:noescape only worked
if it appeared before the use in the source code.

Fixes #5773.

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

11 years agocmd/ld: fix line numbers when using fieldtrack
Russ Cox [Tue, 25 Jun 2013 21:23:33 +0000 (17:23 -0400)]
cmd/ld: fix line numbers when using fieldtrack

USEFIELD is a special kind of NOP, so treat it like a NOP
when generating the pc-ln table.

There are more invasive fixes that could be applied here.
I am going for minimum number of lines changed.

The smallest test case we know of is five distinct Go files
in four packages, and the bug only happens with
GOEXPERIMENT=fieldtrack enabled, which we don't
normally build with, so the test would never run
meaningfully anyway.

Fixes #5762.

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

11 years agocodereview: force hg update after hg pull -u during hg sync
Russ Cox [Tue, 25 Jun 2013 21:23:21 +0000 (17:23 -0400)]
codereview: force hg update after hg pull -u during hg sync

If you hg update your client to an earlier CL, then
hg sync will move you back to tip if it pulls anything in,
but it will leave you where you are if it doesn't pull anything in.
That's confusing: make hg sync always update to tip.

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

11 years agolib9: avoid all -Wconversion warnings
Ian Lance Taylor [Tue, 25 Jun 2013 17:44:25 +0000 (10:44 -0700)]
lib9: avoid all -Wconversion warnings

Built after adding -Wconversion to the list of compiler
arguments used when building.  I believe these are all OK
assuming we will not change the API.  There is no effort to
detect overflow due to very long strings.

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

11 years agosync: fix race instrumentation of WaitGroup
Dmitriy Vyukov [Tue, 25 Jun 2013 16:27:19 +0000 (20:27 +0400)]
sync: fix race instrumentation of WaitGroup
Currently more than 1 gorutine can execute raceWrite() in Wait()
in the following scenario:
1. goroutine 1 executes first check of wg.counter, sees that it's == 0
2. goroutine 2 executes first check of wg.counter, sees that it's == 0
3. goroutine 2 locks the mutex, sees that he is the first waiter and executes raceWrite()
4. goroutine 2 block on the semaphore
5. goroutine 3 executes Done() and unblocks goroutine 2
6. goroutine 1 lock the mutex, sees that he is the first waiter and executes raceWrite()

It produces the following false report:
WARNING: DATA RACE
Write by goroutine 35:
  sync.raceWrite()
      src/pkg/sync/race.go:41 +0x33
  sync.(*WaitGroup).Wait()
      src/pkg/sync/waitgroup.go:103 +0xae
  command-line-arguments_test.TestNoRaceWaitGroupMultipleWait2()
      src/pkg/runtime/race/testdata/waitgroup_test.go:156 +0x19a
  testing.tRunner()
      src/pkg/testing/testing.go:361 +0x108

Previous write by goroutine 36:
  sync.raceWrite()
      src/pkg/sync/race.go:41 +0x33
  sync.(*WaitGroup).Wait()
      src/pkg/sync/waitgroup.go:103 +0xae
  command-line-arguments_test.func·012()
      src/pkg/runtime/race/testdata/waitgroup_test.go:148 +0x4d

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

11 years agoruntime: do not mark os memory as executable on windows
Alex Brainman [Tue, 25 Jun 2013 07:20:14 +0000 (17:20 +1000)]
runtime: do not mark os memory as executable on windows

Resubmit 3c2cddfbdaec now that windows callbacks
are not generated during runtime.

Fixes #5494

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

11 years agotest: add shift expression incorrectly rejected by gccgo.
Rémy Oudompheng [Tue, 25 Jun 2013 06:06:34 +0000 (08:06 +0200)]
test: add shift expression incorrectly rejected by gccgo.

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