1
0
mirror of https://github.com/golang/go synced 2024-10-04 12:31:21 -06:00
Commit Graph

17142 Commits

Author SHA1 Message Date
Brad Fitzpatrick
4c772cda54 all: use strings.IndexByte instead of Index where possible
R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/12486043
2013-08-05 15:46:06 -07:00
Pieter Droogendijk
dd6f49ddca container/heap: add Fix and document the min is element 0.
Fixes #5372.
Fixes #5577.

R=gri, rsc, bradfitz, r
CC=golang-dev
https://golang.org/cl/12265043
2013-08-05 15:45:39 -07:00
Brad Fitzpatrick
37feacf623 net: use F_DUPFD_CLOEXEC when duping fds
This means that in the common case (modern kernel), we only
make 1 system call to dup instead of two, and we also avoid
grabbing the syscall.ForkLock.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/12476043
2013-08-05 15:43:45 -07:00
Keith Randall
f7910128e7 reflect: Get rid of the test for the error message when
you do reflect.call with too big an argument list.
Not worth the hassle.

Fixes #6023
Fixes #6033

R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/12485043
2013-08-05 15:08:37 -07:00
Brad Fitzpatrick
598c78967f strings: use runtime assembly for IndexByte
Fixes #3751

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/12483043
2013-08-05 15:04:05 -07:00
Dave Cheney
8ce8adbe7a runtime: tune append crossover on amd64 and 386
Fixes #4963.

Sets the append crossover to 0 on intel platforms.

Results for linux/amd64 Core i5 SNB

benchmark                     old ns/op    new ns/op    delta
BenchmarkAppend                     102          104   +1.96%
BenchmarkAppend1Byte                 10           11   +0.92%
BenchmarkAppend4Bytes                15           11  -28.10%
BenchmarkAppend7Bytes                17           12  -32.58%
BenchmarkAppend8Bytes                18           12  -36.17%
BenchmarkAppend15Bytes               24           11  -55.02%
BenchmarkAppend16Bytes               25           11  -56.03%
BenchmarkAppend32Bytes               11           12   +4.31%
BenchmarkAppendStr1Byte               8            9  +13.99%
BenchmarkAppendStr4Bytes             11            9  -17.52%
BenchmarkAppendStr8Bytes             14            9  -35.70%
BenchmarkAppendStr16Bytes            21            9  -55.19%
BenchmarkAppendStr32Bytes            10           10   -5.66%
BenchmarkAppendSpecialCase           49           52   +7.96%

Results for linux/386 Atom(TM) CPU 330 @ 1.60GHz

benchmark                     old ns/op    new ns/op    delta
BenchmarkAppend                     219          218   -0.46%
BenchmarkAppend1Byte                 75           72   -3.44%
BenchmarkAppend4Bytes                92           73  -19.87%
BenchmarkAppend7Bytes               108           74  -31.20%
BenchmarkAppend8Bytes               116           74  -35.95%
BenchmarkAppend15Bytes              162           77  -52.22%
BenchmarkAppend16Bytes              169           77  -54.20%
BenchmarkAppend32Bytes               88           86   -2.38%
BenchmarkAppendStr1Byte              57           59   +3.32%
BenchmarkAppendStr4Bytes             72           59  -17.40%
BenchmarkAppendStr8Bytes             92           60  -34.70%
BenchmarkAppendStr16Bytes           141           63  -54.89%
BenchmarkAppendStr32Bytes            75           73   -2.64%
BenchmarkAppendSpecialCase          270          270   +0.00%

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12440044
2013-08-06 07:51:37 +10:00
Keith Randall
19e2922688 cmd/gc: get rid of redundant slice bound check.
For normal slices a[i:j] we're generating 3 bounds
checks: j<={len(string),cap(slice)}, j<=j (!), and i<=j.
Somehow snuck in as part of the [i:j:k] implementation
where the second check does something.
Remove the second check when we don't need it.

R=rsc, r
CC=golang-dev
https://golang.org/cl/12311046
2013-08-05 13:24:33 -07:00
Rémy Oudompheng
49da9a8e44 cmd/gc: fix inlining of unnamed structs with embedded fields.
Update #5910.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/11373044
2013-08-05 22:09:53 +02:00
Russ Cox
8a0779f9b9 compress/bzip2: support concatenated files
While we're here, add a test for the same functionality in gzip,
which was already implemented, and add bzip2 CRC checks.

Fixes #5772.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12387044
2013-08-05 16:08:08 -04:00
Russ Cox
10ebb84d48 runtime: remove debugging knob to turn off preemption
It's still easy to turn off, but the builders are happy.
Also document.

