]> Cypherpunks repositories - gostls13.git/log
gostls13.git
11 years agoruntime: in newstack, double-check calling goroutine
Russ Cox [Fri, 2 Aug 2013 17:51:28 +0000 (13:51 -0400)]
runtime: in newstack, double-check calling goroutine

Checking this condition helped me find the arm problem last night.

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

11 years agomisc/dist: don't ship cmd/api
Brad Fitzpatrick [Fri, 2 Aug 2013 17:19:52 +0000 (10:19 -0700)]
misc/dist: don't ship cmd/api

cmd/api is a tool to prevent the Go developers from breaking
the Go 1 API promise. It has no utility to end users and
doesn't run on arbitrary packages (it's always been full of
hacks for its bespoke type checker to work on the standard
library)

Robert's in-progress rewrite depends on the go.tools repo for
go/types, so we won't be able to ship this tool later
anyway. Just remove it from binary distributions.

A future change to run.bash can conditionally build & run
cmd/api, perhaps automatically fetching go/types if
necessary. I assume people don't want to vendor go/types into
a private gopath just for cmd/api.

I will need help with run.bat.

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

11 years agocmd/go: change error message to refer to correct bootstrap command
Alex Brainman [Fri, 2 Aug 2013 05:55:21 +0000 (15:55 +1000)]
cmd/go: change error message to refer to correct bootstrap command

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

11 years agoimage/draw: fix typos found by "go vet".
Nigel Tao [Fri, 2 Aug 2013 03:29:45 +0000 (13:29 +1000)]
image/draw: fix typos found by "go vet".

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

11 years agofmt: clean up some errors found by vet
Rob Pike [Fri, 2 Aug 2013 01:38:19 +0000 (11:38 +1000)]
fmt: clean up some errors found by vet
Includes deleting some unused items.

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

11 years agoruntime: disable preemption during software fp routines
Russ Cox [Fri, 2 Aug 2013 00:07:01 +0000 (20:07 -0400)]
runtime: disable preemption during software fp routines

It's okay to preempt at ordinary function calls because
compilers arrange that there are no live registers to save
on entry to the function call.

The software floating point routines are function calls
masquerading as individual machine instructions. They are
expected to keep all the registers intact. In particular,
they are expected not to clobber all the floating point
registers.

The floating point registers are kept per-M, because they
are not live at non-preemptive goroutine scheduling events,
and so keeping them per-M reduces the number of 132-byte
register blocks we are keeping in memory.

Because they are per-M, allowing the goroutine to be
rescheduled during software floating point simulation
would mean some other goroutine could overwrite the registers
or perhaps the goroutine would continue running on a different
M entirely.

Disallow preemption during the software floating point
routines to make sure that a function full of floating point
instructions has the same floating point registers throughout
its execution.

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

11 years agobytes: move IndexByte assembly to pkg runtime
Brad Fitzpatrick [Thu, 1 Aug 2013 23:11:19 +0000 (16:11 -0700)]
bytes: move IndexByte assembly to pkg runtime

Per suggestion from Russ in February. Then strings.IndexByte
can be implemented in terms of the shared code in pkg runtime.

Update #3751

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

11 years agonet/url: prepend slash to path in String()
Scott Ferguson [Thu, 1 Aug 2013 22:52:56 +0000 (15:52 -0700)]
net/url: prepend slash to path in String()

Previously if a path was set manually without a leading /, String()
would not insert the slash when writing its output. This would lead
to situations where a URL that should be http://www.google.com/search
is output as http://www.google.comsearch

Fixes #5927.

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

11 years agoruntime: fix traceback across morestack
Russ Cox [Thu, 1 Aug 2013 22:51:55 +0000 (18:51 -0400)]
runtime: fix traceback across morestack

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

11 years agoA+C: Scott Ferguson (individual CLA)
Brad Fitzpatrick [Thu, 1 Aug 2013 22:49:35 +0000 (15:49 -0700)]
A+C: Scott Ferguson (individual CLA)

Generated by addca.

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

11 years agocompress/flate: Fixed two panics on bad data
Pieter Droogendijk [Thu, 1 Aug 2013 22:20:01 +0000 (15:20 -0700)]
compress/flate: Fixed two panics on bad data

I used just enough of the data provided by Matt in Issue 5915 to trigger
issue 5915. As luck would have it, using slightly less of it triggered
issue 5962.

Fixes #5915.
Fixes #5962.

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

11 years agonet/http: don't write out invalid cookie lines
Brad Fitzpatrick [Thu, 1 Aug 2013 19:16:37 +0000 (12:16 -0700)]
net/http: don't write out invalid cookie lines

Fixes #3033

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

