1
0
mirror of https://github.com/golang/go synced 2024-10-03 11:21:22 -06:00
Commit Graph

15846 Commits

Author SHA1 Message Date
Russ Cox
1a4599b41a runtime: clear locked bit when goroutine exits
Otherwise the next goroutine run on the m
can get inadvertently locked if it executes a cgo call
that turns on the internal lock.

While we're here, fix the cgo panic unwind to
decrement m->ncgo like the non-panic unwind does.

Fixes #4971.

R=golang-dev, iant, dvyukov
CC=golang-dev
https://golang.org/cl/7627043
2013-03-08 11:26:00 -05:00
Russ Cox
091d7210c7 runtime: make TestStackMem a little less flaky
Have seen failures with GOMAXPROCS=4 on Windows.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7626043
2013-03-08 11:25:21 -05:00
Russ Cox
e0c430d5b7 cmd/6l, cmd/8l: fix BSD builds
Before this CL, running

        cd misc/cgo/test
        go test -c
        readelf --dyn-syms test.test | grep cgoexp

turned up many UNDEF symbols corresponding to symbols actually
in the binary but marked only cgo_export_static. Only symbols
marked cgo_export_dynamic should be listed in this mode.
And if the symbol is going to be listed, it should be listed with its
actual address instead of UNDEF.

The Linux dynamic linker didn't care about the seemingly missing
symbols, but the BSD one did.

This CL eliminates the symbols from the dyn-syms table.

R=golang-dev
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/7624043
2013-03-07 21:23:59 -08:00
Robert Griesemer
51338095eb spec: clarify unsafe.Offsetof
Fixes #4905.

R=rsc, r, iant, ken
CC=golang-dev
https://golang.org/cl/7583043
2013-03-07 20:11:37 -08:00
Russ Cox
7663ffcae6 cmd/ld: steps toward 386 host linking
- Introduce MaxAlign constant and use in data layout
and ELF section header.

