]> Cypherpunks repositories - gostls13.git/log
gostls13.git
9 years agonet/http: require valid methods in NewRequest and Transport.RoundTrip
Brad Fitzpatrick [Thu, 12 Nov 2015 15:16:06 +0000 (15:16 +0000)]
net/http: require valid methods in NewRequest and Transport.RoundTrip

Fixes #12078

Change-Id: If09c927fae639ec4ed3894a2b393a87c1e677803
Reviewed-on: https://go-review.googlesource.com/16829
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agonet/http: add method constants
Brad Fitzpatrick [Thu, 12 Nov 2015 15:33:23 +0000 (15:33 +0000)]
net/http: add method constants

Fixes #12078

Change-Id: Ia8738123b07ca29be4a0cf400ee143729c8b5b3c
Reviewed-on: https://go-review.googlesource.com/16860
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agodoc: add mips64/mips64le to supported GOARCHes
Shenghou Ma [Fri, 13 Nov 2015 08:12:26 +0000 (03:12 -0500)]
doc: add mips64/mips64le to supported GOARCHes

Change-Id: If9dc08d6c29bf60b63d75d973033897ad8bf8cc4
Reviewed-on: https://go-review.googlesource.com/16905
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoapi: update next.txt
Shenghou Ma [Fri, 13 Nov 2015 07:37:59 +0000 (02:37 -0500)]
api: update next.txt

Change-Id: I4903014f2883d3f52a75a3500dc9e01a5cad8611
Reviewed-on: https://go-review.googlesource.com/16904
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocompress/gzip: specify when Reader.Header is valid
Joe Tsai [Thu, 12 Nov 2015 18:41:09 +0000 (10:41 -0800)]
compress/gzip: specify when Reader.Header is valid

The gzip package is asymmetrical in the way it handles headers.
In Writer, the Header is written on the first call to Write, Flush, or Close.
In Reader, the Header is read on calls to NewReader or Reset as opposed to
after the first Read. Thus, we document this difference.

Fixes #13211

Change-Id: I5f87beff036e5e2fd68a02a15fdb7137e9ca4c37
Reviewed-on: https://go-review.googlesource.com/16838
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/internal/obj/arm64: rewrite branches that are too far
Shenghou Ma [Fri, 13 Nov 2015 02:23:21 +0000 (21:23 -0500)]
cmd/internal/obj/arm64: rewrite branches that are too far

Fixes #12540.

Change-Id: I7893fdc023145b0aca4b4c7df7e08e47edcf5bba
Reviewed-on: https://go-review.googlesource.com/16902
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: move m's OS-specific semaphore fields into mOS
Matthew Dempsky [Thu, 22 Oct 2015 01:36:05 +0000 (18:36 -0700)]
runtime: move m's OS-specific semaphore fields into mOS

Allows removing fields that aren't relevant to a particular OS or
changing their types to match the underlying OS system calls they'll
be used for.

Change-Id: I5cea89ee77b4e7b985bff41337e561887c3272ff
Reviewed-on: https://go-review.googlesource.com/16176
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>

9 years agocmd/dist: set timeout for go1 benchmark too
Shenghou Ma [Fri, 13 Nov 2015 01:05:06 +0000 (20:05 -0500)]
cmd/dist: set timeout for go1 benchmark too

so that GO_TEST_TIMEOUT_SCALE can be applied too.
It's for the mips64 builder, which is so slow that the
go1 benchmark can't finish startup within 10 minutes.

Change-Id: I1b824eb0649460101b294fb442da784e872403e7
Reviewed-on: https://go-review.googlesource.com/16901
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoarchive/tar: make output deterministic
Matt Layher [Thu, 27 Aug 2015 18:52:06 +0000 (14:52 -0400)]
archive/tar: make output deterministic

Replaces PID in PaxHeaders with 0.  Sorts PAX header keys before writing
them to the archive.

Fixes #12358

Change-Id: If239f89c85f1c9d9895a253fb06a47ad44960124
Reviewed-on: https://go-review.googlesource.com/13975
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Joe Tsai <joetsai@digital-static.net>
9 years agoruntime: replace tls0 with m0.tls
Matthew Dempsky [Thu, 12 Nov 2015 23:35:50 +0000 (15:35 -0800)]
runtime: replace tls0 with m0.tls

We're allocating TLS storage for m0 anyway, so might as well use it.

Change-Id: I7dc20bbea5320c8ab8a367f18a9540706751e771
Reviewed-on: https://go-review.googlesource.com/16890
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet: make TestInterfaceList work on non-English Windows
Yasuhiro Matsumoto [Tue, 10 Nov 2015 02:23:41 +0000 (11:23 +0900)]
net: make TestInterfaceList work on non-English Windows

Fixes #13198

The output of netsh is encoded with ANSI encoding. So doesn't match with UTF-8 strings.
Write output as UTF-8 using powershell.

Change-Id: I6c7e93c590ed407f24ae847601d71df9523e028c
Reviewed-on: https://go-review.googlesource.com/16756
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
9 years agoruntime: disable prefetching on 386
Shenghou Ma [Sat, 17 Oct 2015 22:21:44 +0000 (18:21 -0400)]
runtime: disable prefetching on 386

It doesn't seem to help on modern processors and it makes Go impossible to run
on Pentium MMX (which is the documented minimum hardware requirement.)

Old is with prefetch, new is w/o. Both are compiled with GO386=sse2.
Benchmarking is done on Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz.

name                     old time/op    new time/op    delta
BinaryTree17-4              2.89s ± 2%     2.87s ± 0%    ~     (p=0.061 n=11+10)
Fannkuch11-4                3.65s ± 0%     3.65s ± 0%    ~     (p=0.365 n=11+11)
FmtFprintfEmpty-4          52.1ns ± 0%    52.1ns ± 0%    ~      (p=0.065 n=10+9)
FmtFprintfString-4          168ns ± 0%     167ns ± 0%  -0.48%   (p=0.000 n=8+10)
FmtFprintfInt-4             167ns ± 0%     167ns ± 1%    ~      (p=0.591 n=9+10)
FmtFprintfIntInt-4          295ns ± 0%     292ns ± 0%  -0.99%   (p=0.000 n=9+10)
FmtFprintfPrefixedInt-4     327ns ± 0%     326ns ± 0%  -0.24%  (p=0.007 n=10+10)
FmtFprintfFloat-4           431ns ± 0%     431ns ± 0%  -0.07%  (p=0.000 n=10+11)
FmtManyArgs-4              1.13µs ± 0%    1.13µs ± 0%  -0.37%  (p=0.009 n=11+11)
GobDecode-4                9.36ms ± 1%    9.33ms ± 0%  -0.31%  (p=0.006 n=11+10)
GobEncode-4                7.38ms ± 1%    7.38ms ± 1%    ~     (p=0.797 n=11+11)
Gzip-4                      394ms ± 0%     395ms ± 1%    ~     (p=0.519 n=11+11)
Gunzip-4                   65.4ms ± 0%    65.4ms ± 0%    ~     (p=0.739 n=10+10)
HTTPClientServer-4         52.4µs ± 1%    52.5µs ± 1%    ~     (p=0.748 n=11+11)
JSONEncode-4               19.0ms ± 0%    19.0ms ± 0%    ~      (p=0.780 n=9+10)
JSONDecode-4               59.6ms ± 0%    59.6ms ± 0%    ~      (p=0.720 n=9+10)
Mandelbrot200-4            4.09ms ± 0%    4.09ms ± 0%    ~      (p=0.295 n=11+9)
GoParse-4                  3.45ms ± 1%    3.43ms ± 1%  -0.35%  (p=0.040 n=11+11)
RegexpMatchEasy0_32-4       101ns ± 1%     101ns ± 1%    ~     (p=1.000 n=11+11)
RegexpMatchEasy0_1K-4       796ns ± 0%     796ns ± 0%    ~      (p=0.954 n=10+8)
RegexpMatchEasy1_32-4       110ns ± 0%     110ns ± 1%    ~      (p=0.289 n=9+11)
RegexpMatchEasy1_1K-4       991ns ± 0%     991ns ± 0%    ~      (p=0.784 n=10+8)
RegexpMatchMedium_32-4      131ns ± 0%     130ns ± 0%  -0.42%   (p=0.004 n=11+9)
RegexpMatchMedium_1K-4     41.9µs ± 1%    41.6µs ± 0%    ~      (p=0.067 n=11+9)
RegexpMatchHard_32-4       2.34µs ± 0%    2.34µs ± 0%    ~     (p=0.208 n=11+11)
RegexpMatchHard_1K-4       70.9µs ± 0%    71.0µs ± 0%    ~      (p=0.968 n=9+10)
Revcomp-4                   819ms ± 0%     818ms ± 0%    ~     (p=0.251 n=10+11)
Template-4                 73.9ms ± 0%    73.8ms ± 0%  -0.25%  (p=0.013 n=10+11)
TimeParse-4                 414ns ± 0%     414ns ± 0%    ~     (p=0.809 n=11+10)
TimeFormat-4                485ns ± 0%     485ns ± 0%    ~      (p=0.404 n=11+7)