11 years agonet/http: document that Error is to be used with plain text
Andrew Balholm [Thu, 1 Aug 2013 19:05:05 +0000 (12:05 -0700)]
net/http: document that Error is to be used with plain text

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

11 years agostrings: add IndexByte, for consistency with bytes package
Brad Fitzpatrick [Thu, 1 Aug 2013 18:17:26 +0000 (11:17 -0700)]
strings: add IndexByte, for consistency with bytes package

I always forget which package has it.

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

11 years agocmd/ld: report pclntab, funcdata sizes in 6l -v output
Russ Cox [Thu, 1 Aug 2013 16:58:27 +0000 (12:58 -0400)]
cmd/ld: report pclntab, funcdata sizes in 6l -v output
Also move chatty recent additions to -v -v.

For what it's worth:

$ go build -o /dev/null -ldflags -v cmd/go
...
 0.87 pclntab=1110836 bytes, funcdata total 69700 bytes
...
$

This broke the ELF builds last time because I tried to dedup
the funcdata in case the same funcdata was pointed at by
multiple functions. That doesn't currently happen, so I've
removed that test.

If we start doing bitmap coalescing we'll need to figure out
how to measure the size more carefully, but I think at that
point the bitmaps will be an extra indirection away from the
funcdata anyway, so the dedup I used before wouldn't help.

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

11 years agostrconv: fix doc comment for IntSize
Russ Cox [Thu, 1 Aug 2013 15:34:25 +0000 (11:34 -0400)]
strconv: fix doc comment for IntSize

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

11 years agoruntime: print "created by" for running goroutines in traceback
Dmitriy Vyukov [Thu, 1 Aug 2013 15:28:38 +0000 (19:28 +0400)]
runtime: print "created by" for running goroutines in traceback
This allows to at least determine goroutine "identity".
Now it looks like:
goroutine 12 [running]:
        goroutine running on other thread; stack unavailable
created by testing.RunTests
        src/pkg/testing/testing.go:440 +0x88e

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

11 years agoruntime: remove unused var
Dmitriy Vyukov [Thu, 1 Aug 2013 14:26:21 +0000 (18:26 +0400)]
runtime: remove unused var

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

11 years agoruntime: make new tests shorter in short mode
Dmitriy Vyukov [Thu, 1 Aug 2013 14:25:36 +0000 (18:25 +0400)]
runtime: make new tests shorter in short mode
We see timeouts in these tests on some platforms,
but not on the others.  The hypothesis is that
the problematic platforms are slow uniprocessors.
Stack traces do not suggest that the process
is completely hang, and it is able to schedule
the alarm goroutine. And if it actually hangs,
we still will be able to detect that.

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

11 years agotesting: say what was the timeout if it fires
Dmitriy Vyukov [Thu, 1 Aug 2013 13:24:24 +0000 (17:24 +0400)]
testing: say what was the timeout if it fires
It looks reasonable here and may be useful.

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

11 years agoruntime: fix netbsd/arm build
Dmitriy Vyukov [Thu, 1 Aug 2013 11:19:45 +0000 (15:19 +0400)]
runtime: fix netbsd/arm build
Currently fails with:
fatal error: runtime: stack split during syscall
goroutine 2 [stack split]:
_vasop(0x3ac4a0, 0x505f8f00, 0x7a5a8, 0x7, 0x1ed3797f, ...)
        src/pkg/runtime/vlrt_arm.c:513 fp=0x505f8ecc
runtime.semasleep(0xf8475800, 0xd)
        src/pkg/runtime/os_netbsd.c:97 +0x178 fp=0x505f8efc

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

11 years agodoc: remove jquery.js and style.css
Andrew Gerrand [Thu, 1 Aug 2013 07:36:45 +0000 (17:36 +1000)]
doc: remove jquery.js and style.css

Somehow missed these. Moved to go.tools/cmd/godoc/template.

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

11 years agomisc/dist: include godoc from go.tools
Andrew Gerrand [Thu, 1 Aug 2013 06:48:31 +0000 (16:48 +1000)]
misc/dist: include godoc from go.tools

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

11 years agosyscall: add Dup3 on Linux
Brad Fitzpatrick [Thu, 1 Aug 2013 06:38:53 +0000 (23:38 -0700)]
syscall: add Dup3 on Linux

With dup3, we can avoid an extra system call on some machines
while holding syscall.ForkLock. Currently we have to
syscall.Dup + syscall.CloseOnExec.

On machines with Linux and a new enough kernel, this can just
be dup3.

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

11 years agonet/http: don't MIME sniff if handler set an empty string Content-Type
Brad Fitzpatrick [Thu, 1 Aug 2013 06:38:32 +0000 (23:38 -0700)]
net/http: don't MIME sniff if handler set an empty string Content-Type

