Keith Randall [Fri, 18 Aug 2017 06:13:57 +0000 (23:13 -0700)]
runtime: no need to protect key/value increments against end of bucket
After the key and value arrays, we have an overflow pointer.
So there's no way a past-the-end key or value pointer could point
past the end of the containing bucket.
Russ Cox [Fri, 9 Jun 2017 15:36:10 +0000 (11:36 -0400)]
cmd/go: remove Package.Internal.Deps
Package.Internal.Imports is enough in nearly all cases,
and not maintaining a separate Package.Internal.Deps
avoids the two lists ending up out of sync.
(In some synthesized packages created during go test,
only Internal.Imports is initialized.)
Change-Id: I83f6a3ec6e6cbd75382f1fa0e439d31feec32d5a
Reviewed-on: https://go-review.googlesource.com/56278 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Russ Cox [Fri, 9 Jun 2017 14:45:49 +0000 (10:45 -0400)]
cmd/go: use objdir as consistent variable name for per-package work dir
Before it was obj, but if you don't have everything paged in
that sounds a bit like an object file. Use objdir, which is more
clearly a directory and also matches the Action.Objdir struct field.
Change-Id: I268042800f9ca05721814d7f18c728acb4831232
Reviewed-on: https://go-review.googlesource.com/56277 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Russ Cox [Fri, 9 Jun 2017 16:29:43 +0000 (12:29 -0400)]
cmd/go: document that BinaryOnly packages must have accurate import info
Update BinaryOnly test by adding import _ "fmt".
Change-Id: I3a1dcfb83a27d8ff50a658060a46e1a3f481f6c7
Reviewed-on: https://go-review.googlesource.com/56276 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Russ Cox [Fri, 9 Jun 2017 15:44:31 +0000 (11:44 -0400)]
cmd/go: rewrite TestCgoFlagContainsSpace not to use a fake CC
Using a fake CC fails today if runtime/cgo is stale, because the
build will try to rebuild runtime/cgo using the fake CC, and the
fake CC is not a working C compiler.
Worse, in the future, when the go command is sensitive to details like
the fact that different CCs produce different outputs, putting in
the fake CC will make runtime/cgo look stale even if it was
formerly up-to-date.
Fix both problems by not overriding CC and instead looking at
the command being run to make sure the flags are quoted as expected.
Change-Id: I4417e35cfab33a07546cc90748ddb6119d8fdb2d
Reviewed-on: https://go-review.googlesource.com/56272
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Lakshay Garg [Wed, 28 Jun 2017 16:37:55 +0000 (22:07 +0530)]
math: implement the erfinv function
This commit defines the inverse of error function (erfinv) in the
math package. The function is based on the rational approximation
of percentage points of normal distribution available at
https://www.jstor.org/stable/pdf/2347330.pdf.
Fixes #6359
Change-Id: Icfe4508f623e0574c7fffdbf7aa929540fd4c944
Reviewed-on: https://go-review.googlesource.com/46990
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Brian Kessler [Fri, 18 Aug 2017 06:44:34 +0000 (23:44 -0700)]
math/big: use internal square for Rat
updates #13745
A squared rational is always positive and can not
be reduced since the numerator and denominator had
no previous common factors. The nat multiplication
can be performed using the internal sqr method.
Change-Id: I558f5b38e379bfd26ff163c9489006d7e5a9cfaa
Reviewed-on: https://go-review.googlesource.com/56776 Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Alex Brainman [Fri, 18 Aug 2017 04:55:05 +0000 (14:55 +1000)]
misc/cgo/testcshared: fix syntax error in the test
Another attempt to fix build
Change-Id: I26137c115ad4b5f5a69801ed981c146adf6e824c
Reviewed-on: https://go-review.googlesource.com/56750 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Alex Brainman [Fri, 18 Aug 2017 03:53:42 +0000 (13:53 +1000)]
misc/cgo/testcshared: use adb instead of ./adb on android
Hopefully fixes build.
Change-Id: If0629b95b923a65e4507073cf7aa44a5e178fc0f
Reviewed-on: https://go-review.googlesource.com/56711 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Hiroshi Ioka [Thu, 17 Aug 2017 00:11:36 +0000 (09:11 +0900)]
debug/macho: support LC_RPATH
Updates #21487
Change-Id: Ia549a87a8a305cc80da11ea9bd904402f1a14689
Reviewed-on: https://go-review.googlesource.com/56321 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Hiroshi Ioka [Thu, 17 Aug 2017 00:45:20 +0000 (09:45 +0900)]
cmd/link: show native relocation type name in error messages
Change-Id: I7f7b1e7ef832d53a93562b08ae914d023247c2c0
Reviewed-on: https://go-review.googlesource.com/56312
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Bryan C. Mills [Sat, 13 May 2017 04:01:50 +0000 (00:01 -0400)]
{net,os/user,plugin}: eliminate unnecessary C round-trips
We're making two extra round-trips to C to malloc and free strings
that originate in Go and don't escape. Skip those round-trips by
allocating null-terminated slices in Go memory instead.
Change-Id: I9e4c5ad999a7924ba50b82293c52073ec75518be
Reviewed-on: https://go-review.googlesource.com/56530
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
isharipo [Tue, 15 Aug 2017 17:31:45 +0000 (20:31 +0300)]
cmd/asm: uncomment tests for PCMPESTRI, PHMINPOSUW
Instructions are implemented in the following revisions:
PCMPESTRI - https://golang.org/cl/22337
PHMINPOSUW - https://golang.org/cl/18853
It is unknown when x86test will be updated/re-run, but tests are useful
to check which x86 instructions are not yet supported.
As an example of tool that uses this information, there is Damien
Lespiau x86db.
Part of the mission to add missing amd64 SSE4 instructions to Go asm.
The existing implementation is translated from C, which uses a
polynomial coefficient very close to 1/6. If the function uses
1/6 as this coeffient, the result of Exp(1) will be more accurate.
And this change doesn't introduce more error to Exp function.
Fixes #20319
Change-Id: I94c236a18cf95570ebb69f7fb99884b0d7cf5f6e
Reviewed-on: https://go-review.googlesource.com/49294 Reviewed-by: Robert Griesemer <gri@golang.org>
Hiroshi Ioka [Wed, 16 Aug 2017 22:26:07 +0000 (07:26 +0900)]
cmd/link: correct runtime/cgo detection for -linkshared
Current code detect runtime/cgo iff the package or sub packages imports
runtime/cgo directly. However, when we are using linkshared, imported
shared libraries might have already included runtime/cgo.
This CL handles later case by looking an actual runtime/cgo symbol.
Change-Id: I35e7dfdb5e1a939eafc95a0259ee1af9782bc864
Reviewed-on: https://go-review.googlesource.com/56310 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Hiroshi Ioka [Thu, 17 Aug 2017 00:16:32 +0000 (09:16 +0900)]
debug/macho: add comments for ambiguious LoadCommand
While LoadCmdDylib represents LC_LOAD_DYLIB,
LoadCmdDylinker represents LC_ID_DYLINKER.
This is confusing because there is another command called LC_LOAD_DYLINKER.
LC_ID_DYLINKER is not included in normal binary, it is only used for
/usr/lib/dyld as far as I know. So, perhaps this is a mistake.
Change-Id: I6ea61664a26998962742914af5688e094a233541
Reviewed-on: https://go-review.googlesource.com/56330 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Hiroshi Ioka [Wed, 16 Aug 2017 23:54:39 +0000 (08:54 +0900)]
debug/macho: make tests more comprehensive
add tests for LC_LOAD_DYLIB.
Change-Id: Ic4b7a0f6296709175e9a75240aecd1d5291ade4b
Reviewed-on: https://go-review.googlesource.com/56311 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Hiroshi Ioka [Sat, 5 Aug 2017 11:03:32 +0000 (20:03 +0900)]
cmd/internal/obj/x86: don't apply workaround for solaris to darwin
Currently, we have a workaround for solaris that enforce aboslute
addressing for external symbols. However, We don't want to use the
workaround for darwin.
This CL also refactors code a little bit, because the original function
name is not appropriate now.
Updates #17490
Change-Id: Id21f9cdf33dca6a40647226be49010c2c324ee24
Reviewed-on: https://go-review.googlesource.com/54871 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Hiroshi Ioka [Wed, 16 Aug 2017 11:50:26 +0000 (20:50 +0900)]
debug/macho: rearrange code
* group load command structs.
* use hex literal for LoadCommand.
Decimal number is not a proper representation for some commands.
(e.g. LC_RPATH = 0x8000001c)
* move Symbol struct from macho.go to file.go.
Symbol is a high level representation, not in Mach-O.
Change-Id: I3c69923cb464fb1211f2e766c02e1b537e0b5de2
Reviewed-on: https://go-review.googlesource.com/56130 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Kyle Shannon [Wed, 9 Aug 2017 16:27:48 +0000 (10:27 -0600)]
cmd/go: add support for Fossil SCM to go get
Fixes #10010.
Change-Id: Ib13ac28eafed72c456d8b5b6549015cdf5fdda94
Reviewed-on: https://go-review.googlesource.com/56190 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Michael Steinert [Mon, 17 Jul 2017 16:14:23 +0000 (11:14 -0500)]
cmd/cgo: unify cgo output for gc and gccgo
When calling a Go function that returns multiple values from C, cgo
generates a structure to hold the values. According to the documentation
this structure is called `struct <function-name>_return`. When compiling
for gccgo the generated structure name is `struct <function-name>_result`.
This change updates the output for gccgo to match the documentation and
output for gc.
Fixes #20910
Change-Id: Iaea8030a695a7aaf9d9f317447fc05615d8e4adc
Reviewed-on: https://go-review.googlesource.com/49350 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Bryan C. Mills [Wed, 16 Aug 2017 18:58:19 +0000 (14:58 -0400)]
bytes: avoid overflow in (*Buffer).Grow and ReadFrom
fixes #21481
Change-Id: I26717876a1c0ee25a86c81159c6b3c59563dfec6
Reviewed-on: https://go-review.googlesource.com/56230 Reviewed-by: Ian Lance Taylor <iant@golang.org>
David du Colombier [Wed, 16 Aug 2017 18:30:26 +0000 (20:30 +0200)]
cmd/link: skip TestFieldOverlap on Plan 9
TestSizes has been added in CL 50170. This test is
failing on Plan 9 because executables don't have
a DWARF symbol table.
Fixes #21480.
Change-Id: I51079abdc18ad944617bdbcfe2dad970a0cea0f2
Reviewed-on: https://go-review.googlesource.com/56210
Run-TryBot: David du Colombier <0intro@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Bryan C. Mills [Mon, 7 Aug 2017 23:30:03 +0000 (19:30 -0400)]
runtime/cgo: defeat inlining in x_cgo_yield
We use a call to strncpy to work around a TSAN bug (wherein TSAN only
delivers asynchronous signals when the thread receiving the signal
calls a libc function). Unfortunately, GCC 7 inlines the call,
avoiding the TSAN libc trap entirely.
Per Ian's suggestion, use global variables as strncpy arguments: that
way, the compiler can't make any assumptions about the concrete values
and can't inline the call away.
fixes #21196
Change-Id: Ie95f1feaf9af1a8056f924f49c29cfc8515385d7
Reviewed-on: https://go-review.googlesource.com/55872 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Change-Id: Id9a54f0c81b1b5db5b5efb12a2ad6509c4ab42b3
Reviewed-on: https://go-review.googlesource.com/55770 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Keith Randall [Thu, 20 Jul 2017 02:52:29 +0000 (19:52 -0700)]
cmd/link: fix bad dwarf for sudog<T>
The DWARF entries for type-specific sudog entries used the
channel value type instead of a pointer-to-value type for the elem field.
Fixes #21094
R=go1.10
Change-Id: I3f63a5664f42b571f729931309f2c9f6f38ab031
Reviewed-on: https://go-review.googlesource.com/50170 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Ilya Tocar [Wed, 9 Aug 2017 19:50:58 +0000 (14:50 -0500)]
cmd/compile/internal/ssa: use sse to zero on amd64
Use 16-byte stores instead of 8-byte stores to zero small blocks.
Also switch to duffzero for 65+ bytes only, because for each
duffzero call we also save/restore BP, so call requires 4 instructions
and replacing it with 4 sse stores doesn't cause code-bloat.
Also switch duffzero to use leaq, instead of addq to avoid clobbering flags.
griesemer [Tue, 15 Aug 2017 12:44:26 +0000 (14:44 +0200)]
go/importer: make source importer more tolerant in presence of errors
If the source importer only encounters "soft" type checking errors
it can safely return the type-checked package because it will be
completely set up. This makes the source importer slightly more
robust in the presence of errors.
Fixes #20855.
Change-Id: I5af9ccdb30eee6bca7a0fab872f6057bde521bf3
Reviewed-on: https://go-review.googlesource.com/55730 Reviewed-by: Alan Donovan <adonovan@google.com>
Daniel Martí [Thu, 10 Aug 2017 02:17:59 +0000 (11:17 +0900)]
reflect: remove useless parameter from newName
pkgPath always received the empty string. Worse yet, it panicked if it
received anything else. This has been the case ever since newName was
introduced in early 2016.
Change-Id: I5f164305bd30c34455ef35e776c7616f303b37e4
Reviewed-on: https://go-review.googlesource.com/54331
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
Change-Id: I087980d30308353c4a450636122f7e87c8310090
Reviewed-on: https://go-review.googlesource.com/56090 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Brian Kessler [Sat, 29 Jul 2017 05:29:30 +0000 (22:29 -0700)]
math/big: recognize z.Mul(x, x) as squaring of x
updates #13745
Multiprecision squaring can be done in a straightforward manner
with about half the multiplications of a basic multiplication
due to the symmetry of the operands. This change implements
basic squaring for nat types and uses it for Int multiplication
when the same variable is supplied to both arguments of
z.Mul(x, x). This has some overhead to allocate a temporary
variable to hold the cross products, shift them to double and
add them to the diagonal terms. There is a speed benefit in
the intermediate range when the overhead is neglible and the
asymptotic performance of karatsuba multiplication has not been
reached.
Show a speed up of 10-25% in the range where basicSqr is optimal,
improved single word squaring and no significant difference when
the fallback to standard multiplication is used.
Change-Id: Iae2c82ca91cf890823f91e5c83bbe9a2c534b72b
Reviewed-on: https://go-review.googlesource.com/53638 Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Alberto Donizetti [Tue, 15 Aug 2017 21:49:12 +0000 (23:49 +0200)]
cmd/go: make go tool suggest 'go doc cmd/<command>'
$ gotip tool -h says:
For more about each tool command, see 'go tool command -h'.
But it's better to suggest
go doc cmd/<command>
Fixes #18313
Change-Id: I0a36d585906a5e1879e5b7927d1b6173e97cb500
Reviewed-on: https://go-review.googlesource.com/55990 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Brian Kessler [Fri, 21 Jul 2017 06:31:51 +0000 (23:31 -0700)]
math/big: speed up GCD x, y calculation
The current implementation of the extended Euclidean GCD algorithm
calculates both cosequences x and y inside the division loop. This
is unneccessary since the second Bezout coefficient can be obtained
at the end of calculation via a multiplication, subtraction and a
division. In case only one coefficient is needed, e.g. ModInverse
this calculation can be skipped entirely. This is a standard
optimization, see e.g.
"Handbook of Elliptic and Hyperelliptic Curve Cryptography"
Cohen et al pp 191
Available at:
http://cs.ucsb.edu/~koc/ccs130h/2013/EllipticHyperelliptic-CohenFrey.pdf
Updates #15833
Change-Id: I1e0d2e63567cfed97fd955048fe6373d36f22757
Reviewed-on: https://go-review.googlesource.com/50530 Reviewed-by: Robert Griesemer <gri@golang.org>
Brian Kessler [Thu, 13 Jul 2017 05:02:39 +0000 (22:02 -0700)]
math: eliminate overflow in Pow(x,y) for large y
The current implementation uses a shift and add
loop to compute the product of x's exponent xe and
the integer part of y (yi) for yi up to 1<<63.
Since xe is an 11-bit exponent, this product can be
up to 74-bits and overflow both 32 and 64-bit int.
This change checks whether the accumulated exponent
will fit in the 11-bit float exponent of the output
and breaks out of the loop early if overflow is detected.
The current handling of yi >= 1<<63 uses Exp(y * Log(x))
which incorrectly returns Nan for x<0. In addition,
for y this large, Exp(y * Log(x)) can be enumerated
to only overflow except when x == -1 since the
boundary cases computed exactly:
Alex Brainman [Mon, 5 Jun 2017 04:29:14 +0000 (14:29 +1000)]
cmd/link: delete addpesection
Change-Id: Iee9db172d28d4d372fa617907078a494e764bf12
Reviewed-on: https://go-review.googlesource.com/55260 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Alex Brainman [Mon, 5 Jun 2017 04:21:35 +0000 (14:21 +1000)]
cmd/link: use peSection everywhere
Change-Id: I4d4e8452b9b9e628f3ea8b2b727ad63ec2a1dd31
Reviewed-on: https://go-review.googlesource.com/55259 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Alex Brainman [Fri, 2 Jun 2017 06:53:22 +0000 (16:53 +1000)]
cmd/link: add peSection
Change-Id: Id3aeeaeaacf5f079fb2ddad579f2f209b7fc0e06
Reviewed-on: https://go-review.googlesource.com/55258 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Alex Brainman [Thu, 1 Jun 2017 07:33:15 +0000 (17:33 +1000)]
cmd/link: introduce and use peFile and peStringTable
Change-Id: Icd13b32d35cde474c9292227471f916a64af88eb
Reviewed-on: https://go-review.googlesource.com/55257 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Joe Tsai [Tue, 15 Aug 2017 01:38:46 +0000 (18:38 -0700)]
archive/tar: make Writer error handling consistent
The Writer logic was not consistent about when an IO error would
persist across multiple calls on Writer's methods.
Thus, to make the error handling more consistent we always check
the persistent state of the error prior to every exported method
call, and return an error if set. Otherwise, it is the responsibility
of every exported method to persist any fatal errors that may occur.
As a simplification, we can remove the close field since that
information can be represented by simply storing ErrWriteAfterClose
in the err field.
Change-Id: I8746ca36b3739803e0373253450db69b3bd12f38
Reviewed-on: https://go-review.googlesource.com/55590
Run-TryBot: Joe Tsai <joetsai@digital-static.net>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Joe Tsai [Mon, 14 Aug 2017 23:44:15 +0000 (16:44 -0700)]
archive/tar: add support for long binary strings in GNU format
The GNU tar format defines the following type flags:
TypeGNULongName = 'L' // Next file has a long name
TypeGNULongLink = 'K' // Next file symlinks to a file w/ a long name
Anytime a string exceeds the field dedicated to store it, the GNU format
permits a fake "file" to be prepended where that file entry has a Typeflag
of 'L' or 'K' and the contents of the file is a NUL-terminated string.
Contrary to previous TODO comments,
the GNU format supports arbitrary strings (without NUL) rather UTF-8 strings.
The manual says the following:
<<<
The name, linkname, magic, uname, and gname are
null-terminated character strings
>>>
<<<
All characters in header blocks are represented
by using 8-bit characters in the local variant of ASCII.
>>>
From this description, we gather the following:
* We must forbid NULs in any GNU strings
* Any 8-bit value (other than NUL) is permitted
Since the modern world has moved to UTF-8, it is really difficult to
determine what a "local variant of ASCII" means. For this reason,
we treat strings as just an arbitrary binary string (without NUL)
and leave it to the user to determine the encoding of this string.
(Practically, it seems that UTF-8 is the typical encoding used
in GNU archives seen in the wild).
The implementation of GNU tar seems to confirm this interpretation
of the manual where it permits any arbitrary binary string to exist
within these fields so long as they do not contain the NUL character.
The fact that we permit arbitrary binary in GNU strings goes
hand-in-hand with the fact that GNU also permits a "base-256" encoding
of numeric fields, which is effectively two-complement binary.
Change-Id: Ic037ec6bed306d07d1312f0058594bd9b64d9880
Reviewed-on: https://go-review.googlesource.com/55573 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
In the existing implementation, if pattern is an empty string,
program calls a panic with the message which is a concatenation of
"http: invalid pattern " and pattern.
In this case, pattern is an empty, so the commit removes
this concatenation and the trailing space.
Fixes: #21102
Change-Id: I49f58b52d835311a6ac642de871eb15646e48a54
Reviewed-on: https://go-review.googlesource.com/50350 Reviewed-by: Dmitri Shuralyov <shurcool@gmail.com> Reviewed-by: Tom Bergan <tombergan@google.com>
Run-TryBot: Tom Bergan <tombergan@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Ian Lance Taylor [Tue, 8 Aug 2017 22:50:43 +0000 (15:50 -0700)]
testing: don't fail all tests after racy test failure
The code was adding race.Errors to t.raceErrors before checking
Failed, but Failed was using t.raceErrors+race.Errors. We don't want
to change Failed, since that would affect tests themselves, so modify
the harness to not unnecessarily change t.raceErrors.
Updates #19851
Fixes #21338
Change-Id: I7bfdf281f90e045146c92444f1370d55c45221d4
Reviewed-on: https://go-review.googlesource.com/54050 Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
cmd/compile: insert ' ' and \n at beginning of walkprint
Rather than emitting spaces and newlines for println
as we walk the expression, construct it all up front.
This enables further optimizations.
This requires using printstring instead of print in
the implementation of printsp and printnl,
on pain of infinite recursion.
That's ok; it's more efficient anyway, and just as simple.
While we're here, do it for other print routines as well.
Hana Kim [Tue, 15 Aug 2017 19:22:28 +0000 (15:22 -0400)]
.gitignore: include only Go project artifiacts
This effectively reverts
https://golang.org/cl/53770
and adds a guide on what not to add in this file.
Update #21458
Change-Id: I7c740d492b70628b5d9f9e1622014995a3f6f8ec
Reviewed-on: https://go-review.googlesource.com/55871 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Daniel Morsing [Wed, 2 Aug 2017 18:01:17 +0000 (19:01 +0100)]
runtime: move selectdone into g
Writing to selectdone on the stack of another goroutine meant a
pretty subtle dance between the select code and the stack copying
code. Instead move the selectdone variable into the g struct.
Keith Randall [Tue, 30 May 2017 19:59:25 +0000 (12:59 -0700)]
cmd/compile: set itab function pointers at compile time
I noticed that we don't set an itab's function pointers at compile
time. Instead, we currently do it at executable startup.
Set the function pointers at compile time instead. This shortens
startup time. It has no effect on normal binary size. Object files
will have more relocations, but that isn't a big deal.
For PIE there are additional pointers that will need to be adjusted at
load time. There are already other pointers in an itab that need to be
adjusted, so the cache line will already be paged in. There might be
some binary size overhead to mark these pointers. The "go test -c
-buildmode=pie net/http" binary is 0.18% bigger.
Update #20505
Change-Id: I267c82489915b509ff66e512fc7319b2dd79b8f7
Reviewed-on: https://go-review.googlesource.com/44341
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Andreas Auernhammer [Fri, 26 May 2017 09:33:49 +0000 (11:33 +0200)]
crypto/tls: don't check whether an ec point is on a curve twice
The processClientKeyExchange and processServerKeyExchange functions unmarshal an
encoded EC point and explicitly check whether the point is on the curve. The explicit
check can be omitted because elliptic.Unmarshal fails if the point is not on the curve
and the returned error would always be the same.
Fixes #20496
Change-Id: I5231a655eace79acee2737dd036a0c255ed42dbb
Reviewed-on: https://go-review.googlesource.com/44311 Reviewed-by: Adam Langley <agl@golang.org> Reviewed-by: Avelino <t@avelino.xxx>
Run-TryBot: Adam Langley <agl@golang.org>
Austin Clements [Tue, 15 Aug 2017 15:32:02 +0000 (11:32 -0400)]
runtime: fix getclosureptr doc
Change-Id: I1b42fca2107b06e6fc95728f7bf3d08d005c4cb4
Reviewed-on: https://go-review.googlesource.com/55810 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Tobias Klauser [Mon, 14 Aug 2017 07:47:58 +0000 (09:47 +0200)]
syscall: really use utimensat for UtimesNano on Solaris
golang.org/cl/55130 added utimensat for Solaris but didn't use it in
UtimesNano (despite indicating otherwise in the commit message). Fix
this by also using utimensat for UtimesNano on Solaris.
Because all versions of Solaris suppported by Go support utimensat,
there is no need for the fallback logic and utimensat can be called
unconditionally.
This issue was pointed out by Shawn Walker-Salas.
Updates #16480
Change-Id: I114338113a6da3cfcb8bca950674bdc8f5a7a9e5
Reviewed-on: https://go-review.googlesource.com/55141
Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Hana (Hyang-Ah) Kim [Fri, 4 Aug 2017 21:38:46 +0000 (17:38 -0400)]
.gitignore: exclude /.idea/
Some IDEs (e.g. intellij IDE based ones) create the .idea folder
to store project specific settings. This is irrelevant to Go project
that does not assume any specific IDEs, but interferes with git.
Change-Id: I0c93d9a3f7edff095fbe0c7a53b06c92b391c970
Reviewed-on: https://go-review.googlesource.com/53770 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Agniva De Sarker [Sun, 13 Aug 2017 18:15:04 +0000 (23:45 +0530)]
encoding/hex: save allocation in DecodeString()
The destination slice does not need to be created at all. The source
slice itself can be used as the destination because the decode loop
increments by one and then the 'seen' byte is not used anymore. Therefore
the decoded byte can be stored in that index of the source slice itself.
This trick cannot be applied to EncodeString() because in that case,
the destination slice is large than the source. And for a single byte
in the source slice, two bytes in the destination slice is written.
func BenchmarkDecodeString(b *testing.B) {
for i := 0; i < b.N; i++ {
DecodeString("0123456789abcdef")
}
}
name old time/op new time/op delta
DecodeString 71.0ns ± 6% 58.0ns ± 0% -18.28% (p=0.008 n=5+5)
name old alloc/op new alloc/op delta
DecodeString 16.0B ± 0% 8.0B ± 0% -50.00% (p=0.008 n=5+5)
name old allocs/op new allocs/op delta
DecodeString 1.00 ± 0% 1.00 ± 0% ~ (all equal)
Change-Id: Id98db4e712444557a804155457a4dd8d1b8b416d
Reviewed-on: https://go-review.googlesource.com/55611 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Tobias Klauser [Tue, 15 Aug 2017 08:27:42 +0000 (10:27 +0200)]
syscall: fix definition of _AT_FDCWD on dragonfly
CL golang.org/cl/55130 messed up the definition of _AT_FDCWD on
dragonfly.
This fixes the following test failure on dragonfly/amd64:
--- FAIL: TestPackageMainTestImportsArchiveNotBinary (0.00s)
go_test.go:192: chtimes ./testdata/src/main_test/m.go: bad file descriptor
Change-Id: I4c96983769e6b02d714859dc838875c3c0f1be50
Reviewed-on: https://go-review.googlesource.com/55690
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
The stxr/stxrw/stxrb/stxrh instructions belong to STLXR-like instructions
set and they require special handling. The current code has no special
handling for those instructions.
The fix adds the special handling for those instructions.
Improve static branch prediction in arm64 wrapper prologue
by making the unusual case branch forwards. (Most other
architectures implement this optimization.)
Additionally, replace a CMP+BNE pair with a CBNZ
to save one instruction.
Hiroshi Ioka [Tue, 15 Aug 2017 11:53:49 +0000 (20:53 +0900)]
misc/cgo/testshared: call flag.Parse in TestMain
Otherwise, some test flags don't work.
Change-Id: Iacf3930d0eec28e4d690cd382adbb2ecf866a0e2
Reviewed-on: https://go-review.googlesource.com/55615 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
philhofer [Wed, 9 Aug 2017 05:01:26 +0000 (05:01 +0000)]
cmd/compile: add support for arm64 bit-test instructions
Add support for generating TBZ/TBNZ instructions.
The bit-test-and-branch pattern shows up in a number of
important places, including the runtime (gc bitmaps).
Before this change, there were 3 TB[N]?Z instructions in the Go tool,
all of which were in hand-written assembly. After this change, there
are 285. Also, the go1 benchmark binary gets about 4.5kB smaller.
Martin Möhrmann [Sun, 13 Aug 2017 18:03:02 +0000 (20:03 +0200)]
cmd/compile: generate makechan calls with int arguments
Where possible generate calls to runtime makechan with int arguments
during compile time instead of makechan with int64 arguments.
This eliminates converting arguments for calls to makechan with
int64 arguments for platforms where int64 values do not fit into
arguments of type int.
A similar optimization for makeslice was introduced in CL
golang.org/cl/27851.
Joe Tsai [Tue, 15 Aug 2017 00:16:52 +0000 (17:16 -0700)]
archive/tar: re-implement USTAR path splitting
The logic for USTAR was disabled because a previous implementation of
Writer had a wrong understanding of the differences between USTAR and GNU,
causing the prefix field is incorrectly be populated in GNU files.
Now that this issue has been fixed, we can re-enable the logic for USTAR
path splitting, which allows Writer to use the USTAR for a wider range
of possible inputs.
Updates #9683
Updates #12594
Updates #17630
Change-Id: I9fe34e5df63f99c6dd56fee3a7e7e4d6ec3995c9
Reviewed-on: https://go-review.googlesource.com/55574
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Joe Tsai [Tue, 15 Aug 2017 03:11:02 +0000 (20:11 -0700)]
archive/tar: centralize errors in common.go
Move all sentinel errors to common.go since some of them are
returned by both the reader and writer and remove errInvalidHeader
since it not used.
Also, consistently use the "tar: " prefix for errors.
Change-Id: I0afb185bbf3db80dfd9595321603924454a4c2f9
Reviewed-on: https://go-review.googlesource.com/55650 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Martin Möhrmann [Sat, 5 Aug 2017 11:44:25 +0000 (13:44 +0200)]
runtime: simplify memory capacity check in growslice
Instead of comparing if the number of elements will
not fit into memory check if the memory size of the
slices backing memory is higher then the memory limit.
Note that due to integer division from capmem > _MaxMem
it does not follow that uintptr(newcap) > maxSliceCap(et.size).
Consolidated runtime GrowSlice benchmarks by using sub-benchmarks and
added more struct sizes to show performance improvement when division
is avoided for element sizes larger than 32 bytes.
Russ Cox [Fri, 11 Aug 2017 20:22:10 +0000 (16:22 -0400)]
cmd/link: implement R_X86_64_PC64 relocations
Change-Id: I1d7bd5cff7350a4e0f78b8efc8406e79c74732d1
Reviewed-on: https://go-review.googlesource.com/55370 Reviewed-by: Ian Lance Taylor <iant@golang.org>