1
0
mirror of https://github.com/golang/go synced 2024-09-23 11:20:17 -06:00
Commit Graph

21233 Commits

Author SHA1 Message Date
Andrew Gerrand
69f24cfa14 doc: update README.md and CONTRIBUTING.md in response to review comments
I didn't 'add' these files before my final mail.

Change-Id: Id6f25629638e58421a3dee7632aec38aad9b1970
Reviewed-on: https://go-review.googlesource.com/1340
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-10 22:48:34 +00:00
Andrew Gerrand
495e02db8c doc: convert README to markdown and update CONTRIBUTING.md
Fixes #9233

Change-Id: If64480cbfaafe44025fcdcc0f20d76c995ffb3a1
Reviewed-on: https://go-review.googlesource.com/1296
Reviewed-by: Russ Cox <rsc@golang.org>
2014-12-10 22:19:01 +00:00
David Crawshaw
bee8ae1185 runtime: send android stderr to /dev/log/main
I tried to submit this in Go 1.4 as cl/107540044 but tripped over the
changes for getting C off the G stack. This is a rewritten version that
avoids cgo and works directly with the underlying log device.

Change-Id: I14c227dbb4202690c2c67c5a613d6c6689a6662a
Reviewed-on: https://go-review.googlesource.com/1285
Reviewed-by: Keith Randall <khr@golang.org>
2014-12-10 22:06:13 +00:00
Keith Randall
6820be25da runtime: clean up & go-ify the hash function seeder
Change-Id: I0e95f8a5962c547da20e19a356ae1cf8375c9107
Reviewed-on: https://go-review.googlesource.com/1270
Reviewed-by: Russ Cox <rsc@golang.org>
2014-12-10 21:15:35 +00:00
Keith Randall
b796cbc406 runtime: fix finalizer iterator
It could only handle one finalizer before it raised an out-of-bounds error.

Fixes issue #9172

Change-Id: Ibb4d0c8aff2d78a1396e248c7129a631176ab427
Reviewed-on: https://go-review.googlesource.com/1201
Reviewed-by: Russ Cox <rsc@golang.org>
2014-12-10 16:33:26 +00:00
Andrew Gerrand
508a22d5bc misc/makerelease: use new storage api, handle git sub-repos
Change-Id: I8c5b77d861aafdc594714982503da7bee053c9fe
Reviewed-on: https://go-review.googlesource.com/1291
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2014-12-10 02:08:38 +00:00
Brad Fitzpatrick
38ecd2e267 all: tighten overly-broad runtime/z* gitignore line
Fixes #9231

Change-Id: Ifed6cd37e885415d9a298b63d472d63f44e72321
Reviewed-on: https://go-review.googlesource.com/1290
Reviewed-by: Russ Cox <rsc@golang.org>
2014-12-10 00:45:47 +00:00
Rick Hudson
2937d88af5 runtime: fix some comment formatting
Change-Id: Ife7d6ce1131ff26444f09e8fda4f61344e669e21
Reviewed-on: https://go-review.googlesource.com/1260
Reviewed-by: Russ Cox <rsc@golang.org>
2014-12-09 22:08:45 +00:00
Austin Clements
76f71959c8 runtime: restore error message on early needm
needm used to print an error before exiting when it was called too
early, but this error was lost in the transition to Go.  Bring back
the error so we don't silently exit(1) when this happens.

Change-Id: I8086932783fd29a337d7dea31b9d6facb64cb5c1
Reviewed-on: https://go-review.googlesource.com/1226
Reviewed-by: Russ Cox <rsc@golang.org>
2014-12-09 20:12:14 +00:00
Shenghou Ma
e8f13700b7 test/fixedbugs/bug302: fix test on windows.
Change-Id: I74c2578d1620b37a6486eca00a774b9a736a8899
Reviewed-on: https://go-review.googlesource.com/1222
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2014-12-09 05:23:35 +00:00
Brad Fitzpatrick
e67a39ed08 net/http: avoid some allocations in DetectContentType
Change-Id: I64985f8de7ca09e63208e8c949a5d4f4fc09073f
Reviewed-on: https://go-review.googlesource.com/1230
Reviewed-by: David Symonds <dsymonds@golang.org>
2014-12-09 02:00:09 +00:00
Ian Lance Taylor
c5de72b213 test: write Go wrapper code so that bug302 can be run by run.go
Issue #4139.

