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

24054 Commits

Author SHA1 Message Date
Dmitry Vyukov
9f1c78781b cmd/cgo: fix line info in _cgo_gotypes.go
Don't write line info for types, we don't have it.
Otherwise types look like:

type _Ctype_struct_cb struct {
//line :1
      on_test *[0]byte
//line :1
}

Which is not useful. Moreover we never override source info,
so subsequent source code uses the same source info.
Moreover, empty file name makes compile emit no source debug info at all.

Update #17190

Change-Id: I7ae6fa4964520d7665743d340419b787df0b51e8
Reviewed-on: https://go-review.googlesource.com/29713
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-25 12:16:44 +00:00
Dmitry Vyukov
c14050646f runtime: fix newextram PC passed to race detector
PC passed to racegostart is expected to be a return PC
of the go statement. Race runtime will subtract 1 from the PC
before symbolization. Passing start PC of a function is wrong.
Add sys.PCQuantum to the function start PC.

Update #17190

Change-Id: Ia504c49e79af84ed4ea360c2aea472b370ea8bf5
Reviewed-on: https://go-review.googlesource.com/29712
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-25 12:15:40 +00:00
Jaana Burcu Dogan
893edc9b3f net/http/httptrace: remove the mention of http client
This sentence is partially guilty why httptrace is considered as an
http.Client tracing package. Removing the mention.

Updates #17152.

Change-Id: I69f78a6e10817db933f44e464a949ae896e44ec6
Reviewed-on: https://go-review.googlesource.com/29755
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-25 05:25:00 +00:00
Ian Lance Taylor
159a90b93a runtime: merge Unix sighandler functions
Replace all the Unix sighandler functions with a single instance.
Push the relatively small amount of processor-specific code into five
methods on sigctxt: sigpc, sigsp, siglr, fault, preparePanic.
(Some processors already had a fault method.)

Change-Id: Ib459412ff8f7e0f5ad06bfd43eb827c8b196fc32
Reviewed-on: https://go-review.googlesource.com/29752
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-25 03:55:33 +00:00
Kale Blankenship
890c09efb7 os: make IsExist report true on ERROR_DIR_NOT_EMPTY on Windows
Fixes #17164

Change-Id: I3e626d92293c1379e2922276f033fdee6f48dda3
Reviewed-on: https://go-review.googlesource.com/29753
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-25 02:38:11 +00:00
Keith Randall
60074b0fd3 runtime: remove TestCollisions from -short
Takes a bit too long to run it all the time.

Fixes #17217
Update #17104

Change-Id: I4802190ea16ee0f436a7f95b093ea0f995f5b11d
Reviewed-on: https://go-review.googlesource.com/29751
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-24 03:10:13 +00:00
Ian Lance Taylor
ab552aa3b6 runtime: unify some signal handling functions
Unify the OS-specific versions of msigsave, msigrestore, sigblock,
updatesigmask, and unblocksig into single versions in signal_unix.go.
To do this, make sigprocmask work the same way on all systems, which
required adding a definition of sigprocmask for linux and openbsd.
Also add a single OS-specific function sigmaskToSigset.

Change-Id: I7cbf75131dddb57eeefe648ef845b0791404f785
Reviewed-on: https://go-review.googlesource.com/29689
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-24 01:39:48 +00:00
David Crawshaw
fd296282e0 cmd/dist: enable plugin test on darwin/amd64
Change-Id: I6071881a5f7b9638bca0bfef76d6f4f45c9202a6
Reviewed-on: https://go-review.googlesource.com/29396
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-24 00:24:28 +00:00
David Crawshaw
96acfaaefa cmd/go: enable -buildmode=plugin on darwin/amd64
Change-Id: I8e594e059448879a9f451801064729186ac7c11b
Reviewed-on: https://go-review.googlesource.com/29395
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-24 00:05:35 +00:00
David Crawshaw
73e7a569b4 cmd/link: plugin support on darwin/amd64
This CL turns some special section marker symbols into real symbols
laid out in the sections they mark. This is to deal with the fact
that dyld on OS X resolves the section marker symbols in any dlopen-ed
Go program to the original section marker symbols in the host program.

More details in a comment in cmd/link/internal/ld/data.go.

Change-Id: Ie9451cfbf06d0bdcccb9959219c791b829f3f771
Reviewed-on: https://go-review.googlesource.com/29394
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-23 22:58:57 +00:00
Keith Randall
26a6131bac cmd/compile: fix 4-byte unaligned load rules
The 2-byte rule was firing before the 4-byte rule, preventing
the 4-byte rule from firing.  Update the 4-byte rule to use
the results of the 2-byte rule instead.

Add some tests to make sure we don't regress again.

Fixes #17147

Change-Id: Icfeccd9f2b96450981086a52edd76afb3191410a
Reviewed-on: https://go-review.googlesource.com/29382
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-09-23 19:32:37 +00:00
Michael Munday
120e9ff34f cmd/compile: recognize OpS390XLoweredNilCheck as a nil check in the scheduler
Before this change a nil check on s390x could be scheduled after the
target pointer has been dereferenced.

Change-Id: I7ea40a4b52f975739f6db183a2794be4981c4e3d
Reviewed-on: https://go-review.googlesource.com/29730
Run-TryBot: Michael Munday <munday@ca.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-09-23 17:15:36 +00:00
Lynn Boger
3311275ce8 math, cmd/internal/obj/ppc64: improve floor, ceil, trunc with asm
This adds the instructions frim, frip, and friz to the ppc64x
assembler for use in implementing the math.Floor, math.Ceil, and
math.Trunc functions to improve performance.

Fixes #17185

BenchmarkCeil-128                    21.4          6.99          -67.34%
BenchmarkFloor-128                   13.9          6.37          -54.17%
BenchmarkTrunc-128                   12.7          6.33          -50.16%

Change-Id: I96131bd4e8c9c8dbafb25bfeb544cf9d2dbb4282
Reviewed-on: https://go-review.googlesource.com/29654
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Michael Munday <munday@ca.ibm.com>
2016-09-23 13:03:08 +00:00
David Crawshaw
ed915ad421 runtime: use sched_yield instead of pthread_yield
Attempt to fix the linux-amd64-clang builder, which broke
with CL 29472.

