]> Cypherpunks repositories - gostls13.git/log
gostls13.git
10 years agoruntime: bump MaxGcprocs to 32
Dmitriy Vyukov [Fri, 8 Aug 2014 16:52:11 +0000 (20:52 +0400)]
runtime: bump MaxGcprocs to 32
There was a number of improvements related to GC parallelization:
1. Parallel roots/stacks scanning.
2. Parallel stack shrinking.
3. Per-thread workbuf caches.
4. Workset reduction.
Currently 32 threads work well.
go.benchmarks:garbage benchmark on 2 x Intel Xeon E5-2690 (16 HT cores)

1 thread/1 processor:
time=16405255
cputime=16386223
gc-pause-one=546793975
gc-pause-total=3280763

2 threads/1 processor:
time=9043497
cputime=18075822
gc-pause-one=331116489
gc-pause-total=2152257

4 threads/1 processor:
time=4882030
cputime=19421337
gc-pause-one=174543105
gc-pause-total=1134530

8 threads/1 processor:
time=4134757
cputime=20097075
gc-pause-one=158680588
gc-pause-total=1015555

16 threads/1 processor + HT:
time=2006706
cputime=31960509
gc-pause-one=75425744
gc-pause-total=460097

16 threads/2 processors:
time=1513373
cputime=23805571
gc-pause-one=56630946
gc-pause-total=345448

32 threads/2 processors + HT:
time=1199312
cputime=37592764
gc-pause-one=48945064
gc-pause-total=278986

LGTM=rlh
R=golang-codereviews, tracey.brendan, rlh
CC=golang-codereviews, khr, rsc
https://golang.org/cl/123920043

10 years agoruntime: mark functions as static where possible
Matthew Dempsky [Fri, 8 Aug 2014 16:15:52 +0000 (20:15 +0400)]
runtime: mark functions as static where possible

Update #8092

LGTM=dvyukov
R=golang-codereviews, minux, dvyukov
CC=golang-codereviews
https://golang.org/cl/122250043

10 years agoruntime: fix data race in stackalloc
Dmitriy Vyukov [Fri, 8 Aug 2014 16:13:57 +0000 (20:13 +0400)]
runtime: fix data race in stackalloc
Stack shrinking happens during mark phase,
and it assumes that it owns stackcache in mcache.
Stack cache flushing also happens during mark phase,
and it accesses stackcache's w/o any synchronization.
This leads to stackcache corruption:
http://goperfd.appspot.com/log/309af5571dfd7e1817259b9c9cf9bcf9b2c27610

LGTM=khr
R=khr
CC=golang-codereviews, rsc
https://golang.org/cl/126870043

10 years agosyscall: ignore EINVAL/ENOENT from readdirent on OS X 10.10
Russ Cox [Fri, 8 Aug 2014 15:20:45 +0000 (11:20 -0400)]
syscall: ignore EINVAL/ENOENT from readdirent on OS X 10.10

On OS X 10.10 Yosemite, if you have a directory that can be returned
in a single getdirentries64 call (for example, a directory with one file),
and you read from the directory at EOF twice, you get EOF both times:
        fd = open("dir")
        getdirentries64(fd) returns data
        getdirentries64(fd) returns 0 (EOF)
        getdirentries64(fd) returns 0 (EOF)

But if you remove the file in the middle between the two calls, the
second call returns an error instead.
        fd = open("dir")
        getdirentries64(fd) returns data
        getdirentries64(fd) returns 0 (EOF)
        remove("dir/file")
        getdirentries64(fd) returns ENOENT/EINVAL

Whether you get ENOENT or EINVAL depends on exactly what was
in the directory. It is deterministic, just data-dependent.

This only happens in small directories. A directory containing more data
than fits in a 4k getdirentries64 call will return EOF correctly.
(It's not clear if the criteria is that the directory be split across multiple
getdirentries64 calls or that it be split across multiple file system blocks.)

We could change package os to avoid the second read at EOF,
and maybe we should, but that's a bit involved.
For now, treat the EINVAL/ENOENT as EOF.

With this CL, all.bash passes on my MacBook Air running
OS X 10.10 (14A299l) and Xcode 6 beta 5 (6A279r).

I tried filing an issue with Apple using "Feedback Assistant", but it was
unable to send the report and lost it.

C program reproducing the issue, also at http://swtch.com/~rsc/readdirbug.c:

#include <stdio.h>
#include <dirent.h>
#include <unistd.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>

static void test(int);

int
main(void)
{
        int fd, n;
        DIR *dir;
        struct dirent *dp;
        struct stat st;
        char buf[10000];
        long basep;
        int saw;

        if(stat("/tmp/readdirbug", &st) >= 0) {
                fprintf(stderr, "please rm -r /tmp/readdirbug and run again\n");
                exit(1);
        }

        fprintf(stderr, "mkdir /tmp/readdirbug\n");
        if(mkdir("/tmp/readdirbug", 0777) < 0) {
                perror("mkdir /tmp/readdirbug");
                exit(1);
        }

        fprintf(stderr, "create /tmp/readdirbug/file1\n");
        if((fd = creat("/tmp/readdirbug/file1", 0666)) < 0) {
                perror("create /tmp/readdirbug/file1");
                exit(1);
        }
        close(fd);

        test(0);
        test(1);

        fprintf(stderr, "ok - everything worked\n");
}