name                     old speed      new speed      delta
GobDecode-4              82.0MB/s ± 1%  82.3MB/s ± 0%  +0.31%  (p=0.007 n=11+10)
GobEncode-4               104MB/s ± 1%   104MB/s ± 1%    ~     (p=0.797 n=11+11)
Gzip-4                   49.2MB/s ± 0%  49.1MB/s ± 1%    ~     (p=0.507 n=11+11)
Gunzip-4                  297MB/s ± 0%   297MB/s ± 0%    ~     (p=0.670 n=10+10)
JSONEncode-4              102MB/s ± 0%   102MB/s ± 0%    ~      (p=0.794 n=9+10)
JSONDecode-4             32.6MB/s ± 0%  32.6MB/s ± 0%    ~       (p=0.334 n=9+9)
GoParse-4                16.8MB/s ± 1%  16.9MB/s ± 1%    ~     (p=0.052 n=11+11)
RegexpMatchEasy0_32-4     314MB/s ± 0%   314MB/s ± 1%    ~     (p=0.618 n=11+11)
RegexpMatchEasy0_1K-4    1.29GB/s ± 0%  1.29GB/s ± 0%    ~     (p=0.315 n=10+10)
RegexpMatchEasy1_32-4     290MB/s ± 1%   290MB/s ± 1%    ~     (p=0.667 n=10+11)
RegexpMatchEasy1_1K-4    1.03GB/s ± 0%  1.03GB/s ± 0%    ~      (p=0.829 n=10+8)
RegexpMatchMedium_32-4   7.63MB/s ± 0%  7.65MB/s ± 0%    ~     (p=0.142 n=11+11)
RegexpMatchMedium_1K-4   24.4MB/s ± 1%  24.6MB/s ± 0%    ~      (p=0.063 n=11+9)
RegexpMatchHard_32-4     13.7MB/s ± 0%  13.7MB/s ± 0%    ~     (p=0.302 n=11+11)
RegexpMatchHard_1K-4     14.4MB/s ± 0%  14.4MB/s ± 0%    ~      (p=0.784 n=9+10)
Revcomp-4                 310MB/s ± 0%   311MB/s ± 0%    ~     (p=0.243 n=10+11)
Template-4               26.2MB/s ± 0%  26.3MB/s ± 0%  +0.24%  (p=0.009 n=10+11)

Update #12970.

Change-Id: Id185080687a60c229a5cb2e5220e7ca1b53910e2
Reviewed-on: https://go-review.googlesource.com/15999
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
9 years agoos: add document for ErrInvalid
Shenghou Ma [Thu, 12 Nov 2015 20:27:51 +0000 (15:27 -0500)]
os: add document for ErrInvalid

Fixes #12391.

Change-Id: I31211cd711c035151785c3083571594d15c7d93e
Reviewed-on: https://go-review.googlesource.com/16873
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/dist: run testshared on linux/ppc64le
Michael Hudson-Doyle [Wed, 4 Nov 2015 20:56:32 +0000 (09:56 +1300)]
cmd/dist: run testshared on linux/ppc64le

Change-Id: I4d079d29408e5344701056c88882cfd3b3857478
Reviewed-on: https://go-review.googlesource.com/15973
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>

9 years agocmd/link, runtime: implement & call addmoduledata on ppc64le
Michael Hudson-Doyle [Fri, 16 Oct 2015 08:22:20 +0000 (21:22 +1300)]
cmd/link, runtime: implement & call addmoduledata on ppc64le

Change-Id: I3980d82c7df95e69522c3d2c90311f89c6fef0e1
Reviewed-on: https://go-review.googlesource.com/15972
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/internal/obj/ppc64: avoid calling morestack via a PLT when dynamically linking
Michael Hudson-Doyle [Fri, 16 Oct 2015 07:50:59 +0000 (20:50 +1300)]
cmd/internal/obj/ppc64: avoid calling morestack via a PLT when dynamically linking

Change-Id: Ie79f72786b1d7154f1910e717a0faf354b913b89
Reviewed-on: https://go-review.googlesource.com/15970
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/internal/obj, cmd/link: access global data via GOT when dynlinking on ppc64le
Michael Hudson-Doyle [Fri, 16 Oct 2015 02:54:10 +0000 (15:54 +1300)]
cmd/internal/obj, cmd/link: access global data via GOT when dynlinking on ppc64le

Change-Id: I79c60241df6c785f35371e70c777a7bd6e93571c
Reviewed-on: https://go-review.googlesource.com/15968
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/go, cmd/link: enable -buildmode=shared on linux/ppc64le
Michael Hudson-Doyle [Wed, 4 Nov 2015 20:55:44 +0000 (09:55 +1300)]
cmd/go, cmd/link: enable -buildmode=shared on linux/ppc64le

Change-Id: Ifba76413b8aa78a221385bf505b92a3a5fbc3d24
Reviewed-on: https://go-review.googlesource.com/16713
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/internal/obj, runtime: implement IE model TLS on ppc64le
Michael Hudson-Doyle [Fri, 16 Oct 2015 08:15:18 +0000 (21:15 +1300)]
cmd/internal/obj, runtime: implement IE model TLS on ppc64le

This requires changing the tls access code to match the patterns documented in
the ABI documentation or the system linker will "optimize" it into ridiculousness.

With this change, -buildmode=pie works, although as it is tested in testshared,
the tests are not run yet.

Change-Id: I1efa6687af0a5b8db3385b10f6542a49056b2eb3
Reviewed-on: https://go-review.googlesource.com/15971
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/internal/obj, cmd/link: generate position independent loads of static data
Michael Hudson-Doyle [Fri, 16 Oct 2015 07:48:56 +0000 (20:48 +1300)]
cmd/internal/obj, cmd/link: generate position independent loads of static data

Change-Id: I0a8448c2b69f5cfa6f099d772f5eb3412f853045
Reviewed-on: https://go-review.googlesource.com/15969
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/compile, cmd/link, runtime: on ppc64x, maintain the TOC pointer in R2 when compil...
Michael Hudson-Doyle [Fri, 16 Oct 2015 02:42:09 +0000 (15:42 +1300)]
cmd/compile, cmd/link, runtime: on ppc64x, maintain the TOC pointer in R2 when compiling PIC

