1
0
mirror of https://github.com/golang/go synced 2024-11-07 01:46:15 -07:00
Commit Graph

34031 Commits

Author SHA1 Message Date
Giovanni Bajo
11f494f37e runtime: rename offsets macros to prepare for multiple versions
High Sierra has a new commpage layout (this is issue #3188), so
we need to adjust the code to handle multiple versions of the
layout.

In preparation for this change, we rename the existing offset
macros with a prefix that identifies the commpage version they
refer to.

Updates #22037

Change-Id: Idca4b7a855a2ff6dbc434cd12453fc3194707aa8
Reviewed-on: https://go-review.googlesource.com/67331
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-03 14:53:33 +00:00
Florian Uekermann
630d176e7d time: enable ZONEINFO tzdata file support and error reporting
Loading location data from tzdata files was only supported
from default paths on android. This change enables support on
all OS via the ZONEINFO environment variable and reduces the
amount of android specific code significantly.
Furthermore, unsuccessful calls to LoadLocation now return the
first error encountered, including errors from attempting to
load a location from the source specified by ZONEINFO.
Errors indicating that the source or location was not found are
ignored until all possible sources have been traversed.

Change-Id: I45bc23b92253c9447f12f95f3ca29a7e613ed995
Reviewed-on: https://go-review.googlesource.com/67170
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-03 14:35:32 +00:00
Ian Lance Taylor
a9345307a1 doc: update GCC release info in gccgo_install
Fixes #22077

Change-Id: I8d1b18e78719514fa2a410e85c9d3934c47cd2fe
Reviewed-on: https://go-review.googlesource.com/66930
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2017-10-03 14:33:14 +00:00
Grant Griffiths
0bbc3dd4b5 net/smtp: patch for SMTP injections
Fixes #21159.

Change-Id: I2c5ad505d673e213a548e5d632a5b3ad706e0dde
Reviewed-on: https://go-review.googlesource.com/67635
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-03 14:23:31 +00:00
Elias Naur
eb5bf55496 misc/ios: always kill lldb process when it hangs
The lldb child process is killed if a test runs too long. Also
kill it when the setup times out (and is retried).

Might help with builder flakes where all 5 attempts to start up
lldb fail even though the tests before and after the timeouts
succeed. For example:

...
ok  	vendor/golang_org/x/net/route	37.797s
lldb setup error: command timeout (lldb start for 17s)
start timeout, trying again
lldb setup error: command timeout (lldb start for 17s)
start timeout, trying again
lldb setup error: command timeout (lldb start for 17s)
start timeout, trying again
lldb setup error: command timeout (lldb start for 17s)
start timeout, trying again
lldb setup error: command timeout (lldb start for 17s)
go_darwin_arm_exec: failed to start test harness (retry attempted)
FAIL	vendor/golang_org/x/text/transform	115.185s
ok  	vendor/golang_org/x/text/unicode/norm	122.773s
...

Change-Id: I6638860522896491dccfa12f1e520c0f23df6d66
Reviewed-on: https://go-review.googlesource.com/67791
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-03 14:21:35 +00:00
Russ Cox
6b4008db8b cmd/go: drop PackageInternal.Fake
The point of this code is to print a warning about repeated go test
invocations rebuilding the same packages over and over.
The new cache will eliminate this failure mode and with it
the need for the warning and this field.

Change-Id: Ied79b3ca67d51a61f44629de6ae4974e6c8dd5a9
Reviewed-on: https://go-review.googlesource.com/56282
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-03 14:11:06 +00:00
Russ Cox
9f52b5ab14 cmd/dist: fix mkdeps
Mistake introduced just before submitting CL 67650 that somehow
did not break a final pre-submit all.bash on my laptop.

Not sure why all.bash passes locally when mkdeps.go doesn't build.
I guess the test only runs on builders?

Change-Id: I18fb91ada47605035345ba4b2f5e360a5c4b7f6e
Reviewed-on: https://go-review.googlesource.com/67850
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2017-10-03 14:10:17 +00:00
Russ Cox
94e6d3de72 cmd/dist: change mkdeps to be more merge-friendly
In addition to the obvious formatting change, this also drops
from deps.go any indirect dependencies, so that when you add
a new import to one package, the resulting diff only affects that
one package, not every package that imports that package
directly or indirectly. That makes the file a bit easier to understand,
if you need to debug it or deal with a possible merge conflict.

The code to trim the import lists (but not too much) was more
than I wanted to do in shell, so I rewrote mkdeps in Go.

The shell script is left behind for backwards-compatibility with
people who have learned to run ./mkdeps.bash (or documentation
suggesting the same).

Change-Id: I0bf27b5b27d0440e11ea830b00735c73f58eae03
Reviewed-on: https://go-review.googlesource.com/67650
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-10-03 14:06:29 +00:00
Austin Clements
70258cc59f cmd/compile: rename (*Type).HasPointer to (*Type).HasHeapPointer
This method indicates whether a type contains any *heap* pointers, not
just whether it contains any pointers. Rename the method to make this
clear.

Change-Id: Ifff143e2f02a820444ac26b84250495c0098cb33
Reviewed-on: https://go-review.googlesource.com/67690
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-10-03 13:40:06 +00:00
Lynn Boger
f47c8f130e runtime: skip test that intermittently hangs on ppc64le
A new testcase TestSelectFairness was recently added, and
since then the ppc64le build tests have intermittently failed.

This adds a change to skip this test on ppc64le using
SkipFlaky to help determine if the problem is with the
test or something else with that commit.

Updates #22047

Change-Id: Idfef72ed791c5bd45c42ff180947fea3df280ea7
Reviewed-on: https://go-review.googlesource.com/67631
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-03 12:26:42 +00:00
Keith Randall
41eabc0fc7 cmd/compile: fix merge rules for panic calls
Use entire inlining call stack to decide whether two panic calls
can be merged. We used to merge panic calls when only the leaf
line numbers matched, but that leads to places higher up the call
stack being merged incorrectly.

Fixes #22083

Change-Id: Ia41400a80de4b6ecf3e5089abce0c42b65e9b38a
Reviewed-on: https://go-review.googlesource.com/67632
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-10-03 09:27:37 +00:00
Martin Kreichgauer
d851f10b81 crypto/x509: add string conversion of PKIX names
Fixes #21615

Change-Id: Ic13190617d9b446b35f5dd00f142597c187ab669
Reviewed-on: https://go-review.googlesource.com/67270
Reviewed-by: Adam Langley <agl@golang.org>
Reviewed-by: Martin Kreichgauer <martinkr@google.com>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-10-03 00:11:25 +00:00
Artyom Pervukhin
d1bef43daf net/http: make TimeoutHandler recover child handler panics
Fixes #22084.

Change-Id: If405ffdc57fcf81de3c0e8473c45fc504db735bc
Reviewed-on: https://go-review.googlesource.com/67410
Run-TryBot: Tom Bergan <tombergan@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tom Bergan <tombergan@google.com>
2017-10-02 19:42:50 +00:00
Adam Langley
c4d63a0d34 crypto/x509: abstract SAN parsing function
We'll need this for handling name constraints during verification.

Change-Id: I4ef19d9489fb2a9ae9a62699d81cef92a21fda28
Reviewed-on: https://go-review.googlesource.com/62692
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-10-02 18:30:34 +00:00
Adam Langley
3079b0ad89 crypto/x509: reject empty name constraints extension
Change-Id: Idcda0fc1607157cb5bbf0521fbdc0c77f043ca3a
Reviewed-on: https://go-review.googlesource.com/62691
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-10-02 18:30:13 +00:00
Alan Donovan
93f1aac246 cmd/vet: in rangeloop check, inspect for loop variables too
+ Test.

Change-Id: I42eaea1c716217f7945c008ff4bde6de14df5687
Reviewed-on: https://go-review.googlesource.com/34619
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-10-02 17:45:00 +00:00
Guilherme Rezende
66fa4fc8b9 net/http: use canonicalAddr on shouldCopyHeaderOnRedirect
Change-Id: Ic3f7f575d3640706adb7d64545ed8027add6c58f
Reviewed-on: https://go-review.googlesource.com/61350
Run-TryBot: Tom Bergan <tombergan@google.com>
Reviewed-by: Tom Bergan <tombergan@google.com>
2017-10-02 17:21:04 +00:00
Alberto Donizetti
60aa2cabbf cmd/objdump: fix and re-enable arm test
Fixes #9021

Change-Id: Id4465857c765342aa8c4b5bc2fdc06754a290025
Reviewed-on: https://go-review.googlesource.com/67530
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-10-02 16:11:26 +00:00
Russ Cox
cb3dc8ba79 cmd/go: drop PackageInternal.External, SFiles
These are no longer used.

Change-Id: I17fa29bbf90b1a41109fde4504eeff06af1eb8be
Reviewed-on: https://go-review.googlesource.com/56281
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2017-10-02 14:26:58 +00:00
Elias Naur
9735fcfce7 sync/atomic: add memory barriers to Load/StoreInt32 on darwin/arm
After switching to an iPhone 5 for the darwin/arm builds,
TestStoreLoadRelAcq32 started to timeout on every builder run.
Adding the same memory barriers as armLoadUint64 and armStoreUint64
makes the test complete successfully.

Fixes sync/atomic tests on the darwin/arm builder.

Change-Id: Id73de31679304e259bdbd7f2f94383ae7fd70ee4
Reviewed-on: https://go-review.googlesource.com/67390
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2017-10-02 09:57:23 +00:00
Tim Cooper
f2af0c1780 bytes: explicitly state if a function expects UTF-8-encoded data
Fixes #21950

Change-Id: I6fa392abd2c3bf6a4f80f14c6b1419470e9a944d
Reviewed-on: https://go-review.googlesource.com/66750
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2017-10-02 00:31:47 +00:00
Dave Cheney
ed815d0038 cmd/link/internal/ld: reduce the scope of some local declarations
Move some local declarations closer to their use, reducing their
respective lifetimes. Spotted while reviewing CL 67318.

Change-Id: I68db67fe8530344d95e50efb6587bc724e1171f5
Reviewed-on: https://go-review.googlesource.com/67370
Run-TryBot: Dave Cheney <dave@cheney.net>
Reviewed-by: Marvin Stenger <marvin.stenger94@gmail.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-10-01 22:00:18 +00:00
Cyrill Schumacher
3487c4e021 database/sql: convertAssign string and time.Time into RawBytes
A new switch case for converting the source string type into a
destination RawBytes type avoids the reflection based conversion.
Speed up from old ~61.7ns/op down to ~49ns/op.

A second new switch case allows to convert and assign a source time.Time
type into a destination sql.RawBytes type. This switch case appends
the time to the reset RawBytes slice. This allows the reuse of RawBytes
and avoids allocations.

Fixes #20746

Change-Id: Ib0563fd5c5c7cb6d9d0acaa1d9aa7b2927f1329c
Reviewed-on: https://go-review.googlesource.com/66830
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
2017-10-01 16:41:57 +00:00
Adam Langley
a82ee9c76d encoding/asn1: respect “explicit” and “tag” when unmarshaling RawValues.
Previously, any “explicit” and/or “tag” decorations on a RawValue would
be ignored when unmarshaling. The RawValue would swallow whatever
element was encountered.

This change causes these decorations to be respected. Thus a field like:
  Foo asn1.RawValue `asn1:"explicit,tag:1,optional"`
will only match if an explicit tag with value one is encountered.
Otherwise the RawValue will get the default value and parsing will move
onto the next element.

Thanks to Martin Kreichgauer for reporting the issue.

Change-Id: If6c4488685b9bd039cb5e352d6d75744f98dbb1f
Reviewed-on: https://go-review.googlesource.com/34503
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2017-09-30 17:01:26 +00:00
Russ Cox
ee4fbbc621 cmd/go: stop creating nested temp directory trees
Now that we have -importcfg, there's no need for the
temporary directory trees that mirror the import path structure,
and we can drop a bunch of complex code that was building
and maintaining that structure.

This should fix "file name too long" errors on systems with low limits.
(For example #10651 and #17070, although we fixed those by
adding code to deal with very long file names on Windows instead.)

Change-Id: I11e221c6c1edeb81c3b2f1d89988f5235aa2bbb9
Reviewed-on: https://go-review.googlesource.com/56280
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-30 00:56:08 +00:00
Russ Cox
a1fb024ac9 cmd/go: hide work subdirectory names in gcc/clang object files
Until now the subdirectories under $WORK have had predictable
names, so it was OK to strip just $WORK from the file names that
end up in object files. In the future, those predictable names would
cause predictable collisions when compiling one package in two
different ways, so we're moving toward arbitrary, unpredictable
subdirectory names instead. When we do that, if the names appear
in the object files we won't get reproducible builds.

Take the subdirectory names out now, to make the later change safe.

Change-Id: I8057d1cc73f6e35c98b7718c9789c161dcbd87c0
Reviewed-on: https://go-review.googlesource.com/67251
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-30 00:55:58 +00:00
Russ Cox
1409c28707 cmd/go: rename .o files going into final .a
CL 64793 removed the collect step, which took all
the generated .o files and merged them into a single _all.o.
Now the generated .o files all go directly into the final .a.

The only property of the _all.o approach that was lost
in CL 64793 was that before we could be sure that the
one name we used was "ar-compatible", that is, short
enough not to be truncated.

Now that the generated .o files are being kept directly,
this CL gives them guaranteed ar-compatible names.

This doesn't matter for nearly all uses today, but for some
future processing it might help not to lose the .o suffix
or not to end up with two identical entries with truncated
names.

I might not have bothered with this except that it's what's
leftover after syncing my own CL disabling _all.o
(necessary for reproducible builds on macOS) against
Ian's CL 64793, which landed first.

Change-Id: Ic86ed2a51432a5a4c58dc523e092a86d341f1997
Reviewed-on: https://go-review.googlesource.com/67250
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-30 00:55:55 +00:00
David Crawshaw
046c658919 misc/cgo/testplugin: add test for issue 18584
Fixes #18584

Change-Id: I5f9428758999cacee49f3449e596e0a88bc06f91
Reviewed-on: https://go-review.googlesource.com/67150
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-29 22:10:22 +00:00
Kevin Burke
33c06b1d46 cmd/compile: fix spelling mistake
Change-Id: Id900636ee58a39aaa3dc1c601cb83706d3e2fbe8
Reviewed-on: https://go-review.googlesource.com/67190
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-29 20:54:55 +00:00
Russ Cox
1b873f5fd2 cmd/go: declare runtime/cgo dependency for darwin/arm, darwin/arm64 tests
I don't know why these tests must import runtime/cgo
in _testmain.go, but if they must, they must also tell the
rest of the go command that they are doing so.

Should fix the newly-broken darwin/arm and darwin/arm64 builders.

Change-Id: I9b183f8c84c6f403bf3a90cbfc838d6ef428e16f
Reviewed-on: https://go-review.googlesource.com/67230
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-09-29 20:11:01 +00:00
Ian Lance Taylor
c56434f6a6 cmd/go: don't modify input slice in gccSupportsFlag
Modifying the input slice broke the new test for whether gccgo
supports -fgo-importcfg, as the test passed a slice of the argument
slice it was in the process of building.

Fixes #22089

Change-Id: I45444a82673223c46be0c8579da3e31a74c32d73
Reviewed-on: https://go-review.googlesource.com/67191
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2017-09-29 18:54:12 +00:00
Marvin Stenger
bad5abf64d cmd/compile: avoid copying in nilcheckelim2
nilcheckelim2 cleans up by copying b.Values in a loop, omitting
OpUnknowns. However, the common case is that there are no OpUnknowns,
in which case we can skip a lot of work.

So we track the first nilcheck which was eliminated, if any, and only
start copying from there. If no nilcheck was eliminated we won't copy at all.

Fixes #20964

Change-Id: Icd44194cf8ac81ce6485ce257b4d33e093003a40
Reviewed-on: https://go-review.googlesource.com/65651
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-09-29 09:27:14 +00:00
Russ Cox
d8efa0e0ed cmd/go: add gccgo support for recent work
Implement importcfg on behalf of gccgo by writing out a
tree of symbolic links. In addition to keeping gccgo working
with the latest changes, this also fixes a precedence bug in
gccgo's cmd/go vendor support (the vendor equivalent of #14271).

Change-Id: I0e5645116e1c84c957936baf22e3126ba6b0d46e
Reviewed-on: https://go-review.googlesource.com/61731
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-09-29 00:23:01 +00:00
Russ Cox
0be2d52eba cmd/go: use -importcfg to invoke compiler, linker
This is a step toward using cached build artifacts: the importcfg
will direct the compiler and linker to read them right from the cache
if necessary. However, this CL does not have a cache yet, so it still
reads them from the usual install location or build location.
Even so, this fixes a long-standing issue that -I and -L (no longer used)
are not expressive enough to describe complex GOPATH setups.

Shared libraries are handled enough that all.bash passes, but
there may still be more work to do here. If so, tests and fixes
can be added in follow-up CLs.

Gccgo will need updating to support -importcfg as well.

Fixes #14271.

Change-Id: I5c52a0a5df0ffbf7436e1130c74e9e24fceff80f
Reviewed-on: https://go-review.googlesource.com/56279
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-29 00:22:58 +00:00
Daniel Martí
a2993456bb cmd/compile: add reflect to TestIntendedInlining
Add the package to the table and start it off with a few small, basic
functions. Inspired by CL 66331, which added flag.ro.

Updates #21851.

Change-Id: I3995cde1ff7bb09a718110473bed8b193c2232a5
Reviewed-on: https://go-review.googlesource.com/66990
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-28 21:09:46 +00:00
Tim Cooper
0828ec1ea8 flag: align multi-line usage strings
Previously, a multi-line flag usage string would not be indented with the
rest of the usage strings. This made long usage strings difficult to read.

For example, the usage for flag.String("A", "", "1\n2\n3") would be printed
as:

  -A	1
2
3

But will now be printed as:

  -A	1
    	2
    	3

Also fixes a slight error in the FlagSet.PrintDefaults documentation.

Fixes #20799

Change-Id: I4379c6b7590fdb93a2809a01046a0f6ae32c3e5d
Reviewed-on: https://go-review.googlesource.com/66711
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2017-09-28 20:45:32 +00:00
Daniel Martí
ded2c65db3 cmd/compile: simplify a few bits of the code
Remove an unused type, a few redundant returns and replace a few slice
append loops with a single append.

Change-Id: If07248180bae5631b5b152c6051d9635889997d5
Reviewed-on: https://go-review.googlesource.com/66851
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2017-09-28 20:40:17 +00:00
Heschi Kreinick
6bbe1bc940 cmd/compile: cover control flow insns in location lists
The information that's used to generate DWARF location lists is very
ssa.Value centric; it uses Values as start and end coordinates to define
ranges. That mostly works fine, but control flow instructions don't come
from Values, so the ranges couldn't cover them.

Control flow instructions are generated when the SSA representation is
converted to assembly, so that's the best place to extend the ranges
to cover them. (Before that, there's nothing to refer to, and afterward
the boundaries between blocks have been lost.) That requires block
information in the debugInfo type, which then flows down to make
everything else awkward. On the plus side, there's a little less copying
slices around than there used to be, so it should be a little faster.

Previously, the ranges for empty blocks were not very meaningful. That
was fine, because they had no Values to cover, so no debug information
was generated for them. But they do have control flow instructions
(that's why they exist) and so now it's important that the information
be correct. Introduce two sentinel values, BlockStart and BlockEnd, that
denote the boundary of a block, even if the block is empty. BlockEnd
replaces the previous SurvivedBlock flag.

There's one more problem: the last instruction in the function will be a
control flow instruction, so any live ranges need to be extended past
it. But there's no instruction after it to use as the end of the range.
Instead, leave the EndProg field of those ranges as nil and fix it up to
point to past the end of the assembled text at the very last moment.

Change-Id: I81f884020ff36fd6fe8d7888fc57c99412c4245b
Reviewed-on: https://go-review.googlesource.com/63010
Reviewed-by: Alessandro Arzilli <alessandro.arzilli@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-28 20:30:12 +00:00
Matthew Dempsky
6f1724ff41 reflect: fix method indexing for non-ASCII exported methods
Currently, methods are sorted by name. This happens to guarantee that
exported ASCII methods appear before non-exported ASCII methods, but
this breaks down when Unicode method names are considered.

Type.Method already accounts for this by always indexing into the
slice returned by exportedMethods. This CL makes Value.Method do the
same.

Fixes #22073.

Change-Id: I9bfc6bbfb7353e0bd3c439a15d1c3da60d16d209
Reviewed-on: https://go-review.googlesource.com/66770
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-09-28 18:06:53 +00:00
Agniva De Sarker
b3cae37464 doc: fix minor capitalization typo
Updated page to Page to match with the sample code

Fixes #21773

Change-Id: Ia884a22fd587860c7a6148103b2b474425e45284
Reviewed-on: https://go-review.googlesource.com/66790
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-28 17:13:13 +00:00
Marvin Stenger
9ec5f5b35f runtime: delete unused function dumpbvtypes
The function dumpbvtypes has no use case anymore, so we remove it with
this change.

Change-Id: I1e0323542be2bcc683b75dffde76b222e087c285
Reviewed-on: https://go-review.googlesource.com/66370
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-28 15:40:53 +00:00
Ian Lance Taylor
d0006e7868 net: use newLocalListener in TestClosingListener.
Updates #21856

Change-Id: I9baa51fe23e6dd2fcf9dd14f7acfaf7457571e1d
Reviewed-on: https://go-review.googlesource.com/66334
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2017-09-28 03:02:07 +00:00
Ian Lance Taylor
1591dad274 net: move some Linux-specific tests to unixsock_linux_test.go file
Also changed name from TestUnix... to TestUnixgram....

Updates #21965

Change-Id: I2833110b77e9fe1b28d4a15feb3d70453ab98d3b
Reviewed-on: https://go-review.googlesource.com/66333
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
2017-09-28 03:00:34 +00:00
Daniel Martí
39e523792e cmd/compile: fix another invalid switch case panic
Very similar fix to the one made in golang.org/cl/65655. This time it's
for switches on interface values, as we look for duplicates in a
different manner to keep types in mind.

As before, add a small regression test.

Updates #22001.
Fixes #22063.

Change-Id: I9a55d08999aeca262ad276b4649b51848a627b02
Reviewed-on: https://go-review.googlesource.com/66450
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-09-27 21:19:06 +00:00
Cyrill Schumacher
70bcd2c54e database/sql: TestConversions add forgotten fields wantbytes and wantraw
The fields wantbytes and wantraw in the test struct `conversionTest` has
been forgotten to include in the TestConversions function.

Change-Id: I6dab69e76de3799a1bbf9fa09a15607e55172114
Reviewed-on: https://go-review.googlesource.com/66610
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-27 20:42:07 +00:00
Agniva De Sarker
ecff94311d cmd/cgo: simplify a call to strip spaces
Combined the Split and Join call with a Replace. This simplifies
the code as well as makes it fast.

Micro-benchmarks show good improvements -

func BenchmarkJoinSplit(b *testing.B) {
  for n := 0; n < b.N; n++ {
    strings.Join(strings.Split("this string has some spaces", " "), "")
  }
}

func BenchmarkReplace(b *testing.B) {
  for n := 0; n < b.N; n++ {
    strings.Replace("this string has some spaces", " ", "", -1)
  }
}

name         old time/op    new time/op    delta
JoinSplit-4     308ns ± 2%     192ns ± 4%  -37.60%  (p=0.008 n=5+5)

name         old alloc/op   new alloc/op   delta
JoinSplit-4      144B ± 0%       64B ± 0%  -55.56%  (p=0.008 n=5+5)

name         old allocs/op  new allocs/op  delta
JoinSplit-4      3.00 ± 0%      2.00 ± 0%  -33.33%  (p=0.008 n=5+5)

Change-Id: I1dc32105ae7a0be5a43ab0bedde992cefbed5d7d
Reviewed-on: https://go-review.googlesource.com/66590
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-27 19:52:55 +00:00
Joe Tsai
d94078f040 reflect: add URL scheme for godoc hyperlinking
Adding the "https://" scheme allows godoc to properly detect
the URL and provide a hyperlink for it.

Change-Id: I76dc309368c86975de01bc6e6e9196037b2114d7
Reviewed-on: https://go-review.googlesource.com/66570
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-27 18:23:25 +00:00
Matthew Dempsky
6471ace2ea reflect: fix mutability of non-exported embedded fields
The reflect API normally grants only read-only access to non-exported
fields, but it specially handles non-exported embedded fields so that
users can still fully access promoted fields and methods. For example,
if v.Field(i) refers to a non-exported embedded field, it would be
limited to RO access. But if v.Field(i).Field(j) is an exported field,
then the resulting Value will have full access.

However, the way this was implemented allowed other operations to be
interspersed between the Field calls, which could grant inappropriate
access.

Relatedly, Elem() is safe to use on pointer-embeddings, but it was
also being allowed on embeddings of interface types. This is
inappropriate because it could allow accessing methods of the dynamic
value's complete method set, not just those that were promoted via the
interface embedding.

Fixes #22031.
Fixes #22053.

Change-Id: I9db9be88583f1c1d80c1b4705a76f23a4379182f
Reviewed-on: https://go-review.googlesource.com/66331
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-27 18:03:28 +00:00
Austin Clements
a714470cce runtime: allow more CPUs on FreeBSD
Currently the FreeBSD CPU affinity code assumes that the maximum
GOMAXPROCS is 256, but we just removed that limit.

This commit rewrites the FreeBSD CPU affinity code to raise the CPU
count limit to 65,536, like the Linux CPU affinity code, and to
degrade more gracefully if we do somehow go over that.

Change-Id: Ic4ca7f88bd8b9448aae4dbd43ef21a6c1b8fea63
Reviewed-on: https://go-review.googlesource.com/66291
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-27 16:29:18 +00:00
Austin Clements
e900e275e8 runtime: clean up loops over allp
allp now has length gomaxprocs, which means none of allp[i] are nil or
in state _Pdead. This lets replace several different styles of loops
over allp with normal range loops.

for i := 0; i < gomaxprocs; i++ { ... } loops can simply range over
allp. Likewise, range loops over allp[:gomaxprocs] can just range over
allp.

Loops that check for p == nil || p.state == _Pdead don't need to check
this any more.

Loops that check for p == nil don't have to check this *if* dead Ps
don't affect them. I checked that all such loops are, in fact,
unaffected by dead Ps. One loop was potentially affected, which this
fixes by zeroing p.gcAssistTime in procresize.

Updates #15131.

Change-Id: Ifa1c2a86ed59892eca0610360a75bb613bc6dcee
Reviewed-on: https://go-review.googlesource.com/45575
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-09-27 16:29:15 +00:00