static void
test(int doremove)
{
        DIR *dir;
        struct dirent *dp;
        int numeof;

        fprintf(stderr, "\n");
        fprintf(stderr, "opendir /tmp/readdirbug\n");
        dir = opendir("/tmp/readdirbug");
        if(dir == 0) {
                perror("open /tmp/readdirbug");
                exit(1);
        }

        numeof = 0;
        for(;;) {
                errno = 0;
                dp = readdir(dir);
                if(dp != 0) {
                        fprintf(stderr, "readdir: found %s\n", dp->d_name);
                        continue;
                }
                if(errno != 0) {
                        perror("readdir");
                        exit(1);
                }
                fprintf(stderr, "readdir: EOF\n");
                if(++numeof == 3)
                        break;
                if(doremove) {
                        fprintf(stderr, "rm /tmp/readdirbug/file1\n");
                        if(remove("/tmp/readdirbug/file1") < 0) {
                                perror("remove");
                                exit(1);
                        }
                }
        }
        fprintf(stderr, "closedir\n");
        closedir(dir);
}

Fixes #8423.

LGTM=bradfitz, r
R=golang-codereviews, bradfitz, dsymonds, dave, r
CC=golang-codereviews, iant
https://golang.org/cl/119530044

10 years agoencoding/gob: fix data races in benchmarks
Dmitriy Vyukov [Fri, 8 Aug 2014 08:48:34 +0000 (12:48 +0400)]
encoding/gob: fix data races in benchmarks
All goroutines decode into the same value.

LGTM=r
R=r, abursavich
CC=golang-codereviews
https://golang.org/cl/123930043

10 years agocmd/go: fix build in airplane mode
Mikio Hara [Fri, 8 Aug 2014 07:20:20 +0000 (16:20 +0900)]
cmd/go: fix build in airplane mode

LGTM=iant
R=golang-codereviews, adg, iant
CC=golang-codereviews
https://golang.org/cl/122190043

10 years agodebug/pe/testdata: make sure gcc-amd64-mingw-exec has symbols
Alex Brainman [Fri, 8 Aug 2014 06:19:45 +0000 (16:19 +1000)]
debug/pe/testdata: make sure gcc-amd64-mingw-exec has symbols

as per rsc request

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/123970043