Fixes #5953

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

11 years agoruntime: fix arm build.
Rémy Oudompheng [Thu, 1 Aug 2013 05:48:21 +0000 (07:48 +0200)]
runtime: fix arm build.

More functions needs to be marked as no stack split.

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

11 years agospec: clarify index and selector expressions
Robert Griesemer [Thu, 1 Aug 2013 05:25:47 +0000 (22:25 -0700)]
spec: clarify index and selector expressions

(Replacement for CL 11884043.)

1) Explain a[i] and a[i:j] where a is of type *A as
   shortcut for (*a)[i] and (*a)[i:j], respectively.

2) Together with 1), because len() of nil slices is
   well defined, there's no need to special case nil
   operands anymore.

3) The result of indexing or slicing a constant string
   is always a non-constant byte or string value.

4) The result of slicing an untyped string is a value
   of type string.

5) If the operand of a valid slice a[i:j] is nil (i, j
   must be 0 for it to be valid - this already follows
   from the in-range rules), the result is a nil slice.

Fixes #4913.
Fixes #5951.

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

11 years agodoc: remove godocs.js and playground.js from core repo
Andrew Gerrand [Thu, 1 Aug 2013 05:09:18 +0000 (15:09 +1000)]
doc: remove godocs.js and playground.js from core repo

These are moved to code.google.com/p/go.tools/cmd/godoc.

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

11 years agoruntime: mark arm _lsvh nosplit (may fix arm build)
Russ Cox [Thu, 1 Aug 2013 04:23:30 +0000 (00:23 -0400)]
runtime: mark arm _lsvh nosplit (may fix arm build)

Mark the 386 one too for consistency,
although most of that code is no longer used.

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

11 years agoruntime: fix arm preemption
Russ Cox [Thu, 1 Aug 2013 04:16:31 +0000 (00:16 -0400)]
runtime: fix arm preemption

Preemption during the software floating point code
could cause m (R9) to change, so that when the
original registers were restored at the end of the
floating point handler, the changed and correct m
would be replaced by the old and incorrect m.

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

11 years agobuild: remove builder from test suite (fix build)
Andrew Gerrand [Thu, 1 Aug 2013 03:49:00 +0000 (13:49 +1000)]
build: remove builder from test suite (fix build)

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

11 years agomisc/dashboard/app, misc/dashboard/builder: delete from main repo; part of move to...
Chris Manghane [Thu, 1 Aug 2013 03:27:27 +0000 (13:27 +1000)]
misc/dashboard/app, misc/dashboard/builder: delete from main repo; part of move to go.tools
See also https://golang.org/cl/12180043/

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

11 years agoC: add Chris Manghane (Google CLA)
Andrew Gerrand [Thu, 1 Aug 2013 03:22:42 +0000 (13:22 +1000)]
C: add Chris Manghane (Google CLA)

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

11 years agocmd/godoc: delete from core repository
Andrew Gerrand [Thu, 1 Aug 2013 01:21:17 +0000 (11:21 +1000)]
cmd/godoc: delete from core repository

The godoc command now lives at code.google.com/p/go.tools/cmd/godoc.

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

11 years agocmd/go: install go.tools/cmd/godoc to $GOROOT/bin/godoc
Andrew Gerrand [Thu, 1 Aug 2013 01:17:42 +0000 (11:17 +1000)]
cmd/go: install go.tools/cmd/godoc to $GOROOT/bin/godoc

Also suggest "go get" if godoc not found when running "go doc".

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

11 years agodoc: don't invoke go build with -o /dev/null during test
Robert Daniel Kortschak [Thu, 1 Aug 2013 01:03:13 +0000 (11:03 +1000)]
doc: don't invoke go build with -o /dev/null during test

Fixes #5998.

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

11 years agoC: add Folke Behrens (Google CLA)
Andrew Gerrand [Thu, 1 Aug 2013 00:28:37 +0000 (10:28 +1000)]
C: add Folke Behrens (Google CLA)

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

11 years agoundo CL 12193043 / cc5858966b08
Brad Fitzpatrick [Wed, 31 Jul 2013 22:31:43 +0000 (15:31 -0700)]
undo CL 12193043 / cc5858966b08

Breaks all ELF builds.

««« original CL description
       cmd/ld: report pclntab, funcdata sizes in 6l -v output
       Also move chatty recent additions to -v -v.

       For what it's worth:

       $ go build -o /dev/null -ldflags -v cmd/godoc
       ...
        0.73 pclntab=1259976 bytes, funcdata total 79788 bytes
       ...
       $

R=ken2
CC=cshapiro, golang-dev
https://golang.org/cl/12193043
»»»

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