R=golang-dev, iant, dvyukov
CC=golang-dev
https://golang.org/cl/12371043
2013-08-05 16:06:24 -04:00
Dmitriy Vyukov
f38ff9e5ea undo CL 12250043 / e911f94c4902
Break all 386 builders.

««« original CL description
runtime: use gcpc/gcsp during traceback of goroutines in syscalls
gcpc/gcsp are used by GC in similar situation.
gcpc/gcsp are also more stable than gp->sched,
because gp->sched is mutated by entersyscall/exitsyscall
in morestack and mcall. So it has higher chances of being inconsistent.
Also, rename gcpc/gcsp to syscallpc/syscallsp.

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

R=rsc
CC=golang-dev
https://golang.org/cl/12424045
2013-08-05 23:33:50 +04:00
Brad Fitzpatrick
7963ba6a4a os, syscall: implement Getwd on darwin using getattrlist
Fixes #4807

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12349044
2013-08-05 12:26:05 -07:00
Dmitriy Vyukov
d5ab784611 runtime: remove singleproc var
It was needed for the old scheduler,
because there temporary could be more threads than gomaxprocs.
In the new scheduler gomaxprocs is always respected.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12438043
2013-08-05 22:58:02 +04:00
Dmitriy Vyukov
f73972fa33 runtime: use gcpc/gcsp during traceback of goroutines in syscalls
gcpc/gcsp are used by GC in similar situation.
gcpc/gcsp are also more stable than gp->sched,
because gp->sched is mutated by entersyscall/exitsyscall
in morestack and mcall. So it has higher chances of being inconsistent.
Also, rename gcpc/gcsp to syscallpc/syscallsp.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12250043
2013-08-05 22:55:54 +04:00
Adam Langley
20a2b96089 crypto/cipher: add GCM mode.
GCM is Galois Counter Mode, an authenticated encryption mode that is,
nearly always, used with AES.

R=rsc
CC=golang-dev
https://golang.org/cl/12375043
2013-08-05 14:31:58 -04:00
Adam Langley
5e36877d2a crypto: include hash number in panic message.
In the event that code tries to use a hash function that isn't compiled
in and panics, give the developer a fighting chance of figuring out
which hash function it needed.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12420045
2013-08-05 14:23:32 -04:00
ChaiShushan
6abbbcdc75 misc/notepadplus: add Function List support
Fixes #6045.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12463043
2013-08-05 08:24:55 -07:00
Rob Pike
c43cca7d92 doc/progs/slices.go: fix typo in comment
Fixes #6025.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12387046
2013-08-05 13:35:42 +10:00
ChaiShushan
6ab49fbc6e net: fix some test bug
Fixes #5785.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/10587043
2013-08-05 11:59:59 +10:00
Rob Pike
38a77ff03f doc/effective_go.html: remove spurious word
Fixes #6003.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12387045
2013-08-05 11:24:27 +10:00
Rob Pike
af8426eebe time: match month and day names only when not followed immediately by a lower-case letter
Avoids seeing "Janet" as "Januaryet".

Fixes #6020.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12448044
2013-08-05 10:53:46 +10:00
Dmitriy Vyukov
49217cf5fd runtime: remove unused scheduler knob
Blockingsyscall was used in net package on windows,
it's not used anymore.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12436043
2013-08-04 23:32:40 +04:00
Dmitriy Vyukov
0a904a3f2e runtime: remove dead code
Remove dead code related to allocation of type metadata with SysAlloc.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12311045
2013-08-04 23:32:06 +04:00
Dmitriy Vyukov
77f21eea59 net: fix concurrent Accept on windows
Runtime netpoll supports at most one read waiter
and at most one write waiter. It's responsibility
of net package to ensure that. Currently windows
implementation allows more than one waiter in Accept.
It leads to "fatal error: netpollblock: double wait".

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12400045
2013-08-04 23:31:23 +04:00
Josh Bleecher Snyder
910caf9345 net/http: fix Response.Header documentation for multiple headers with same key
Whether the keys are concatenated or separate (or a mixture) depends on the server.

Fixes #5979.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12433043
2013-08-04 11:23:17 -07:00
Dmitriy Vyukov
a574822f80 runtime: disable dynamic priority boosting on windows
Windows dynamic priority boosting assumes that a process has different types
of dedicated threads -- GUI, IO, computational, etc. Go processes use
equivalent threads that all do a mix of GUI, IO, computations, etc.
In such context dynamic priority boosting does nothing but harm, so turn it off.
In particular, if 2 goroutines do heavy IO on a server uniprocessor machine,
windows rejects to schedule timer thread for 2+ seconds when priority boosting is enabled.
Fixes #5971.