Turns out pthread_yield is a non-portable Linux function, and
should have #define _GNU_SOURCE before #include <pthread.h>.
GCC doesn't complain about this, but Clang does:

	./raceprof.go:44:3: warning: implicit declaration of function 'pthread_yield' is invalid in C99 [-Wimplicit-function-declaration]

(Though the error, while explicable, certainly could be clearer.)

There is a portable POSIX equivalent, sched_yield, so this
CL uses it instead.

Change-Id: I58ca7a3f73a2b3697712fdb02e72a8027c391169
Reviewed-on: https://go-review.googlesource.com/29675
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-23 04:32:38 +00:00
David Crawshaw
b444d438c0 plugin: darwin support
Change-Id: I76981d1d83da401178226634d076371a04f5ccb7
Reviewed-on: https://go-review.googlesource.com/29392
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-23 02:16:42 +00:00
David Crawshaw
b4c9829c22 runtime: check plugin-loaded moduledata addresses
Inspired by difficulties with plugin support on darwin.

Change-Id: I2cef8410837946454e75d00e94e46791f03f2267
Reviewed-on: https://go-review.googlesource.com/29391
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-23 02:16:17 +00:00
Ian Lance Taylor
9d8522fdc7 cmd/compile: don't instrument copy and append in runtime
Instrumenting copy and append for the race detector changes them to call
different functions. In the runtime package the alternate functions are
not marked as nosplit. This caused a crash in the SIGPROF handler when
invoked on a non-Go thread in a program built with the race detector. In
some cases the handler can call copy, the race detector changed that to
a call to a non-nosplit function, the function tried to check the stack
guard, and crashed because it was running on a non-Go thread. The
SIGPROF handler is written carefully to avoid such problems, but hidden
function calls are difficult to avoid.

Fix this by changing the compiler to not instrument copy and append when
compiling the runtime package. Change the runtime package to add
explicit race checks for the only code I could find where copy is used
to write to user data (append is never used).

Change-Id: I11078a66c0aaa459a7d2b827b49f4147922050af
Reviewed-on: https://go-review.googlesource.com/29472
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2016-09-22 23:37:17 +00:00
Keith Randall
88d2f9112a cmd/compile: fix type of static closure pointer
var x *X = ...
  defer x.foo()

As part of the defer, we need to calculate &(*X).foo·f.  This expression
is the address of the static closure that will call (*X).foo when a
pointer to that closure is used in a call/defer/go.  This pointer is not
currently properly typed in SSA.  It is a pointer type, but the base
type is nil, not a proper type.

This turns out not to be a problem currently because we never use the
type of these SSA values.  But I'm trying to change that (to be able to
spill them) in CL 28391.  To fix, use uint8 as the fake type of the
closure.

Change-Id: Ieee388089c9af398ed772ee8c815122c347cb633
Reviewed-on: https://go-review.googlesource.com/29444
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-09-22 21:50:32 +00:00
Cherry Zhang
3dfb92f254 cmd/compile: ensure args are live in tail calls for LR machines
On link-register machines we uses RET (sym), instead of JMP (sym),
for tail call (so the assembler knows and may rewrite it to
restore link register if necessary). Add RET to the analysis.

Fixes #17186.
Fixes #16016 on link-register machines.

Change-Id: I8690ac57dd9d49beeea76a5f291988e9a1d3afe5
Reviewed-on: https://go-review.googlesource.com/29570
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-09-22 19:15:09 +00:00
Adam Langley
254169d7bb crypto/tls: fix deadlock when racing to complete handshake.
After renegotiation support was added (af125a5193) it's possible for a
Write to block on a Read when racing to complete the handshake:
   1. The Write determines that a handshake is needed and tries to
      take the neccesary locks in the correct order.
   2. The Read also determines that a handshake is needed and wins
      the race to take the locks.
   3. The Read goroutine completes the handshake and wins a race
      to unlock and relock c.in, which it'll hold when waiting for
      more network data.

If the application-level protocol requires the Write to complete before
data can be read then the system as a whole will deadlock.

Unfortunately it doesn't appear possible to reverse the locking order of
c.in and handshakeMutex because we might read a renegotiation request at
any point and need to be able to do a handshake without unlocking.

So this change adds a sync.Cond that indicates that a goroutine has
committed to doing a handshake. Other interested goroutines can wait on
that Cond when needed.

The test for this isn't great. I was able to reproduce the deadlock with
it only when building with -race. (Because -race happened to alter the
timing just enough.)

Fixes #17101.

Change-Id: I4e8757f7b82a84e46c9963a977d089f0fb675495
Reviewed-on: https://go-review.googlesource.com/29164
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-22 18:36:58 +00:00
Kale Blankenship
ad5d91c17a net/url: prefix relative paths containing ":" in the first segment with "./"
This change modifies URL.String to prepend "./" to a relative URL which
contains a colon in the first path segment.

Per RFC 3986 §4.2:

> A path segment that contains a colon character (e.g., "this:that")
> cannot be used as the first segment of a relative-path reference, as
> it would be mistaken for a scheme name.  Such a segment must be
> preceded by a dot-segment (e.g., "./this:that") to make a relative-
> path reference.

https://go-review.googlesource.com/27440 corrects the behavior for http.FileServer,
but URL.String will still return an invalid URL. This CL reverts the changes to
http.FileServer as they are unnecessary with this fix.

Fixes #17184

Change-Id: I9211ae20f82c91b785d1b079b2cd766487d94225
Reviewed-on: https://go-review.googlesource.com/29610
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-22 18:26:26 +00:00
David Chase
cddddbc623 cmd/compile: use ISEL, cleanup use of zero & extensions
Abandoned earlier efforts to expose zero register,
but left it in numbering to decrease squirrelyness of
register allocator.

ISELrelOp used in code generation of bool := x relOp y.
Some patterns added to better elide zero case and
some sign extension.

Updates: #17109

Change-Id: Ida7839f0023ca8f0ffddc0545f0ac269e65b05d9
Reviewed-on: https://go-review.googlesource.com/29380
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-09-22 17:36:39 +00:00
Emmanuel Odeke
dcbbd319e9 compress/gzip: add examples
Updates #16360.