11 years agoruntime: save 8 stack bytes in timediv on arm.
Rémy Oudompheng [Wed, 31 Jul 2013 21:37:23 +0000 (23:37 +0200)]
runtime: save 8 stack bytes in timediv on arm.

Operations on int64 are very stack consuming with 5c.
Fixes netbsd/arm build.

Before: TEXT    runtime.timediv+0(SB),7,$52-16
After:  TEXT    runtime.timediv+0(SB),7,$44-16

The stack usage is unchanged on 386:
        TEXT    runtime.timediv+0(SB),7,$8-16

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

11 years agodoc/go1.2.txt: add time zone offsets with seconds
Brad Fitzpatrick [Wed, 31 Jul 2013 21:33:34 +0000 (14:33 -0700)]
doc/go1.2.txt: add time zone offsets with seconds

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

11 years agospec: clarify a couple of issues about channels
Rob Pike [Wed, 31 Jul 2013 21:12:32 +0000 (07:12 +1000)]
spec: clarify a couple of issues about channels

1. They are FIFOs.
2. They are safe for concurrent access.

Fixes #5911.

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

11 years agocontainer/list: added MoveBefore and MoveAfter
Pieter Droogendijk [Wed, 31 Jul 2013 21:11:25 +0000 (14:11 -0700)]
container/list: added MoveBefore and MoveAfter

Fixes #4940.

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

11 years agoundo CL 11884043 / bfd5ed8236d5
Robert Griesemer [Wed, 31 Jul 2013 21:10:46 +0000 (14:10 -0700)]
undo CL 11884043 / bfd5ed8236d5

CL submitted prematurely by mistake.

««« original CL description
spec: clarify index and selector expressions

1) Explain a[i] and a[i:j] where a is of type *A as
   shortcut for (*a)[i] and (*a)[i:j], respectively.

2) Together with 1), because len() of nil slices is
   well defined, there's no need to special case nil
   operands anymore.

3) The result of indexing or slicing a constant string
   is always a non-constant byte or string value.

4) The result of slicing an untyped string is a value
   of type string.

5) If the operand of a valid slice a[i:j] is nil (i, j
   must be 0 for it to be valid - this already follows
   from the in-range rules), the result is a nil slice.

Fixes #4913.
Fixes #5951.

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

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

11 years agospec: clarify index and selector expressions
Robert Griesemer [Wed, 31 Jul 2013 20:40:01 +0000 (13:40 -0700)]
spec: clarify index and selector expressions

1) Explain a[i] and a[i:j] where a is of type *A as
   shortcut for (*a)[i] and (*a)[i:j], respectively.

2) Together with 1), because len() of nil slices is
   well defined, there's no need to special case nil
   operands anymore.

3) The result of indexing or slicing a constant string
   is always a non-constant byte or string value.

4) The result of slicing an untyped string is a value
   of type string.

5) If the operand of a valid slice a[i:j] is nil (i, j
   must be 0 for it to be valid - this already follows
   from the in-range rules), the result is a nil slice.

Fixes #4913.
Fixes #5951.

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

11 years agocrypto/des: faster permutation.
Rémy Oudompheng [Wed, 31 Jul 2013 20:06:48 +0000 (22:06 +0200)]
crypto/des: faster permutation.

This patch introduces specialized functions for initial
and final permutations, and precomputes the output of the
third permutation on the S-box elements.

benchmark           old ns/op    new ns/op    delta
BenchmarkEncrypt         3581         1226  -65.76%
BenchmarkDecrypt         3590         1224  -65.91%

benchmark            old MB/s     new MB/s  speedup
BenchmarkEncrypt         2.23         6.52    2.92x
BenchmarkDecrypt         2.23         6.53    2.93x

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

11 years ago cmd/ld: report pclntab, funcdata sizes in 6l -v output
Russ Cox [Wed, 31 Jul 2013 19:36:49 +0000 (15:36 -0400)]
   cmd/ld: report pclntab, funcdata sizes in 6l -v output
       Also move chatty recent additions to -v -v.

       For what it's worth:

       $ go build -o /dev/null -ldflags -v cmd/godoc
       ...
0.73 pclntab=1259976 bytes, funcdata total 79788 bytes
       ...
       $

R=ken2
CC=cshapiro, golang-dev
https://golang.org/cl/12193043

11 years agoruntime: better debug output for inconsistent Note
Dmitriy Vyukov [Wed, 31 Jul 2013 18:03:59 +0000 (22:03 +0400)]
runtime: better debug output for inconsistent Note
Update #5139.
Double wakeup on Note was reported several times,
but no reliable reproducer.
There also was a strange report about weird value of epoll fd.
Maybe it's corruption of global data...

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