- Allow up to 16-byte alignment for large objects
(will help Keith's hash changes).

- Emit ELF symbol for .rathole (global /dev/null used by 8c).

- Invoke gcc with -m32/-m64 as appropriate.

- Don't invoke gcc if writing the .o file failed.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7563045
2013-03-07 19:57:25 -08:00
Russ Cox
dfc22e29ec runtime: change 386 startup convention
Now the default startup is that the program begins at _rt0_386_$GOOS,
which behaves as if calling main(argc, argv). Main jumps to _rt0_386.

This makes the _rt0_386 entry match the expected semantics for
the standard C "main" function, which we can now provide for use when
linking against a standard C library.

386 analogue of https://golang.org/cl/7525043

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7551045
2013-03-07 19:57:10 -08:00
Brad Fitzpatrick
b6e0d39a34 net/http: Transport socket late binding
Implement what Chrome calls socket "late binding". See:
https://insouciant.org/tech/connection-management-in-chromium/

In a nutshell, if our HTTP client needs a TCP connection to a
remote host and there's not an idle one available, rather than
kick off a dial and wait for that specific dial, we instead
kick off a dial and wait for either our own dial to finish, or
any other TCP connection to that same host to become
available.

The implementation looks like a classic "Learning Go
Concurrency" slide.

Chrome's commit and numbers:
http://src.chromium.org/viewvc/chrome?view=rev&revision=36230

R=golang-dev, daniel.morsing, adg
CC=golang-dev
https://golang.org/cl/7587043
2013-03-07 17:56:00 -08:00
Akshat Kumar
a566deace1 syscall: Plan 9: use lightweight errstr in entersyscall mode
Change 231af8ac63aa (CL 7314062) made runtime.enteryscall()
set m->mcache = nil, which means that we can no longer use
syscall.errstr in syscall.Syscall and syscall.Syscall6, since it
requires a new buffer to be allocated for holding the error string.
Instead, we use pre-allocated per-M storage to hold error strings
from syscalls made while in entersyscall mode, and call
runtime.findnull to calculate the lengths.

Fixes #4994.

R=rsc, rminnich, ality, dvyukov, rminnich, r
CC=golang-dev
https://golang.org/cl/7567043
2013-03-08 00:54:44 +01:00
Mikio Hara
2ac799cfbc net: fix multicast listener tests
This CL splits multicast listener tests into two; for IPv4 and
for IPv6. It also removes redundant test inputs and makes sure
that assignment of multicast interface to stablize the tests.

Fixes #4059.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7565043
2013-03-08 06:51:06 +09:00
Keith Randall
297bb12809 cmd/6a, cmd/8a, cmd/6l, cmd/8l: add AES instructions
Instructions for use in AES hashing.  See CL#7543043

R=rsc
CC=golang-dev
https://golang.org/cl/7548043
2013-03-07 12:54:00 -08:00
Rémy Oudompheng
4c203172a2 cmd/8g: fix code generation of int64(0) == int64(0).
The code would violate the contract of cmp64.

Fixes #5002.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/7593043
2013-03-07 21:47:45 +01:00
Brad Fitzpatrick
43ee80997a C: add Keith Randall (Google CLA)
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7595043
2013-03-07 12:46:44 -08:00
Russ Cox
5641a09171 lib9: fix windows build (don't use runesmprint)
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/7575046
2013-03-07 14:38:49 -05:00
Robert Griesemer
6ee75663c9 go/types: more internal cleanups
R=adonovan, bradfitz
CC=golang-dev
https://golang.org/cl/7492045
2013-03-07 11:17:30 -08:00
Dominik Honnef
77ddbf1ff0 misc/emacs: Rewrite gofmt to use own function for applying patch instead of using diff-mode.
Instead of relying on gofmt's diff output (which is a unified
    diff), we manually invoke diff -n and produce an RCS format diff,
    which can easily be parsed in Emacs, with the go--apply-rcs-patch
    function.

    This fixes undocumented issues with the old implementation such as
    skipping over hunks of changes, and it fixes the documented issue
    of not being able to handle file names that include whitespace.

    It can also apply the patch on a buffer that has no file name
    attached at all.

    Last but not least, it greatly simplifies the gofmt function
    itself.

Fixes #4766.
Fixes #4475.

R=adonovan, cw, patrick.allen.higgins, sameer
CC=golang-dev
https://golang.org/cl/7516046
2013-03-07 13:12:37 -05:00
Dmitriy Vyukov
b000f2286c net: more refactoring in preparation for runtime integrated pollster
Move pollServer from fd_unix.go to fd_poll_unix.go.
Add pollServerInit(*NetFD) to allow custom initialization.
Add pollServer.Close(*NetFD) to allow custom finalization.
Move setDeadline() to fd_poll_unix.go to allow custom handling of deadlines.
Move newPollServer() to fd_poll_unix.go to allow custom initialization.
No logical code changes.
The next step will be to turn off fd_poll_unix.go for some platform
(I have changes for darwin/linux) and redirect it into runtime. See:
https://golang.org/cl/7569043/diff/2001/src/pkg/net/fd_poll_runtime.go

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7513045
2013-03-07 21:44:24 +04:00
Dmitriy Vyukov
cb945ba6ba runtime: fix deadlock
The deadlock episodically occurs on misc/cgo/test/TestCthread.
The problem is that starttheworld() leaves some P's with local work
without M's. Then all active M's enter into syscalls, but reject to
wake another M's due to the following check (both in entersyscallblock() and in retake()):
if(p->runqhead == p->runqtail &&
        runtime·atomicload(&runtime·sched.nmspinning) +
        runtime·atomicload(&runtime·sched.npidle) > 0)
        continue;

R=rsc
CC=golang-dev
https://golang.org/cl/7424054
2013-03-07 21:39:59 +04:00
Russ Cox
60f783d92b cmd/ld: host linking support for linux/amd64
Still to do: non-linux and non-amd64.
It may work on other ELF-based amd64 systems too, but untested.

"go test -ldflags -hostobj $GOROOT/misc/cgo/test" passes.

Much may yet change, but this seems a reasonable checkpoint.

R=iant
CC=golang-dev
https://golang.org/cl/7369057
2013-03-07 09:19:02 -05:00
Russ Cox
8aafb44b0b runtime: fix cgo callbacks on windows
Fixes #4955.

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/7563043
2013-03-07 09:18:48 -05:00
Dmitriy Vyukov
0f136f2c05 net: fix accept/connect deadline handling
Ensure that accept/connect respect deadline,
even if the operation can be executed w/o blocking.
Note this changes external behavior, but it makes
it consistent with read/write.
Factor out deadline check into pollServer.PrepareRead/Write,
in preparation for edge triggered pollServer.
Ensure that pollServer.WaitRead/Write are not called concurrently
by adding rio/wio locks around connect/accept.

R=golang-dev, mikioh.mikioh, bradfitz, iant
CC=golang-dev
https://golang.org/cl/7436048
2013-03-07 17:03:40 +04:00
Mikio Hara
48fa4a10fb net: fix typo in skip message
R=golang-dev, akumar
CC=golang-dev
https://golang.org/cl/7523044
2013-03-07 19:17:18 +09:00
Mikio Hara
3fc244f370 net: fix plan9 build
R=golang-dev, akumar
CC=golang-dev
https://golang.org/cl/7564043
2013-03-07 19:15:00 +09:00
Tyler Bunnell
ae7aa345db cmd/fix: remove redundant 0 port
Fixes #4505.

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7468043
2013-03-07 19:06:19 +09:00
Rob Pike
bcb1da7065 all: delete a couple of mentions of the exp and old trees
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7551043
2013-03-06 16:52:03 -08:00
Robert Griesemer
0b2caf2717 go/types: implement constant string(x) conversions
Fixes #4982.

R=adonovan, r
CC=golang-dev
https://golang.org/cl/7537043
2013-03-06 16:15:04 -08:00
Robert Griesemer
b8db56ad2e go/types: cleanup of assignment checks
Also:
- cleaner handling of constants w/ unknown value
- removed several TODOs

R=adonovan
CC=golang-dev
https://golang.org/cl/7473043
2013-03-06 16:14:07 -08:00
Albert Strasheim
0a71a5b029 all: Skip AllocsPerRun tests if GOMAXPROCS>1.
Fixes #4974.

R=rsc, bradfitz, r
CC=golang-dev
https://golang.org/cl/7545043
2013-03-06 15:52:32 -08:00
Rob Pike
45a3b3714f doc/effective_go.html: unify and expand the discussion of Sprintf and String
It's a common mistake to build a recursive String method; explain it well and
show how to avoid it.

R=golang-dev, bradfitz, adg
CC=golang-dev
https://golang.org/cl/7486049
2013-03-06 15:47:49 -08:00
Rob Pike
d07978a0f7 exp/norm: delete, part of moving to go.text
See also https://golang.org/cl/7520044

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7533044
2013-03-06 14:34:03 -08:00
Brad Fitzpatrick
a30bede5ef net/http: remove allocations in HeaderWriteSubset
Before:
BenchmarkHeaderWriteSubset  500000  2354 ns/op  197 B/op  2 allocs/op
After:
BenchmarkHeaderWriteSubset 1000000  2085 ns/op    0 B/op  0 allocs/op

Fixes #3761

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7508043
2013-03-06 14:10:47 -08:00
Russ Cox
fb59aed60b cmd/cgo: split cgo_export into cgo_export_static and cgo_export_dynamic
Also emit cgo_ldflag pragmas.

R=golang-dev, remyoudompheng, iant
CC=golang-dev
https://golang.org/cl/7530043
2013-03-06 16:57:14 -05:00
Russ Cox
56d1faa8b6 net/http/httputil: fix build
TBR=bradfitz
CC=golang-dev
https://golang.org/cl/7540043
2013-03-06 16:56:53 -05:00
Russ Cox
efd3d1ffe9 runtime: fix netbsd, windows build
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/7539043
2013-03-06 16:55:08 -05:00
Russ Cox
48c1db4003 net/http: change user agent string
Some IDS somewhere thinks "Go http package" is a virus.
Make it something else for Go 1.1. Dumb but easy.

R=golang-dev, bradfitz, minux.ma
CC=golang-dev
https://golang.org/cl/7532043
2013-03-06 16:48:20 -05:00
Rob Pike
a25486e4b1 make.bash,bat: add -tags gotypes to the build
This installs type checking into go vet.
(To be removed before releasing Go 1.1)

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7528044
2013-03-06 13:16:43 -08:00
Rob Pike
0ed517e5e6 cmd/vet: isolate the type checking code into a separate file
We can enable/disable type checking with a build tag.
Should simplify cutting the go1.1 distribution free of go/types.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7482045
2013-03-06 12:49:56 -08:00
Russ Cox
7610a0552f lib9: add mktempdir, removeall, runprog
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7523043
2013-03-06 15:48:28 -05:00
Rob Pike
c76379954f text/template: improve error reporting for executing an empty template
Fixes #4522.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7502044
2013-03-06 12:34:19 -08:00
Ewan Chou
4f43201e51 strings: remove allocations in Split(s, "")
BenchmarkSplit1     77984460     24131380  -69.06%

R=golang-dev, rsc, minux.ma, dave, extemporalgenome
CC=golang-dev
https://golang.org/cl/7458043
2013-03-06 15:21:19 -05:00
Russ Cox
64eec93225 A+C: Ewan Chou (individual CLA)
Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/7473047
2013-03-06 15:20:24 -05:00
Alex Brainman
2f23f90dab runtime,misc/cgo/test: disable broken tests so we can test the rest
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7486048
2013-03-06 15:19:01 -05:00
Alex Brainman
e44f42e056 libmach: fix amd64 pe handling
Fixes #4841.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7475046
2013-03-06 15:14:07 -05:00
Russ Cox
77deeda717 misc/cgo/test: do not stop on first error
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7529043
2013-03-06 15:03:28 -05:00
Russ Cox
36b414f639 runtime: change amd64 startup convention
Now the default startup is that the program begins at _rt0_amd64_$GOOS,
which sets DI = argc, SI = argv and jumps to _rt0_amd64.

This makes the _rt0_amd64 entry match the expected semantics for
the standard C "main" function, which we can now provide for use when
linking against a standard C library.

R=golang-dev, devon.odell, minux.ma
CC=golang-dev
https://golang.org/cl/7525043
2013-03-06 15:03:04 -05:00
Dominik Honnef
cf8434fa31 misc/emacs: Add compatibility for GNU Emacs 23 and XEmacs >=21.5.32
This CL adds compatibility for GNU Emacs 23 (fixing fontification
issues) and XEmacs >=21.5.32 (fixing a lot of issues). Earlier
versions of XEmacs will not be supported because they do not
support POSIX character classes. Because of that, we also make use
of a lot of functions that were added in 21.5.32.

A known and currently unfixable issue with XEmacs is that go-mode
will not always fontify identifiers that use unicode correctly.

All changes for XEmacs are annotated in the diff.

Note: go--position-bytes is not currently used anywhere, but will
be in a future CL.

Fixes #4927.

R=golang-dev, adonovan, cw, patrick.allen.higgins, sameer
CC=golang-dev
https://golang.org/cl/7456051
2013-03-06 14:35:29 -05:00
Brad Fitzpatrick
1ca529c62c api: update next.txt
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7518044
2013-03-06 11:16:58 -08:00
Rob Pike
5f07125cb9 effective_go.html: round 3 of minor edits.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7489044
2013-03-06 10:08:48 -08:00
Brad Fitzpatrick
ce8341554c net/http: close TCP connection on Response.Body.Close
Previously the HTTP client's (*Response).Body.Close would try
to keep reading until EOF, hoping to reuse the keep-alive HTTP
connection, but the EOF might never come, or it might take a
long time. Now we immediately close the TCP connection if we
haven't seen EOF.

This shifts the burden onto clients to read their whole response
bodies if they want the advantage of reusing TCP connections.

In the future maybe we could decide on heuristics to read some
number of bytes for some max amount of time before forcefully
closing, but I'd rather not for now.

Statistically, touching this code makes things regress, so I
wouldn't be surprised if this introduces new bugs, but all the
tests pass, and I think the code is simpler now too. Maybe.

Please test your HTTP client code before Go 1.1.

Fixes #3672

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7419050
2013-03-05 18:47:27 -08:00
Nigel Tao
0d9bf2757e image/jpeg: for progressive JPEGs, the first SOS segment doesn't
necessarily contain all components.

Fixes #4975.

R=r, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/7469043
2013-03-06 10:08:46 +11:00
David Symonds
a22361d68d vet: check for useless assignments.
The only check so far is for self-assignments of the form "expr = expr",
but even that found one instance in the standard library.

R=r, adg, mtj, rsc
CC=golang-dev
https://golang.org/cl/7455048
2013-03-06 09:55:04 +11:00