Adds examples uing:
+ Writer, Reader
+ Reader.Multistream to concatenate and then
individually retrieve multiple gzipped files
+ Reset

Change-Id: I9ad9b92729a5cd58f7368eaf2db05f1cdf21063d
Reviewed-on: https://go-review.googlesource.com/29218
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-22 06:41:11 +00:00
Nigel Tao
a7dc821d64 crypto/rsa: clarify comment on maximum message length.
See https://groups.google.com/d/topic/golang-nuts/stbum5gZbAc/discussion

Change-Id: I2e78e8d0dadd78c8b0389514cad3c45d061b663b
Reviewed-on: https://go-review.googlesource.com/29496
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-22 03:06:25 +00:00
Ian Lance Taylor
9e028b70ea runtime: merge signal[12]_unix.go into signal_unix.go
Requires adding a sigfwd function for Solaris, as previously
signal2_unix.go was not built for Solaris.

Change-Id: Iea3ff0ddfa15af573813eb075bead532b324a3fc
Reviewed-on: https://go-review.googlesource.com/29550
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-21 23:04:34 +00:00
Mikio Hara
5db80c30e6 runtime: revert CL 18835; don't install new signal stack unconditionally on dragonfly
This change reverts CL 18835 which is a workaroud for older DragonFly
BSD kernels, and fixes #14051, #14052 and #14067 in a more general way
the same as other platforms except NetBSD.

This change also bumps the minimum required version of DragonFly BSD
kernel to 4.4.4.

Fixes #16329.

Change-Id: I0b44b6afa675f5ed9523914226bd9ec4809ba5ae
Reviewed-on: https://go-review.googlesource.com/29491
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-21 22:18:06 +00:00
Matthew Dempsky
e6134702bb cmd/compile: simplify obj.ProgInfo and extract from obj.Prog
Updates #16357.

Change-Id: Ia837dd44bad76931baa9469e64371bc253d6694b
Reviewed-on: https://go-review.googlesource.com/29219
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-09-21 22:08:45 +00:00
Russ Cox
404ae84aa2 cmd/link: add time stamp to hostlink print in -v mode
Change-Id: I128b142aee5e1b917e7ba63b48512972f053ea0b
Reviewed-on: https://go-review.googlesource.com/29531
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-21 20:25:48 +00:00
Lynn Boger
b4efd09d18 cmd/link: split large elf text sections on ppc64x
Some applications built with Go on ppc64x with external linking
can fail to link with relocation truncation errors if the elf
text section that is generated is larger than 2^26 bytes and that
section contains a call instruction (bl) which calls a function
beyond the limit addressable by the 24 bit field in the
instruction.

This solution consists of generating multiple text sections where
each is small enough to allow the GNU linker to resolve the calls
by generating long branch code where needed.  Other changes were added
to handle differences in processing when multiple text sections exist.

Some adjustments were required to the computation of a method's address
when using the method offset table when there are multiple text sections.

The number of possible section headers was increased to allow for up
to 128 text sections.  A test case was also added.

Fixes #15823.

Change-Id: If8117b0e0afb058cbc072258425a35aef2363c92
Reviewed-on: https://go-review.googlesource.com/27790
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-21 20:23:49 +00:00
Suyash
445f51fb11 image/png: add Encode and Decode examples
partially addresses #16360

Change-Id: I8274825b9ca6aec46294c8513b4795b0eb3062a2
Reviewed-on: https://go-review.googlesource.com/28992
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-21 19:47:04 +00:00
Brad Fitzpatrick
2bc5f1258e net: add Resolver type, Dialer.Resolver, and DefaultResolver
The new Resolver type (a struct) has 9 Lookup methods, all taking a
context.Context.

There's now a new DefaultResolver global, like http's
DefaultTransport and DefaultClient.

net.Dialer now has an optional Resolver field to set the Resolver.

This also does finishes some resolver cleanup internally, deleting
lookupIPMerge and renaming lookupIPContext into Resolver.LookupIPAddr.

The Resolver currently doesn't let you tweak much, but it's a struct
specifically so we can add knobs in the future. Currently I just added
a bool to force the pure Go resolver. In the future we could let
people provide an interface to implement the methods, or add a Timeout
time.Duration, which would wrap all provided contexts in a
context.WithTimeout.

Fixes #16672

Change-Id: I7ba1f886704f06def7b6b5c4da9809db51bc1495
Reviewed-on: https://go-review.googlesource.com/29440
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-21 18:35:40 +00:00
Thomas de Zeeuw
ea143c2990 net/http/httptest: fill ContentLength in recorded Response
This change fills the ContentLength field in the http.Response returned by
ResponseRecorder.Result.

Fixes #16952.

Change-Id: I9c49b1bf83e3719b5275b03a43aff5033156637d
Reviewed-on: https://go-review.googlesource.com/28302
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-21 17:34:01 +00:00
Michal Bohuslávek
e69d63e807 net/http/cookiejar: fix typo
Change-Id: I6ea8650927e7946c6fd4659f400fd91ddaae68af
Reviewed-on: https://go-review.googlesource.com/29510
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-21 15:12:22 +00:00
Austin Clements
c03925edd3 runtime: remove unnecessary atomics from heapBitSetType
These used to be necessary when racing with updates to the mark bit,
but since the mark bit is no longer in the bitmap and the checkmark is
only updated with the world stopped, we can now always use regular
writes to update the type information in the heap bitmap.

Somewhat surprisingly, this has basically no overall performance
effect beyond the usual noise, but it does clean up the code.

Change-Id: I3933d0b4c0bc1c9bcf6313613515c0b496212105
Reviewed-on: https://go-review.googlesource.com/29277
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2016-09-21 15:08:16 +00:00
Mikio Hara
6072e4d710 syscall: fix build on dragonfly
This change fixes the broken build caused by CL 23780.