11 years agoruntime: do not park sysmon thread if any goroutines are running
Dmitriy Vyukov [Wed, 31 Jul 2013 16:09:03 +0000 (20:09 +0400)]
runtime: do not park sysmon thread if any goroutines are running
Sysmon thread parks if no goroutines are running (runtime.sched.npidle ==
runtime.gomaxprocs).
Currently it's unparked when a goroutine enters syscall, it was enough
to retake P's from blocking syscalls.
But it's not enough for reliable goroutine preemption. We need to ensure that
sysmon runs if any goroutines are running.

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

11 years agoundo CL 12167043 / 475e11851fc1
Dmitriy Vyukov [Wed, 31 Jul 2013 16:03:05 +0000 (20:03 +0400)]
undo CL 12167043 / 475e11851fc1

Submitted with some unrelated changes that were not intended to go in.

««« original CL description
runtime: do not park sysmon thread if any goroutines are running
Sysmon thread parks if no goroutines are running (runtime.sched.npidle == runtime.gomaxprocs).
Currently it's unparked when a goroutine enters syscall, it was enough
to retake P's from blocking syscalls.
But it's not enough for reliable goroutine preemption. We need to ensure that
sysmon runs if any goroutines are running.

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

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

11 years agocmd/gc: record argument size for all indirect function calls
Dmitriy Vyukov [Wed, 31 Jul 2013 16:00:33 +0000 (20:00 +0400)]
cmd/gc: record argument size for all indirect function calls
This is required to properly unwind reflect.methodValueCall/makeFuncStub.
Fixes #5954.
Stats for 'go install std':
61849 total INSTCALL
24655 currently have ArgSize metadata
27278 have ArgSize metadata with this change
godoc size before: 11351888, after: 11364288

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

11 years agoruntime: do not park sysmon thread if any goroutines are running
Dmitriy Vyukov [Wed, 31 Jul 2013 15:59:27 +0000 (19:59 +0400)]
runtime: do not park sysmon thread if any goroutines are running
Sysmon thread parks if no goroutines are running (runtime.sched.npidle == runtime.gomaxprocs).
Currently it's unparked when a goroutine enters syscall, it was enough
to retake P's from blocking syscalls.
But it's not enough for reliable goroutine preemption. We need to ensure that
sysmon runs if any goroutines are running.

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

11 years agoruntime: rewrite map size test
Russ Cox [Wed, 31 Jul 2013 12:35:43 +0000 (08:35 -0400)]
runtime: rewrite map size test

I don't know why the memstats code is flaky.

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

11 years agopath/filepath: Panic in Match when parsing invalid character range.
Pieter Droogendijk [Wed, 31 Jul 2013 06:58:28 +0000 (16:58 +1000)]
path/filepath: Panic in Match when parsing invalid character range.

Fixes #5668.

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

11 years agofmt: make all errors begin with the string "%!", always.
Robert Daniel Kortschak [Wed, 31 Jul 2013 06:11:12 +0000 (16:11 +1000)]
fmt: make all errors begin with the string "%!", always.

Fixes #5730.

R=dsymonds, r, kamil.kisiel
CC=golang-dev
https://golang.org/cl/11998044

11 years agotime: Allow Parse and Format to handle time zone offsets with seconds
Ulf Holm Nielsen [Wed, 31 Jul 2013 06:11:02 +0000 (16:11 +1000)]
time: Allow Parse and Format to handle time zone offsets with seconds

Adds layout cases with seconds for stdISO8601 and stdNumTZ with and without colons. Update time.Format to append seconds for those cases.

Fixes #4934.

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

11 years agoA+C: Ulf Holm Nielsen (individual CLA)
Rob Pike [Wed, 31 Jul 2013 06:10:50 +0000 (16:10 +1000)]
A+C: Ulf Holm Nielsen (individual CLA)

Generated by addca.

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

11 years agotext/template/parse: print TextNodes using %s not %q
Rob Pike [Wed, 31 Jul 2013 05:09:13 +0000 (15:09 +1000)]
text/template/parse: print TextNodes using %s not %q
This means that printing a Node will produce output that can be used as valid input.
It won't be exactly the same - some spacing may be different - but it will mean the same.

Fixes #4593.

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

11 years agofmt: treat \r\n as \n in Scan
Rob Pike [Wed, 31 Jul 2013 05:00:08 +0000 (15:00 +1000)]
fmt: treat \r\n as \n in Scan
When scanning input and "white space" is permitted, a carriage return
followed immediately by a newline (\r\n) is treated exactly the same
as a plain newline (\n). I hope this makes it work better on Windows.

We do it everywhere, not just on Windows, since why not?