Change-Id: I50d85a65b22c0cfb4d2a078cee45cf7adb23ba77
Reviewed-on: https://go-review.googlesource.com/1210
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2014-12-09 01:07:27 +00:00
Burcu Dogan
2917ed40d0 doc: Fix the canonical location
Change-Id: I3030d678c4eee85970826c86332a2b818cf7f5b6
Reviewed-on: https://go-review.googlesource.com/1217
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2014-12-09 00:40:28 +00:00
Keith Randall
ea51f2d304 cmd/objdump: Fix error logging
Change-Id: I6b1b4d3e8c039ba3198cb4b9765de75859ea8c32
Reviewed-on: https://go-review.googlesource.com/1214
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2014-12-09 00:27:39 +00:00
Robert Griesemer
779682107f Fix whitespace (use blanks consistently).
Change-Id: I73ecfe8f1e46e4821dafc6ed5788f48a1f0deeea
Reviewed-on: https://go-review.googlesource.com/1213
Reviewed-by: Alan Donovan <adonovan@google.com>
2014-12-08 22:22:58 +00:00
Keith Randall
212914f573 runtime: test for linear enqueue/dequeue behavior
Make sure dequeueing from a channel queue does not exhibit quadratic time behavior.

Change-Id: Ifb7c709b026f74c7e783610d4914dd92909a441b
Reviewed-on: https://go-review.googlesource.com/1212
Reviewed-by: Russ Cox <rsc@golang.org>
2014-12-08 22:18:17 +00:00
David Symonds
36e443342d doc: remove obsolete FAQ entry about using Mercurial vs. Git.
Change-Id: I9d9b02ad745208e7297cb75c86af49b2d858b12d
Reviewed-on: https://go-review.googlesource.com/1176
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-08 21:15:02 +00:00
Robert Griesemer
8d5fe682b0 test/fibo: a stand-alone bignum/allocation benchmark and test
Usage:
fibo <n>        compute fibonacci(n), n must be >= 0
fibo -bench     benchmark fibonacci computation (takes about 1 min)

Additional flags:
-half           add values using two half-digit additions
-opt            optimize memory allocation through reuse
-short          only print the first 10 digits of very large fibonacci numbers

This change was reviewed in detail as https://codereview.appspot.com/168480043 .

Change-Id: I7c86d49c5508532ea6206d00f424cf2117d2fe41
Reviewed-on: https://go-review.googlesource.com/1211
Reviewed-by: Russ Cox <rsc@golang.org>
2014-12-08 20:57:31 +00:00
Keith Randall
8eb8b40a49 runtime: use doubly-linked lists for channel send/recv queues.
Avoids a potential O(n^2) performance problem when dequeueing
from very popular channels.

benchmark                old ns/op     new ns/op     delta
BenchmarkChanPopular     2563782       627201        -75.54%

Change-Id: I231aaeafea0ecd93d27b268a0b2128530df3ddd6
Reviewed-on: https://go-review.googlesource.com/1200
Reviewed-by: Russ Cox <rsc@golang.org>
2014-12-08 19:20:12 +00:00
Austin Clements
006ceb2f1d runtime: fix missing newline when dumping bad symbol table
If the symbol table isn't sorted, we print it and abort.  However, we
were missing the line break after each symbol, resulting in one
gigantic line instead of a nicely formatted table.

Change-Id: Ie5c6f3c256d0e648277cb3db4496512a79d266dd
Reviewed-on: https://go-review.googlesource.com/1182
Reviewed-by: Russ Cox <rsc@golang.org>
2014-12-08 18:39:58 +00:00
Andrew Gerrand
0f2db82174 doc: add CONRIBUTORS.md
This file is known to GitHub and will be linked prominently when
potential contributors try to open pull requests.

Here's how it should appear:
	https://gist.github.com/adg/e0ffcc922a32f20af3db