Change-Id: I142cf8a1af033d036d57ac56e9e21ea925d922d4
Reviewed-on: https://go-review.googlesource.com/29490
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-21 05:23:57 +00:00
Matthew Dempsky
35d22afb4b cmd/internal/obj: remove unused GOROOT-related fields
Change-Id: I6634f70d6bd1a4eced47eda69a2d9b207d222a1b
Reviewed-on: https://go-review.googlesource.com/29470
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-21 01:25:29 +00:00
Matthew Dempsky
e6158b3c46 cmd/internal/obj: remove unused Textp and Etextp fields
Change-Id: Idcb5a8d6676aa38b4ebd0975edd2068386f5ca83
Reviewed-on: https://go-review.googlesource.com/29449
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-21 01:15:56 +00:00
Yasuhiro Matsumoto
b851ded09a os: use GetConsoleCP() instead of GetACP()
It is possible (and common) for Windows systems to use a different codepage
for console applications from that used on normal windowed application
(called ANSI codepage); for instance, most of the western Europe uses
CP850 for console (for backward compatibility with MS-DOS), while
windowed applications use a different codepage depending on the country
(eg: CP1252 aka Latin-1). The usage being changed with this commit is
specifically related to decoding input coming from the console, so the
previous usage of the ANSI codepage was wrong.

Also fixes an issue that previous did convert bytes as NFD. Go is
designed to handle single Unicode code point. This fix change behaivor
to NFC.

Fixes #16857.

Change-Id: I4f41ae83ece47321b6e9a79a2087ecbb8ac066dd
Reviewed-on: https://go-review.googlesource.com/27575
Reviewed-by: Hiroshi Ioka <hirochachacha@gmail.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2016-09-21 00:38:51 +00:00
Brad Fitzpatrick
16f81b617e image/draw: add FloydSteinberg Drawer example
Updates #16360

Change-Id: I80b981aa291a8e16d2986d4a2dfd84d3819bf488
Reviewed-on: https://go-review.googlesource.com/29443
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2016-09-21 00:08:58 +00:00
Keith Randall
dd24b1098a cmd/compile: improve tighten pass
Move a value to the block which is the lowest common ancestor in the
dominator tree of all of its uses.  Make sure not to move a value into a
loop.

Makes the tighten pass on average (across go1 benchmarks) 40% slower.
Still not a big contributor to overall compile time.

Binary size is just a tad smaller.

name                      old time/op    new time/op    delta
BinaryTree17-12              2.77s ± 9%     2.76s ± 9%     ~     (p=0.878 n=8+8)
Fannkuch11-12                2.75s ± 1%     2.74s ± 1%     ~     (p=0.232 n=8+7)
FmtFprintfEmpty-12          48.9ns ± 9%    47.7ns ± 0%     ~     (p=0.431 n=8+8)
FmtFprintfString-12          143ns ± 8%     142ns ± 1%     ~     (p=0.257 n=8+7)
FmtFprintfInt-12             123ns ± 1%     122ns ± 1%   -1.04%  (p=0.026 n=7+8)
FmtFprintfIntInt-12          195ns ± 7%     185ns ± 0%   -5.32%  (p=0.000 n=8+8)
FmtFprintfPrefixedInt-12     194ns ± 4%     195ns ± 0%   +0.81%  (p=0.015 n=7+7)
FmtFprintfFloat-12           267ns ± 0%     268ns ± 0%   +0.37%  (p=0.001 n=7+6)
FmtManyArgs-12               800ns ± 0%     762ns ± 1%   -4.78%  (p=0.000 n=8+8)
GobDecode-12                7.67ms ± 2%    7.60ms ± 2%     ~     (p=0.234 n=8+8)
GobEncode-12                6.55ms ± 0%    6.57ms ± 1%     ~     (p=0.336 n=7+8)
Gzip-12                      237ms ± 0%     238ms ± 0%   +0.40%  (p=0.017 n=7+7)
Gunzip-12                   40.8ms ± 0%    40.2ms ± 0%   -1.52%  (p=0.000 n=7+8)
HTTPClientServer-12          208µs ± 3%     209µs ± 3%     ~     (p=0.955 n=8+7)
JSONEncode-12               16.2ms ± 1%    17.2ms ±11%   +5.80%  (p=0.001 n=7+8)
JSONDecode-12               57.3ms ±12%    55.5ms ± 3%     ~     (p=0.867 n=8+7)
Mandelbrot200-12            4.68ms ± 6%    4.46ms ± 1%     ~     (p=0.442 n=8+8)
GoParse-12                  4.27ms ±44%    3.42ms ± 1%  -19.95%  (p=0.005 n=8+8)
RegexpMatchEasy0_32-12      75.1ns ± 0%    75.8ns ± 1%   +0.99%  (p=0.002 n=7+7)
RegexpMatchEasy0_1K-12       963ns ± 0%    1021ns ± 6%   +5.98%  (p=0.001 n=7+7)
RegexpMatchEasy1_32-12      72.4ns ±11%    70.8ns ± 1%     ~     (p=0.368 n=8+8)
RegexpMatchEasy1_1K-12       394ns ± 1%     399ns ± 0%   +1.23%  (p=0.000 n=8+7)
RegexpMatchMedium_32-12      114ns ± 0%     115ns ± 1%   +0.63%  (p=0.021 n=7+7)
RegexpMatchMedium_1K-12     35.9µs ± 0%    37.6µs ± 1%   +4.72%  (p=0.000 n=7+8)
RegexpMatchHard_32-12       1.93µs ± 2%    1.91µs ± 0%   -0.91%  (p=0.001 n=7+7)
RegexpMatchHard_1K-12       60.2µs ± 3%    61.2µs ±10%     ~     (p=0.442 n=8+8)
Revcomp-12                   404ms ± 1%     406ms ± 1%     ~     (p=0.054 n=8+7)
Template-12                 64.6ms ± 1%    63.5ms ± 1%   -1.66%  (p=0.000 n=8+8)
TimeParse-12                 347ns ± 8%     309ns ± 0%  -11.13%  (p=0.000 n=8+7)
TimeFormat-12                343ns ± 4%     331ns ± 0%   -3.34%  (p=0.000 n=8+7)