Fixes #5391.

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

11 years agoruntime: optimize some hash lookups.
Keith Randall [Wed, 31 Jul 2013 04:39:57 +0000 (21:39 -0700)]
runtime: optimize some hash lookups.

When comparing strings, check these (in order):
- length mismatch => not equal
- string pointer equal => equal
- if length is short:
  - memeq on body
- if length is long:
  - compare first&last few bytes, if different => not equal
  - save entry as a possible match
  - after checking every entry, if there is only one possible
    match, use memeq on that entry.  Otherwise, fallback to hash.

benchmark                 old ns/op    new ns/op    delta
BenchmarkSameLengthMap           43            4  -89.77%

Fixes #5194.
Update #3885.

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

11 years agofmt: remove "Scan:" prefix from error messages
Rob Pike [Wed, 31 Jul 2013 04:09:19 +0000 (14:09 +1000)]
fmt: remove "Scan:" prefix from error messages
The prefix was not uniformly applied and is probably better left off anyway.

Fixes #4944.

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

11 years agofmt: put a ! in all error output generated by Printf-like functions
Rob Pike [Wed, 31 Jul 2013 04:08:47 +0000 (14:08 +1000)]
fmt: put a ! in all error output generated by Printf-like functions
Fixes #5730.

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

11 years agonet: add simple SetKeepAlivePeriod call test
Mikio Hara [Wed, 31 Jul 2013 03:34:14 +0000 (12:34 +0900)]
net: add simple SetKeepAlivePeriod call test

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

11 years agoruntime: fix build on FreeBSD
Russ Cox [Wed, 31 Jul 2013 03:21:07 +0000 (23:21 -0400)]
runtime: fix build on FreeBSD

This is what I get for being talked into a test.

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

11 years agotext/template: fix type of ComplexZero in test
Rob Pike [Wed, 31 Jul 2013 03:04:57 +0000 (13:04 +1000)]
text/template: fix type of ComplexZero in test
Was stupidly float64; should be complex128.
The tests still pass.

Fixes #5649.

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

11 years agoruntime: ARM _sfloat has no arguments
Russ Cox [Wed, 31 Jul 2013 02:58:38 +0000 (22:58 -0400)]
runtime: ARM _sfloat has no arguments

Fixes one build failure.

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

11 years agocmd/go: send timed out test SIGQUIT before SIGKILL
Russ Cox [Wed, 31 Jul 2013 02:52:10 +0000 (22:52 -0400)]
cmd/go: send timed out test SIGQUIT before SIGKILL

There is a chance that the SIGQUIT will make the test process
dump its stacks as part of exiting, which would be nice for
finding out what it is doing.

Right now the builders are occasionally timing out running
the runtime test. I hope this will give us some information
about the state of the runtime.

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

11 years agoruntime: cut struct Hmap back to 48-byte allocation
Russ Cox [Wed, 31 Jul 2013 02:48:03 +0000 (22:48 -0400)]
runtime: cut struct Hmap back to 48-byte allocation

struct Hmap is the header for a map value.

CL 8377046 made flags a uint32 so that it could be updated atomically,
but that bumped the struct to 56 bytes, which allocates as 64 bytes (on amd64).

hash0 is initialized from runtime.fastrand1, which returns a uint32,
so the top 32 bits were always zero anyway. Declare it as a uint32
to reclaim 4 bytes and bring the Hmap size back down to a 48-byte allocation.

Fixes #5237.

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

11 years agonet/http: skip TestDirJoin on Windows, even if /etc/hosts exists
Shivakumar GN [Wed, 31 Jul 2013 01:25:08 +0000 (18:25 -0700)]
net/http: skip TestDirJoin on Windows, even if /etc/hosts exists

Fixes #5460.

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

11 years agocontainer/list: document complexity of Len
Robert Griesemer [Tue, 30 Jul 2013 20:35:14 +0000 (13:35 -0700)]
container/list: document complexity of Len

Fixes #5972.

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

11 years agoruntime: fix code formatting
Dmitriy Vyukov [Tue, 30 Jul 2013 19:48:18 +0000 (23:48 +0400)]
runtime: fix code formatting
This is mainly to force another build
with goroutine preemption.

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

11 years agoruntime: enable goroutine preemption
Dmitriy Vyukov [Tue, 30 Jul 2013 18:17:38 +0000 (22:17 +0400)]
runtime: enable goroutine preemption
All known issues with preemption have beed fixed.

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

11 years agoruntime: fix race builders
Dmitriy Vyukov [Tue, 30 Jul 2013 18:13:51 +0000 (22:13 +0400)]
runtime: fix race builders
Do not run Syscall benchmarks under race detector,
they split stack in syscall status.

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