The PowerPC ISA does not have a PC-relative load instruction, which poses
obvious challenges when generating position-independent code. The way the ELFv2
ABI addresses this is to specify that r2 points to a per "module" (shared
library or executable) TOC pointer. Maintaining this pointer requires
cooperation between codegen and the system linker:

 * Non-leaf functions leave space on the stack at r1+24 to save the TOC pointer.
 * A call to a function that *might* have to go via a PLT stub must be followed
   by a nop instruction that the system linker can replace with "ld r1, 24(r1)"
   to restore the TOC pointer (only when dynamically linking Go code).
 * When calling a function via a function pointer, the address of the function
   must be in r12, and the first couple of instructions (the "global entry
   point") of the called function use this to derive the address of the TOC
   for the module it is in.
 * When calling a function that is implemented in the same module, the system
   linker adjusts the call to skip over the instructions mentioned above (the
   "local entry point"), assuming that r2 is already correctly set.

So this changeset adds the global entry point instructions, sets the metadata so
the system linker knows where the local entry point is, inserts code to save the
TOC pointer at 24(r1), adds a nop after any call not known to be local and copes
with the odd non-local code transfer in the runtime (e.g. the stuff around
jmpdefer). It does not actually compile PIC yet.

Change-Id: I7522e22bdfd2f891745a900c60254fe9e372c854
Reviewed-on: https://go-review.googlesource.com/15967
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: update newosproc asm to access m.id directly
Matthew Dempsky [Thu, 12 Nov 2015 22:26:19 +0000 (14:26 -0800)]
runtime: update newosproc asm to access m.id directly

darwin/386, freebsd/386, and linux/386 use a setldt system call to
setup each M's thread-local storage area, and they need access to the
M's id for this.  The current code copies m.id into m.tls[0] (and this
logic has been cargo culted to OSes like NetBSD and OpenBSD, which
don't even need m.id to configure TLS), and then the 386 assembly
loads m.tls[0]... but since the assembly code already has a pointer to
the M, it might as well just load m.id directly.

Change-Id: I1a7278f1ec8ebda8d1de3aa3a61993070e3a8cdf
Reviewed-on: https://go-review.googlesource.com/16881
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/internal/obj, cmd/link, runtime: use a larger stack frame on ppc64
Michael Hudson-Doyle [Thu, 29 Oct 2015 23:36:08 +0000 (12:36 +1300)]
cmd/internal/obj, cmd/link, runtime: use a larger stack frame on ppc64

The larger stack frames causes the nosplit stack to overflow so the next change
increases the stackguard.

Change-Id: Ib2b4f24f0649eb1d13e3a58d265f13d1b6cc9bf9
Reviewed-on: https://go-review.googlesource.com/15964
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/internal/obj, cmd/link, runtime: increase stack limit to accommodate larger frame...
Michael Hudson-Doyle [Thu, 29 Oct 2015 23:47:24 +0000 (12:47 +1300)]
cmd/internal/obj, cmd/link, runtime: increase stack limit to accommodate larger frames on ppc64x

Larger stack frames mean nosplit functions use more stack and so the limit
needs to increase.

The change to test/nosplit.go is a bit ugly but I can't really think of a
way to make it nicer.

Change-Id: I2616b58015f0b62abbd62951575fcd0d2d8643c2
Reviewed-on: https://go-review.googlesource.com/16504
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime/internal/sys: remove Intptr
Matthew Dempsky [Thu, 12 Nov 2015 21:27:40 +0000 (13:27 -0800)]
runtime/internal/sys: remove Intptr

Apparently its last use was removed in CL 8899.

Change-Id: I4f3a789b3cc4c249582e81463af62b576a281e40
Reviewed-on: https://go-review.googlesource.com/16880
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoruntime/race: update race runtime
Dmitry Vyukov [Thu, 12 Nov 2015 13:12:48 +0000 (14:12 +0100)]
runtime/race: update race runtime

The new revision is 389d49d4943780efbfcd2a434f4462b6d0f23c44 (Nov 13, 2015).
The runtimes are built using the new x/build/cmd/racebuild utility.
This update fixes a bug in race detection algorithm that can
lead to occasional false negatives (#10589). But generally just
brings in an up-to-date runtime.

Update #8653
Fixes #10589

Change-Id: I7ac9614d014ee89c2302ce5e096d326ef293f367
Reviewed-on: https://go-review.googlesource.com/16827
Reviewed-by: Keith Randall <khr@golang.org>
9 years agoruntime, runtime/internal/sys: fix build for linux/{mips64,mips64le}
Shenghou Ma [Thu, 12 Nov 2015 20:43:18 +0000 (15:43 -0500)]
runtime, runtime/internal/sys: fix build for linux/{mips64,mips64le}

Change-Id: I37bac9680efdfd797ca5dca90bd9a9e1001bfb68
Reviewed-on: https://go-review.googlesource.com/16874
Reviewed-by: Michael Matloob <matloob@golang.org>
9 years agoruntime: delete runtime/internal/atomic/textflag.h
Michael Matloob [Thu, 12 Nov 2015 16:30:33 +0000 (11:30 -0500)]
runtime: delete runtime/internal/atomic/textflag.h

As per mdempsky's comment on golang.org/cl/14204, textflag.h is
copied to the includes dir by cmd/dist, and the copy in
runtime/internal/atomic is not actually being used.

Updates #11647

Change-Id: Ie95c08903a9df54cea4c70ee9d5291176f7b5609
Reviewed-on: https://go-review.googlesource.com/16871
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agoruntime: ignore rt_sigaction error if it is for SIGRTMAX
Michael Hudson-Doyle [Thu, 12 Nov 2015 19:55:44 +0000 (08:55 +1300)]
runtime: ignore rt_sigaction error if it is for SIGRTMAX

A forward port of https://codereview.appspot.com/124900043/ which somehow
got lost somewhere.

Fixes #13024

Change-Id: Iab128899e65c51d90f6704e3e1b2fc9326e3a1c2
Reviewed-on: https://go-review.googlesource.com/16853
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: use WriteConsole to implement print and panic on windows
Daniel Theophanes [Fri, 6 Nov 2015 06:47:45 +0000 (22:47 -0800)]
runtime: use WriteConsole to implement print and panic on windows

Fixes #7864

Change-Id: Id13369352aeccac8387876f0b911e383c543c28e
Reviewed-on: https://go-review.googlesource.com/16714
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agopath/filepath: in Rel use case-insensitive comparison on Windows
Yasuhiro Matsumoto [Wed, 11 Nov 2015 01:21:49 +0000 (10:21 +0900)]
path/filepath: in Rel use case-insensitive comparison on Windows

Fixes #10802

Compare Volume name and each path elements using strings.EqualFold.

Change-Id: Ibdefdb801d0326e53755bc9cc8c10eed998094e5
Reviewed-on: https://go-review.googlesource.com/16795
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/dist: copy textflag.h for runtime/internal/* too
Shenghou Ma [Thu, 12 Nov 2015 19:52:01 +0000 (14:52 -0500)]
cmd/dist: copy textflag.h for runtime/internal/* too

Change-Id: I22216df83898e560cfe6d97344f05e3678c2db99
Reviewed-on: https://go-review.googlesource.com/16872
Reviewed-by: Michael Matloob <matloob@golang.org>
9 years agoruntime: move arch_mips64(le)?.go into runtime/internal/sys
Michael Matloob [Thu, 12 Nov 2015 18:43:27 +0000 (13:43 -0500)]
runtime: move arch_mips64(le)?.go into runtime/internal/sys

Somehow these were left out of the orignial CL.

Updates #11647

Change-Id: I058a30eaa25fbb72d60e7fb6bc9ff0a3b54fdb2a
Reviewed-on: https://go-review.googlesource.com/16870
Reviewed-by: Minux Ma <minux@golang.org>
9 years agotesting: only call flag.Parse if it has not been called before
Alberto Bertogli [Fri, 6 Nov 2015 01:40:56 +0000 (01:40 +0000)]
testing: only call flag.Parse if it has not been called before

Calling flag.Parse twice can be problematic if other goroutines called
flag.Parsed in between: the race detector complains due to the
write after read from a different goroutine.

This can happen if TestMain calls flag.Parse and launches goroutines
that call flag.Parsed, for example if it initializes a server which
checks flags.

This patch makes testing.M.Run only parse the flags if they have not
been parsed already.

Change-Id: Id9f8c31c5f90614e3f34c63d1a32cf7e9055d68e
Reviewed-on: https://go-review.googlesource.com/16739
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agotest: really force heap profile update in heapsampling.go
Austin Clements [Thu, 12 Nov 2015 17:24:36 +0000 (12:24 -0500)]
test: really force heap profile update in heapsampling.go

The heap profile is only guaranteed to be up-to-date after two GC
cycles, so force two GCs instead of just one.

Updates #13098.

Change-Id: I4fb9287b698f4a3b90b8af9fc6a2efb3b082bfe5
Reviewed-on: https://go-review.googlesource.com/16848
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
9 years agoruntime/internal/atomic: delete arch1_*.go files
Michael Matloob [Thu, 12 Nov 2015 17:09:29 +0000 (12:09 -0500)]
runtime/internal/atomic: delete arch1_*.go files

I made a copy of the per-arch _CacheLineSize definitons when checking in
runtime/internal/atomic. Now that runtime/internal/sys is checked in,
we can use the definition there.

Change-Id: I7242f6b633e4164f033b67ff471416b9d71c64d2
Reviewed-on: https://go-review.googlesource.com/16847
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: make SIGPROF skip stacks that are being copied
Austin Clements [Wed, 11 Nov 2015 20:34:54 +0000 (15:34 -0500)]
runtime: make SIGPROF skip stacks that are being copied

sigprof tracebacks the stack across systemstack switches to make
profile tracebacks more complete. However, it does this even if the
user stack is currently being copied, which means it may be in an
inconsistent state that will cause the traceback to panic.

One specific way this can happen is during stack shrinking. Some
goroutine blocks for STW, then enters gchelper, which then assists
with root marking. If that root marking happens to pick the original
goroutine and its stack needs to be shrunk, it will begin to copy that
stack. During this copy, the stack is generally inconsistent and, in
particular, the actual locations of the stack barriers and their
recorded locations are temporarily out of sync. If a SIGPROF happens
during this inconsistency, it will walk the stack all the way back to
the blocked goroutine and panic when it fails to unwind the stack
barriers.

Fix this by disallowing jumping to the user stack during SIGPROF if
that user stack is in the process of being copied.

Fixes #12932.

Change-Id: I9ef694c2c01e3653e292ce22612418dd3daff1b4
Reviewed-on: https://go-review.googlesource.com/16819
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoRevert "cmd/go: use shallow clones for new git checkouts"
Burcu Dogan [Wed, 11 Nov 2015 23:45:09 +0000 (15:45 -0800)]
Revert "cmd/go: use shallow clones for new git checkouts"

This reverts commit bc1f9d20b40998b87c9a5f56f2b22595de65c2d4.

The current go-get strategy doesn't support cases that servers
cannot handle shallow clients.

Also, `go get -u` is broken and is not compatible with already
go-getted unshallow repos.

Fixes #13213.
Fixes #13206.

Change-Id: Ie89d7603d96d323db64ad82997793fda0972f709
Reviewed-on: https://go-review.googlesource.com/16832
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/compile: delete the runtime_internal_atomic.go builtin defs file
Michael Matloob [Thu, 12 Nov 2015 15:44:37 +0000 (10:44 -0500)]
cmd/compile: delete the runtime_internal_atomic.go builtin defs file

The file was automatically placed in the cl by a tool I had built.
Since the compiler doesn't hook into the atomic package, it's unnecessary.

Change-Id: I631fd876813b381bb12604865b00fc5b268dce84
Reviewed-on: https://go-review.googlesource.com/16844
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agomisc/sortac: add tool to sort the AUTHORS and CONTRIBUTORS files
Brad Fitzpatrick [Thu, 12 Nov 2015 11:50:24 +0000 (11:50 +0000)]
misc/sortac: add tool to sort the AUTHORS and CONTRIBUTORS files

I keep losing this utility, used as part of other tools to auto-update
the AUTHORS and CONTRIBUTORS files.  Check it in to the repo so I
don't lose it, and so others can use it as well.

Updates #12042

Change-Id: Ib5886b85799087aaaddcec4c81169e2726322c05
Reviewed-on: https://go-review.googlesource.com/16824
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/dist: remove race binaries when rebuilding everything
Russ Cox [Thu, 12 Nov 2015 16:28:07 +0000 (11:28 -0500)]
cmd/dist: remove race binaries when rebuilding everything

Fixes #13214.

Change-Id: Id8fbb252b8beadb0b41f839dcd85d6165dea86a3
Reviewed-on: https://go-review.googlesource.com/16845
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: break out system-specific constants into package sys
Michael Matloob [Wed, 11 Nov 2015 17:39:30 +0000 (12:39 -0500)]
runtime: break out system-specific constants into package sys

runtime/internal/sys will hold system-, architecture- and config-
specific constants.

Updates #11647

Change-Id: I6db29c312556087a42e8d2bdd9af40d157c56b54
Reviewed-on: https://go-review.googlesource.com/16817
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agotest: force heap profile update in heapsampling.go test
Austin Clements [Thu, 12 Nov 2015 16:30:26 +0000 (11:30 -0500)]
test: force heap profile update in heapsampling.go test

The heapsampling.go test occasionally fails on some architectures
because it finds zero heap samples in main.alloc. This happens because
the byte and object counts are only updated at a GC. Hence, if a GC
happens part way through allocInterleaved, but then doesn't happen
after we start calling main.alloc, checkAllocations will see buckets
for the lines in main.alloc (which are created eagerly), but the
object and byte counts will be zero.

Fix this by forcing a GC to update the profile before we collect it.

Fixes #13098.

Change-Id: Ia7a9918eea6399307f10499dd7abefd4f6d13cf6
Reviewed-on: https://go-review.googlesource.com/16846
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
9 years agocmd/go: subdirs of runtime other than runtime/internal do depend on runtime
Ian Lance Taylor [Thu, 12 Nov 2015 07:13:14 +0000 (23:13 -0800)]
cmd/go: subdirs of runtime other than runtime/internal do depend on runtime

Correct an error in the last change: it caused runtime/cgo and
runtime/race to not depend on runtime.

Fixes #13214.

Change-Id: Ib48b3b5e9a74567ddfaccb7ab4a897ee2aedc2b8
Reviewed-on: https://go-review.googlesource.com/16837
Reviewed-by: Michael Matloob <matloob@golang.org>
9 years agoA+C: alter email-address description to cover more than two
Ralph Corderoy [Thu, 12 Nov 2015 13:00:57 +0000 (13:00 +0000)]
A+C: alter email-address description to cover more than two

Explictly list the alternative formats in each file.  In AUTHORS, refer
to CONTRIBUTORS' definition of multiple email addresses.  Indent with
four spaces;  AUTHORS used a tab, but CONTRIBUTORS used four spaces.
s/Rietveld/Gerrit/

Change the tab separating Sebastien Binet from his email address,
added in 2010's 18b02f6c.

Change-Id: Id52228ae6b62dd88ad8098110c22373bf14e068f
Reviewed-on: https://go-review.googlesource.com/16826
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: fix vet warning about println
Matthew Dempsky [Thu, 12 Nov 2015 04:49:37 +0000 (20:49 -0800)]
runtime: fix vet warning about println

lfstack.go:19: println call ends with newline

Change-Id: I2a903eef80a5300e9014999c2f0bc5d40ed5c735
Reviewed-on: https://go-review.googlesource.com/16836
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoruntime: fix vet warning about +build rule
Matthew Dempsky [Thu, 12 Nov 2015 04:47:25 +0000 (20:47 -0800)]
runtime: fix vet warning about +build rule

cgo_ppc64x.go:7: +build comment must appear before package clause and be followed by a blank line

Change-Id: Ib6dedddae70cc75dc3f137eb37ea338a64f8b595
Reviewed-on: https://go-review.googlesource.com/16835
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agodoc: update go1.6.txt
Shenghou Ma [Thu, 12 Nov 2015 05:08:09 +0000 (00:08 -0500)]
doc: update go1.6.txt

Change-Id: I9161c4a7e747d35ad7643b8cf0fe8b66eaea963b
Reviewed-on: https://go-review.googlesource.com/16842
Reviewed-by: Minux Ma <minux@golang.org>
9 years agocmd/dist: added support for GOARCH=mips64{,le}
Yao Zhang [Thu, 10 Sep 2015 14:16:45 +0000 (10:16 -0400)]
cmd/dist: added support for GOARCH=mips64{,le}

Change-Id: I22ea3352ad0794fc611334c2f2ec5f1e894985ce
Reviewed-on: https://go-review.googlesource.com/14460
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
9 years agotest: fix nosplit.go, fixedbugs/issue11656.go and skip two tests for mips64{,le}
Yao Zhang [Mon, 28 Sep 2015 21:30:32 +0000 (17:30 -0400)]
test: fix nosplit.go, fixedbugs/issue11656.go and skip two tests for mips64{,le}

Skip fixedbugs/issue10607.go because external linking is not supported
yet.

Skip nilptr3.go because of issue #9058 (same as ppc64).

Change-Id: Ib3dfbd9a03ee4052871cf57c74b3cc5e745e1f80
Reviewed-on: https://go-review.googlesource.com/14461
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoruntime/debug: skip TestFreeOSMemory for mips64{,le}
Yao Zhang [Thu, 10 Sep 2015 15:33:48 +0000 (11:33 -0400)]
runtime/debug: skip TestFreeOSMemory for mips64{,le}

Change-Id: I419f3b8bf1bddffd4a775b0cd7b98f0239fe19cb
Reviewed-on: https://go-review.googlesource.com/14458
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agointernal/syscall/unix: added support for linux/mips64{,le}
Yao Zhang [Thu, 10 Sep 2015 15:33:39 +0000 (11:33 -0400)]
internal/syscall/unix: added support for linux/mips64{,le}

Change-Id: Ib6f168b6a2daf3befbf75b4b95967ff91ac95d12
Reviewed-on: https://go-review.googlesource.com/14456
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet/http: fixed TestLinuxSendfile for mips64
Yao Zhang [Thu, 10 Sep 2015 15:33:31 +0000 (11:33 -0400)]
net/http: fixed TestLinuxSendfile for mips64

mips64 strace doesn't support sendfile64 and will error out if we
specify that with `-e trace='. So we use sendfile for mips64 here.

Change-Id: If5e2bb39866ca3a77dcc40e4db338ba486921d89
Reviewed-on: https://go-review.googlesource.com/14455
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agohash/crc32: added mips64{,le} build tags
Yao Zhang [Thu, 10 Sep 2015 15:33:26 +0000 (11:33 -0400)]
hash/crc32: added mips64{,le} build tags

Change-Id: I77c6768fff6f0163b36800307c4d573bb6521fe5
Reviewed-on: https://go-review.googlesource.com/14454
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agodebug/elf: added MIPS ELF relocations
Yao Zhang [Thu, 10 Sep 2015 13:15:19 +0000 (09:15 -0400)]
debug/elf: added MIPS ELF relocations

Change-Id: I05352749a852095baae2f67fd71ffcf5f727538d
Reviewed-on: https://go-review.googlesource.com/14453
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoreflect: added support for mips64{,le}
Yao Zhang [Thu, 10 Sep 2015 01:47:09 +0000 (21:47 -0400)]
reflect: added support for mips64{,le}

Change-Id: I84ced3734410d3d05f195901f44d33f4ae6036b1
Reviewed-on: https://go-review.googlesource.com/14452
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agomath, math/big: added support for mips64{,le}
Yao Zhang [Thu, 10 Sep 2015 02:39:45 +0000 (22:39 -0400)]
math, math/big: added support for mips64{,le}

Change-Id: I5129a5b9dbbc57d97da723c2fc247bd28f951817
Reviewed-on: https://go-review.googlesource.com/14451
Reviewed-by: Minux Ma <minux@golang.org>
9 years agosync/atomic: added support for mips64{,le}
Yao Zhang [Thu, 10 Sep 2015 12:08:48 +0000 (08:08 -0400)]
sync/atomic: added support for mips64{,le}

Change-Id: Ibe6c345afd4cbae7e2542a350043fbb6b81d5678
Reviewed-on: https://go-review.googlesource.com/14450
Reviewed-by: Minux Ma <minux@golang.org>
9 years agosyscall: added support for linux/mips64{,le}
Yao Zhang [Thu, 10 Sep 2015 12:48:19 +0000 (08:48 -0400)]
syscall: added support for linux/mips64{,le}

Syscall getdents64 is relatively new in linux/mips64, only since kernel
version 3.10. To support older kernel, syscall getdents is used for
mips64.

Change-Id: I892b05dff7d93e7ddb0d700abd6a5e6d4084ab4c
Reviewed-on: https://go-review.googlesource.com/14449
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
9 years agosyscall: added machine-generated code for linux/mips64{,le}
Yao Zhang [Thu, 10 Sep 2015 12:50:57 +0000 (08:50 -0400)]
syscall: added machine-generated code for linux/mips64{,le}

Change-Id: I574a2b702bb3db596f890ae7b18fb4bc1fd358d5
Reviewed-on: https://go-review.googlesource.com/14448
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoruntime: restructured signal_linux.go, added signal table for mips64.
Yao Zhang [Thu, 24 Sep 2015 12:56:15 +0000 (08:56 -0400)]
runtime: restructured signal_linux.go, added signal table for mips64.

Linux/mips64 uses a different signal table. To avoid code copying,
signal table is factored out from signal_linux.go to
sigtab_linux_generic.go. And a mips64-specific version is added.

Change-Id: I842d7a7467c330bf772855fde01aecc77a42316b
Reviewed-on: https://go-review.googlesource.com/14993
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: renamed os2_linux.go to os2_linux_generic.go, added mips64 support
Yao Zhang [Thu, 24 Sep 2015 12:50:13 +0000 (08:50 -0400)]
runtime: renamed os2_linux.go to os2_linux_generic.go, added mips64 support

Linux/mips64 has a different sigset type and some different constants.
os2_linux.go is renamed to os2_linux_generic.go, and not used in mips64.
The corresponding file os2_linux_mips64x.go is added.

Change-Id: Ief83845a2779f7fe048d236d3c7da52b627ab533
Reviewed-on: https://go-review.googlesource.com/14992
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoruntime: restructured os1_linux.go, added mips64 support
Yao Zhang [Thu, 24 Sep 2015 12:42:10 +0000 (08:42 -0400)]
runtime: restructured os1_linux.go, added mips64 support

Linux/mips64 uses a different type of sigset. To deal with it, related
functions in os1_linux.go is refactored to os1_linux_generic.go
(used for non-mips64 architectures), and os1_linux_mips64x.go (only used
in mips64{,le}), to avoid code copying.

Change-Id: I5cadfccd86bfc4b30bf97e12607c3c614903ea4c
Reviewed-on: https://go-review.googlesource.com/14991
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: added mips64{,le} build tags and GOARCH cases
Yao Zhang [Wed, 23 Sep 2015 22:58:05 +0000 (18:58 -0400)]
runtime: added mips64{,le} build tags and GOARCH cases

Change-Id: I381c03d957a0dccae5f655f02e92760e5c0e9629
Reviewed-on: https://go-review.googlesource.com/14929
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoruntime: updated automatically generated zgoarch_*.go
Yao Zhang [Wed, 23 Sep 2015 19:30:40 +0000 (15:30 -0400)]
runtime: updated automatically generated zgoarch_*.go

files for unsupported architectures are deleted, as it would require
changing cmd/dist to recognize their names as build tags (probably
need a separated CL).

Change-Id: Ifd164b014867d39b4924d1b859fb84317dce4ab0
Reviewed-on: https://go-review.googlesource.com/14928
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoruntime: added go files for linux/mips64{,le} support
Yao Zhang [Thu, 10 Sep 2015 15:21:57 +0000 (11:21 -0400)]
runtime: added go files for linux/mips64{,le} support

Change-Id: I14b537922b97d4bce9e0523d98a822da906348f1
Reviewed-on: https://go-review.googlesource.com/14447
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoruntime: added go files for mips64 architecture support
Yao Zhang [Wed, 23 Sep 2015 18:05:16 +0000 (14:05 -0400)]
runtime: added go files for mips64 architecture support

Change-Id: Ia496470e48b3c5d39fb9fef99fac356dfb73a949
Reviewed-on: https://go-review.googlesource.com/14927
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoruntime/internal/atomic: added mips64 support.
Yao Zhang [Thu, 12 Nov 2015 04:05:06 +0000 (23:05 -0500)]
runtime/internal/atomic: added mips64 support.

Change-Id: I2eaf0658771a0ff788429e2f503d116531166315
Reviewed-on: https://go-review.googlesource.com/16834
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoruntime: added assembly part of linux/mips64{,le} support
Yao Zhang [Thu, 10 Sep 2015 15:25:58 +0000 (11:25 -0400)]
runtime: added assembly part of linux/mips64{,le} support

Change-Id: I9e94027ef66c88007107de2b2b75c3d7cf1352af
Reviewed-on: https://go-review.googlesource.com/14467
Reviewed-by: Minux Ma <minux@golang.org>
9 years agocmd/cgo: added support for GOARCH=mips64{,le}
Yao Zhang [Thu, 10 Sep 2015 15:33:17 +0000 (11:33 -0400)]
cmd/cgo: added support for GOARCH=mips64{,le}

The actual cgo is not supported for now. This is just the cgo command.

Change-Id: I25625100ee552971f47e681b7d613cba16a2132f
Reviewed-on: https://go-review.googlesource.com/14446
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
9 years agocmd/compile: added support for mips64{,le}
Yao Zhang [Thu, 10 Sep 2015 15:33:09 +0000 (11:33 -0400)]
cmd/compile: added support for mips64{,le}

It is based on ppc64 compiler.

Change-Id: I15a101df05f2919ba5292136957ba0009227d067
Reviewed-on: https://go-review.googlesource.com/14445
Reviewed-by: Minux Ma <minux@golang.org>
9 years agocmd/link: added support for mips64{,le}
Yao Zhang [Thu, 10 Sep 2015 15:32:49 +0000 (11:32 -0400)]
cmd/link: added support for mips64{,le}

Only internal linking without cgo is supported for now.

Change-Id: Ie6074a8ff3ec13605b72028f2d60758034f87185
Reviewed-on: https://go-review.googlesource.com/14444
Reviewed-by: Minux Ma <minux@golang.org>
9 years agocmd/asm: added support for GOARCH=mips64{,le}
Yao Zhang [Thu, 10 Sep 2015 15:32:32 +0000 (11:32 -0400)]
cmd/asm: added support for GOARCH=mips64{,le}

Change-Id: I951387f88993715e86b6ab9f18d38ed5c691ee0f
Reviewed-on: https://go-review.googlesource.com/14443
Reviewed-by: Minux Ma <minux@golang.org>
9 years agocmd/internal/obj/mips: added support for GOARCH=mips64{,le}
Yao Zhang [Thu, 10 Sep 2015 15:13:00 +0000 (11:13 -0400)]
cmd/internal/obj/mips: added support for GOARCH=mips64{,le}

MIPS64 has 32 general purpose 64-bit integer registers (R0-R31), 32
64-bit floating point registers (F0-F31). Instructions are fixed-width,
and are 32-bit wide. Instructions are all in standard 1-, 2-, 3-operand
forms.

MIPS64-specific relocations are added. For this reason, test data of
cmd/newlink are regenerated.

No other changes are made to portable structures.

Branch delay slots are current filled with NOP instructions. The function
for instruction scheduling (try to fill the delay slot with a useful
instruction) is implemented but disabled for now.

Change-Id: Ic364999c7a33245260c1381fc26a2fa8972d38b3
Reviewed-on: https://go-review.googlesource.com/14442
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoruntime: update comment that was missed in CL 6584
Matthew Dempsky [Thu, 12 Nov 2015 03:31:42 +0000 (19:31 -0800)]
runtime: update comment that was missed in CL 6584

Change-Id: Ie5f70af7e673bb2c691a45c28db2c017e6cddd4f
Reviewed-on: https://go-review.googlesource.com/16833
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoruntime: rewrite lots of foo_Bar(f, ...) into f.bar(...)
Matthew Dempsky [Thu, 12 Nov 2015 00:13:51 +0000 (16:13 -0800)]
runtime: rewrite lots of foo_Bar(f, ...) into f.bar(...)

Applies to types fixAlloc, mCache, mCentral, mHeap, mSpan, and
mSpanList.

Two special cases:

1. mHeap_Scavenge() previously didn't take an *mheap parameter, so it
was specially handled in this CL.

2. mHeap_Free() would have collided with mheap's "free" field, so it's
been renamed to (*mheap).freeSpan to parallel its underlying
(*mheap).freeSpanLocked method.

Change-Id: I325938554cca432c166fe9d9d689af2bbd68de4b
Reviewed-on: https://go-review.googlesource.com/16221
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoruntime: run TestCgoExternalThreadSIGPROF on ppc64le
Michael Hudson-Doyle [Thu, 12 Nov 2015 00:05:49 +0000 (13:05 +1300)]
runtime: run TestCgoExternalThreadSIGPROF on ppc64le

It was disabled because of the lack of external linking.

Change-Id: Iccb4a4ef8c57d048d53deabe4e0f4e6b9dccce33
Reviewed-on: https://go-review.googlesource.com/16797
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: handle linking against a shared library that implicitly includes a package
Michael Hudson-Doyle [Tue, 27 Oct 2015 00:36:11 +0000 (13:36 +1300)]
cmd/go: handle linking against a shared library that implicitly includes a package

If you say "go install -buildmode=shared a b" and package a depends on another
package c, package c is implicitly included in the resulting shared library (as
specified by "Go Execution Modes"). But if c depends on b, linking against this
shared library hangs, because the go tool doesn't know when computing c's
dependencies that c is part of the same shared library as c.

Fix this by tracking the shared library a package *is* in separately from the
shared library a package has been explicitly linked into.

Fixes #13044

Change-Id: Iacfedab24ae9731ed53d225678b447a2a888823c
Reviewed-on: https://go-review.googlesource.com/16338
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile/internal/x86: avoid CX in a couple of places in the int64 code
Michael Hudson-Doyle [Tue, 27 Oct 2015 21:40:46 +0000 (10:40 +1300)]
cmd/compile/internal/x86: avoid CX in a couple of places in the int64 code

I want to use CX as a scratch register in position independent code and these
uses are easy to remove.

Change-Id: I9e3cb470d7f0000d85786c30bd769d9ec86d532a
Reviewed-on: https://go-review.googlesource.com/16382
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/link: fix size of filetab slice
Michael Hudson-Doyle [Tue, 27 Oct 2015 01:49:51 +0000 (14:49 +1300)]
cmd/link: fix size of filetab slice

The linker writes the number of file symbols (Nhistfile) to the filetab slice
and then Nhistfile offsets -- which means the slice contains Nhistfile+1
entries, not just Nhistfile.

I think this bug has been around since at least 1.4 but it's easier to trigger
with shared libraries and a tiny binary that only has a couple of functions in
it -- try go install -buildmode=shared std && go run -linkshared test/fixedbugs/issue4388.go.

Change-Id: I6c0f01f1e607b9b2b96872e37ffce81281911504
Reviewed-on: https://go-review.googlesource.com/16342
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: add syscalls needed for android/386 logging
Hyang-Ah Hana Kim [Thu, 5 Nov 2015 21:35:24 +0000 (16:35 -0500)]
runtime: add syscalls needed for android/386 logging

Update golang/go#9327.

Change-Id: I27ef973190d9ae652411caf3739414b5d46ca7d2
Reviewed-on: https://go-review.googlesource.com/16679
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agocmd,runtime: TLS setup for android/386
Hyang-Ah Hana Kim [Thu, 5 Nov 2015 21:32:27 +0000 (16:32 -0500)]
cmd,runtime: TLS setup for android/386

Same ugly hack as https://go-review.googlesource.com/15991.

Update golang/go#9327.

Change-Id: I58284e83268a15de95eabc833c3e01bf1e3faa2e
Reviewed-on: https://go-review.googlesource.com/16678
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agoruntime: remove unused marking parfor
Austin Clements [Wed, 11 Nov 2015 01:12:37 +0000 (20:12 -0500)]
runtime: remove unused marking parfor

The GC now handles the root marking jobs as part of general marking,
so work.markfor is no longer used.

Change-Id: I6c3b23fed27e4e7ea6430d6ca7ba25ae4d04ed14
Reviewed-on: https://go-review.googlesource.com/16811
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: never allocate new M when jumping time forward
Austin Clements [Tue, 10 Nov 2015 20:24:59 +0000 (15:24 -0500)]
runtime: never allocate new M when jumping time forward

When we're jumping time forward, it means everyone is asleep, so there
should always be an M available. Furthermore, this causes both
allocation and write barriers in contexts that may be running without
a P (such as in sysmon).

Hence, replace this allocation with a throw.

Updates #10600.

Change-Id: I2cee70d5db828d0044082878995949edb25dda5f
Reviewed-on: https://go-review.googlesource.com/16815
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: replace traceBuf slice with index
Austin Clements [Tue, 10 Nov 2015 19:58:51 +0000 (14:58 -0500)]
runtime: replace traceBuf slice with index

Currently traceBuf keeps track of where it is in the trace buffer by
also maintaining a slice that points in to this buffer with an initial
length of 0 and a cap of the length of the array. All writes to this
buffer are done by appending to the slice (as long as the bounds
checks are right, it will never overflow and the append won't allocate
a new slice).

Each of these appends generates a write barrier. As long as we never
overflow the buffer, this write barrier won't fire, but this wreaks
havoc with eliminating write barriers from the tracing code. If we
were to overflow the buffer, this would both allocate and invoke a
write barrier, both things that are dicey at best to do in many of the
contexts tracing happens. It also wastes space in the traceBuf and
leads to more complex code and more complex generated code.

Replace this slice trick with keeping track of a simple array
position.

Updates #10600.

Change-Id: I0a63eecec1992e195449f414ed47653f66318d0e
Reviewed-on: https://go-review.googlesource.com/16814
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
9 years agoruntime: eliminate traceStack write barriers
Austin Clements [Tue, 10 Nov 2015 21:43:33 +0000 (16:43 -0500)]
runtime: eliminate traceStack write barriers

This replaces *traceStack with traceStackPtr, much like the preceding
commit.

Updates #10600.

Change-Id: Ifadc35eb37a405ae877f9740151fb31a0ca1d08f
Reviewed-on: https://go-review.googlesource.com/16813
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
9 years agoruntime: eliminate traceBuf write barriers
Austin Clements [Tue, 10 Nov 2015 19:37:52 +0000 (14:37 -0500)]
runtime: eliminate traceBuf write barriers

The tracing code is currently called from contexts such as sysmon and
the scheduler where write barriers are not allowed. Unfortunately,
while the common paths through the tracing code do not have write
barriers, many of the less common paths dealing with buffer overflow
and recycling do.

This change replaces all *traceBufs with traceBufPtrs. In the style of
guintptr, etc., the GC does not trace traceBufPtrs and write barriers
do not apply when these pointers are written. Since traceBufs are
allocated from non-GC'd memory and manually managed, this is always
safe.

Updates #10600.

Change-Id: I52b992d36d1b634ebd855c8cde27947ec14f59ba
Reviewed-on: https://go-review.googlesource.com/16812
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
9 years agodoc: update go1.6.txt
Brad Fitzpatrick [Wed, 11 Nov 2015 16:01:41 +0000 (16:01 +0000)]
doc: update go1.6.txt

Mention shallow clones.

Fixes #13204

Change-Id: I0ed9d4e829d388425beba0d64e6889d16d4bb173
Reviewed-on: https://go-review.googlesource.com/16822
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: fix use of xadd64
Austin Clements [Wed, 11 Nov 2015 15:23:44 +0000 (10:23 -0500)]
runtime: fix use of xadd64

Commit 7407d8e was rebased over the switch to runtime/internal/atomic
and introduced a call to xadd64, which no longer exists. Fix that
call.

Change-Id: I99c93469794c16504ae4a8ffe3066ac382c66a3a
Reviewed-on: https://go-review.googlesource.com/16816
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agoruntime: fix over-aggressive proportional sweep
Austin Clements [Fri, 30 Oct 2015 18:25:28 +0000 (14:25 -0400)]
runtime: fix over-aggressive proportional sweep

Currently, sweeping is performed before allocating a span by charging
for the entire size of the span requested, rather than the number of
bytes actually available for allocation from the returned span. That
is, if the returned span is 8K, but already has 6K in use, the mutator
is charged for 8K of heap allocation even though it can only allocate
2K more from the span. As a result, proportional sweep is
over-aggressive and tends to finish much earlier than it needs to.
This effect is more amplified by fragmented heaps.

Fix this by reimbursing the mutator for the used space in a span once
it has allocated that span. We still have to charge up-front for the
worst-case because we don't know which span the mutator will get, but
at least we can correct the over-charge once it has a span, which will
go toward later span allocations.

This has negligible effect on the throughput of the go1 benchmarks and
the garbage benchmark.

Fixes #12040.

Change-Id: I0e23e7a4ccf126cca000fed5067b20017028dd6b
Reviewed-on: https://go-review.googlesource.com/16515
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agocmd/go: use shallow clones for new git checkouts
Meng Zhuo [Tue, 27 Oct 2015 07:36:38 +0000 (15:36 +0800)]
cmd/go: use shallow clones for new git checkouts

Currently go get will clone the full history of git repos.
We can improve the download waiting time/size by passing depth argument.

The docs about shallow clones and the --depth argument are here:
https://git-scm.com/docs/git-clone
https://git-scm.com/docs/git-pull

Fixes #13078

Change-Id: Ie891d905d9c77f6ecadf7dcd5b44b477f4e079e0
Reviewed-on: https://go-review.googlesource.com/16360
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: don't call msanread when running on the system stack
Ian Lance Taylor [Wed, 4 Nov 2015 20:30:30 +0000 (12:30 -0800)]
runtime: don't call msanread when running on the system stack

The runtime is not instrumented, but the calls to msanread in the
runtime can sometimes refer to the system stack.  An example is the call
to copy in stkbucket in mprof.go.  Depending on what C code has done,
the system stack may appear uninitialized to msan.

Change-Id: Ic21705b9ac504ae5cf7601a59189302f072e7db1
Reviewed-on: https://go-review.googlesource.com/16660
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agoruntime: mark cgo callback results as written for msan
Ian Lance Taylor [Wed, 4 Nov 2015 01:15:30 +0000 (17:15 -0800)]
runtime: mark cgo callback results as written for msan

This is a fix for the -msan option when using cgo callbacks.  A cgo
callback works by writing out C code that puts a struct on the stack and
passes the address of that struct into Go.  The result parameters are
fields of the struct.  The Go code will write to the result parameters,
but the Go code thinks it is just writing into the Go stack, and
therefore won't call msanwrite.  This CL adds a call to msanwrite in the
cgo callback code so that the C knows that results were written.

Change-Id: I80438dbd4561502bdee97fad3f02893a06880ee1
Reviewed-on: https://go-review.googlesource.com/16611
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agoruntime: clean up park messages
Austin Clements [Fri, 30 Oct 2015 02:40:36 +0000 (22:40 -0400)]
runtime: clean up park messages

This changes "mark worker (idle)" to "GC worker (idle)" so it's more
clear to users that these goroutines are GC-related. It changes "GC
assist" to "GC assist wait" to make it clear that the assist is
blocked.

Change-Id: Iafbc0903c84f9250ff6bee14baac6fcd4ed5ef76
Reviewed-on: https://go-review.googlesource.com/16511
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agoruntime: free stack spans outside STW
Austin Clements [Tue, 27 Oct 2015 21:48:18 +0000 (17:48 -0400)]
runtime: free stack spans outside STW

We couldn't do this before this point because it must be done before
the next GC cycle starts. Hence, if it delayed the start of the next
cycle, that would widen the window between reaching the heap trigger
of the next cycle and starting the next GC cycle, during which the
mutator could over-allocate. With the decentralized GC, any mutators
that reach the heap trigger will block on the GC starting, so it's
safe to widen the time between starting the world and being able to
start the next GC cycle.

Fixes #11465.

Change-Id: Ic7ea7e9eba5b66fc050299f843a9c9001ad814aa
Reviewed-on: https://go-review.googlesource.com/16394
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agomisc/cgo/test: disable Test10303 for gccgo
Ian Lance Taylor [Tue, 10 Nov 2015 18:39:38 +0000 (10:39 -0800)]
misc/cgo/test: disable Test10303 for gccgo

When using gccgo it's OK if a pointer passed to C remains on the stack.
Gccgo does not have the clear distinction between C and Go stacks.

Change-Id: I3af9dd6fe078214ab16d9d8dad2d206608d7891d
Reviewed-on: https://go-review.googlesource.com/16774
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
9 years agocmd/cgo, runtime: add checks for passing pointers from Go to C
Ian Lance Taylor [Fri, 16 Oct 2015 22:26:00 +0000 (15:26 -0700)]
cmd/cgo, runtime: add checks for passing pointers from Go to C

This implements part of the proposal in issue 12416 by adding dynamic
checks for passing pointers from Go to C.  This code is intended to be
on at all times.  It does not try to catch every case.  It does not
implement checks on calling Go functions from C.

The new cgo checks may be disabled using GODEBUG=cgocheck=0.

Update #12416.

Change-Id: I48de130e7e2e83fb99a1e176b2c856be38a4d3c8
Reviewed-on: https://go-review.googlesource.com/16003
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocrypto/tls: len(clientRandom) used for serverRandom source
Ralph Corderoy [Sat, 7 Nov 2015 11:45:00 +0000 (11:45 +0000)]
crypto/tls: len(clientRandom) used for serverRandom source

In keysFromMasterSecret(), don't copy from serverRandom into
seed[:len(clientRandom)].  Actually, switch from an array to a slice in
keysFromMasterSecret() and masterFromPreMasterSecret() so the length
need not be given;  that's how it's done elsewhere in the file.

Fixes #13181

Change-Id: I92abaa892d1bba80c2d4f12776341cda7d538837
Reviewed-on: https://go-review.googlesource.com/16697
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
9 years agocrypto/tls: don't send IP literals as SNI values.
Adam Langley [Tue, 10 Nov 2015 19:18:50 +0000 (11:18 -0800)]
crypto/tls: don't send IP literals as SNI values.

(This relands commit a4dcc692011bf1ceca9b1a363fd83f3e59e399ee.)

https://tools.ietf.org/html/rfc6066#section-3 states:

  “Literal IPv4 and IPv6 addresses are not permitted in "HostName".”

However, if an IP literal was set as Config.ServerName (which could
happen as easily as calling Dial with an IP address) then the code would
send the IP literal as the SNI value.

This change filters out IP literals, as recognised by net.ParseIP, from
being sent as the SNI value.

Fixes #13111.

Change-Id: I6e544a78a01388f8fe98150589d073b917087f75
Reviewed-on: https://go-review.googlesource.com/16776
Run-TryBot: Adam Langley <agl@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocrypto/elliptic,crypto/ecdsa: P256 amd64 assembly
Vlad Krasnov [Fri, 17 Apr 2015 13:10:35 +0000 (06:10 -0700)]
crypto/elliptic,crypto/ecdsa: P256 amd64 assembly

This is based on the implementation used in OpenSSL, from a
submission by Shay Gueron and myself. Besides using assembly,
this implementation employs several optimizations described in:

    S.Gueron and V.Krasnov, "Fast prime field elliptic-curve
                             cryptography with 256-bit primes"

In addition a new and improved modular inverse modulo N is
implemented here.

The performance measured on a Haswell based Macbook Pro shows 21X
speedup for the sign and 9X for the verify operations.
The operation BaseMult is 30X faster (and the Diffie-Hellman/ECDSA
key generation that use it are sped up as well).

The adaptation to Go with the help of Filippo Valsorda

Updated the submission for faster verify/ecdh, fixed some asm syntax
and API problems and added benchmarks.

Change-Id: I86a33636747d5c92f15e0c8344caa2e7e07e0028
Reviewed-on: https://go-review.googlesource.com/8968
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>