Change-Id: Id6da1239ddd4d0cb074ff29cffb06302d1c6d08f
Reviewed-on: https://go-review.googlesource.com/28712
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-09-20 22:49:48 +00:00
Keith Randall
b7426089e5 cmd/compile: simple cleanups
Change-Id: If2cf3c5a29afc6cf74c3b08b9745e950231ead37
Reviewed-on: https://go-review.googlesource.com/29441
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-20 21:45:56 +00:00
Damien Neil
f5f7d6e32d syscall: validate ParseDirent inputs
Don't panic, crash, or return references to uninitialized memory when
ParseDirent is passed invalid input.

Move common dirent parsing to syscall.go with minimal platform-specific
functions in syscall_$GOOS.go.

Fixes #15653

Change-Id: I5602475e02321fe381064488401c14b33bec6886
Reviewed-on: https://go-review.googlesource.com/23780
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-20 19:27:57 +00:00
Austin Clements
ab59235729 runtime: consistency check for G rescan position
Issue #17099 shows a failure that indicates we rescanned a stack twice
concurrently during mark termination, which suggests that the rescan
list became inconsistent. Add a simple check when we dequeue something
from the rescan list that it claims to be at the index where we found
it.

Change-Id: I6a267da4154a2e7b7d430cb4056e6bae978eaf62
Reviewed-on: https://go-review.googlesource.com/29280
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2016-09-20 18:37:32 +00:00
Austin Clements
39ce6eb9ec runtime: report GCSys and OtherSys in heap profile
The comment block at the end of the heap profile includes *almost*
everything from MemStats. Add the missing fields. These are useful for
debugging RSS that has gone to GC-internal data structures.

Change-Id: I0ee8a918d49629e28fd8fd2bf6861c4529461c24
Reviewed-on: https://go-review.googlesource.com/29276
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2016-09-20 18:37:29 +00:00
Cherry Zhang
38cd79889e cmd/compile: simplify div/mod on ARM
On ARM, DIV, DIVU, MOD, MODU are pseudo instructions that makes
runtime calls _div/_udiv/_mod/_umod, which themselves are wrappers
of udiv. The udiv function does the real thing.

Instead of generating these pseudo instructions, call to udiv
directly. This removes one layer of wrappers (which has an awkward
way of passing argument), and also allows combining DIV and MOD
if both results are needed.

Change-Id: I118afc3986db3a1daabb5c1e6e57430888c91817
Reviewed-on: https://go-review.googlesource.com/29390
Reviewed-by: David Chase <drchase@google.com>
2016-09-20 13:40:48 +00:00
Jaana Burcu Dogan
f964810025 net/http/httptrace: fix bad tracing example
Tracing happens at the http.Trace level. Fix the example to demostrate
tracing in the lifecycle of a RoundTrip.

Updates #17152.

Change-Id: Ic7d7bcc550176189206185482e8962dbf1504ff1
Reviewed-on: https://go-review.googlesource.com/29431
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-20 05:11:45 +00:00
Michael Hudson-Doyle
836a3ae663 cmd/link: remove more unused ctxt parameters
This time in elf.go.

Change-Id: Ifaf71742ebbc9aadc8606c39ea2d417ae5cc7e0d
Reviewed-on: https://go-review.googlesource.com/29450
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-20 04:21:16 +00:00
Michael Hudson-Doyle
b6324ef5ff cmd/link: kill off Symbols.Version
Change-Id: Iee8f773355870f2333637a093e51c5fd36e5a6e5
Reviewed-on: https://go-review.googlesource.com/29349
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-20 04:20:50 +00:00
Michael Hudson-Doyle
6383709272 cmd/link: remove now-unused ctxt arguments from a few functions
Specifically Addstring, Addbytes and Symgrow.

Change-Id: Ia74093bfcf9f360bf223accbc8feef54a7f059c9
Reviewed-on: https://go-review.googlesource.com/29348
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-20 04:13:16 +00:00
Michael Hudson-Doyle
25d094034b cmd/link: remove Linklookup & Linkrlookup
Change-Id: I25d9f74cb52e6fd4f2ad4b1c8b7102efadbc7481
Reviewed-on: https://go-review.googlesource.com/29344
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-20 04:12:57 +00:00
Michael Hudson-Doyle
324f6ab48c cmd/link: use ctxt.{Lookup,ROLookup} in favour of function versions of same
Done with two eg templates:

package p

import (
	"cmd/link/internal/ld"
)

func before(ctxt *ld.Link, name string, v int) *ld.Symbol {
	return ld.Linklookup(ctxt, name, v)
}
func after(ctxt *ld.Link, name string, v int) *ld.Symbol {
	return ctxt.Syms.Lookup(name, v)
}

package p

import (
	"cmd/link/internal/ld"
)

func before(ctxt *ld.Link, name string, v int) *ld.Symbol {
	return ld.Linkrlookup(ctxt, name, v)
}
func after(ctxt *ld.Link, name string, v int) *ld.Symbol {
	return ctxt.Syms.ROLookup(name, v)
}

Change-Id: I00647dbf62294557bd24c29ad1f108fc786335f1
Reviewed-on: https://go-review.googlesource.com/29343
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-20 04:12:43 +00:00
Michael Hudson-Doyle
d41a7f77c5 cmd/link: do not directly embed Symbols in Link
Mostly done with sed.

Change-Id: Ic8c534a3fdd332b5420d062ee85bb77a30ad1efb
Reviewed-on: https://go-review.googlesource.com/29346
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-20 04:12:28 +00:00
Michael Hudson-Doyle
d284d4ff92 cmd/link: split "bag of Symbols" functionality out of Link
Mechanical refactorings to follow.

Change-Id: I9b98e69a58c3cba7c7d1d3e3f600d4ed99d4fce2
Reviewed-on: https://go-review.googlesource.com/29342
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-20 04:12:12 +00:00
David Crawshaw
e9fddf8f86 cmd/internal/obj, cmd/link: darwin dynlink support
This makes it possible for cmd/compile, when run with -dynlink on
darwin/amd64, to generate TLS_LE relocations which the linker then
turns into the appropriate PC-relative GOT load.