11 years agonet: fix memory leak on unix
Dmitriy Vyukov [Tue, 30 Jul 2013 15:47:16 +0000 (19:47 +0400)]
net: fix memory leak on unix
If netFD is closed by finalizer, runtime netpoll descriptor is not freed.

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

11 years agocmd/gc: don't report mark if other things are broken
Russ Cox [Tue, 30 Jul 2013 14:27:26 +0000 (10:27 -0400)]
cmd/gc: don't report mark if other things are broken

Fixes #5598.

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

11 years agocmd/gc: insert \n at end of every input file
Russ Cox [Tue, 30 Jul 2013 14:27:08 +0000 (10:27 -0400)]
cmd/gc: insert \n at end of every input file

Not just the first one.

Fixes #5433.
Fixes #5913.

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

11 years agonet: fix comment on SetKeepAlivePeriod
Mikio Hara [Tue, 30 Jul 2013 07:31:57 +0000 (16:31 +0900)]
net: fix comment on SetKeepAlivePeriod

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

11 years agonet: add missing SetKeepAlivePeriod for Plan 9
Mikio Hara [Tue, 30 Jul 2013 07:29:51 +0000 (16:29 +0900)]
net: add missing SetKeepAlivePeriod for Plan 9

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

11 years agodoc: don't block page load on JavaScript fetch
Andrew Gerrand [Tue, 30 Jul 2013 04:22:14 +0000 (14:22 +1000)]
doc: don't block page load on JavaScript fetch

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

11 years agoencoding/xml: Do not pass through invalid utf8 bytes
Alex A Skinner [Tue, 30 Jul 2013 04:11:47 +0000 (14:11 +1000)]
encoding/xml: Do not pass through invalid utf8 bytes

EscapeText now escapes 0xFFFD returned from DecodeRune as 0xFFFD, rather than passing through the original byte.
Fixes #5880.

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

11 years agoA+C: Alex A Skinner (individual CLA)
Andrew Gerrand [Tue, 30 Jul 2013 04:10:50 +0000 (14:10 +1000)]
A+C: Alex A Skinner (individual CLA)

Generated by addca.

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

11 years agocmd/gc: make bisonerrors compatible with GNU Bison 3.0
Rémy Oudompheng [Tue, 30 Jul 2013 02:31:15 +0000 (04:31 +0200)]
cmd/gc: make bisonerrors compatible with GNU Bison 3.0

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

11 years agodoc/codewalk: test source code
Andrew Gerrand [Mon, 29 Jul 2013 23:42:53 +0000 (09:42 +1000)]
doc/codewalk: test source code

Fixes #2648.

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

11 years agogo/parser: don't report name errors if DeclarationErrors is not set
Robert Griesemer [Mon, 29 Jul 2013 23:00:28 +0000 (16:00 -0700)]
go/parser: don't report name errors if DeclarationErrors is not set

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

11 years agobuild: fix build
Russ Cox [Mon, 29 Jul 2013 20:52:40 +0000 (16:52 -0400)]
build: fix build

As promised.

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

11 years agogo/parser: selectors may be method expressions
Robert Griesemer [Mon, 29 Jul 2013 20:52:15 +0000 (13:52 -0700)]
go/parser: selectors may be method expressions

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

11 years agobuild: break builds
Russ Cox [Mon, 29 Jul 2013 20:52:03 +0000 (16:52 -0400)]
build: break builds

I want to see the timing information in build logs,
and we can't see the logs for "ok" builds.
So make the build fail everywhere.

Will roll back immediately.

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

11 years agoruntime: adjust timediv to avoid _vasop; mark _subv okay
Russ Cox [Mon, 29 Jul 2013 20:42:07 +0000 (16:42 -0400)]
runtime: adjust timediv to avoid _vasop; mark _subv okay

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

11 years agoruntime: fix timediv calls on NetBSD, OpenBSD
Russ Cox [Mon, 29 Jul 2013 20:31:42 +0000 (16:31 -0400)]
runtime: fix timediv calls on NetBSD, OpenBSD

Document endian-ness assumption.

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

11 years agoruntime: fix arm build
Dmitriy Vyukov [Mon, 29 Jul 2013 20:08:30 +0000 (00:08 +0400)]
runtime: fix arm build

The current failure is:
fatal error: runtime: stack split during syscall
goroutine 2 [stack split]:
_si2v(0xb6ebaebc, 0x3b9aca00)
        /usr/local/go/src/pkg/runtime/vlrt_arm.c:628 fp=0xb6ebae9c
runtime.timediv(0xf8475800, 0xd, 0x3b9aca00, 0xb6ebaef4)
        /usr/local/go/src/pkg/runtime/runtime.c:424 +0x1c fp=0xb6ebaed4

