1
0
mirror of https://github.com/golang/go synced 2024-09-30 12:18:33 -06:00
Commit Graph

16993 Commits

Author SHA1 Message Date
Russ Cox
e03dd07981 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
2013-08-01 20:07:01 -04:00
Brad Fitzpatrick
e2a1bd68b3 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
2013-08-01 16:11:19 -07:00
Scott Ferguson
39679ca88f 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
2013-08-01 15:52:56 -07:00
Russ Cox
13507e0697 runtime: fix traceback across morestack
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12287043
2013-08-01 18:51:55 -04:00
Brad Fitzpatrick
fc5a63066b A+C: Scott Ferguson (individual CLA)
Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/12291043
2013-08-01 15:49:35 -07:00
Pieter Droogendijk
df1eeeba4a 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
2013-08-01 15:20:01 -07:00
Brad Fitzpatrick
17d803d251 net/http: don't write out invalid cookie lines
Fixes #3033

R=golang-dev, fvbommel, rsc
CC=golang-dev
https://golang.org/cl/12204043
2013-08-01 12:16:37 -07:00
Andrew Balholm
334761a666 net/http: document that Error is to be used with plain text
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12276043
2013-08-01 12:05:05 -07:00
Brad Fitzpatrick
9742003ffc 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
2013-08-01 11:17:26 -07:00
Russ Cox
b99fa81555 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
2013-08-01 12:58:27 -04:00
Russ Cox
c24e60eebb strconv: fix doc comment for IntSize
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12258043
2013-08-01 11:34:25 -04:00
Dmitriy Vyukov
c33d490020 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
2013-08-01 19:28:38 +04:00
Dmitriy Vyukov
3cbc2716a9 runtime: remove unused var
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12249043
2013-08-01 18:26:21 +04:00
Dmitriy Vyukov
d8bbbd2537 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
2013-08-01 18:25:36 +04:00
Dmitriy Vyukov
bd0a14fe40 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
2013-08-01 17:24:24 +04:00
Dmitriy Vyukov
21315c3428 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
2013-08-01 15:19:45 +04:00
Andrew Gerrand
ffb62d58a3 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
2013-08-01 17:36:45 +10:00
Andrew Gerrand
87380415e0 misc/dist: include godoc from go.tools
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12075045
2013-08-01 16:48:31 +10:00
Brad Fitzpatrick
c8d49cf56f 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
2013-07-31 23:38:53 -07:00
Brad Fitzpatrick
252c107f2f 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
2013-07-31 23:38:32 -07:00
Rémy Oudompheng
184b02ea9f 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
2013-08-01 07:48:21 +02:00
Robert Griesemer
2961d229de 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
2013-07-31 22:25:47 -07:00
Andrew Gerrand
461f82526a 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
2013-08-01 15:09:18 +10:00
Russ Cox
f4f2cf16b0 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
2013-08-01 00:23:30 -04:00
Russ Cox
cba880e04a 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
2013-08-01 00:16:31 -04:00
Andrew Gerrand
5f1af1608f build: remove builder from test suite (fix build)
R=golang-dev, dave, dsymonds
CC=golang-dev
https://golang.org/cl/12225043
2013-08-01 13:49:00 +10:00
Chris Manghane
acd1b6317d 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
2013-08-01 13:27:27 +10:00
Andrew Gerrand
bc8f443435 C: add Chris Manghane (Google CLA)
R=golang-dev
CC=golang-dev
https://golang.org/cl/12222043
2013-08-01 13:22:42 +10:00
Andrew Gerrand
4fa83edf06 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
2013-08-01 11:21:17 +10:00
Andrew Gerrand
e011ac5420 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
2013-08-01 11:17:42 +10:00
Robert Daniel Kortschak
64cb2cf5cc 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
2013-08-01 11:03:13 +10:00
Andrew Gerrand
226e1eac03 C: add Folke Behrens (Google CLA)
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12208043
2013-08-01 10:28:37 +10:00
Brad Fitzpatrick
b08d0c2c62 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
2013-07-31 15:31:43 -07:00
Rémy Oudompheng
a05237f20a 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
2013-07-31 23:37:23 +02:00
Brad Fitzpatrick
727901410a doc/go1.2.txt: add time zone offsets with seconds
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12174043
2013-07-31 14:33:34 -07:00
Rob Pike
bd65404eef 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
2013-08-01 07:12:32 +10:00
Pieter Droogendijk
fbcc24bb9d container/list: added MoveBefore and MoveAfter
Fixes #4940.

R=golang-dev, bradfitz, gri
CC=golang-dev
https://golang.org/cl/12021044
2013-07-31 14:11:25 -07:00
Robert Griesemer
9f75dd7f25 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
2013-07-31 14:10:46 -07:00
Robert Griesemer
58d2960655 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
2013-07-31 13:40:01 -07:00
Rémy Oudompheng
441ef7978d 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
2013-07-31 22:06:48 +02:00
Russ Cox
d43ee1b714 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
2013-07-31 15:36:49 -04:00
Dmitriy Vyukov
98d94b589c 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
2013-07-31 22:03:59 +04:00
Dmitriy Vyukov
658d19a53f 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
2013-07-31 20:09:03 +04:00
Dmitriy Vyukov
6ee69a9726 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
2013-07-31 20:03:05 +04:00
Dmitriy Vyukov
8679d5f2b5 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
2013-07-31 20:00:33 +04:00
Dmitriy Vyukov
156e8b306d 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
2013-07-31 19:59:27 +04:00
Russ Cox
e8018fbebe 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
2013-07-31 08:35:43 -04:00
Pieter Droogendijk
27032fddee 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
2013-07-31 16:58:28 +10:00
Robert Daniel Kortschak
53b61057b2 fmt: make all errors begin with the string "%!", always.
Fixes #5730.

R=dsymonds, r, kamil.kisiel
CC=golang-dev
https://golang.org/cl/11998044
2013-07-31 16:11:12 +10:00
Ulf Holm Nielsen
aa38aeaeaf 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
2013-07-31 16:11:02 +10:00