Change-Id: I1a71da432608bdb108ff66c22de600100209c873
Reviewed-on: https://go-review.googlesource.com/29393
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-20 03:15:15 +00:00
David Crawshaw
1d3fae461c cmd/link: remove Cursym
Change-Id: I58253a6cd2d77a9319c0783afb0d92cd5a88a7f7
Reviewed-on: https://go-review.googlesource.com/29370
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
2016-09-20 02:42:16 +00:00
David Crawshaw
5a597e2d29 cmd/link: replace ld.Link.Diag with ld.Errorf
Instead of using ctxt.Cursym, Errorf takes an explicit *Symbol
parameter. This removes most uses of Cursym and means the *Link
context object is needed in fewer parts of the linker.

All transformations done manually, as wiring Cursym is tricky.

Change-Id: Ief88b00b73904224675c0035684c3a84c19249d7
Reviewed-on: https://go-review.googlesource.com/29369
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-20 02:36:39 +00:00
Michael Hudson-Doyle
50644f2e67 cmd/link: move comment somewhere more appropriate
At least, I assume it's meant to be here. It makes no sense at all where it
currently is.

Change-Id: Ic6a6c112c3dcf1318256d7d602168c3446b55412
Reviewed-on: https://go-review.googlesource.com/29339
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-19 21:42:57 +00:00
Tormod Erevik Lea
b625810d28 cmd/vet: hard-code program name in usage message
Example on linux_amd64 for 'go tool vet -h':

Before:
	Usage of /usr/local/go/pkg/tool/linux_amd64/vet:
After:
	Usage of vet:

Change-Id: I11cb16b656bd097062d57a8c7441fbe66caaef78
Reviewed-on: https://go-review.googlesource.com/29294
Reviewed-by: Rob Pike <r@golang.org>
2016-09-19 20:26:36 +00:00
Rob Pike
3cca069220 time: allow long fractions in ParseDuration
The code scanned for an integer after a decimal point, which
meant things could overflow if the number was very precise
(0.1234123412341234123412342134s). This fix changes the
parser to stop adding precision once we run out of bits, rather
than trigger an erroneous overflow.

We could parse durations using floating-point arithmetic,
but since the type is int64 and float64 has only has 53 bits
of precision, that would be imprecise.

Fixes #15011.

Change-Id: If85e22b8f6cef12475e221169bb8f493bb9eb590
Reviewed-on: https://go-review.googlesource.com/29338
Reviewed-by: Costin Chirvasuta <costinc@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-19 19:46:09 +00:00
Michael Munday
e94c52933b cmd/compile: intrinsify Ctz{32,64} and Bswap{32,64} on s390x
Also adds the 'find leftmost one' instruction (FLOGR) and replaces the
WORD-encoded use of FLOGR in math/big with it.

Change-Id: I18e7cd19e75b8501a6ae8bd925471f7e37ded206
Reviewed-on: https://go-review.googlesource.com/29372
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Michael Munday <munday@ca.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-19 19:03:01 +00:00
Carlos Eduardo Seo
f1973fca71 cmd/asm, cmd/internal/obj/ppc64: add ppc64 vector registers and instructions
The current implementation for Power architecture does not include the vector
(Altivec) registers.  This adds the 32 VMX registers and the most commonly used
instructions: X-form loads/stores; VX-form logical operations, add/sub,
rotate/shift, count, splat, SHA Sigma and AES cipher; VC-form compare; and
VA-form permute, shift, add/sub and select.

Fixes #15619

Change-Id: I544b990631726e8fdfcce8ecca0aeeb72faae9aa
Reviewed-on: https://go-review.googlesource.com/25600
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: David Chase <drchase@google.com>
2016-09-19 18:39:36 +00:00
Emmanuel Odeke
31ba855014 crypto/md5, crypto/sha1, crypto/sha256: add examples for checksumming a file
Updates #16360.

Change-Id: I75714d2b5f095fe39fd81edfa6dd9e44d7c44da1
Reviewed-on: https://go-review.googlesource.com/29375
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-19 17:29:19 +00:00
Keith Randall
ca4089ad62 cmd/compile: args no longer live until end-of-function
We're dropping this behavior in favor of runtime.KeepAlive.
Implement runtime.KeepAlive as an intrinsic.

Update #15843

Change-Id: Ib60225bd30d6770ece1c3c7d1339a06aa25b1cbc
Reviewed-on: https://go-review.googlesource.com/28310
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-09-19 16:54:35 +00:00
Brady Sullivan
faf611a07a net/http: rename Post's parameter from bodyType to contentType
Change-Id: Ie1b08215c02ce3ec72a4752f4b800f23345ff99d
Reviewed-on: https://go-review.googlesource.com/29362
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-19 16:08:31 +00:00
Keith Randall
75ce89c20d cmd/compile: cache CFG-dependent computations
We compute a lot of stuff based off the CFG: postorder traversal,
dominators, dominator tree, loop nest.  Multiple phases use this
information and we end up recomputing some of it.  Add a cache
for this information so if the CFG hasn't changed, we can reuse
the previous computation.

Change-Id: I9b5b58af06830bd120afbee9cfab395a0a2f74b2
Reviewed-on: https://go-review.googlesource.com/29356
Reviewed-by: David Chase <drchase@google.com>
2016-09-19 16:00:13 +00:00
Keith Randall
2679282da4 cmd/compile: fold ADDconsts together for PPC
Change-Id: I571f03af6f791e78e7e18addcc310eb25747cdcf
Reviewed-on: https://go-review.googlesource.com/29351
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-19 15:57:29 +00:00
Keith Randall
6129f37367 cmd/compile: inline convT2{I,E} when result doesn't escape
No point in calling a function when we can build the interface
using a known type (or itab) and the address of a local.

Get rid of third arg (preallocated stack space) to convT2{I,E}.

Makes go binary smaller by 0.2%

benchmark                   old ns/op     new ns/op     delta
BenchmarkEfaceInteger-8     16.7          10.1          -39.52%

Update #17118
Update #15375

Change-Id: I9724a1f802bfa1e3957bf1856b55558278e198a2
Reviewed-on: https://go-review.googlesource.com/29373
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-09-19 02:37:08 +00:00
Rob Pike
892d146a7a cmd/vet: fix documentation for -structtags
Was missing a title in the documentation, so it formatted wrong.

Fixes #17124

Change-Id: Ie8a9c36fbc54eed7d8a761f89a088e582b8c062d
Reviewed-on: https://go-review.googlesource.com/29340
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-09-19 02:02:44 +00:00
Michael Hudson-Doyle
dcb954c3f7 cmd/link: remove size and version from genasmsym's argument
They are trivially available in the few places they are needed.