Change-Id: I41c5aadf284a0a24c485f96b7fe2caa338ad1e4f
Reviewed-on: https://go-review.googlesource.com/1178
Reviewed-by: Rob Pike <r@golang.org>
2014-12-08 13:16:02 +00:00
David Symonds
439b329363 remove the obsolete lib/codereview.
Change-Id: Idd2e74053ce4a2be3d757aef1bb83313973de6f0
Reviewed-on: https://go-review.googlesource.com/1175
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-08 07:51:54 +00:00
David Symonds
3aaef230fa remove dev.cc file, left over from merge of the dev.cc branch.
Change-Id: I6021f42ce4ac6a66632751b21ab13e9b22383af9
Reviewed-on: https://go-review.googlesource.com/1172
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-08 06:16:43 +00:00
David Symonds
26399948e3 add bin/ to .gitignore.
Change-Id: I5c788d324e56ca88366fb54b67240cebf5dced2c
Reviewed-on: https://go-review.googlesource.com/1171
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-08 04:42:22 +00:00
David Symonds
f33fc0eb95 cmd/dist: convert dist from Hg to Git. 2014-12-08 13:53:11 +11:00
David Symonds
369873c6e5 convert .hgignore to .gitignore. 2014-12-08 13:50:49 +11:00
David Symonds
258f53dee3 remove .hgtags. 2014-12-08 13:50:49 +11:00
Russ Cox
94151eb279 encoding/xml: remove SyntaxError.Byte
It is unused. It was introduced in the CL that added InputOffset.
I suspect it was an editing mistake.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/182580043
2014-12-05 21:33:07 -05:00
Russ Cox
31457cef6d all: merge dev.garbage (d1238958d4ae) into default branch
When we start work on Gerrit, ppc64 and garbage collection
work will continue in the master branch, not the dev branches.

(We may still use dev branches for other things later, but
these are ready to be merged, and doing it now, before moving
to Git means we don't have to have dev branches working
in the Gerrit workflow on day one.)

TBR=rlh
CC=golang-codereviews
https://golang.org/cl/183140043
2014-12-05 20:34:45 -05:00
Russ Cox
db40624110 [dev.garbage] runtime: raise StackGuard limit for Windows (again)
640 bytes ought to be enough for anybody.

We'll bring this back down before Go 1.5. That's issue 9214.

TBR=rlh
CC=golang-codereviews
https://golang.org/cl/188730043
2014-12-05 19:50:09 -05:00
Russ Cox
09d92b6bbf all: power64 is now ppc64
Fixes #8654.

LGTM=austin
R=austin
CC=golang-codereviews
https://golang.org/cl/180600043
2014-12-05 19:13:20 -05:00
Russ Cox
fa6c54953c [dev.garbage] runtime: reduce stack footprint of write barriers
This is going to hurt a bit but we'll make it better later.
Now the race detector can be run again.

I added the write barrier optimizations from
CL 183020043 to try to make it hurt a little less.

TBR=rlh
CC=golang-codereviews
https://golang.org/cl/185070043
2014-12-05 16:47:50 -05:00
Russ Cox
dcb2ec3b65 runtime: generate windows callback list with go generate
This is the last system-dependent file written by cmd/dist.
They are all now written by go generate.

cmd/dist is not needed to start building package runtime
for a different system anymore.

Now all the generated files can be assumed generated, so
delete the clumsy hacks in cmd/api.