R=alex.brainman
CC=golang-dev
https://golang.org/cl/12406043
2013-08-04 14:08:13 +04:00
Rob Pike
7d4ea6cc9e html/template: delete panic recovery code from test
The test isn't checking deliberate panics so catching them just makes the code longer.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12420043
2013-08-04 09:06:14 +10:00
Josh Bleecher Snyder
53d9b6fcf3 html/template: handle nils during indirection
Fixes #5982.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12387043
2013-08-04 08:41:19 +10:00
Rob Pike
67f2ca3530 A+C: Josh Bleecher Snyder (individual CLA)
Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/12419043
2013-08-04 08:41:02 +10:00
Ian Lance Taylor
5437eefa65 libbio: add casts to remove -Wconversion warnings
Update #5764

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/12388043
2013-08-03 11:36:47 -07:00
Alex Brainman
a039bf20be cmd/dist: generate cmd/cgo/zdefaultcc.go on windows (fixes windows build)
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12404043
2013-08-03 18:32:14 +10:00
Rob Pike
16c9d3616a various: deleted unused items
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12396043
2013-08-03 16:01:04 +10:00
Mikio Hara
8a7def2b3b net: reduce unnecessary syscall.Sockaddr conversions
This CL makes IPAddr, UDPAddr and TCPAddr implement sockaddr
interface, UnixAddr is already sockaddr interface compliant, and
reduces unnecessary conversions between net.Addr, net.sockaddr and
syscall.Sockaddr.

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

Update #5199

R=golang-dev, dave, bradfitz
CC=golang-dev
https://golang.org/cl/12010043
2013-08-03 13:32:22 +09:00
Mikio Hara
f0291a8e10 net: make IP address selection work correctly on IPv6-only kernel
Update #3610
Update #5267
Update #5707

R=golang-dev, bradfitz, dave, fvbommel
CC=golang-dev
https://golang.org/cl/11958043
2013-08-03 12:17:01 +09:00
Brad Fitzpatrick
74d2e096db build: ignore new zfiles, delete temp goplay binary in run.bash
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12320045
2013-08-02 19:14:13 -07:00
Rémy Oudompheng
0fe65c4f49 cmd/dist: fix windows build.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12351045
2013-08-02 14:29:04 -07:00
Brad Fitzpatrick
7acf9e93de cmd/go: fix build
This was missed in c3b45d0dc5c0

R=golang-dev
CC=golang-dev
https://golang.org/cl/12379043
2013-08-02 14:28:52 -07:00
Alberto García Hierro
bbf1430021 cmd/go: Fix go get when the fetched XML uses ASCII encoding
Also, add a meaningful error message when an encoding which
can't be parsed is found.

Fixes #5801.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/12343043
2013-08-02 14:15:33 -07:00
Brad Fitzpatrick
869774cbf9 api: update next.txt
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12360043
2013-08-02 13:15:49 -07:00
Keith Randall
9cd570680b runtime: reimplement reflect.call to not use stack splitting.
R=golang-dev, r, khr, rsc
CC=golang-dev
https://golang.org/cl/12053043
2013-08-02 13:03:14 -07:00
Russ Cox
b8c8cb8509 cmd/dist: fix build again
I am really bad at this. Didn't hg add this file.

TBR=bradfitz
CC=golang-dev
https://golang.org/cl/12372043
2013-08-02 15:20:42 -04:00
Russ Cox
e6ddddadda cmd/dist: fix build
TBR=bradfitz
CC=golang-dev
https://golang.org/cl/12369043
2013-08-02 15:13:06 -04:00
Russ Cox
2ddb672ddc build: on OS X 10.8 and later, use clang instead of gcc
Fixes #5822.
Will no doubt cause other problems, but Apple has forced our hand.

R=golang-dev, bradfitz, khr
CC=golang-dev
https://golang.org/cl/12350044
2013-08-02 14:58:27 -04:00
Russ Cox
337407d847 testing: make parsing of -cpu more lenient
Also add \n to error message.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12261044
2013-08-02 13:51:45 -04:00
Russ Cox
ebc5513be6 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
2013-08-02 13:51:28 -04:00
Brad Fitzpatrick
b8b48abe0f 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
2013-08-02 10:19:52 -07:00
Alex Brainman
6f8acd5fb9 cmd/go: change error message to refer to correct bootstrap command
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12317043
2013-08-02 15:55:21 +10:00
Nigel Tao
97863bb8af image/draw: fix typos found by "go vet".
R=r, adg, bradfitz
CC=golang-dev
https://golang.org/cl/12312043
2013-08-02 13:29:45 +10:00
Rob Pike
fba7b04dcb 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
2013-08-02 11:38:19 +10:00
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