Change-Id: I6544692e9027076ec9e6e9a295c66457039e55e1
Reviewed-on: https://go-review.googlesource.com/29332
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-18 21:59:20 +00:00
Michael Hudson-Doyle
2266047556 cmd/link: give names and a type to the symbol types used by genasmsym
Doing this revealed some dead code.

Change-Id: I5202fcc3f73e3dfddfea3ec7b772e16da51195da
Reviewed-on: https://go-review.googlesource.com/29331
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-18 21:59:09 +00:00
Cherry Zhang
c1bee49cac cmd/dist: fix internal linking check for mips64le
Fix mips64le build.

Change-Id: Icf1b4901655463f582b49054a88edfb06ad6c676
Reviewed-on: https://go-review.googlesource.com/29281
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-09-18 20:15:13 +00:00
Cherry Zhang
964639cc33 cmd/compile: intrinsify runtime/internal/atomic.Xaddint64
This aliases to Xadd64.

Change-Id: I95d49e1d03eecc242e9e6fd4b2742b1c1a1d5ade
Reviewed-on: https://go-review.googlesource.com/29274
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-09-17 14:21:32 +00:00
David Crawshaw
5c0fbf052b plugin: cast dlerror return value for android
Until a few weeks ago, bionic, the Andoid libc, incorrectly
returned const char* (instead of char*) from dlerror(3).

5e071a18ce

Change-Id: I30d33240c63a9f35b6c20ca7e3928ad33bc5e33f
Reviewed-on: https://go-review.googlesource.com/29352
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-17 13:47:37 +00:00
Keith Randall
2e2db7a170 cmd/compile: fix format verbs in ssa package
%s is no longer valid.  Use %v instead.

Change-Id: I5ec4fa6a9280082c1a0c75fd1cf94b4bb8096f5c
Reviewed-on: https://go-review.googlesource.com/29365
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-17 02:54:11 +00:00
Matthew Dempsky
246074d043 cmd/internal/obj: remove ACHECKNIL
Updates #16357.

Change-Id: I35f938d675ca5c31f65c4419ee0732bbc593b5cb
Reviewed-on: https://go-review.googlesource.com/29368
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-17 02:38:24 +00:00
Matthew Dempsky
e518962a27 cmd/internal/obj: simplify Plists
Keep Plists in a slice instead of a linked list.
Eliminate unnecessary fields.
Also, while here remove gc's unused breakpc and continpc vars.

Change-Id: Ia04264036c0442843869965d247ccf68a5295115
Reviewed-on: https://go-review.googlesource.com/29367
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2016-09-17 02:09:23 +00:00
Trey Lawrence
fc5df089da cmd/compile: fix compiler bug for constant equality comparison
The compiler incorrectly will error when comparing a nil pointer
interface to a nil pointer of any other type. Example:
(*int)(nil) == interface{}(nil)
Will error with "gc: illegal constant expression: *int == interface {}"

Fixes #16702

Change-Id: I1a15d651df2cfca6762b1783a28b377b2e6ff8c6
Reviewed-on: https://go-review.googlesource.com/27591
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-09-17 01:12:24 +00:00
Matthew Dempsky
6fe1febc86 cmd/internal/obj: replace AGLOBL with (*Link).Globl
Replace the AGLOBL pseudo-op with a method to directly register an
LSym as a global. Similar to how we previously already replaced the
ADATA pseudo-op with directly writing out data bytes.

Passes toolstash -cmp.

Change-Id: I3631af0a2ab5798152d0c26b833dc309dbec5772
Reviewed-on: https://go-review.googlesource.com/29366
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-17 00:51:47 +00:00
Dan Peterson
a1bf203b57 net: respect resolv.conf rotate option
Instead of ranging over servers in the config, grab an offset
from the config that is used to determine indices.

When the rotate option is enabled, the offset increases which
rotates queries through servers. Otherwise, it is always 0
which uses servers in config order.

Fixes #17126

Change-Id: If233f6de7bfa42f88570055b9ab631be08a76b3e
Reviewed-on: https://go-review.googlesource.com/29233
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-09-17 00:34:19 +00:00
Suyash
f7e49f6644 sort: fix search descending order example
Change-Id: I27b82d8c63a06ddf7e148b15853aba24a22a6282
Reviewed-on: https://go-review.googlesource.com/29336
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-17 00:14:19 +00:00
David Crawshaw
569340ebaf cmd/dist: disable plugin test on arm64
Mysterious error and no time or easy machine access to investigate
now, so disabling the -buildmode=plugin test on arm64. (The arm
version is working as expected.)

Updates #17138

Change-Id: I4cc56ddf47e7597213462e48d4934a765168bd07
Reviewed-on: https://go-review.googlesource.com/29363
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-16 23:55:35 +00:00
David Crawshaw
192548a547 cmd/dist: unify internal linking checks
I missed one in CL 29360.

Change-Id: I29fc6dcd920829a918c70734d646119133a0a9df
Reviewed-on: https://go-review.googlesource.com/29361
Reviewed-by: Keith Randall <khr@golang.org>
2016-09-16 22:38:53 +00:00
David Crawshaw
f4748f1e21 cmd/dist: skip libgcc test on arm64 and mips64
This test was always being run with external linking on these
platforms because the linker was silently forcing external linking
until CL 28971. Now it produces an error instead.

Change-Id: I794e0812711e05b150daf805dc3451507bb4cae8
Reviewed-on: https://go-review.googlesource.com/29360
Run-TryBot: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-16 21:31:35 +00:00
David Crawshaw
fb4e49059c cmd/dist: disable plugin test on ppc64le and s390x
These are close to working, but untested and failing on
build.golang.org. So disable for now.

Change-Id: I330b8d1a91f0bf5139c894913868f01ec87e986d
Reviewed-on: https://go-review.googlesource.com/29359
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-16 21:31:24 +00:00
Matthew Dempsky
08feadbd6e cmd/compile: remove Arch.REGCTXT
Update #16357.