10 years agomisc/nacl/testzip.proto: include cmd/internal/* to fix build
Shenghou Ma [Fri, 8 Aug 2014 01:48:34 +0000 (21:48 -0400)]
misc/nacl/testzip.proto: include cmd/internal/* to fix build

LGTM=adg, dave
R=golang-codereviews, adg, dave
CC=golang-codereviews
https://golang.org/cl/123050043

10 years agoos: simplify windows Getwd (fixes build)
Alex Brainman [Fri, 8 Aug 2014 00:09:31 +0000 (10:09 +1000)]
os: simplify windows Getwd (fixes build)

Current version of Getwd calls Stat that
calls Getwd therefore infinite recursion.

LGTM=minux
R=golang-codereviews, minux
CC=golang-codereviews
https://golang.org/cl/119600043

10 years agoencoding/json: document coercion of invalid UTF-8 characters
Andrew Gerrand [Thu, 7 Aug 2014 22:57:41 +0000 (08:57 +1000)]
encoding/json: document coercion of invalid UTF-8 characters

Fixes #8342.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/122180043

10 years agoflag: mention -h in docs
Andrew Gerrand [Thu, 7 Aug 2014 22:57:18 +0000 (08:57 +1000)]
flag: mention -h in docs

Fixes #8314.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/125820043

10 years agocmd/go: download test dependencies of all named packages
Andrew Gerrand [Thu, 7 Aug 2014 22:56:40 +0000 (08:56 +1000)]
cmd/go: download test dependencies of all named packages

Fixes #8181.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/123870043

10 years agocmd/go: don't pass --buildid=none on OpenBSD
Ian Lance Taylor [Thu, 7 Aug 2014 22:05:20 +0000 (15:05 -0700)]
cmd/go: don't pass --buildid=none on OpenBSD

According to the OpenBSD builder, it doesn't work.

TBR=bradfitz
CC=golang-codereviews
https://golang.org/cl/126830043

10 years agoruntime: convert equality functions to Go
Keith Randall [Thu, 7 Aug 2014 21:52:55 +0000 (14:52 -0700)]
runtime: convert equality functions to Go

LGTM=rsc
R=rsc, khr
CC=golang-codereviews
https://golang.org/cl/121330043

10 years agodoc: add note about crypto/tls cert selection callback.
Adam Langley [Thu, 7 Aug 2014 21:22:15 +0000 (14:22 -0700)]
doc: add note about crypto/tls cert selection callback.

CC=golang-codereviews
https://golang.org/cl/123950043

10 years agoruntime: convert interface routines from C to Go.
Keith Randall [Thu, 7 Aug 2014 20:58:42 +0000 (13:58 -0700)]
runtime: convert interface routines from C to Go.

LGTM=dvyukov
R=golang-codereviews, dave, bradfitz, dvyukov, khr
CC=golang-codereviews
https://golang.org/cl/98510044

10 years agocmd/go: don't pass --buildid=none on FreeBSD
Ian Lance Taylor [Thu, 7 Aug 2014 20:51:29 +0000 (13:51 -0700)]
cmd/go: don't pass --buildid=none on FreeBSD

According to the FreeBSD builder, it doesn't work.

TBR=bradfitz
CC=golang-codereviews
https://golang.org/cl/121400043

10 years agoruntime: fix nacl/amd64p32 build
Dmitriy Vyukov [Thu, 7 Aug 2014 19:47:01 +0000 (23:47 +0400)]
runtime: fix nacl/amd64p32 build
C compiler does not support unnamed fields.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/124870043

10 years agogo/parser: don't do method receiver checks at parse-time
Robert Griesemer [Thu, 7 Aug 2014 19:45:01 +0000 (12:45 -0700)]
go/parser: don't do method receiver checks at parse-time

The ast and printer don't care, and go/types can provide
a better error message.

This change requires an update to the tests for go/types
(go.tools repo). CL forthcoming.

Fixes #8493.

LGTM=adonovan
R=rsc, adonovan
CC=golang-codereviews
https://golang.org/cl/123010044

10 years agocmd/go: pass --build-id=none when generating a cgo .o
Ian Lance Taylor [Thu, 7 Aug 2014 19:38:39 +0000 (12:38 -0700)]
cmd/go: pass --build-id=none when generating a cgo .o

Some systems, like Ubuntu, pass --build-id when linking.  The
effect is to put a note in the output file.  This is not
useful when generating an object file with the -r option, as
it eventually causes multiple build ID notes in the final
executable, all but one of which are for tiny portions of the
file and are therefore useless.

Disable that by passing an explicit --build-id=none when
linking with -r on systems that might do this.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/119460043

10 years agoruntime: test distribution of interface hashes.
Keith Randall [Thu, 7 Aug 2014 19:33:20 +0000 (12:33 -0700)]
runtime: test distribution of interface hashes.

LGTM=dvyukov
R=dvyukov, khr
CC=golang-codereviews
https://golang.org/cl/121030043

10 years agoencoding/gob: make benchmarks parallel
Dmitriy Vyukov [Thu, 7 Aug 2014 17:39:32 +0000 (21:39 +0400)]
encoding/gob: make benchmarks parallel
There are lots of internal synchronization in gob,
so it makes sense to have parallel benchmarks.
Also add a benchmark with slices and interfaces.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/115960043

10 years agogo/build: look in $GOROOT/src/cmd/foo/bar for import cmd/foo/bar
Russ Cox [Thu, 7 Aug 2014 16:33:19 +0000 (12:33 -0400)]
go/build: look in $GOROOT/src/cmd/foo/bar for import cmd/foo/bar

This lets us have non-main packages like cmd/internal or cmd/nm/internal/whatever.

The src/pkg migration (see golang.org/s/go14mainrepo) will allow this
as a natural side effect. The explicit change here just allows use of the
effect a little sooner.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/117630043

10 years agocmd/addr2line, cmd/nm: factor object reading into cmd/internal/objfile
Russ Cox [Thu, 7 Aug 2014 16:33:06 +0000 (12:33 -0400)]
cmd/addr2line, cmd/nm: factor object reading into cmd/internal/objfile

To do in another CL: make cmd/objdump use cmd/internal/objfile too.

There is a package placement decision in this CL:
cmd/internal/objfile instead of internal/objfile.
I chose to put internal under cmd to make clear (and enforce)
that no standard library packages should use this
(it's a bit dependency-heavy).

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/123910043

10 years agocmd/fix: mention -help instead of the non-existent -? flag
Andrew Gerrand [Thu, 7 Aug 2014 13:24:32 +0000 (23:24 +1000)]
cmd/fix: mention -help instead of the non-existent -? flag

Update #8314

TBR=r
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/123890043

10 years agocmd/cc, runtime: eliminate use of the unnamed substructure C extension
Peter Collingbourne [Thu, 7 Aug 2014 13:00:02 +0000 (09:00 -0400)]
cmd/cc, runtime: eliminate use of the unnamed substructure C extension

Eliminating use of this extension makes it easier to port the Go runtime
to other compilers. This CL also disables the extension in cc to prevent
accidental use.

LGTM=rsc, khr
R=rsc, aram, khr, dvyukov
CC=axwalk, golang-codereviews
https://golang.org/cl/106790044

10 years agoos: in Getwd, $PWD override syscall.Getwd
Russ Cox [Thu, 7 Aug 2014 12:58:25 +0000 (08:58 -0400)]
os: in Getwd, $PWD override syscall.Getwd

This makes os.Getwd mimic C getwd on OS X,
and possibly other systems. The change on OS X
was a regression from 1.2 to 1.3.

Fixes #8400.

LGTM=bradfitz
R=iant, bradfitz
CC=golang-codereviews
https://golang.org/cl/118970043

10 years agocmd/gc: remove ignored debugging arguments in Fconv print
Russ Cox [Thu, 7 Aug 2014 12:17:41 +0000 (08:17 -0400)]
cmd/gc: remove ignored debugging arguments in Fconv print

LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/123880043

10 years agoruntime: convert markallocated from C to Go
Dmitriy Vyukov [Thu, 7 Aug 2014 09:34:30 +0000 (13:34 +0400)]
runtime: convert markallocated from C to Go

benchmark                      old ns/op     new ns/op     delta
BenchmarkMalloc8               28.7          22.4          -21.95%
BenchmarkMalloc16              44.8          33.8          -24.55%
BenchmarkMallocTypeInfo8       49.0          32.9          -32.86%
BenchmarkMallocTypeInfo16      46.7          35.8          -23.34%
BenchmarkMallocLargeStruct     907           901           -0.66%
BenchmarkGobDecode             13235542      12036851      -9.06%
BenchmarkGobEncode             10639699      9539155       -10.34%
BenchmarkJSONEncode            25193036      21898922      -13.08%
BenchmarkJSONDecode            96104044      89464904      -6.91%

Fixes #8452.

LGTM=khr
R=golang-codereviews, bradfitz, rsc, dave, khr
CC=golang-codereviews
https://golang.org/cl/122090043

10 years agoruntime: fix plan9/windows build
Dmitriy Vyukov [Thu, 7 Aug 2014 09:28:10 +0000 (13:28 +0400)]
runtime: fix plan9/windows build
Fix few remaining cases after cl/117580043.

TBR=dfc
R=golang-codereviews
CC=dave, golang-codereviews
https://golang.org/cl/124850043

10 years agoruntime: remove mal/malloc/FlagNoGC/FlagNoInvokeGC
Dmitriy Vyukov [Thu, 7 Aug 2014 09:04:04 +0000 (13:04 +0400)]
runtime: remove mal/malloc/FlagNoGC/FlagNoInvokeGC
FlagNoGC is unused now.
FlagNoInvokeGC is unneeded as we don't invoke GC
on g0 and when holding locks anyway.
mal/malloc have very few uses and you never remember
the exact set of flags they use and the difference between them.
Moreover, eventually we need to give exact types to all allocations,
something what mal/malloc do not support.

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, rsc
https://golang.org/cl/117580043

10 years agoruntime: shrink stacks in parallel
Dmitriy Vyukov [Thu, 7 Aug 2014 08:55:28 +0000 (12:55 +0400)]
runtime: shrink stacks in parallel
Shrinkstack does not touch normal heap anymore,
so we can shink stacks concurrently with marking.

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, khr, rlh, rsc
https://golang.org/cl/122130043

10 years agodoc: document new ParseMultipartForm behavior
Andrew Gerrand [Thu, 7 Aug 2014 05:42:06 +0000 (15:42 +1000)]
doc: document new ParseMultipartForm behavior

Fixes #8403.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/123860043

10 years agomisc/nacl: wrap lines in README file
Andrew Gerrand [Thu, 7 Aug 2014 01:50:27 +0000 (11:50 +1000)]
misc/nacl: wrap lines in README file

LGTM=dan.kortschak, dave
R=dave, dan.kortschak
CC=golang-codereviews
https://golang.org/cl/121350043

10 years agoC: add Paul Nasrat (Google CLA)
Andrew Gerrand [Thu, 7 Aug 2014 01:21:32 +0000 (11:21 +1000)]
C: add Paul Nasrat (Google CLA)

TBR=gobot
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/125790043

10 years agodoc/go1.4.txt: add support for ALPN
Mikio Hara [Thu, 7 Aug 2014 00:28:49 +0000 (09:28 +0900)]
doc/go1.4.txt: add support for ALPN

LGTM=minux
R=r, agl, minux
CC=golang-codereviews
https://golang.org/cl/121340043

10 years agodoc/go1.4.txt: implement monotonic clocks on windows
Alex Brainman [Thu, 7 Aug 2014 00:25:50 +0000 (10:25 +1000)]
doc/go1.4.txt: implement monotonic clocks on windows

LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/126760043

10 years agopath/filepath: do not restore original working directory twice in test
Alex Brainman [Thu, 7 Aug 2014 00:22:10 +0000 (10:22 +1000)]
path/filepath: do not restore original working directory twice in test

LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/122910043

10 years agoencoding/xml: add InputOffset method to Decoder
Russ Cox [Wed, 6 Aug 2014 22:00:06 +0000 (18:00 -0400)]
encoding/xml: add InputOffset method to Decoder

Among other things, this allows users to match the decoded
pieces with the original XML, which can be necessary for
implementing standards like XML signatures.

Fixes #8484.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/122960043

10 years agocmd/go: revise disallowInternal
Russ Cox [Wed, 6 Aug 2014 21:59:30 +0000 (17:59 -0400)]
cmd/go: revise disallowInternal

This fixes two problems: x/internal/y/z was using parent = x/internal/y instead of x,
and hasPathPrefix only looks at /, not \ for Windows.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/121280045

10 years agodebug/dwarf: fix typos in comment for UnspecifiedType
Rob Pike [Wed, 6 Aug 2014 21:43:50 +0000 (14:43 -0700)]
debug/dwarf: fix typos in comment for UnspecifiedType

LGTM=iant, bradfitz
R=bradfitz, iant
CC=golang-codereviews
https://golang.org/cl/120700043

10 years agoruntime: clean up naming of mcallable functions.
Keith Randall [Wed, 6 Aug 2014 21:33:57 +0000 (14:33 -0700)]
runtime: clean up naming of mcallable functions.

Introduce the mFunction type to represent an mcall/onM-able function.
Name such functions using _m.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/121320043

10 years agotest/mapnan.go: add regression test for non-empty interfaces.
Alan Donovan [Wed, 6 Aug 2014 21:02:55 +0000 (17:02 -0400)]
test/mapnan.go: add regression test for non-empty interfaces.

LGTM=rsc, khr
R=rsc, khr, bradfitz
CC=golang-codereviews
https://golang.org/cl/126720043

10 years agoruntime: use better hash for floating point inputs
Russ Cox [Wed, 6 Aug 2014 20:47:54 +0000 (16:47 -0400)]
runtime: use better hash for floating point inputs

Hashing on the bytes instead of the words does
a (much) better job of using all the bits, so that
maps of floats have linear performance.

LGTM=khr
R=golang-codereviews, khr
CC=adonovan, golang-codereviews
https://golang.org/cl/126720044

10 years agocmd/go: implement 'internal' convention
Russ Cox [Wed, 6 Aug 2014 20:45:06 +0000 (16:45 -0400)]
cmd/go: implement 'internal' convention

See golang.org/s/go14internal for design.

LGTM=r
R=r, adg
CC=golang-codereviews
https://golang.org/cl/120600043

10 years agoruntime: shorten hash declarations
Keith Randall [Wed, 6 Aug 2014 20:42:00 +0000 (13:42 -0700)]
runtime: shorten hash declarations

LGTM=iant
R=dvyukov, iant
CC=golang-codereviews
https://golang.org/cl/117680044

10 years agoruntime: use better hash for non-empty interface
Russ Cox [Wed, 6 Aug 2014 20:22:52 +0000 (16:22 -0400)]
runtime: use better hash for non-empty interface

The implementation 'return 0' results in too many collisions.

LGTM=khr
R=golang-codereviews, adonovan, khr
CC=golang-codereviews, iant, khr, r
https://golang.org/cl/125720044

10 years agocodereview: do not hit upload_complete on first patch
Russ Cox [Wed, 6 Aug 2014 20:12:24 +0000 (16:12 -0400)]
codereview: do not hit upload_complete on first patch

Causes server 500 error, so don't do it.

TBR=minux
CC=golang-codereviews
https://golang.org/cl/125770043

10 years agocodereview: fix submit of merge + include branch prefix in submitted message
Russ Cox [Wed, 6 Aug 2014 20:10:08 +0000 (16:10 -0400)]
codereview: fix submit of merge + include branch prefix in submitted message

hg insists that we not list explicit files for a merge.

for benefit of other tools reading logs, include branch prefix
at start of every commit message.

LGTM=minux
R=minux
CC=golang-codereviews
https://golang.org/cl/124780044

10 years agocmd/gc: make liveness ~10x faster
Russ Cox [Wed, 6 Aug 2014 19:46:33 +0000 (15:46 -0400)]
cmd/gc: make liveness ~10x faster

1) The arrayindexof lookup function is O(n). Replace with O(1) lookups.

2) The checkptxt function is O(n²) and is purely for debugging.
Only run when the debugging flags are turned on.

3) Iterating over sparse bitmaps can be done faster word by word.
Introduce and use bvnext for that.

Run times before and after, on my 2.5 GHz Core i5 MacBook Pro.

x.go       9.48  0.84  issue 8259

x100.go    0.01  0.01  issue 8354
x1000.go   0.10  0.10
x2000.go   0.62  0.19
x3000.go   1.33  0.34
x4000.go   2.29  0.49
x5000.go   3.89  0.67
x6000.go   5.00  0.90
x7000.go   6.70  1.13
x8000.go   9.44  1.38
x9000.go  11.23  1.87
x10000.go 13.78  2.09

Fixes #8259.
Fixes #8354.

LGTM=iant, r
R=golang-codereviews, iant, r
CC=golang-codereviews
https://golang.org/cl/125720043

10 years agocodereview: handle upload of merge
Russ Cox [Wed, 6 Aug 2014 19:25:17 +0000 (15:25 -0400)]
codereview: handle upload of merge

LGTM=minux
R=minux
CC=golang-codereviews
https://golang.org/cl/118690043

10 years agocodereview: preserve branch prefix in subject during hg mail
Russ Cox [Wed, 6 Aug 2014 19:15:45 +0000 (15:15 -0400)]
codereview: preserve branch prefix in subject during hg mail

LGTM=minux
R=minux
CC=golang-codereviews
https://golang.org/cl/124800043

10 years agodebug/dwarf: fix Reader panic on DW_TAG_unspecified_type
Derek Parker [Wed, 6 Aug 2014 19:11:37 +0000 (12:11 -0700)]
debug/dwarf: fix Reader panic on DW_TAG_unspecified_type

The linker currently produces the DWARF 3 DW_TAG_unspecified_type tag, however the Reader in debug/dwarf will panic whenever that tag is encountered.

Fixes #8437.

LGTM=rsc
R=golang-codereviews, bradfitz, iant, rsc
CC=golang-codereviews
https://golang.org/cl/117280043

10 years agoA+C: Derek Parker (individual CLA)
Brad Fitzpatrick [Wed, 6 Aug 2014 19:10:00 +0000 (12:10 -0700)]
A+C: Derek Parker (individual CLA)

Generated by a+c.

R=gobot
CC=golang-codereviews
https://golang.org/cl/125750043

10 years agocodereview: enable work and code reviews in development branches
Russ Cox [Wed, 6 Aug 2014 18:52:12 +0000 (14:52 -0400)]
codereview: enable work and code reviews in development branches

This is an experiment. See mail on golang-dev
(subject: "an experiment: development branches").

LGTM=minux
R=minux
CC=golang-codereviews
https://golang.org/cl/117660043

10 years agoruntime: turn off 'unexpected return pc' print on arm traceback
Russ Cox [Wed, 6 Aug 2014 18:50:09 +0000 (14:50 -0400)]
runtime: turn off 'unexpected return pc' print on arm traceback

It can happen legitimately if a profiling signal arrives at just the wrong moment.
It's harmless.

Fixes #8153.

LGTM=minux
R=golang-codereviews, minux
CC=golang-codereviews, iant, r
https://golang.org/cl/118670043

10 years agocrypto/tls: Added dynamic alternative to NameToCertificate map for SNI
Percy Wegmann [Wed, 6 Aug 2014 18:22:00 +0000 (11:22 -0700)]
crypto/tls: Added dynamic alternative to NameToCertificate map for SNI

Revised version of https://golang.org/cl/81260045/

LGTM=agl
R=golang-codereviews, gobot, agl, ox
CC=golang-codereviews
https://golang.org/cl/107400043

10 years agocmd/cgo: consistently map void* to *byte under -{c,go}defs
Matthew Dempsky [Wed, 6 Aug 2014 17:28:19 +0000 (10:28 -0700)]
cmd/cgo: consistently map void* to *byte under -{c,go}defs

Fixes #8478.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/122150043

10 years agoruntime: remove unused variable
Dmitriy Vyukov [Wed, 6 Aug 2014 15:33:15 +0000 (19:33 +0400)]
runtime: remove unused variable
Left over from cl/119490044.

LGTM=bradfitz
R=rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/125730043

10 years agoruntime: simplify code
Dmitriy Vyukov [Wed, 6 Aug 2014 14:36:48 +0000 (18:36 +0400)]
runtime: simplify code
Full spans can't be passed to UncacheSpan since we get rid of free.

LGTM=rsc
R=golang-codereviews
CC=golang-codereviews, khr, rsc
https://golang.org/cl/119490044

10 years agodist: fix Plan 9 build
David du Colombier [Wed, 6 Aug 2014 13:11:41 +0000 (06:11 -0700)]
dist: fix Plan 9 build

Since CL 115060044, mkanames declares an empty
array in anames8.c and anames6.c, which is not
valid for the Plan 9 compiler.

char* cnames8[] = {
};

This change makes mkanames not declaring the
cnames array when no C_ constants are found.

LGTM=iant
R=minux, iant
CC=golang-codereviews
https://golang.org/cl/117680043

10 years agoruntime: burn cpu before calling yield in windows runtime.systime
Alex Brainman [Wed, 6 Aug 2014 07:24:03 +0000 (17:24 +1000)]
runtime: burn cpu before calling yield in windows runtime.systime

LGTM=dvyukov
R=golang-codereviews, dvyukov
CC=golang-codereviews
https://golang.org/cl/117670043

10 years agoundo CL 114420043 / b613f2acdf69
Shenghou Ma [Wed, 6 Aug 2014 06:07:31 +0000 (02:07 -0400)]
undo CL 114420043 / b613f2acdf69

Broke freebsd/amd64 due to exposure of a latent bug.

««« original CL description
cmd/ld: fix operator precedence

LGTM=rsc
R=rsc, iant
CC=golang-codereviews
https://golang.org/cl/114420043
»»»

TBR=dfc
R=dave
CC=golang-codereviews
https://golang.org/cl/120630043

10 years agoliblink: encode MOVBQZX as MOVZBL instead of MOVZBQ
Rui Ueyama [Wed, 6 Aug 2014 04:38:41 +0000 (21:38 -0700)]
liblink: encode MOVBQZX as MOVZBL instead of MOVZBQ

LGTM=rsc
R=golang-codereviews, gobot, rsc
CC=golang-codereviews
https://golang.org/cl/118480046

10 years agoliblink, cmd/dist, cmd/5l: introduce %^ and move C_* constants.
Shenghou Ma [Wed, 6 Aug 2014 04:31:22 +0000 (00:31 -0400)]
liblink, cmd/dist, cmd/5l: introduce %^ and move C_* constants.

The helps certain diagnostics and also removed duplicated enums as a side effect.

LGTM=dave, rsc
R=rsc, dave
CC=golang-codereviews
https://golang.org/cl/115060044

10 years agocmd/cc, cmd/gc: set ctxt->debugvlog with debug['v']
Shenghou Ma [Wed, 6 Aug 2014 04:27:14 +0000 (00:27 -0400)]
cmd/cc, cmd/gc: set ctxt->debugvlog with debug['v']

LGTM=rsc
R=rsc, iant
CC=golang-codereviews
https://golang.org/cl/118610043

10 years agocmd/5l, cmd/6l, cmd/8l, cmd/ld: remove unused code, consolidate enums
Shenghou Ma [Wed, 6 Aug 2014 04:25:52 +0000 (00:25 -0400)]
cmd/5l, cmd/6l, cmd/8l, cmd/ld: remove unused code, consolidate enums

LGTM=rsc
R=rsc, iant
CC=golang-codereviews
https://golang.org/cl/120220043

10 years agoliblink: support big-endian properly
Shenghou Ma [Wed, 6 Aug 2014 04:25:41 +0000 (00:25 -0400)]
liblink: support big-endian properly

LGTM=rsc
R=rsc, iant
CC=golang-codereviews
https://golang.org/cl/115300044

10 years agocmd/ld: fix operator precedence
Shenghou Ma [Wed, 6 Aug 2014 04:25:05 +0000 (00:25 -0400)]
cmd/ld: fix operator precedence

LGTM=rsc
R=rsc, iant
CC=golang-codereviews
https://golang.org/cl/114420043

10 years agoruntime: get rid of SA_RESTORER on ARM.
Shenghou Ma [Wed, 6 Aug 2014 04:24:55 +0000 (00:24 -0400)]
runtime: get rid of SA_RESTORER on ARM.

The manpages says SA_RESTORER is obsolete, and indeed, not every architecture
support it. However, sadly it's required on x86_64, see http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/x86/kernel/signal.c?id=26bcd8b72563b4c54892c4c2a409f6656fb8ae8b#n430, so only use it on x86.

LGTM=rsc
R=rsc, iant
CC=golang-codereviews
https://golang.org/cl/115450043

10 years agoliblink: use LinkArch.textflag() to get text and dataflag
Shenghou Ma [Wed, 6 Aug 2014 04:24:43 +0000 (00:24 -0400)]
liblink: use LinkArch.textflag() to get text and dataflag
Rather than switch on thechar.

LGTM=rsc, dave
R=rsc, iant, dave
CC=golang-codereviews
https://golang.org/cl/119330043

10 years agoruntime: remove dead code
Shenghou Ma [Wed, 6 Aug 2014 04:24:31 +0000 (00:24 -0400)]
runtime: remove dead code

LGTM=bradfitz, dave, ruiu
R=rsc, iant, bradfitz, dave, ruiu
CC=golang-codereviews
https://golang.org/cl/116610043

10 years agoruntime: disable aeshash on NaCl at compile time
Shenghou Ma [Wed, 6 Aug 2014 04:24:11 +0000 (00:24 -0400)]
runtime: disable aeshash on NaCl at compile time

Fixes build for nacl/386.

LGTM=dave
R=khr, bradfitz, dave, dan.kortschak, rsc
CC=golang-codereviews
https://golang.org/cl/121080043

10 years agoliblink: shorter encoding for zeroing register
Rui Ueyama [Wed, 6 Aug 2014 04:10:07 +0000 (21:10 -0700)]
liblink: shorter encoding for zeroing register

Encode MOV $0, %ax as XOR %eax, %eax instead of
XOR %rax, %rax. If an operand register does not
need REX.w bit (i.e. not one of R8-R15), it is
encoded in 2 bytes instead of 3 bytes.

LGTM=rsc
R=golang-codereviews, gobot, rsc
CC=golang-codereviews
https://golang.org/cl/115580044

10 years agocmd/cgo: fix recursive type mapping
Matthew Dempsky [Wed, 6 Aug 2014 01:16:56 +0000 (18:16 -0700)]
cmd/cgo: fix recursive type mapping

Instead of immediately completing pointer type mappings, add them to
a queue to allow them to be completed later.  This fixes issues caused
by Type() returning arbitrary in-progress type mappings.

Fixes #8368.
Fixes #8441.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/122850043

10 years agocmd/cgo: fix handling of defs_linux.go
Matthew Dempsky [Wed, 6 Aug 2014 01:12:32 +0000 (18:12 -0700)]
cmd/cgo: fix handling of defs_linux.go

Instead of including <sys/types.h> to get size_t, instead include
the ISO C standard <stddef.h> header, which defines fewer additional
types at risk of colliding with the user code.  In particular, this
prevents collisions between <sys/types.h>'s userspace definitions with
the kernel definitions needed by defs_linux.go.

Also, -cdefs mode uses #pragma pack, so we can keep misaligned fields.

Fixes #8477.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/120610043

10 years agonet: separate DNS transport from DNS query-response interaction
Mikio Hara [Wed, 6 Aug 2014 00:58:47 +0000 (09:58 +0900)]
net: separate DNS transport from DNS query-response interaction

Before fixing issue 6579 this CL separates DNS transport from
DNS message interaction to make it easier to add builtin DNS
resolver control logic.

Update #6579

LGTM=alex, kevlar
R=golang-codereviews, alex, gobot, iant, minux, kevlar
CC=golang-codereviews
https://golang.org/cl/101220044

10 years agocmd/cgo: for -godefs, promote first field of anonymous union
Ian Lance Taylor [Wed, 6 Aug 2014 00:10:15 +0000 (17:10 -0700)]
cmd/cgo: for -godefs, promote first field of anonymous union

Update #6677

When a struct contains an anonymous union, use the type and
name of the first field in the union.

This should make the glibc <sys/resource.h> file work; in that
file struct rusage has fields like

__extension__ union
{
        long int ru_maxrss;
        __syscall_slong_t __ru_maxrss_word;
};

in which the field that matters is ru_maxrss and
__ru_maxrss_word just exists to advance to the next field on
systems where the kernel uses long long fields but userspace
expects long fields.

LGTM=mikioh.mikioh
R=golang-codereviews, mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/106260044

10 years agoruntime: cache one GC workbuf in thread-local storage
Dmitriy Vyukov [Tue, 5 Aug 2014 21:50:37 +0000 (01:50 +0400)]
runtime: cache one GC workbuf in thread-local storage
We call scanblock for lots of small root pieces
e.g. for every stack frame args and locals area.
Every scanblock invocation calls getempty/putempty,
which accesses lock-free stack shared among all worker threads.
One-element local cache allows most scanblock calls
to proceed without accessing the shared stack.

LGTM=rsc
R=golang-codereviews, rlh
CC=golang-codereviews, khr, rsc
https://golang.org/cl/121250043

10 years agomime/multipart: fix Writer data race test
Rui Ueyama [Tue, 5 Aug 2014 20:43:12 +0000 (13:43 -0700)]
mime/multipart: fix Writer data race test

If the process exits before the spawned goroutine
completes, it'll miss the data race.

LGTM=bradfitz
R=bradfitz
CC=dvyukov, golang-codereviews
https://golang.org/cl/122120043

10 years agodoc/go1.4.txt: document ASN.1 behaviour change.
Adam Langley [Tue, 5 Aug 2014 19:00:14 +0000 (12:00 -0700)]
doc/go1.4.txt: document ASN.1 behaviour change.

CC=golang-codereviews
https://golang.org/cl/116710043

10 years agomime/multipart: add Writer data race test
Brad Fitzpatrick [Tue, 5 Aug 2014 18:45:24 +0000 (11:45 -0700)]
mime/multipart: add Writer data race test

Camlistore uses this pattern to do streaming writes, as do
others I imagine, and it was broken by the lazy boundary
change.

LGTM=dvyukov, ruiu
R=ruiu, dvyukov
CC=golang-codereviews, mathieu.lonjaret
https://golang.org/cl/116690043

10 years agoundo CL 95760043 / b2131d729e52
Brad Fitzpatrick [Tue, 5 Aug 2014 18:36:44 +0000 (11:36 -0700)]
undo CL 95760043 / b2131d729e52

Breaks Camlistore by introducing a datarace. See comments on
https://golang.org/cl/95760043/ for details.

I'll add a new test to lock-in the current behavior in a
subsequent CL.

I don't think Camlistore is particularly unique here: it's doing
the obvious thing to stream a multipart body to a server
using a goroutine feeding the multipart writer.

««« original CL description
mime/multipart: delay reading random source

If a user sets his/her own boundary string with SetBoundary,
we don't need to call randomBoundary at all.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/95760043
»»»

LGTM=ruiu
R=ruiu
CC=golang-codereviews, mathieu.lonjaret
https://golang.org/cl/117600043

10 years agocrypto/tls: add ALPN support.
Adam Langley [Tue, 5 Aug 2014 18:36:20 +0000 (11:36 -0700)]
crypto/tls: add ALPN support.

Fixes #6736.

LGTM=mikioh.mikioh
R=bradfitz, mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/108710046

10 years agoruntime: remove type.go
Dmitriy Vyukov [Tue, 5 Aug 2014 18:32:24 +0000 (22:32 +0400)]
runtime: remove type.go
We have an autogenerated version in zruntime_defs.
I am not sure what are the consequences as gdb never printed any values for me.
But it looks unnecessary to manually duplicate it.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews, iant, khr
https://golang.org/cl/115660043

10 years agospec: comma-ok expressions return untyped boolean 2nd result
Robert Griesemer [Tue, 5 Aug 2014 18:31:32 +0000 (11:31 -0700)]
spec: comma-ok expressions return untyped boolean 2nd result

Technically a language change, this cleanup is a completely
backward compatible change that brings the boolean results
of comma-ok expressions in line with the boolean results of
comparisons: they are now all untyped booleans.

The implementation effort should be minimal (less than a
handfull lines of code, depending how well factored the
implementation of comma-ok expressions is).

Fixes #8189.

LGTM=iant, r, rsc
R=r, rsc, iant, ken
CC=golang-codereviews
https://golang.org/cl/112320045

10 years agoA+C: Percy Wegmann (individual CLA)
Adam Langley [Tue, 5 Aug 2014 18:25:47 +0000 (11:25 -0700)]
A+C: Percy Wegmann (individual CLA)

Generated by a+c.

R=gobot
CC=golang-codereviews
https://golang.org/cl/121240043

10 years agoruntime/race: add tests for maps with big keys/vals
Dmitriy Vyukov [Tue, 5 Aug 2014 14:12:38 +0000 (18:12 +0400)]
runtime/race: add tests for maps with big keys/vals
With the recent GC changes large objects are handled somewhat differently.

LGTM=khr
R=khr
CC=golang-codereviews
https://golang.org/cl/114600043

10 years agoruntime: remove outdated comment
Dmitriy Vyukov [Tue, 5 Aug 2014 13:03:06 +0000 (17:03 +0400)]
runtime: remove outdated comment

LGTM=bradfitz, khr
R=khr, bradfitz
CC=golang-codereviews
https://golang.org/cl/120400043

10 years agoruntime: use memmove rather than memcopy in mgc0.c
Ian Lance Taylor [Tue, 5 Aug 2014 03:40:44 +0000 (20:40 -0700)]
runtime: use memmove rather than memcopy in mgc0.c

For consistency with other code, as that was the only use of
memcopy outside of alg.goc.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/122030044

10 years agosyscall: fix typo in comment
Ian Lance Taylor [Tue, 5 Aug 2014 03:30:26 +0000 (20:30 -0700)]
syscall: fix typo in comment

LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/120570043

10 years agoruntime: remove unused enum maxround
Ian Lance Taylor [Tue, 5 Aug 2014 03:29:58 +0000 (20:29 -0700)]
runtime: remove unused enum maxround

LGTM=minux, dave
R=golang-codereviews, minux, dave
CC=golang-codereviews
https://golang.org/cl/122030043

10 years agoruntime: only use a single variable in USED
Ian Lance Taylor [Tue, 5 Aug 2014 03:29:36 +0000 (20:29 -0700)]
runtime: only use a single variable in USED

The gccgo version of USED only accepts a single variable, so
this simplifies merging.

LGTM=minux, dave
R=golang-codereviews, minux, dave
CC=golang-codereviews
https://golang.org/cl/115630043

10 years agotest: add test for function type in function literal
Ian Lance Taylor [Tue, 5 Aug 2014 02:50:49 +0000 (19:50 -0700)]
test: add test for function type in function literal

The gccgo compiler used to fail this test.  This was the root
cause of http://gcc.gnu.org/PR61308 .  The fix for the gccgo
compiler is https://golang.org/cl/122020043 .

LGTM=dave, bradfitz
R=golang-codereviews, dave, bradfitz
CC=golang-codereviews
https://golang.org/cl/121200043

10 years agoarchive/zip: accept bogus trailing zeros in extras
Brad Fitzpatrick [Mon, 4 Aug 2014 23:12:55 +0000 (16:12 -0700)]
archive/zip: accept bogus trailing zeros in extras

Popular tools both add incorrect trailing zeroes to the zip
extras, and popular tools accept trailing zeros. We seemed to
be the only ones being strict here. Stop being strict. :(

Fixes #8186

LGTM=ruiu, adg, dave
R=adg, ruiu, dave
CC=frohrweck, golang-codereviews
https://golang.org/cl/117550044

10 years agonet: consolidate sockaddrToAddr functions
Mikio Hara [Mon, 4 Aug 2014 21:10:46 +0000 (06:10 +0900)]
net: consolidate sockaddrToAddr functions

This CL removes sockaddrToAddr functions from socket creation
operations to avoid the bug like issue 7183.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/105100046

10 years agoencoding/gob: save a call to userType
Rob Pike [Sun, 3 Aug 2014 22:14:59 +0000 (15:14 -0700)]
encoding/gob: save a call to userType
Avoid some pressure on the global mutex by lifting the call to userType
out of the closure.
TOTH to Matt Harden.

LGTM=crawshaw, ruiu
R=golang-codereviews, crawshaw, ruiu
CC=golang-codereviews
https://golang.org/cl/117520043

10 years agonet: fix Dial comment about IPv6 addresses
Brad Fitzpatrick [Sat, 2 Aug 2014 04:35:03 +0000 (21:35 -0700)]
net: fix Dial comment about IPv6 addresses

LGTM=r
R=golang-codereviews, r
CC=adg, golang-codereviews
https://golang.org/cl/118550043

10 years agocmd/go: use correct link flags if main package contains C++/ObjC files
Peter Collingbourne [Fri, 1 Aug 2014 23:45:33 +0000 (16:45 -0700)]
cmd/go: use correct link flags if main package contains C++/ObjC files

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/117470043

10 years agoruntime: move constants from map header to map type
Keith Randall [Fri, 1 Aug 2014 21:38:56 +0000 (14:38 -0700)]
runtime: move constants from map header to map type

A good cleanup anyway, and it makes some room for an additional
field needed for issue 8412.

Update #8412

LGTM=iant
R=iant, khr
CC=golang-codereviews
https://golang.org/cl/112700043