Re-enable api check in run.bash.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/185040044
2014-12-05 16:24:20 -05:00
Russ Cox
7d516079de runtime: convert netbsd/arm to Go
This was the last src/runtime/*.c file.

LGTM=austin
R=austin
CC=golang-codereviews
https://golang.org/cl/187770043
2014-12-05 16:17:09 -05:00
Russ Cox
b537635a7f all: merge default (faa3ed1dc30e) into dev.garbage 2014-12-05 11:45:03 -05:00
Russ Cox
b9c52302ff all: merge dev.cc (81884b89bd88) into default
With this change, default now contains Go 1.5 work.
Any future bug fixes for Go 1.4 in the compilers or
the runtime will have to be made directly to the
release branch.
2014-12-05 11:43:41 -05:00
Russ Cox
444839014b [dev.garbage] all: merge dev.cc (81884b89bd88) into dev.garbage
TBR=rlh
CC=golang-codereviews
https://golang.org/cl/181100044
2014-12-05 11:40:41 -05:00
Russ Cox
829b286f2c [dev.cc] all: merge default (8d42099cdc23) into dev.cc
TBR=austin
CC=golang-codereviews
https://golang.org/cl/178700044
2014-12-05 11:18:10 -05:00
Austin Clements
e04c8b063f [dev.cc] liblink: don't patch jumps to jumps to symbols
When liblink sees something like

       JMP x
       ...
    x: JMP y

it rewrites the first jump to jump directly to y.  This is
fine if y is a resolved label.  However, it *also* does this
if y is a function symbol, but fails to carry over the
relocation that would later patch in that symbol's value.  As
a result, the original jump becomes either a self-jump (if
relative) or a jump to PC 0 (if absolute).

Fix this by disabling this optimization if the jump being
patched in is a jump to a symbol.

LGTM=minux
R=rsc, minux
CC=golang-codereviews
https://golang.org/cl/185890044
2014-12-05 09:24:01 -05:00
Shenghou Ma
274976f45c [dev.cc] cmd/ld: finalize linkmode before determining whether to import runtime/cgo
Frankly, I don't understand how the current code could possibly work except
when every android program is using cgo. Discovered this while working on
the iOS port.

LGTM=crawshaw, rsc
R=rsc, crawshaw
CC=golang-codereviews
https://golang.org/cl/177470043
2014-12-05 02:22:20 -05:00
Rob Pike
41c6b84342 cmd/go: fix build
The new semantics of split require the newline be present.
The test was stale.

LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/182480043
2014-12-05 09:37:56 +09:00
Rob Pike
dd26fc3822 cmd/go: avoid use of bufio.Scanner in generate
Scanner can't handle stupid long lines and there are
reports of stupid long lines in production.

Note the issue isn't long "//go:generate" lines, but
any long line in any Go source file.

To be fair, if you're going to have a stupid long line
it's not a bad bet you'll want to run it through go
generate, because it's some embeddable asset that
has been machine generated. (One could ask why
that generation process didn't add a newline or two,
but we should cope anyway.)

Rewrite the file scanner in "go generate" so it can
handle arbitrarily long lines, and only stores in memory
those lines that start "//go:generate".

Also: Adjust the documentation to make clear that it
does not parse the file.

Fixes #9143.
Fixes #9196.

LGTM=rsc, dominik.honnef
R=rsc, cespare, minux, dominik.honnef
CC=golang-codereviews
https://golang.org/cl/182970043
2014-12-05 09:15:38 +09:00
Shenghou Ma
c9d0c81214 cmd/pprof/internal/commands: add command to open browser on windows
While we're at there, also add a message to prompt the user to install
Graphviz if "dot" command is not found.

Fixes #9178.

LGTM=adg, alex.brainman, cookieo9, rsc
R=rsc, adg, bradfitz, alex.brainman, cookieo9, smyrman
CC=golang-codereviews
https://golang.org/cl/180380043
2014-12-04 11:24:23 -05:00
Rob Pike
b2950a2931 lib/time: update to ICANN time zone database 2014j
Fixes #9189.

LGTM=dsymonds
R=golang-codereviews, dsymonds
CC=golang-codereviews
https://golang.org/cl/178660043
2014-12-03 20:07:48 -08:00
David Symonds
583b29cb18 spec: add comment marker for consistency.
LGTM=r
R=gri, r
CC=golang-codereviews
https://golang.org/cl/185830043
2014-12-04 09:29:29 +11:00
Russ Cox
9f04a62a39 cmd/pprof: fix symbol resolution for remote profiles
Fixes #9199.

LGTM=iant
R=golang-codereviews, iant
CC=austin, golang-codereviews, minux
https://golang.org/cl/183080043
2014-12-03 14:14:00 -05:00
Dominik Honnef
14948481f6 cmd/go: regenerate doc.go
Move change from CL 170770043 to correct file and regenerate docs
for changes from CL 164120043.

LGTM=adg
R=golang-codereviews, adg, bradfitz
CC=golang-codereviews
https://golang.org/cl/183000043
2014-12-03 10:28:54 +11:00
Andrew Gerrand
ce5d7cffe8 tag go1.4rc2
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/178600043
2014-12-02 14:39:23 +11:00
Russ Cox
2b62e1eaec runtime: fix hang in GC due to shrinkstack vs netpoll race
During garbage collection, after scanning a stack, we think about
shrinking it to reclaim some memory. The shrinking code (called
while the world is stopped) checked that the status was Gwaiting
or Grunnable and then changed the state to Gcopystack, to essentially
lock the stack so that no other GC thread is scanning it.
The same locking happens for stack growth (and is more necessary there).

        oldstatus = runtime·readgstatus(gp);
        oldstatus &= ~Gscan;
        if(oldstatus == Gwaiting || oldstatus == Grunnable)
                runtime·casgstatus(gp, oldstatus, Gcopystack); // oldstatus is Gwaiting or Grunnable
        else
                runtime·throw("copystack: bad status, not Gwaiting or Grunnable");

Unfortunately, "stop the world" doesn't stop everything. It stops all
normal goroutine execution, but the network polling thread is still
blocked in epoll and may wake up. If it does, and it chooses a goroutine
to mark runnable, and that goroutine is the one whose stack is shrinking,
then it can happen that between readgstatus and casgstatus, the status
changes from Gwaiting to Grunnable.

casgstatus assumes that if the status is not what is expected, it is a
transient change (like from Gwaiting to Gscanwaiting and back, or like
from Gwaiting to Gcopystack and back), and it loops until the status
has been restored to the expected value. In this case, the status has
changed semi-permanently from Gwaiting to Grunnable - it won't
change again until the GC is done and the world can continue, but the
GC is waiting for the status to change back. This wedges the program.

To fix, call a special variant of casgstatus that accepts either Gwaiting
or Grunnable as valid statuses.

Without the fix bug with the extra check+throw in casgstatus, the
program below dies in a few seconds (2-10) with GOMAXPROCS=8
on a 2012 Retina MacBook Pro. With the fix, it runs for minutes
and minutes.

package main

import (
        "io"
        "log"
        "net"
        "runtime"
)

func main() {
        const N = 100
        for i := 0; i < N; i++ {
                l, err := net.Listen("tcp", "127.0.0.1:0")
                if err != nil {
                        log.Fatal(err)
                }
                ch := make(chan net.Conn, 1)
                go func() {
                        var err error
                        c1, err := net.Dial("tcp", l.Addr().String())
                        if err != nil {
                                log.Fatal(err)
                        }
                        ch <- c1
                }()
                c2, err := l.Accept()
                if err != nil {
                        log.Fatal(err)
                }
                c1 := <-ch
                l.Close()
                go netguy(c1, c2)
                go netguy(c2, c1)
                c1.Write(make([]byte, 100))
        }
        for {
                runtime.GC()
        }
}

func netguy(r, w net.Conn) {
        buf := make([]byte, 100)
        for {
                bigstack(1000)
                _, err := io.ReadFull(r, buf)
                if err != nil {
                        log.Fatal(err)
                }
                w.Write(buf)
        }
}

var g int

func bigstack(n int) {
        var buf [100]byte
        if n > 0 {
                bigstack(n - 1)
        }
        g = int(buf[0]) + int(buf[99])
}

Fixes #9186.

LGTM=rlh
R=austin, rlh
CC=dvyukov, golang-codereviews, iant, khr, r
https://golang.org/cl/179680043
2014-12-01 16:32:06 -05:00
Keith Randall
7c1e33033d reflect: Fix reflect.funcLayout. The GC bitmap has two bits per
pointer, not one.

Fixes #9179

LGTM=iant, rsc
R=golang-codereviews, iant, rsc
CC=golang-codereviews
https://golang.org/cl/182160043
2014-12-01 07:52:09 -08:00