Change-Id: I507676212d7137a62c76de7bfa0ba8dbd68e840f
Reviewed-on: https://go-review.googlesource.com/29358
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
2016-09-16 21:22:03 +00:00
David Crawshaw
f323a7c6d2 cmd/link: remove never-set Windows variable
Change-Id: I3d64549b85b71bb63bcc815ce2276af6ca2eb215
Reviewed-on: https://go-review.googlesource.com/29354
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-16 21:11:57 +00:00
Matthew Dempsky
d6194c1fd1 cmd/compile: change goarch.Main into goarch.Init
Similar idea to golang.org/cl/28970.

Change-Id: I9d2feb1a669d71ffda1d612cf39ee0d3c08d22d2
Reviewed-on: https://go-review.googlesource.com/29357
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-16 21:10:46 +00:00
Robert Griesemer
32db3f2756 cmd/compile/internal/syntax: support for alias declarations
Permits parsing of alias declarations with -newparser

	const/type/var/func T => p.T

but the compiler will reject it with an error. For now this
also accepts

	type T = p.T

so we can experiment with a type-alias only scenario.

- renamed _Arrow token to _Larrow (<-)
- introduced _Rarrow token (=>)
- introduced AliasDecl node
- extended scanner to accept _Rarrow
- extended parser and printer to handle alias declarations

Change-Id: I0170d10a87df8255db9186d466b6fd405228c38e
Reviewed-on: https://go-review.googlesource.com/29355
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-16 20:58:20 +00:00
David Crawshaw
28ed2b0cd9 cmd/link: skip arch-specific main function
Add some notes to main.go on what happens where.

Change-Id: I4fb0b6c280e5f990ddc5d749267372b86870af6d
Reviewed-on: https://go-review.googlesource.com/28970
TryBot-Result: Gobot Gobot <gobot@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-16 20:38:38 +00:00
Matthew Dempsky
9f447c20ef cmd/compile: remove unused Label fields
Updates #16357.

Change-Id: I37f04d83134b5e1e7f6ba44eb9a566758ef594d3
Reviewed-on: https://go-review.googlesource.com/29350
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-16 19:14:47 +00:00
Keith Randall
833ed7c431 cmd/compile: reorganize SSA register numbering
Teach SSA about the cmd/internal/obj/$ARCH register numbering.
It can then return that numbering when requested.  Each architecture
now does not need to know anything about the internal SSA numbering
of registers.

Change-Id: I34472a2736227c15482e60994eebcdd2723fa52d
Reviewed-on: https://go-review.googlesource.com/29249
Reviewed-by: David Chase <drchase@google.com>
2016-09-16 19:01:55 +00:00
David Crawshaw
b87d7a5cf6 cmd/link: give RelocVariant a type, document Reloc
Change-Id: Ib20263405a08674b5e160295fc965da4c8b54b34
Reviewed-on: https://go-review.googlesource.com/29248
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-16 18:30:27 +00:00
David Crawshaw
6007c8c76b cmd/link: attempt to rationalize linkmode init
This CL gives Linkmode a type, switches it to the standard flag
handling mechanism, and deduplicates some logic.

There is a semantic change in this CL. Previously if a link was
invoked explicitly with -linkmode=internal, any condition that forced
external linking would silently override this and use external
linking. Instead it now fails with a reason why. I believe this is an
improvement, but will change it back if there's disagreement.

Fixes #12848

Change-Id: Ic80e341fff65ecfdd2b6fdd6079674cc7210fc5f
Reviewed-on: https://go-review.googlesource.com/28971
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-16 17:57:53 +00:00
David Crawshaw
1df438f79c misc/cgo/testplugin: add test of -buildmode=plugin
Change-Id: Ie9fea9814c850b084562ab2349b54d9ad9fa1f4a
Reviewed-on: https://go-review.googlesource.com/27825
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-16 17:55:24 +00:00
David Crawshaw
c19382319a cmd/go: support -buildmode=plugin on linux
Change-Id: I0c8a04457db28c55c35c9a186b63c40f40730e39
Reviewed-on: https://go-review.googlesource.com/27824
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-16 17:54:59 +00:00
David Crawshaw
0cbb12f0bb plugin: new package for loading plugins
Includes a linux implementation.

Change-Id: Iacc2ed7da760ae9deebc928adf2b334b043b07ec
Reviewed-on: https://go-review.googlesource.com/27823
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-16 17:54:40 +00:00
David Chase
c87528d776 cmd/compile: elide unnecessary sign/zeroExt, PPC64
Bias {Eq,Neq}{8,16} to prefer the extension likely to match
their operand's load (if loaded), and elide sign and zero
extending MOV{B,W}, MOV{B,W}Z when their operands are already
appropriately extended.

Change-Id: Ic01b9cab55e170f68fc2369688b50ce78a818608
Reviewed-on: https://go-review.googlesource.com/29236
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-09-16 15:58:56 +00:00
Cherry Zhang
46ba59025f cmd/compile: label LoadReg with line number of the use
A tentative fix of #16380. It adds "line" everywhere...

This also reduces binary size slightly (cmd/go on ARM as an example):

			before		after
total binary size	8068097		8018945 (-0.6%)
.gopclntab		1195341		1179929 (-1.3%)
.debug_line		 689692		 652017 (-5.5%)

Change-Id: Ibda657c6999783c5bac180cbbba487006dbf0ed7
Reviewed-on: https://go-review.googlesource.com/25082
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-16 15:38:28 +00:00
Cherry Zhang
882dd1c3ba cmd/compile: enable rewritings that are blocked by old backends
Old backends did not implement them, but SSA do.

Change-Id: I543b2281dcf4bab0da37c9b1f26a5ef55a0ea11b
Reviewed-on: https://go-review.googlesource.com/29278
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-09-16 14:53:12 +00:00
David Crawshaw
8607bed744 runtime: avoid dependence on main symbol
For -buildmode=plugin, this lets the linker drop the main.main symbol
out of the binary while including most of the runtime.

(In the future it should be possible to drop the entire runtime
package from plugins.)

Change-Id: I3e7a024ddf5cc945e3d8b84bf37a0b7cb2a00eb6
Reviewed-on: https://go-review.googlesource.com/27821
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-16 14:49:27 +00:00