Just adding textflag 7 causes the following error:
notetsleep: nosplit stack overflow
        128 assumed on entry to notetsleep
        96 after notetsleep uses 32
        60 after runtime.futexsleep uses 36
        4 after runtime.timediv uses 56
        -4 after _si2v uses 8

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

11 years agomath/big: better documentation for Rat.Float64
Robert Griesemer [Mon, 29 Jul 2013 20:06:34 +0000 (13:06 -0700)]
math/big: better documentation for Rat.Float64

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

11 years agoruntime: fix arm build
Dmitriy Vyukov [Mon, 29 Jul 2013 19:41:12 +0000 (23:41 +0400)]
runtime: fix arm build

The current failure is:
fatal error: runtime: stack split during syscall
goroutine 2 [stack split]:
_addv(0xb6fa0f28, 0xd0a5112e, 0x13156d6e, 0xf8475800, 0xd)
        /usr/local/go/src/pkg/runtime/vlrt_arm.c:66 fp=0xb6fa0ef8
notetsleep(0xb6fa0f9c, 0xf8475800, 0xd, 0x0, 0x0, ...)
        /usr/local/go/src/pkg/runtime/lock_futex.c:156 +0xd0 fp=0xb6fa0f18
runtime.notetsleepg(0xb6fa0f9c, 0xf8475800, 0xd)
        /usr/local/go/src/pkg/runtime/lock_futex.c:197 +0x74 fp=0xb6fa0f3c

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

11 years agoruntime: fix linux/arm build
Dmitriy Vyukov [Mon, 29 Jul 2013 18:59:30 +0000 (22:59 +0400)]
runtime: fix linux/arm build
notetsleep: nosplit stack overflow
        128 assumed on entry to notetsleep
        80 after notetsleep uses 48
        44 after runtime.futexsleep uses 36
        -12 after runtime.timediv uses 56

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

11 years agoruntime: fix openbsd build
Dmitriy Vyukov [Mon, 29 Jul 2013 18:58:58 +0000 (22:58 +0400)]
runtime: fix openbsd build
notetsleep: nosplit stack overflow
        120 assumed on entry to notetsleep
        96 after notetsleep uses 24
        88 on entry to runtime.semasleep
        32 after runtime.semasleep uses 56
        24 on entry to runtime.nanotime
        -8 after runtime.nanotime uses 32

Nanotime seems to be using only 24 bytes of stack space.
Unless I am missing something.

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

11 years agoruntime: fix freebsd build
Dmitriy Vyukov [Mon, 29 Jul 2013 18:58:26 +0000 (22:58 +0400)]
runtime: fix freebsd build
notetsleep: nosplit stack overflow
        120 assumed on entry to notetsleep
        80 after notetsleep uses 40
        72 on entry to runtime.futexsleep
        16 after runtime.futexsleep uses 56
        8 on entry to runtime.printf
        -16 after runtime.printf uses 24

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

11 years agoruntime: do not split stacks in syscall status
Dmitriy Vyukov [Mon, 29 Jul 2013 18:22:34 +0000 (22:22 +0400)]
runtime: do not split stacks in syscall status
Split stack checks (morestack) corrupt g->sched,
but g->sched must be preserved consistent for GC/traceback.
The change implements runtime.notetsleepg function,
which does entersyscall/exitsyscall and is carefully arranged
to not call any split functions in between.

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

11 years agonet: fix memory leaks on windows
Dmitriy Vyukov [Mon, 29 Jul 2013 16:01:13 +0000 (20:01 +0400)]
net: fix memory leaks on windows
Close netpoll descriptor along with socket.
Ensure that error paths close the descriptor as well.

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

11 years agoruntime: allow SetFinalizer with a func(interface{})
Pieter Droogendijk [Mon, 29 Jul 2013 15:43:08 +0000 (19:43 +0400)]
runtime: allow SetFinalizer with a func(interface{})

Fixes #5368.

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

11 years agonet: remove redundant comment on isWildcard
Mikio Hara [Mon, 29 Jul 2013 14:26:11 +0000 (23:26 +0900)]
net: remove redundant comment on isWildcard

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

11 years agonet: document sockaddr interface
Mikio Hara [Mon, 29 Jul 2013 14:25:39 +0000 (23:25 +0900)]
net: document sockaddr interface

This is in preparation for runtime-integrated network pollster for BSD
variants.

Update #5199

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

11 years agodoc/articles: state that slices/arrays start at the 0th element
Andrew Gerrand [Mon, 29 Jul 2013 08:33:39 +0000 (18:33 +1000)]
doc/articles: state that slices/arrays start at the 0th element

Fixes #5881.

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