From ee392ac10c7bed0ef1984dbb421491ca7b18e190 Mon Sep 17 00:00:00 2001
From: Ian Lance Taylor
Date: Fri, 21 Jul 2017 16:37:40 -0700
Subject: [PATCH 01/36] cmd/compile: consider exported flag in namedata
It is possible to have an unexported name with a nil package,
for an embedded field whose type is a pointer to an unexported type.
We must encode that fact in the type..namedata symbol name,
to avoid incorrectly merging an unexported name with an exported name.
Fixes #21120
Change-Id: I2e3879d77fa15c05ad92e0bf8e55f74082db5111
Reviewed-on: https://go-review.googlesource.com/50710
Run-TryBot: Ian Lance Taylor
TryBot-Result: Gobot Gobot
Reviewed-by: David Crawshaw
---
src/cmd/compile/internal/gc/reflect.go | 6 +++++-
test/fixedbugs/issue21120.dir/a.go | 13 ++++++++++++
test/fixedbugs/issue21120.dir/b.go | 29 ++++++++++++++++++++++++++
test/fixedbugs/issue21120.dir/main.go | 25 ++++++++++++++++++++++
test/fixedbugs/issue21120.go | 11 ++++++++++
5 files changed, 83 insertions(+), 1 deletion(-)
create mode 100644 test/fixedbugs/issue21120.dir/a.go
create mode 100644 test/fixedbugs/issue21120.dir/b.go
create mode 100644 test/fixedbugs/issue21120.dir/main.go
create mode 100644 test/fixedbugs/issue21120.go
diff --git a/src/cmd/compile/internal/gc/reflect.go b/src/cmd/compile/internal/gc/reflect.go
index decd3beda7..91e6f46804 100644
--- a/src/cmd/compile/internal/gc/reflect.go
+++ b/src/cmd/compile/internal/gc/reflect.go
@@ -582,7 +582,11 @@ func dname(name, tag string, pkg *types.Pkg, exported bool) *obj.LSym {
sname += "-noname-unexported." + tag
}
} else {
- sname += name + "." + tag
+ if exported {
+ sname += name + "." + tag
+ } else {
+ sname += name + "-" + tag
+ }
}
} else {
sname = fmt.Sprintf(`%s"".%d`, sname, dnameCount)
diff --git a/test/fixedbugs/issue21120.dir/a.go b/test/fixedbugs/issue21120.dir/a.go
new file mode 100644
index 0000000000..f2ee252671
--- /dev/null
+++ b/test/fixedbugs/issue21120.dir/a.go
@@ -0,0 +1,13 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package a
+
+type S struct {
+ x int
+}
+
+func V() interface{} {
+ return S{0}
+}
diff --git a/test/fixedbugs/issue21120.dir/b.go b/test/fixedbugs/issue21120.dir/b.go
new file mode 100644
index 0000000000..b00bd53a5d
--- /dev/null
+++ b/test/fixedbugs/issue21120.dir/b.go
@@ -0,0 +1,29 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package b
+
+import "reflect"
+
+type X int
+
+func F1() string {
+ type x X
+
+ s := struct {
+ *x
+ }{nil}
+ v := reflect.TypeOf(s)
+ return v.Field(0).PkgPath
+}
+
+func F2() string {
+ type y X
+
+ s := struct {
+ *y
+ }{nil}
+ v := reflect.TypeOf(s)
+ return v.Field(0).PkgPath
+}
diff --git a/test/fixedbugs/issue21120.dir/main.go b/test/fixedbugs/issue21120.dir/main.go
new file mode 100644
index 0000000000..1f1ec30e56
--- /dev/null
+++ b/test/fixedbugs/issue21120.dir/main.go
@@ -0,0 +1,25 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+ "fmt"
+ "os"
+
+ "./a"
+ "./b"
+)
+
+func main() {
+ // Make sure the reflect information for a.S is in the executable.
+ _ = a.V()
+
+ b1 := b.F1()
+ b2 := b.F2()
+ if b1 != b2 {
+ fmt.Printf("%q (from b.F1()) != %q (from b.F2())\n", b1, b2)
+ os.Exit(1)
+ }
+}
diff --git a/test/fixedbugs/issue21120.go b/test/fixedbugs/issue21120.go
new file mode 100644
index 0000000000..ea896ce8e1
--- /dev/null
+++ b/test/fixedbugs/issue21120.go
@@ -0,0 +1,11 @@
+// rundir
+
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// The compiler was using an incomplete symbol name for reflect name data,
+// permitting an invalid merge in the linker, producing an incorrect
+// exported flag bit.
+
+package ignored
From b9661a14eabeb6ee3b9bf4a001aed4c88991be28 Mon Sep 17 00:00:00 2001
From: Zac Bergquist
Date: Mon, 24 Jul 2017 19:05:43 -0400
Subject: [PATCH 02/36] doc: add Atom to editor guide
Fixes #20569
Change-Id: I752a49ed50c1567f8db7112859ac073f37dd77dc
Reviewed-on: https://go-review.googlesource.com/50952
Reviewed-by: Jaana Burcu Dogan
---
doc/editors.html | 27 ++++++++++++++++++++++++---
doc/editors/go-plus.png | Bin 0 -> 15558 bytes
2 files changed, 24 insertions(+), 3 deletions(-)
create mode 100644 doc/editors/go-plus.png
diff --git a/doc/editors.html b/doc/editors.html
index 1448781036..5228dfc7a8 100644
--- a/doc/editors.html
+++ b/doc/editors.html
@@ -24,6 +24,7 @@ editing, navigation, testing, and debugging experience.
an extension for Visual Studio Code to provide support for the Go programming language
Gogland: Gogland is distributed either as a standalone IDE
or as a plugin for the IntelliJ Platform IDEs
+
Go-Plus: Go-Plus is an Atom package that provides enhanced Go support
@@ -44,6 +45,7 @@ The following feature matrix lists and compares the most significant features.
Vim Go
Visual Studio Code Go
Gogland
+
Go-Plus
Editing features
@@ -53,42 +55,49 @@ The following feature matrix lists and compares the most significant features.
Yes
Yes
Yes
+
Yes
Autocompletion of identifers (variable, method, and function names)
Yes
Yes
Yes
+
Yes
Autocompletion based on type
No
No
Yes
+
No
Rename identifiers
Yes
Yes
Yes
+
Yes
Auto format, build, vet, and lint on save
Yes
Yes
Yes1
+
Yes
Auto insert import paths and remove unused on save
Yes
Yes
Yes2
+
Yes
Auto generate JSON, XML tags for struct fields
Yes
Yes
Yes
+
Yes
Navigation features
@@ -98,30 +107,35 @@ The following feature matrix lists and compares the most significant features.
Yes
Yes
Yes
+
Yes
Switch between *.go and *_test.go file
Yes
Yes
Yes
+
No
Jump to definition and referees
Yes
Yes
Yes
+
Yes
Look up for interface implementations
Yes
Yes
Yes
+
Yes
Search for callers and callees
Yes
Yes
Yes
+
Yes
Testing and debugging features
@@ -131,36 +145,43 @@ The following feature matrix lists and compares the most significant features.
No
Yes
Yes
+
Yes3
+
Run a single test case, all tests from file, or all tests from a package
Yes
Yes
Yes
+
No
Auto generate tests for packages, files and identifiers
@@ -168,6 +189,8 @@ The following feature matrix lists and compares the most significant features.
1: Possible when enabled via Settings > Go > On Save, govet and golint are available via plugins. Also runs tests on save if configured.
2: Additionally, user input can disambiguate when two or more options are available.
+
+3: Available if the go-debug package is installed.
@@ -205,6 +228,4 @@ The following feature matrix lists and compares the most significant features.
background-color: #ebebeb;
font-weight: bold;
}
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/doc/editors/go-plus.png b/doc/editors/go-plus.png
new file mode 100644
index 0000000000000000000000000000000000000000..c09c7fe6756a7203964d15d079593811557c9672
GIT binary patch
literal 15558
zcmY+r19)aJw8Cp*d7D+|f9
zvsbcK!W87h;bCxK0002Iq=bm#cd7TE383d4)f%T1`VXmz1q%JGNZD?yvuWw{)U`+33ZTF200PwnTe^;%Io%D&^tgUPu
zx!w3k{tJWqyZ#?A0}0W8p*UIck*Lcm5DD8l7!$G4v(ht?@WT)h5%D@0nQ$wLi2YCZ
z?-n14nUj+pHv@yKt1G=L3%#v_DFYK17Z(E~GXpa--8TlEqq~ihz8js5Bk6w=`TyvM
z7&{s|nAr~t$?vq)MEf%IM81V}g#{OY9dM++V(bcc
z$F#yj%UDlXQ?soR+&^C7hmCcuhimwf6lwjEU_F{tQSRJOb*Z}Ls^a{w@#~8uzwCFC
z)i~u=b6`SZY-}tt!{^iPU^r&%Dv1xAkH~g3)H|{tA{@vvr0Si$YR2>tUFD-!1!{+2t(6ECN3
zxPgD#JSAuN!$&D9GWA4O>oglin*?K+cdEiOCjaP
zkGTg#TM&$hMZo8}7cxDGR-+CeFpUTi5Z<9<%j0VacDzU*UEW7`iInw(Y{r{Db>J}H
zk~LvcZzzE?V#ExI8a7a6#@gn3G?nRD)w28d&tYS)J_L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tbimm_E;0`!tR%CPH$Uf%s!ou~OhbI(vx
zq-b73>4h8Og9q^gjHhgtXO6zhchXiYV%J%%D{T6o)2pNhGl-uYFNeU9*p|h!w}sj1
z?ghq_s6T;MS$`0s5`d=;E~vfL{4eIUrL5soUvQ;n^XA?6I{AW)#s;N*)wk6)vFUl$
zxs)xxjbByYJ3|Et|wz(Z-j?*LLjMTOOKkoljZrk;8m{^?UaT=t4%8R=7kV+UO
za!tvukJD!hRO9i>JCf<{h3j?3E8@f#Z0(0NBED+DtM&oJrj1?n(i^u#?x0OVH-(!P
z?cH?7TprcveGXVR|7*f_is&^!jnL*QAlGwn2yANGv`by+g4_u;>40QI3wOE?c)lJc
ze19g;2D~l-EyLggC8Su`tLb$aeR@yR*3wXWBU)n?UhC|zb?SFRQlEbz+5r*R2_o)h
zdI)@h*=z@zCpe}AUB7Xn2OVn0f@j_y^^>mL%~$qf-58`3~x!8w+Owl~jhaU{mcM=RC`BoJxgtp82JuG#^FB
zG`V7{8&u6HW`_Vg1|WC^ff9$H-)PZ8=NKx;uN0-?4tGuTuSEOUIk`ReD9Qiqyowbk
zAm0A=|AMW6<1^?&Q-1TX}z;BSrex~$!zOyuFz~xbQ!K^JViiQuiL6t~Bm34W5t0af4
zbHa)n;8@h4IhF5iacoPX_CpQ=l-ggs@mUz<+;a2G=7haH|J5iylQUp0BzjMQ8c#Rj
zdj$X9IqJRrz7^@-aV29{ufT+T>{`Ao4XLUbO!wx^r`fl)EVY%xJPwz2@g1hRRc_yJ
z)Ar2e4WZ5gDt2%aBJAij4Btr=LJ-@(
Date: Tue, 25 Jul 2017 14:08:47 -0400
Subject: [PATCH 03/36] doc: cleanup editor page
Fix some UI issues introduced with CL50952:
- increase header colspan to account for additional column
- remove ':' character from footnotes
Change-Id: I56f59b8e4b2852612b3c6c7c0dfe99125dd8b57b
Reviewed-on: https://go-review.googlesource.com/51113
Reviewed-by: Jaana Burcu Dogan
---
doc/editors.html | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/doc/editors.html b/doc/editors.html
index 5228dfc7a8..1da83daf07 100644
--- a/doc/editors.html
+++ b/doc/editors.html
@@ -24,7 +24,7 @@ editing, navigation, testing, and debugging experience.
an extension for Visual Studio Code to provide support for the Go programming language
Gogland: Gogland is distributed either as a standalone IDE
or as a plugin for the IntelliJ Platform IDEs
-
Go-Plus: Go-Plus is an Atom package that provides enhanced Go support
+
Go-Plus: Go-Plus is an Atom package that provides enhanced Go support
@@ -48,7 +48,7 @@ The following feature matrix lists and compares the most significant features.
Go-Plus
-
Editing features
+
Editing features
Build and run from the editor/IDE
@@ -100,7 +100,7 @@ The following feature matrix lists and compares the most significant features.
Yes
-
Navigation features
+
Navigation features
Display documentation inline, or open godoc in browser
@@ -138,7 +138,7 @@ The following feature matrix lists and compares the most significant features.
Yes
-
Testing and debugging features
+
Testing and debugging features
Debugger support
@@ -186,11 +186,11 @@ The following feature matrix lists and compares the most significant features.
-1: Possible when enabled via Settings > Go > On Save, govet and golint are available via plugins. Also runs tests on save if configured.
+1Possible when enabled via Settings > Go > On Save, govet and golint are available via plugins. Also runs tests on save if configured.
-2: Additionally, user input can disambiguate when two or more options are available.
+2Additionally, user input can disambiguate when two or more options are available.
-3: Available if the go-debug package is installed.
+3Available if the go-debug package is installed.
@@ -228,4 +228,4 @@ The following feature matrix lists and compares the most significant features.
background-color: #ebebeb;
font-weight: bold;
}
-
\ No newline at end of file
+
From df91b8044dbe790c69c16058330f545be069cc1f Mon Sep 17 00:00:00 2001
From: Jaana Burcu Dogan
Date: Tue, 25 Jul 2017 13:03:48 -0700
Subject: [PATCH 04/36] doc: list editor options by name, not plugin name
So the users can recognize their option by their editor's name.
Fixes #20398.
Change-Id: Id314d4dbe26f40231a479b179620d7e66512b506
Reviewed-on: https://go-review.googlesource.com/51114
Reviewed-by: Chris Broadfoot
---
doc/editors.html | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/doc/editors.html b/doc/editors.html
index 1da83daf07..5df5d38bce 100644
--- a/doc/editors.html
+++ b/doc/editors.html
@@ -19,12 +19,12 @@ editing, navigation, testing, and debugging experience.
-
Vim Go: a plugin for Vim to provide Go programming language support
-
Visual Studio Code Go:
-an extension for Visual Studio Code to provide support for the Go programming language
+
vim: vim-go plugin provides Go programming language support
+
Visual Studio Code:
+Go extension provides support for the Go programming language
Gogland: Gogland is distributed either as a standalone IDE
or as a plugin for the IntelliJ Platform IDEs
-
Go-Plus: Go-Plus is an Atom package that provides enhanced Go support
+
Atom: Go-Plus is an Atom package that provides enhanced Go support
@@ -42,10 +42,10 @@ The following feature matrix lists and compares the most significant features.
-
Vim Go
-
Visual Studio Code Go
+
vim
+
Visual Studio Code
Gogland
-
Go-Plus
+
Atom
Editing features
From 835dfef939879b284d4c0f4e1726491f27e4f1ee Mon Sep 17 00:00:00 2001
From: Vladimir Stefanovic
Date: Thu, 4 May 2017 16:45:29 +0200
Subject: [PATCH 05/36] runtime/pprof: prevent a deadlock that SIGPROF might
create on mips{,le}
64bit atomics on mips/mipsle are implemented using spinlocks. If SIGPROF
is received while the program is in the critical section, it will try to
write the sample using the same spinlock, creating a deadloop.
Prevent it by creating a counter of SIGPROFs during atomic64 and
postpone writing the sample(s) until called from elsewhere, with
pc set to _LostSIGPROFDuringAtomic64.
Added a test case, per Cherry's suggestion. Works around #20146.
Change-Id: Icff504180bae4ee83d78b19c0d9d6a80097087f9
Reviewed-on: https://go-review.googlesource.com/42652
Run-TryBot: Cherry Zhang
TryBot-Result: Gobot Gobot
Reviewed-by: Cherry Zhang
---
src/runtime/cpuprof.go | 9 +++++++++
src/runtime/pprof/pprof_test.go | 31 +++++++++++++++++++++++++++++++
src/runtime/proc.go | 31 +++++++++++++++++++++++++++----
3 files changed, 67 insertions(+), 4 deletions(-)
diff --git a/src/runtime/cpuprof.go b/src/runtime/cpuprof.go
index c761e440b6..fb841a9f3d 100644
--- a/src/runtime/cpuprof.go
+++ b/src/runtime/cpuprof.go
@@ -163,6 +163,15 @@ func (p *cpuProfile) addExtra() {
}
}
+func (p *cpuProfile) addLostAtomic64(count uint64) {
+ hdr := [1]uint64{count}
+ lostStk := [2]uintptr{
+ funcPC(_LostSIGPROFDuringAtomic64) + sys.PCQuantum,
+ funcPC(_System) + sys.PCQuantum,
+ }
+ cpuprof.log.write(nil, 0, hdr[:], lostStk[:])
+}
+
// CPUProfile panics.
// It formerly provided raw access to chunks of
// a pprof-format profile generated by the runtime.
diff --git a/src/runtime/pprof/pprof_test.go b/src/runtime/pprof/pprof_test.go
index 22fea0a52f..992d2abb6a 100644
--- a/src/runtime/pprof/pprof_test.go
+++ b/src/runtime/pprof/pprof_test.go
@@ -12,6 +12,7 @@ import (
"fmt"
"internal/testenv"
"io"
+ "io/ioutil"
"math/big"
"os"
"os/exec"
@@ -20,6 +21,7 @@ import (
"runtime/pprof/internal/profile"
"strings"
"sync"
+ "sync/atomic"
"testing"
"time"
)
@@ -713,3 +715,32 @@ func TestCPUProfileLabel(t *testing.T) {
})
})
}
+
+// Check that there is no deadlock when the program receives SIGPROF while in
+// 64bit atomics' critical section. Used to happen on mips{,le}. See #20146.
+func TestAtomicLoadStore64(t *testing.T) {
+ f, err := ioutil.TempFile("", "profatomic")
+ if err != nil {
+ t.Fatalf("TempFile: %v", err)
+ }
+ defer os.Remove(f.Name())
+ defer f.Close()
+
+ if err := StartCPUProfile(f); err != nil {
+ t.Fatal(err)
+ }
+ defer StopCPUProfile()
+
+ var flag uint64
+ done := make(chan bool, 1)
+
+ go func() {
+ for atomic.LoadUint64(&flag) == 0 {
+ runtime.Gosched()
+ }
+ done <- true
+ }()
+ time.Sleep(50 * time.Millisecond)
+ atomic.StoreUint64(&flag, 1)
+ <-done
+}
diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index a5ada4f6db..ed333bb92e 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -3232,10 +3232,14 @@ var prof struct {
hz int32
}
-func _System() { _System() }
-func _ExternalCode() { _ExternalCode() }
-func _LostExternalCode() { _LostExternalCode() }
-func _GC() { _GC() }
+func _System() { _System() }
+func _ExternalCode() { _ExternalCode() }
+func _LostExternalCode() { _LostExternalCode() }
+func _GC() { _GC() }
+func _LostSIGPROFDuringAtomic64() { _LostSIGPROFDuringAtomic64() }
+
+// Counts SIGPROFs received while in atomic64 critical section, on mips{,le}
+var lostAtomic64Count uint64
// Called if we receive a SIGPROF signal.
// Called by the signal handler, may run during STW.
@@ -3245,6 +3249,21 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) {
return
}
+ // On mips{,le}, 64bit atomics are emulated with spinlocks, in
+ // runtime/internal/atomic. If SIGPROF arrives while the program is inside
+ // the critical section, it creates a deadlock (when writing the sample).
+ // As a workaround, create a counter of SIGPROFs while in critical section
+ // to store the count, and pass it to sigprof.add() later when SIGPROF is
+ // received from somewhere else (with _LostSIGPROFDuringAtomic64 as pc).
+ if GOARCH == "mips" || GOARCH == "mipsle" {
+ if f := findfunc(pc); f.valid() {
+ if hasprefix(funcname(f), "runtime/internal/atomic") {
+ lostAtomic64Count++
+ return
+ }
+ }
+ }
+
// Profiling runs concurrently with GC, so it must not allocate.
// Set a trap in case the code does allocate.
// Note that on windows, one thread takes profiles of all the
@@ -3371,6 +3390,10 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) {
}
if prof.hz != 0 {
+ if (GOARCH == "mips" || GOARCH == "mipsle") && lostAtomic64Count > 0 {
+ cpuprof.addLostAtomic64(lostAtomic64Count)
+ lostAtomic64Count = 0
+ }
cpuprof.add(gp, stk[:n])
}
getg().m.mallocing--
From e157fac02d4700e9fa8e1c30265a2d90a51be6f3 Mon Sep 17 00:00:00 2001
From: Josh Bleecher Snyder
Date: Mon, 24 Jul 2017 10:17:15 -0700
Subject: [PATCH 06/36] test: add README
Updates #21034
Change-Id: I951fb48ab3b9ed54d225c11879db8f09048a36a3
Reviewed-on: https://go-review.googlesource.com/50950
Reviewed-by: Rob Pike
---
test/README.md | 15 +++++++++++++++
1 file changed, 15 insertions(+)
create mode 100644 test/README.md
diff --git a/test/README.md b/test/README.md
new file mode 100644
index 0000000000..ca6a8c6580
--- /dev/null
+++ b/test/README.md
@@ -0,0 +1,15 @@
+The test directory contains tests of the Go tool chain and runtime.
+It includes black box tests, regression tests, and error output tests.
+They are run as part of all.bash.
+
+To run just these tests, execute:
+
+ go run run.go
+
+Standard library tests should be written as regular Go tests in the appropriate package.
+
+The tool chain and runtime also have regular Go tests in their packages.
+The main reasons to add a new test to this directory are:
+
+* it is most naturally expressed using the test runner; or
+* it is also applicable to `gccgo` and other Go tool chains.
From 45a4609c0ae214e448612e0bc0846e2f2682f1b2 Mon Sep 17 00:00:00 2001
From: Brad Fitzpatrick
Date: Thu, 27 Jul 2017 04:33:18 +0000
Subject: [PATCH 07/36] cmd/dist: skip moved GOROOT on Go's Windows builders
when not sharding tests
Change-Id: I0bcae339624e7d61037d9ea0885b7bd07491bbb6
Reviewed-on: https://go-review.googlesource.com/51430
Run-TryBot: Brad Fitzpatrick
TryBot-Result: Gobot Gobot
Reviewed-by: Ian Lance Taylor
---
src/cmd/dist/test.go | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go
index 6846970ecf..73432d31ea 100644
--- a/src/cmd/dist/test.go
+++ b/src/cmd/dist/test.go
@@ -447,6 +447,17 @@ func (t *tester) registerTests() {
t.runPending(dt)
moved := t.goroot + "-moved"
if err := os.Rename(t.goroot, moved); err != nil {
+ if t.goos == "windows" {
+ // Fails on Windows (with "Access is denied") if a process
+ // or binary is in this directory. For instance, using all.bat
+ // when run from c:\workdir\go\src fails here
+ // if GO_BUILDER_NAME is set. Our builders invoke tests
+ // a different way which happens to work when sharding
+ // tests, but we should be tolerant of the non-sharded
+ // all.bat case.
+ log.Printf("skipping test on Windows")
+ return nil
+ }
return err
}
From ac29f30dbb35d8812c865aed6a6ae738a480def3 Mon Sep 17 00:00:00 2001
From: Ian Lance Taylor
Date: Wed, 26 Jul 2017 09:46:58 -0700
Subject: [PATCH 08/36] plugin: mention that there are known bugs with plugins
Change-Id: I9e63661cac2bebc41d7aa3cd80e1920eec22b894
Reviewed-on: https://go-review.googlesource.com/51250
Reviewed-by: Brad Fitzpatrick
Reviewed-by: David Crawshaw
---
src/plugin/plugin.go | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/plugin/plugin.go b/src/plugin/plugin.go
index 3dc7964048..c774465812 100644
--- a/src/plugin/plugin.go
+++ b/src/plugin/plugin.go
@@ -4,8 +4,6 @@
// Package plugin implements loading and symbol resolution of Go plugins.
//
-// Currently plugins only work on Linux.
-//
// A plugin is a Go main package with exported functions and variables that
// has been built with:
//
@@ -14,6 +12,9 @@
// When a plugin is first opened, the init functions of all packages not
// already part of the program are called. The main function is not run.
// A plugin is only initialized once, and cannot be closed.
+//
+// The plugin support is currently incomplete, only supports Linux,
+// and has known bugs. Please report any issues.
package plugin
// Plugin is a loaded Go plugin.
From 31b2c4cc255b98e4255854a008c0c9b53ad4fd26 Mon Sep 17 00:00:00 2001
From: Gustav Westling
Date: Sun, 30 Jul 2017 22:14:22 +0200
Subject: [PATCH 09/36] .github: add .md extension to SUPPORT file
This makes GitHub render the markdown file automatically
on their web UI.
SUPPORT.md is the recommended file name according to the GitHub
documentation:
https://help.github.com/articles/adding-support-resources-to-your-project/
Fixes #21223
Change-Id: I9f9b9daced9c29a16850e8c446656f353f50b1ae
Reviewed-on: https://go-review.googlesource.com/52013
Reviewed-by: Brad Fitzpatrick
---
.github/{SUPPORT => SUPPORT.md} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename .github/{SUPPORT => SUPPORT.md} (100%)
diff --git a/.github/SUPPORT b/.github/SUPPORT.md
similarity index 100%
rename from .github/SUPPORT
rename to .github/SUPPORT.md
From 780249eed449ea8ae63f0dec258c55381f30173b Mon Sep 17 00:00:00 2001
From: Austin Clements
Date: Fri, 28 Jul 2017 18:06:03 -0400
Subject: [PATCH 10/36] runtime: fall back to small mmaps if we fail to grow
reservation
Right now, if it's possible to grow the arena reservation but
mheap.sysAlloc fails to get 256MB more of memory, it simply fails.
However, on 32-bit we have a fallback path that uses much smaller
mmaps that could take in this situation, but fail to.
This commit fixes mheap.sysAlloc to use a common failure path in case
it can't grow the reservation. On 32-bit, this path includes the
fallback.
Ideally, mheap.sysAlloc would attempt smaller reservation growths
first, but taking the fallback path is a simple change for Go 1.9.
Updates #21044 (fixes one of two issues).
Change-Id: I1e0035ffba986c3551479d5742809e43da5e7c73
Reviewed-on: https://go-review.googlesource.com/51713
Run-TryBot: Austin Clements
Reviewed-by: Ian Lance Taylor
TryBot-Result: Gobot Gobot
---
src/runtime/malloc.go | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go
index 8850659748..0ebd2c0ab2 100644
--- a/src/runtime/malloc.go
+++ b/src/runtime/malloc.go
@@ -416,7 +416,10 @@ func (h *mheap) sysAlloc(n uintptr) unsafe.Pointer {
var reserved bool
p := uintptr(sysReserve(unsafe.Pointer(h.arena_end), p_size, &reserved))
if p == 0 {
- return nil
+ // TODO: Try smaller reservation
+ // growths in case we're in a crowded
+ // 32-bit address space.
+ goto reservationFailed
}
// p can be just about anywhere in the address
// space, including before arena_end.
@@ -476,6 +479,7 @@ func (h *mheap) sysAlloc(n uintptr) unsafe.Pointer {
return unsafe.Pointer(p)
}
+reservationFailed:
// If using 64-bit, our reservation is all we have.
if sys.PtrSize != 4 {
return nil
From 623e2c4603053c8e2ecf4cd7ed5f8242a7a02226 Mon Sep 17 00:00:00 2001
From: Austin Clements
Date: Fri, 28 Jul 2017 17:44:09 -0400
Subject: [PATCH 11/36] runtime: map bitmap and spans during heap
initialization
We lazily map the bitmap and spans areas as the heap grows. However,
right now we're very slightly too lazy. Specifically, the following
can happen on 32-bit:
1. mallocinit fails to allocate any heap arena, so
arena_used == arena_alloc == arena_end == bitmap.
2. There's less than 256MB between the end of the bitmap mapping and
the next mapping.
3. On the first allocation, mheap.sysAlloc sees that there's not
enough room in [arena_alloc, arena_end) because there's no room at
all. It gets a 256MB mapping from somewhere *lower* in the address
space than arena_used and sets arena_alloc and arena_end to this
hole.
4. Since the new arena_alloc is lower than arena_used, mheap.sysAlloc
doesn't bother to call mheap.setArenaUsed, so we still don't have a
bitmap mapping or a spans array mapping.
5. mheap.grow, which called mheap.sysAlloc, attempts to fill in the
spans array and crashes.
Fix this by mapping the metadata regions for the initial arena_used
when the heap is initialized, rather than trying to wait for an
allocation. This maintains the intended invariant that the structures
are always mapped for [arena_start, arena_used).
Fixes #21044.
Change-Id: I4422375a6e234b9f979d22135fc63ae3395946b0
Reviewed-on: https://go-review.googlesource.com/51714
Run-TryBot: Austin Clements
Reviewed-by: Ian Lance Taylor
---
src/runtime/mheap.go | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/runtime/mheap.go b/src/runtime/mheap.go
index bf682ec97f..893587e5d2 100644
--- a/src/runtime/mheap.go
+++ b/src/runtime/mheap.go
@@ -503,6 +503,11 @@ func (h *mheap) init(spansStart, spansBytes uintptr) {
sp.array = unsafe.Pointer(spansStart)
sp.len = 0
sp.cap = int(spansBytes / sys.PtrSize)
+
+ // Map metadata structures. But don't map race detector memory
+ // since we're not actually growing the arena here (and TSAN
+ // gets mad if you map 0 bytes).
+ h.setArenaUsed(h.arena_used, false)
}
// setArenaUsed extends the usable arena to address arena_used and
From f20944de78012a257d1e66b8209e2990a14673a7 Mon Sep 17 00:00:00 2001
From: Cherry Zhang
Date: Tue, 18 Jul 2017 08:35:00 -0400
Subject: [PATCH 12/36] cmd/compile: set/unset base register for better
assembly print
For address of an auto or arg, on all non-x86 architectures
the assembler backend encodes the actual SP offset in the
instruction but leaves the offset in Prog unchanged. When the
assembly is printed in compile -S, it shows an offset
relative to pseudo FP/SP with an actual hardware SP base
register (e.g. R13 on ARM). This is confusing. Unset the
base register if it is indeed SP, so the assembly output is
consistent. If the base register isn't SP, it should be an
error and the error output contains the actual base register.
For address loading instructions, the base register isn't set
in the compiler on non-x86 architectures. Set it. Normally it
is SP and will be unset in the change mentioned above for
printing. If it is not, it will be an error and the error
output contains the actual base register.
No change in generated binary, only printed assembly. Passes
"go build -a -toolexec 'toolstash -cmp' std cmd" on all
architectures.
Fixes #21064.
Change-Id: Ifafe8d5f9b437efbe824b63b3cbc2f5f6cdc1fd5
Reviewed-on: https://go-review.googlesource.com/49432
Run-TryBot: Cherry Zhang
TryBot-Result: Gobot Gobot
Reviewed-by: David Chase
---
src/cmd/compile/internal/arm/ssa.go | 2 +-
src/cmd/compile/internal/arm64/ssa.go | 2 +-
src/cmd/compile/internal/gc/asm_test.go | 24 +++++++++++++++++++++++-
src/cmd/compile/internal/mips/ssa.go | 2 +-
src/cmd/compile/internal/mips64/ssa.go | 2 +-
src/cmd/compile/internal/ppc64/ssa.go | 2 +-
src/cmd/internal/obj/arm/asm5.go | 20 ++++++++++++++++++++
src/cmd/internal/obj/arm64/asm7.go | 20 ++++++++++++++++++++
src/cmd/internal/obj/mips/asm0.go | 20 ++++++++++++++++++++
src/cmd/internal/obj/ppc64/asm9.go | 20 ++++++++++++++++++++
src/cmd/internal/obj/s390x/asmz.go | 20 ++++++++++++++++++++
11 files changed, 128 insertions(+), 6 deletions(-)
diff --git a/src/cmd/compile/internal/arm/ssa.go b/src/cmd/compile/internal/arm/ssa.go
index 343f2d3aec..93abee3da0 100644
--- a/src/cmd/compile/internal/arm/ssa.go
+++ b/src/cmd/compile/internal/arm/ssa.go
@@ -464,6 +464,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
case ssa.OpARMMOVWaddr:
p := s.Prog(arm.AMOVW)
p.From.Type = obj.TYPE_ADDR
+ p.From.Reg = v.Args[0].Reg()
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
@@ -485,7 +486,6 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
case nil:
// No sym, just MOVW $off(SP), R
wantreg = "SP"
- p.From.Reg = arm.REGSP
p.From.Offset = v.AuxInt
}
if reg := v.Args[0].RegName(); reg != wantreg {
diff --git a/src/cmd/compile/internal/arm64/ssa.go b/src/cmd/compile/internal/arm64/ssa.go
index dec6a4e93e..0f9e82c727 100644
--- a/src/cmd/compile/internal/arm64/ssa.go
+++ b/src/cmd/compile/internal/arm64/ssa.go
@@ -260,6 +260,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
case ssa.OpARM64MOVDaddr:
p := s.Prog(arm64.AMOVD)
p.From.Type = obj.TYPE_ADDR
+ p.From.Reg = v.Args[0].Reg()
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
@@ -281,7 +282,6 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
case nil:
// No sym, just MOVD $off(SP), R
wantreg = "SP"
- p.From.Reg = arm64.REGSP
p.From.Offset = v.AuxInt
}
if reg := v.Args[0].RegName(); reg != wantreg {
diff --git a/src/cmd/compile/internal/gc/asm_test.go b/src/cmd/compile/internal/gc/asm_test.go
index 221b8497f1..08ec638f44 100644
--- a/src/cmd/compile/internal/gc/asm_test.go
+++ b/src/cmd/compile/internal/gc/asm_test.go
@@ -898,6 +898,17 @@ var linuxAMD64Tests = []*asmTest{
}`,
[]string{"\tCMPL\t[A-Z]"},
},
+ {
+ // make sure assembly output has matching offset and base register.
+ `
+ func f72(a, b int) int {
+ var x [16]byte // use some frame
+ _ = x
+ return b
+ }
+ `,
+ []string{"b\\+40\\(SP\\)"},
+ },
}
var linux386Tests = []*asmTest{
@@ -1302,6 +1313,17 @@ var linuxARMTests = []*asmTest{
`,
[]string{"\tCLZ\t"},
},
+ {
+ // make sure assembly output has matching offset and base register.
+ `
+ func f13(a, b int) int {
+ var x [16]byte // use some frame
+ _ = x
+ return b
+ }
+ `,
+ []string{"b\\+4\\(FP\\)"},
+ },
}
var linuxARM64Tests = []*asmTest{
@@ -1473,7 +1495,7 @@ var linuxARM64Tests = []*asmTest{
return
}
`,
- []string{"\tMOVD\t\"\"\\.a\\+[0-9]+\\(RSP\\), R[0-9]+", "\tMOVD\tR[0-9]+, \"\"\\.b\\+[0-9]+\\(RSP\\)"},
+ []string{"\tMOVD\t\"\"\\.a\\+[0-9]+\\(FP\\), R[0-9]+", "\tMOVD\tR[0-9]+, \"\"\\.b\\+[0-9]+\\(FP\\)"},
},
}
diff --git a/src/cmd/compile/internal/mips/ssa.go b/src/cmd/compile/internal/mips/ssa.go
index d2b4885eaa..e65515a85b 100644
--- a/src/cmd/compile/internal/mips/ssa.go
+++ b/src/cmd/compile/internal/mips/ssa.go
@@ -273,6 +273,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
case ssa.OpMIPSMOVWaddr:
p := s.Prog(mips.AMOVW)
p.From.Type = obj.TYPE_ADDR
+ p.From.Reg = v.Args[0].Reg()
var wantreg string
// MOVW $sym+off(base), R
// the assembler expands it as the following:
@@ -291,7 +292,6 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
case nil:
// No sym, just MOVW $off(SP), R
wantreg = "SP"
- p.From.Reg = mips.REGSP
p.From.Offset = v.AuxInt
}
if reg := v.Args[0].RegName(); reg != wantreg {
diff --git a/src/cmd/compile/internal/mips64/ssa.go b/src/cmd/compile/internal/mips64/ssa.go
index 5a7a601942..db163f3e9d 100644
--- a/src/cmd/compile/internal/mips64/ssa.go
+++ b/src/cmd/compile/internal/mips64/ssa.go
@@ -247,6 +247,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
case ssa.OpMIPS64MOVVaddr:
p := s.Prog(mips.AMOVV)
p.From.Type = obj.TYPE_ADDR
+ p.From.Reg = v.Args[0].Reg()
var wantreg string
// MOVV $sym+off(base), R
// the assembler expands it as the following:
@@ -265,7 +266,6 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
case nil:
// No sym, just MOVV $off(SP), R
wantreg = "SP"
- p.From.Reg = mips.REGSP
p.From.Offset = v.AuxInt
}
if reg := v.Args[0].RegName(); reg != wantreg {
diff --git a/src/cmd/compile/internal/ppc64/ssa.go b/src/cmd/compile/internal/ppc64/ssa.go
index a95dabccf0..5fe140fdcf 100644
--- a/src/cmd/compile/internal/ppc64/ssa.go
+++ b/src/cmd/compile/internal/ppc64/ssa.go
@@ -638,6 +638,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
case ssa.OpPPC64MOVDaddr:
p := s.Prog(ppc64.AMOVD)
p.From.Type = obj.TYPE_ADDR
+ p.From.Reg = v.Args[0].Reg()
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
@@ -660,7 +661,6 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
case nil:
// No sym, just MOVD $off(SP), R
wantreg = "SP"
- p.From.Reg = ppc64.REGSP
p.From.Offset = v.AuxInt
}
if reg := v.Args[0].RegName(); reg != wantreg {
diff --git a/src/cmd/internal/obj/arm/asm5.go b/src/cmd/internal/obj/arm/asm5.go
index cfda99f602..8abf732b2c 100644
--- a/src/cmd/internal/obj/arm/asm5.go
+++ b/src/cmd/internal/obj/arm/asm5.go
@@ -1167,6 +1167,11 @@ func (c *ctxt5) aclass(a *obj.Addr) int {
return C_ADDR
case obj.NAME_AUTO:
+ if a.Reg == REGSP {
+ // unset base register for better printing, since
+ // a.Offset is still relative to pseudo-SP.
+ a.Reg = obj.REG_NONE
+ }
c.instoffset = c.autosize + a.Offset
if t := immaddr(int32(c.instoffset)); t != 0 {
if immhalf(int32(c.instoffset)) {
@@ -1185,6 +1190,11 @@ func (c *ctxt5) aclass(a *obj.Addr) int {
return C_LAUTO
case obj.NAME_PARAM:
+ if a.Reg == REGSP {
+ // unset base register for better printing, since
+ // a.Offset is still relative to pseudo-FP.
+ a.Reg = obj.REG_NONE
+ }
c.instoffset = c.autosize + a.Offset + 4
if t := immaddr(int32(c.instoffset)); t != 0 {
if immhalf(int32(c.instoffset)) {
@@ -1285,10 +1295,20 @@ func (c *ctxt5) aclass(a *obj.Addr) int {
return C_LCONADDR
case obj.NAME_AUTO:
+ if a.Reg == REGSP {
+ // unset base register for better printing, since
+ // a.Offset is still relative to pseudo-SP.
+ a.Reg = obj.REG_NONE
+ }
c.instoffset = c.autosize + a.Offset
return c.aconsize()
case obj.NAME_PARAM:
+ if a.Reg == REGSP {
+ // unset base register for better printing, since
+ // a.Offset is still relative to pseudo-FP.
+ a.Reg = obj.REG_NONE
+ }
c.instoffset = c.autosize + a.Offset + 4
return c.aconsize()
}
diff --git a/src/cmd/internal/obj/arm64/asm7.go b/src/cmd/internal/obj/arm64/asm7.go
index 04a481863a..4419909f69 100644
--- a/src/cmd/internal/obj/arm64/asm7.go
+++ b/src/cmd/internal/obj/arm64/asm7.go
@@ -1149,10 +1149,20 @@ func (c *ctxt7) aclass(a *obj.Addr) int {
return C_GOTADDR
case obj.NAME_AUTO:
+ if a.Reg == REGSP {
+ // unset base register for better printing, since
+ // a.Offset is still relative to pseudo-SP.
+ a.Reg = obj.REG_NONE
+ }
c.instoffset = int64(c.autosize) + a.Offset
return autoclass(c.instoffset)
case obj.NAME_PARAM:
+ if a.Reg == REGSP {
+ // unset base register for better printing, since
+ // a.Offset is still relative to pseudo-FP.
+ a.Reg = obj.REG_NONE
+ }
c.instoffset = int64(c.autosize) + a.Offset + 8
return autoclass(c.instoffset)
@@ -1228,10 +1238,20 @@ func (c *ctxt7) aclass(a *obj.Addr) int {
return C_VCONADDR
case obj.NAME_AUTO:
+ if a.Reg == REGSP {
+ // unset base register for better printing, since
+ // a.Offset is still relative to pseudo-SP.
+ a.Reg = obj.REG_NONE
+ }
c.instoffset = int64(c.autosize) + a.Offset
goto aconsize
case obj.NAME_PARAM:
+ if a.Reg == REGSP {
+ // unset base register for better printing, since
+ // a.Offset is still relative to pseudo-FP.
+ a.Reg = obj.REG_NONE
+ }
c.instoffset = int64(c.autosize) + a.Offset + 8
goto aconsize
}
diff --git a/src/cmd/internal/obj/mips/asm0.go b/src/cmd/internal/obj/mips/asm0.go
index 3cfb260d60..6257e5b83d 100644
--- a/src/cmd/internal/obj/mips/asm0.go
+++ b/src/cmd/internal/obj/mips/asm0.go
@@ -556,6 +556,11 @@ func (c *ctxt0) aclass(a *obj.Addr) int {
return C_LEXT
case obj.NAME_AUTO:
+ if a.Reg == REGSP {
+ // unset base register for better printing, since
+ // a.Offset is still relative to pseudo-SP.
+ a.Reg = obj.REG_NONE
+ }
c.instoffset = int64(c.autosize) + a.Offset
if c.instoffset >= -BIG && c.instoffset < BIG {
return C_SAUTO
@@ -563,6 +568,11 @@ func (c *ctxt0) aclass(a *obj.Addr) int {
return C_LAUTO
case obj.NAME_PARAM:
+ if a.Reg == REGSP {
+ // unset base register for better printing, since
+ // a.Offset is still relative to pseudo-FP.
+ a.Reg = obj.REG_NONE
+ }
c.instoffset = int64(c.autosize) + a.Offset + c.ctxt.FixedFrameSize()
if c.instoffset >= -BIG && c.instoffset < BIG {
return C_SAUTO
@@ -616,6 +626,11 @@ func (c *ctxt0) aclass(a *obj.Addr) int {
return C_LECON
case obj.NAME_AUTO:
+ if a.Reg == REGSP {
+ // unset base register for better printing, since
+ // a.Offset is still relative to pseudo-SP.
+ a.Reg = obj.REG_NONE
+ }
c.instoffset = int64(c.autosize) + a.Offset
if c.instoffset >= -BIG && c.instoffset < BIG {
return C_SACON
@@ -623,6 +638,11 @@ func (c *ctxt0) aclass(a *obj.Addr) int {
return C_LACON
case obj.NAME_PARAM:
+ if a.Reg == REGSP {
+ // unset base register for better printing, since
+ // a.Offset is still relative to pseudo-FP.
+ a.Reg = obj.REG_NONE
+ }
c.instoffset = int64(c.autosize) + a.Offset + c.ctxt.FixedFrameSize()
if c.instoffset >= -BIG && c.instoffset < BIG {
return C_SACON
diff --git a/src/cmd/internal/obj/ppc64/asm9.go b/src/cmd/internal/obj/ppc64/asm9.go
index bdbac03f9c..4d787b1c35 100644
--- a/src/cmd/internal/obj/ppc64/asm9.go
+++ b/src/cmd/internal/obj/ppc64/asm9.go
@@ -758,6 +758,11 @@ func (c *ctxt9) aclass(a *obj.Addr) int {
return C_GOTADDR
case obj.NAME_AUTO:
+ if a.Reg == REGSP {
+ // unset base register for better printing, since
+ // a.Offset is still relative to pseudo-SP.
+ a.Reg = obj.REG_NONE
+ }
c.instoffset = int64(c.autosize) + a.Offset
if c.instoffset >= -BIG && c.instoffset < BIG {
return C_SAUTO
@@ -765,6 +770,11 @@ func (c *ctxt9) aclass(a *obj.Addr) int {
return C_LAUTO
case obj.NAME_PARAM:
+ if a.Reg == REGSP {
+ // unset base register for better printing, since
+ // a.Offset is still relative to pseudo-FP.
+ a.Reg = obj.REG_NONE
+ }
c.instoffset = int64(c.autosize) + a.Offset + c.ctxt.FixedFrameSize()
if c.instoffset >= -BIG && c.instoffset < BIG {
return C_SAUTO
@@ -817,6 +827,11 @@ func (c *ctxt9) aclass(a *obj.Addr) int {
return C_LCON
case obj.NAME_AUTO:
+ if a.Reg == REGSP {
+ // unset base register for better printing, since
+ // a.Offset is still relative to pseudo-SP.
+ a.Reg = obj.REG_NONE
+ }
c.instoffset = int64(c.autosize) + a.Offset
if c.instoffset >= -BIG && c.instoffset < BIG {
return C_SACON
@@ -824,6 +839,11 @@ func (c *ctxt9) aclass(a *obj.Addr) int {
return C_LACON
case obj.NAME_PARAM:
+ if a.Reg == REGSP {
+ // unset base register for better printing, since
+ // a.Offset is still relative to pseudo-FP.
+ a.Reg = obj.REG_NONE
+ }
c.instoffset = int64(c.autosize) + a.Offset + c.ctxt.FixedFrameSize()
if c.instoffset >= -BIG && c.instoffset < BIG {
return C_SACON
diff --git a/src/cmd/internal/obj/s390x/asmz.go b/src/cmd/internal/obj/s390x/asmz.go
index 3bba7b2a5c..6d2b870f0a 100644
--- a/src/cmd/internal/obj/s390x/asmz.go
+++ b/src/cmd/internal/obj/s390x/asmz.go
@@ -505,6 +505,11 @@ func (c *ctxtz) aclass(a *obj.Addr) int {
return C_GOTADDR
case obj.NAME_AUTO:
+ if a.Reg == REGSP {
+ // unset base register for better printing, since
+ // a.Offset is still relative to pseudo-SP.
+ a.Reg = obj.REG_NONE
+ }
c.instoffset = int64(c.autosize) + a.Offset
if c.instoffset >= -BIG && c.instoffset < BIG {
return C_SAUTO
@@ -512,6 +517,11 @@ func (c *ctxtz) aclass(a *obj.Addr) int {
return C_LAUTO
case obj.NAME_PARAM:
+ if a.Reg == REGSP {
+ // unset base register for better printing, since
+ // a.Offset is still relative to pseudo-FP.
+ a.Reg = obj.REG_NONE
+ }
c.instoffset = int64(c.autosize) + a.Offset + c.ctxt.FixedFrameSize()
if c.instoffset >= -BIG && c.instoffset < BIG {
return C_SAUTO
@@ -567,6 +577,11 @@ func (c *ctxtz) aclass(a *obj.Addr) int {
return C_SYMADDR
case obj.NAME_AUTO:
+ if a.Reg == REGSP {
+ // unset base register for better printing, since
+ // a.Offset is still relative to pseudo-SP.
+ a.Reg = obj.REG_NONE
+ }
c.instoffset = int64(c.autosize) + a.Offset
if c.instoffset >= -BIG && c.instoffset < BIG {
return C_SACON
@@ -574,6 +589,11 @@ func (c *ctxtz) aclass(a *obj.Addr) int {
return C_LACON
case obj.NAME_PARAM:
+ if a.Reg == REGSP {
+ // unset base register for better printing, since
+ // a.Offset is still relative to pseudo-FP.
+ a.Reg = obj.REG_NONE
+ }
c.instoffset = int64(c.autosize) + a.Offset + c.ctxt.FixedFrameSize()
if c.instoffset >= -BIG && c.instoffset < BIG {
return C_SACON
From 6f08c935a9474a300d34e7a476628c2667142474 Mon Sep 17 00:00:00 2001
From: Seiji Takahashi
Date: Sun, 30 Jul 2017 21:00:09 +0900
Subject: [PATCH 13/36] cmd/go: show examples with empty output in go test
-list
Fixes #21205
Change-Id: I81b001eb42cbf2a5d5b7b82eb63548b22f501be5
Reviewed-on: https://go-review.googlesource.com/52110
Reviewed-by: Ian Lance Taylor
Run-TryBot: Ian Lance Taylor
---
src/cmd/go/go_test.go | 17 +++++++++++++++
.../go/testdata/src/testlist/bench_test.go | 14 +++++++++++++
.../go/testdata/src/testlist/example_test.go | 21 +++++++++++++++++++
src/cmd/go/testdata/src/testlist/test_test.go | 10 +++++++++
src/testing/testing.go | 2 +-
5 files changed, 63 insertions(+), 1 deletion(-)
create mode 100644 src/cmd/go/testdata/src/testlist/bench_test.go
create mode 100644 src/cmd/go/testdata/src/testlist/example_test.go
create mode 100644 src/cmd/go/testdata/src/testlist/test_test.go
diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go
index e706e27bdf..7d80d965ae 100644
--- a/src/cmd/go/go_test.go
+++ b/src/cmd/go/go_test.go
@@ -4314,3 +4314,20 @@ func TestTestRegexps(t *testing.T) {
t.Errorf("reduced output:<<<\n%s>>> want:<<<\n%s>>>", have, want)
}
}
+
+func TestListTests(t *testing.T) {
+ var tg *testgoData
+ testWith := func(listName, expected string) func(*testing.T) {
+ return func(t *testing.T) {
+ tg = testgo(t)
+ defer tg.cleanup()
+ tg.run("test", "./testdata/src/testlist/...", fmt.Sprintf("-list=%s", listName))
+ tg.grepStdout(expected, fmt.Sprintf("-test.list=%s returned %q, expected %s", listName, tg.getStdout(), expected))
+ }
+ }
+
+ t.Run("Test", testWith("Test", "TestSimple"))
+ t.Run("Bench", testWith("Benchmark", "BenchmarkSimple"))
+ t.Run("Example1", testWith("Example", "ExampleSimple"))
+ t.Run("Example2", testWith("Example", "ExampleWithEmptyOutput"))
+}
diff --git a/src/cmd/go/testdata/src/testlist/bench_test.go b/src/cmd/go/testdata/src/testlist/bench_test.go
new file mode 100644
index 0000000000..22f147b633
--- /dev/null
+++ b/src/cmd/go/testdata/src/testlist/bench_test.go
@@ -0,0 +1,14 @@
+package testlist
+
+import (
+ "fmt"
+ "testing"
+)
+
+func BenchmarkSimplefunc(b *testing.B) {
+ b.StopTimer()
+ b.StartTimer()
+ for i := 0; i < b.N; i++ {
+ _ = fmt.Sprint("Test for bench")
+ }
+}
diff --git a/src/cmd/go/testdata/src/testlist/example_test.go b/src/cmd/go/testdata/src/testlist/example_test.go
new file mode 100644
index 0000000000..0298dfde81
--- /dev/null
+++ b/src/cmd/go/testdata/src/testlist/example_test.go
@@ -0,0 +1,21 @@
+package testlist
+
+import (
+ "fmt"
+)
+
+func ExampleSimple() {
+ fmt.Println("Test with Output.")
+
+ // Output: Test with Output.
+}
+
+func ExampleWithEmptyOutput() {
+ fmt.Println("")
+
+ // Output:
+}
+
+func ExampleNoOutput() {
+ _ = fmt.Sprint("Test with no output")
+}
diff --git a/src/cmd/go/testdata/src/testlist/test_test.go b/src/cmd/go/testdata/src/testlist/test_test.go
new file mode 100644
index 0000000000..bdc09f27c5
--- /dev/null
+++ b/src/cmd/go/testdata/src/testlist/test_test.go
@@ -0,0 +1,10 @@
+package testlist
+
+import (
+ "fmt"
+ "testing"
+)
+
+func TestSimple(t *testing.T) {
+ _ = fmt.Sprint("Test simple")
+}
diff --git a/src/testing/testing.go b/src/testing/testing.go
index 3d1c0c6947..11af926c80 100644
--- a/src/testing/testing.go
+++ b/src/testing/testing.go
@@ -970,7 +970,7 @@ func listTests(matchString func(pat, str string) (bool, error), tests []Internal
}
}
for _, example := range examples {
- if ok, _ := matchString(*matchList, example.Name); ok && example.Output != "" {
+ if ok, _ := matchString(*matchList, example.Name); ok {
fmt.Println(example.Name)
}
}
From 193eda7291c570e84307b3122a4f496a77b0fa4c Mon Sep 17 00:00:00 2001
From: Alberto Donizetti
Date: Tue, 1 Aug 2017 17:41:51 +0200
Subject: [PATCH 14/36] time: skip ZoneAbbr test in timezones with no
abbreviation
The testZoneAbbr assumes that
Parse(RFC1123, t1.Format(RFC1123))
will always succeed. This is not true because Format will fall back to
the numeric zone (ex. -07) for timezones with no abbreviation, but
Parse won't accept the numeric zone when the layout specifies 'MST'
(an abbreviation).
Skip the zone abbreviation test in timezones with no abbreviation.
Fixes #21183
Change-Id: If04691cc23ae1075d8a953733024e17f5a7646de
Reviewed-on: https://go-review.googlesource.com/52430
Run-TryBot: Alberto Donizetti
TryBot-Result: Gobot Gobot
Reviewed-by: Brad Fitzpatrick
---
src/time/zoneinfo_windows_test.go | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/time/zoneinfo_windows_test.go b/src/time/zoneinfo_windows_test.go
index 7ac1e86822..cf3b428c09 100644
--- a/src/time/zoneinfo_windows_test.go
+++ b/src/time/zoneinfo_windows_test.go
@@ -14,6 +14,14 @@ func testZoneAbbr(t *testing.T) {
t1 := Now()
// discard nsec
t1 = Date(t1.Year(), t1.Month(), t1.Day(), t1.Hour(), t1.Minute(), t1.Second(), 0, t1.Location())
+
+ // Skip the test if we're in a timezone with no abbreviation.
+ // Format will fallback to the numeric abbreviation, and
+ // Parse(RFC1123, ..) will fail (see Issue 21183).
+ if tz := t1.Format("MST"); tz[0] == '-' || tz[0] == '+' {
+ t.Skip("No zone abbreviation")
+ }
+
t2, err := Parse(RFC1123, t1.Format(RFC1123))
if err != nil {
t.Fatalf("Parse failed: %v", err)
From b63db76c4ae4e154ed40b4ec3c782d7fe9c0d3b6 Mon Sep 17 00:00:00 2001
From: Ian Lance Taylor
Date: Wed, 2 Aug 2017 10:49:20 -0700
Subject: [PATCH 15/36] testsanitizers: check that tsan program runs, skip
tsan10 on gcc
Check not only that a tsan program can be built, but also that it runs.
This fails with some installations of GCC 7.
Skip the tsan10 program when using GCC, as it reportedly hangs.
This is a patch to help people build 1.9; we may be able to do a
better fix for 1.10.
Updates #21196
Change-Id: Icd1ffbd018dc65a97ff45cab1264b9b0c7fa0ab2
Reviewed-on: https://go-review.googlesource.com/52790
Run-TryBot: Ian Lance Taylor
Run-TryBot: Bryan Mills
Reviewed-by: Bryan Mills
TryBot-Result: Gobot Gobot
---
misc/cgo/testsanitizers/test.bash | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/misc/cgo/testsanitizers/test.bash b/misc/cgo/testsanitizers/test.bash
index ea08f37432..218af396a7 100755
--- a/misc/cgo/testsanitizers/test.bash
+++ b/misc/cgo/testsanitizers/test.bash
@@ -156,15 +156,18 @@ if test "$tsan" = "yes"; then
if ! $CC -fsanitize=thread ${TMPDIR}/testsanitizers$$.c -o ${TMPDIR}/testsanitizers$$ &> ${TMPDIR}/testsanitizers$$.err; then
ok=no
fi
- if grep "unrecognized" ${TMPDIR}/testsanitizers$$.err >& /dev/null; then
+ if grep "unrecognized" ${TMPDIR}/testsanitizers$$.err >& /dev/null; then
echo "skipping tsan tests: -fsanitize=thread not supported"
tsan=no
- elif test "$ok" != "yes"; then
- cat ${TMPDIR}/testsanitizers$$.err
- echo "skipping tsan tests: -fsanitizer=thread build failed"
- tsan=no
- fi
- rm -f ${TMPDIR}/testsanitizers$$*
+ elif test "$ok" != "yes"; then
+ cat ${TMPDIR}/testsanitizers$$.err
+ echo "skipping tsan tests: -fsanitizer=thread build failed"
+ tsan=no
+ elif ! ${TMPDIR}/testsanitizers$$ 2>&1; then
+ echo "skipping tsan tests: running tsan program failed"
+ tsan=no
+ fi
+ rm -f ${TMPDIR}/testsanitizers$$*
fi
# Run a TSAN test.
@@ -196,8 +199,10 @@ if test "$tsan" = "yes"; then
# These tests are only reliable using clang or GCC version 7 or later.
# Otherwise runtime/cgo/libcgo.h can't tell whether TSAN is in use.
ok=false
+ clang=false
if ${CC} --version | grep clang >/dev/null 2>&1; then
ok=true
+ clang=true
else
ver=$($CC -dumpversion)
major=$(echo $ver | sed -e 's/\([0-9]*\).*/\1/')
@@ -213,7 +218,12 @@ if test "$tsan" = "yes"; then
testtsan tsan5.go "CGO_CFLAGS=-fsanitize=thread CGO_LDFLAGS=-fsanitize=thread" "-installsuffix=tsan"
testtsan tsan6.go "CGO_CFLAGS=-fsanitize=thread CGO_LDFLAGS=-fsanitize=thread" "-installsuffix=tsan"
testtsan tsan7.go "CGO_CFLAGS=-fsanitize=thread CGO_LDFLAGS=-fsanitize=thread" "-installsuffix=tsan"
- testtsan tsan10.go "CGO_CFLAGS=-fsanitize=thread CGO_LDFLAGS=-fsanitize=thread" "-installsuffix=tsan"
+
+ # tsan10 reportedly hangs when built with GCC: issue #21196.
+ if test "$clang" = "true"; then
+ testtsan tsan10.go "CGO_CFLAGS=-fsanitize=thread CGO_LDFLAGS=-fsanitize=thread" "-installsuffix=tsan"
+ fi
+
testtsan tsan11.go "CGO_CFLAGS=-fsanitize=thread CGO_LDFLAGS=-fsanitize=thread" "-installsuffix=tsan"
testtsan tsan12.go "CGO_CFLAGS=-fsanitize=thread CGO_LDFLAGS=-fsanitize=thread" "-installsuffix=tsan"
From a8730cd93a6731a14519902ccfed604971d3e8dc Mon Sep 17 00:00:00 2001
From: Andrew Bonventre
Date: Wed, 2 Aug 2017 16:31:46 -0400
Subject: [PATCH 16/36] doc: hide video and share if being served from CN
In the case where requests are coming from mainland China, hide
links to locations that are blocked and functionality that is
not permitted.
Additionally, some very small cleanup of the JS.
This change requires https://go-review.googlesource.com/c/52873
Change-Id: I7fc68748e629dbe5b966d6bf117e7f7b546966eb
Reviewed-on: https://go-review.googlesource.com/52872
Reviewed-by: Chris Broadfoot
---
doc/root.html | 151 ++++++++++++++++++++++++++------------------------
1 file changed, 80 insertions(+), 71 deletions(-)
diff --git a/doc/root.html b/doc/root.html
index 27dbc74ab6..0b3c74954b 100644
--- a/doc/root.html
+++ b/doc/root.html
@@ -6,7 +6,9 @@
+{{end}}
@@ -93,7 +92,25 @@ Linux, Mac OS X, Windows, and more.
(function() {
'use strict';
- function readableTime(t) {
+ window.initFuncs.push(function() {
+ // Set up playground if enabled.
+ if (window.playground) {
+ window.playground({
+ "codeEl": "#learn .code",
+ "outputEl": "#learn .output",
+ "runEl": "#learn .run",
+ "shareEl": "#learn .share",
+ "shareRedirect": "//play.golang.org/p/",
+ "toysEl": "#learn .toys select"
+ });
+ } else {
+ $('#learn').hide()
+ }
+ });
+
+ {{if not $.GoogleCN}}
+
+ function readableTime(t) {
var m = ["January", "February", "March", "April", "May", "June", "July",
"August", "September", "October", "November", "December"];
var p = t.substring(0, t.indexOf("T")).split("-");
@@ -123,29 +140,11 @@ Linux, Mac OS X, Windows, and more.
}
window.initFuncs.push(function() {
- // Set up playground if enabled.
- if (window.playground) {
- window.playground({
- "codeEl": "#learn .code",
- "outputEl": "#learn .output",
- "runEl": "#learn .run",
- "shareEl": "#learn .share",
- "shareRedirect": "//play.golang.org/p/",
- "toysEl": "#learn .toys select"
- });
- } else {
- $('#learn').hide()
- }
-
// Load blog feed.
$('').attr('text', 'text/javascript')
.attr('src', '//blog.golang.org/.json?jsonp=feedLoaded')
.appendTo('body');
- });
- {{if not $.GoogleCN}}
-
- window.initFuncs.push(function() {
// Set the video at random.
var videos = [
{h: 241, s: "//www.youtube.com/embed/ytEkHepK08c"}, // Tour of Go
From ac0ccf3cd2464c6df3193ad8aec8d6053000cdb5 Mon Sep 17 00:00:00 2001
From: Dmitry Savintsev
Date: Thu, 3 Aug 2017 16:51:32 +0200
Subject: [PATCH 20/36] doc/1.9: add CL 36696 for crypto/x509 to the release
notes
add https://go-review.googlesource.com/c/36696
"crypto/x509: ignore CN if SAN extension present"
to the release notes.
Fixes #21289
Change-Id: Ifa184d3816806a8da3c67b68476c923329acf13e
Reviewed-on: https://go-review.googlesource.com/53030
Reviewed-by: Ian Lance Taylor
---
doc/go1.9.html | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/doc/go1.9.html b/doc/go1.9.html
index be0ceefcd5..16d26386c1 100644
--- a/doc/go1.9.html
+++ b/doc/go1.9.html
@@ -473,6 +473,15 @@ version of gccgo.
populated.
+
+
+ If any SAN extension, including with no DSN names, is present
+ in the certificate, then the Common Name from
+ Subjectcode> is ignored.
+ In previous releases, the code tested only whether DNS-name SANs were
+ present in a certificate.
+
From 5495047223935bf3ec96d7a0bd804ea8ab6f5342 Mon Sep 17 00:00:00 2001
From: Dmitry Savintsev
Date: Fri, 4 Aug 2017 10:12:21 +0200
Subject: [PATCH 24/36] doc/1.9: fix broken html link in CL 53030/53210
Change-Id: I7176becd10ad84cbfc3fb9427e190028626e5baf
Reviewed-on: https://go-review.googlesource.com/53291
Reviewed-by: Ian Lance Taylor
---
doc/go1.9.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/go1.9.html b/doc/go1.9.html
index becf1b18b5..967d79b93e 100644
--- a/doc/go1.9.html
+++ b/doc/go1.9.html
@@ -477,7 +477,7 @@ version of gccgo.
If any SAN extension, including with no DSN names, is present
in the certificate, then the Common Name from
- Subject is ignored.
+ Subject is ignored.
In previous releases, the code tested only whether DNS-name SANs were
present in a certificate.
From 78d74fc2cdd66f7c3387d81af01a49bb2e3273ec Mon Sep 17 00:00:00 2001
From: Jaana Burcu Dogan
Date: Fri, 4 Aug 2017 09:47:06 -0700
Subject: [PATCH 25/36] doc: clarify that Gogland is for paid IntelliJ platform
IDEs
Fixes #21213.
Change-Id: I7b8a84de92bbd1d3f78f8a9612f3af8cd092cb94
Reviewed-on: https://go-review.googlesource.com/53351
Reviewed-by: Andrew Bonventre
---
doc/editors.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/editors.html b/doc/editors.html
index 5df5d38bce..9fa451c6d4 100644
--- a/doc/editors.html
+++ b/doc/editors.html
@@ -23,7 +23,7 @@ editing, navigation, testing, and debugging experience.
Visual Studio Code:
Go extension provides support for the Go programming language
Gogland: Gogland is distributed either as a standalone IDE
-or as a plugin for the IntelliJ Platform IDEs
+or as a plugin for the paid IntelliJ Platform IDEs
Atom: Go-Plus is an Atom package that provides enhanced Go support
From 9bb98e02defa62f196c5a0b3c56a5ab88ccfc123 Mon Sep 17 00:00:00 2001
From: Tristan Colgate
Date: Fri, 4 Aug 2017 08:27:56 +0100
Subject: [PATCH 26/36] doc/1.9: add CL 43712, ReverseProxy of HTTP/2 trailers
to the release notes.
Add https://go-review.googlesource.com/c/43712,
"net/http/httputil: ReverseProxy should pass on unannounced Trailers"
to the relase notes.
Fixes #21307
Change-Id: I52c126987a5d0abc4153c0e71b535529c46cd457
Reviewed-on: https://go-review.googlesource.com/53290
Reviewed-by: Brad Fitzpatrick
---
doc/go1.9.html | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/doc/go1.9.html b/doc/go1.9.html
index 967d79b93e..aafd03c51f 100644
--- a/doc/go1.9.html
+++ b/doc/go1.9.html
@@ -773,6 +773,16 @@ version of gccgo.
+ The ReverseProxy
+ now proxies all HTTP/2 response trailers, even those not declared in the initial response
+ header. Such undeclared trailers are used by the gRPC protocol.
+
Visual Studio Code:
Go extension provides support for the Go programming language
Gogland: Gogland is distributed either as a standalone IDE
-or as a plugin for the paid IntelliJ Platform IDEs
+or as a plugin for the commercial IntelliJ Platform IDEs
Atom: Go-Plus is an Atom package that provides enhanced Go support
From 58ad0176ca280c07a966249a3208f707ee0b1989 Mon Sep 17 00:00:00 2001
From: Jaana Burcu Dogan
Date: Fri, 4 Aug 2017 12:59:55 -0700
Subject: [PATCH 28/36] doc: use better wording to explain type-aware
completion
Some editors can filter the autocompletion suggestions based on
whether the code will compile once autocompleted. Explain this
feature with better wording.
Change-Id: I29e4b0396878f18c79208915402c0a209a813b04
Reviewed-on: https://go-review.googlesource.com/53355
Reviewed-by: Florin Patan
Reviewed-by: Andrew Bonventre
---
doc/editors.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/editors.html b/doc/editors.html
index 05986d9ad2..264f5af920 100644
--- a/doc/editors.html
+++ b/doc/editors.html
@@ -65,7 +65,7 @@ The following feature matrix lists and compares the most significant features.
Yes
-
Autocompletion based on type
+
Type-aware autocompletion
No
No
Yes
From 909f409a8d21c69198fc4d3f9bc08b6774650980 Mon Sep 17 00:00:00 2001
From: Ian Lance Taylor
Date: Fri, 4 Aug 2017 11:23:25 -0700
Subject: [PATCH 29/36] doc: mention handling of moved GOROOT in 1.9 release
notes
Updates #20587
Change-Id: Ia131b9a4dc4986950d9ecbfcbd6b026ade234fc0
Reviewed-on: https://go-review.googlesource.com/53370
Reviewed-by: Brad Fitzpatrick
---
doc/go1.9.html | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/doc/go1.9.html b/doc/go1.9.html
index aafd03c51f..7cee379c45 100644
--- a/doc/go1.9.html
+++ b/doc/go1.9.html
@@ -156,6 +156,21 @@ type T1 = T2
directories, write ./vendor/....
+
Moved GOROOT
+
+
+ The go tool will now use the path from which it
+ was invoked to attempt to locate the root of the Go install tree.
+ This means that if the entire Go installation is moved to a new
+ location, the go tool should continue to work as usual.
+ This may be overriden by setting GOROOT in the environment,
+ which should only be done in unusual circumstances.
+ Note that this does not affect the result of
+ the runtime.GOROOT function, which
+ will continue to report the original installation location;
+ this may be fixed in later releases.
+
+
Compiler Toolchain
From a279b53a18dbe317180e9e411ca7892294a62901 Mon Sep 17 00:00:00 2001
From: Ian Lance Taylor
Date: Wed, 2 Aug 2017 17:52:06 -0700
Subject: [PATCH 30/36] reflect: document how DeepEqual handles cycles
Fixes #20428
Change-Id: Ia450e615728efd4ccb6e42117b547cac162f13a3
Reviewed-on: https://go-review.googlesource.com/52931
Reviewed-by: Joe Tsai
---
src/reflect/deepequal.go | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/reflect/deepequal.go b/src/reflect/deepequal.go
index f3fd7043e5..2fdd6a3d82 100644
--- a/src/reflect/deepequal.go
+++ b/src/reflect/deepequal.go
@@ -178,6 +178,12 @@ func deepValueEqual(v1, v2 Value, visited map[visit]bool, depth int) bool {
// DeepEqual has been defined so that the same short-cut applies
// to slices and maps: if x and y are the same slice or the same map,
// they are deeply equal regardless of content.
+//
+// As DeepEqual traverses the data values it may find a cycle. The
+// second and subsequent times that DeepEqual compares two pointer
+// values that have been compared before, it treats the values as
+// equal rather than examining the values to which they point.
+// This ensures that DeepEqual terminates.
func DeepEqual(x, y interface{}) bool {
if x == nil || y == nil {
return x == y
From b01db023b13f9debdcc101ab6836b89be8bfa7f3 Mon Sep 17 00:00:00 2001
From: Ian Lance Taylor
Date: Fri, 4 Aug 2017 15:33:48 -0700
Subject: [PATCH 31/36] misc/cgo/testsanitizers: also skip tsan11/tsan12 when
using GCC
Updates #21196
Change-Id: I307cacc963448b90a23f633bec15498ba7bf1937
Reviewed-on: https://go-review.googlesource.com/53356
Run-TryBot: Ian Lance Taylor
Reviewed-by: Bryan Mills
TryBot-Result: Gobot Gobot
---
misc/cgo/testsanitizers/test.bash | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/misc/cgo/testsanitizers/test.bash b/misc/cgo/testsanitizers/test.bash
index 218af396a7..9f80af6c50 100755
--- a/misc/cgo/testsanitizers/test.bash
+++ b/misc/cgo/testsanitizers/test.bash
@@ -219,14 +219,13 @@ if test "$tsan" = "yes"; then
testtsan tsan6.go "CGO_CFLAGS=-fsanitize=thread CGO_LDFLAGS=-fsanitize=thread" "-installsuffix=tsan"
testtsan tsan7.go "CGO_CFLAGS=-fsanitize=thread CGO_LDFLAGS=-fsanitize=thread" "-installsuffix=tsan"
- # tsan10 reportedly hangs when built with GCC: issue #21196.
+ # The remaining tests reportedly hang when built with GCC; issue #21196.
if test "$clang" = "true"; then
testtsan tsan10.go "CGO_CFLAGS=-fsanitize=thread CGO_LDFLAGS=-fsanitize=thread" "-installsuffix=tsan"
+ testtsan tsan11.go "CGO_CFLAGS=-fsanitize=thread CGO_LDFLAGS=-fsanitize=thread" "-installsuffix=tsan"
+ testtsan tsan12.go "CGO_CFLAGS=-fsanitize=thread CGO_LDFLAGS=-fsanitize=thread" "-installsuffix=tsan"
fi
- testtsan tsan11.go "CGO_CFLAGS=-fsanitize=thread CGO_LDFLAGS=-fsanitize=thread" "-installsuffix=tsan"
- testtsan tsan12.go "CGO_CFLAGS=-fsanitize=thread CGO_LDFLAGS=-fsanitize=thread" "-installsuffix=tsan"
-
testtsanshared
fi
fi
From 9b1e7cf2ac90d2c4637cae480957e0f0152c3622 Mon Sep 17 00:00:00 2001
From: Francesc Campoy
Date: Fri, 4 Aug 2017 15:41:57 -0700
Subject: [PATCH 32/36] math/bits: add examples for OnesCount functions
Change-Id: Ie673f9665825a40281c2584d478ba1260f725856
Reviewed-on: https://go-review.googlesource.com/53357
Run-TryBot: Chris Broadfoot
Reviewed-by: Chris Broadfoot
---
src/math/bits/example_test.go | 40 +++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/src/math/bits/example_test.go b/src/math/bits/example_test.go
index 5d30f4b259..9836245cfb 100644
--- a/src/math/bits/example_test.go
+++ b/src/math/bits/example_test.go
@@ -36,3 +36,43 @@ func ExampleLeadingZeros64() {
// 64
// 63
}
+
+func ExampleOnesCount() {
+ fmt.Printf("%b\n", 14)
+ fmt.Println(bits.OnesCount(14))
+ // Output:
+ // 1110
+ // 3
+}
+
+func ExampleOnesCount8() {
+ fmt.Printf("%b\n", 14)
+ fmt.Println(bits.OnesCount8(14))
+ // Output:
+ // 1110
+ // 3
+}
+
+func ExampleOnesCount16() {
+ fmt.Printf("%b\n", 14)
+ fmt.Println(bits.OnesCount16(14))
+ // Output:
+ // 1110
+ // 3
+}
+
+func ExampleOnesCount32() {
+ fmt.Printf("%b\n", 14)
+ fmt.Println(bits.OnesCount32(14))
+ // Output:
+ // 1110
+ // 3
+}
+
+func ExampleOnesCount64() {
+ fmt.Printf("%b\n", 14)
+ fmt.Println(bits.OnesCount(14))
+ // Output:
+ // 1110
+ // 3
+}
From 3e3da5463302ff6f73a78e60fa7027d554095520 Mon Sep 17 00:00:00 2001
From: Francesc Campoy Flores
Date: Fri, 4 Aug 2017 17:03:33 -0700
Subject: [PATCH 33/36] math/bits: fix example for OnesCount64
Erroneously called OnesCount instead of OnesCount64
Change-Id: Ie877e43f213253e45d31f64931c4a15915849586
Reviewed-on: https://go-review.googlesource.com/53410
Reviewed-by: Chris Broadfoot
---
src/math/bits/example_test.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/math/bits/example_test.go b/src/math/bits/example_test.go
index 9836245cfb..a43d1f365f 100644
--- a/src/math/bits/example_test.go
+++ b/src/math/bits/example_test.go
@@ -71,7 +71,7 @@ func ExampleOnesCount32() {
func ExampleOnesCount64() {
fmt.Printf("%b\n", 14)
- fmt.Println(bits.OnesCount(14))
+ fmt.Println(bits.OnesCount64(14))
// Output:
// 1110
// 3
From f096b5b340f6e831cf80cd39cbf88d4656d232fa Mon Sep 17 00:00:00 2001
From: Ian Lance Taylor
Date: Fri, 4 Aug 2017 10:36:40 -0700
Subject: [PATCH 34/36] runtime: mark activeModules nosplit/nowritebarrier
The activeModules function is called by the cgo pointer checking code,
which is called by the write barrier (when GODEBUG=cgocheck=2), and as
such must be nosplit/nowritebarrier.
Fixes #21306
Change-Id: I57f2124f14de7f3872b2de9532abab15df95d45a
Reviewed-on: https://go-review.googlesource.com/53352
Reviewed-by: Austin Clements
---
misc/cgo/errors/ptr.go | 8 ++++++++
src/runtime/symtab.go | 5 +++++
2 files changed, 13 insertions(+)
diff --git a/misc/cgo/errors/ptr.go b/misc/cgo/errors/ptr.go
index 4dafbdf3c0..3e117666bf 100644
--- a/misc/cgo/errors/ptr.go
+++ b/misc/cgo/errors/ptr.go
@@ -343,6 +343,14 @@ var ptrTests = []ptrTest{
body: `var b C.char; p := &b; C.f((*C.u)(unsafe.Pointer(&p)))`,
fail: false,
},
+ {
+ // Issue #21306.
+ name: "preempt-during-call",
+ c: `void f() {}`,
+ imports: []string{"runtime", "sync"},
+ body: `var wg sync.WaitGroup; wg.Add(100); for i := 0; i < 100; i++ { go func(i int) { for j := 0; j < 100; j++ { C.f(); runtime.GOMAXPROCS(i) }; wg.Done() }(i) }; wg.Wait()`,
+ fail: false,
+ },
}
func main() {
diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go
index 8e410c4560..e1b41ca4ff 100644
--- a/src/runtime/symtab.go
+++ b/src/runtime/symtab.go
@@ -409,6 +409,11 @@ var modulesSlice unsafe.Pointer // see activeModules
//
// A module is active once its gcdatamask and gcbssmask have been
// assembled and it is usable by the GC.
+//
+// This is nosplit/nowritebarrier because it is called by the
+// cgo pointer checking code.
+//go:nosplit
+//go:nowritebarrier
func activeModules() []*moduledata {
p := (*[]*moduledata)(atomic.Loadp(unsafe.Pointer(&modulesSlice)))
if p == nil {
From 380525598ca917fe3226842f91695f4851b34e89 Mon Sep 17 00:00:00 2001
From: Josh Bleecher Snyder
Date: Sun, 6 Aug 2017 06:17:42 -0700
Subject: [PATCH 35/36] all: remove some manual hyphenation
Manual hyphenation doesn't work well when text gets reflown,
for example by godoc.
There are a few other manual hyphenations in the tree,
but they are in local comments or comments for unexported functions.
Change-Id: I17c9b1fee1def650da48903b3aae2fa1e1119a65
Reviewed-on: https://go-review.googlesource.com/53510
Reviewed-by: Brad Fitzpatrick
---
src/go/ast/ast.go | 8 ++++----
src/go/parser/parser.go | 4 ++--
src/math/big/ratconv.go | 4 ++--
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/go/ast/ast.go b/src/go/ast/ast.go
index 77ef98ceaf..9ab7b1e625 100644
--- a/src/go/ast/ast.go
+++ b/src/go/ast/ast.go
@@ -969,14 +969,14 @@ func (*FuncDecl) declNode() {}
//
// For correct printing of source code containing comments (using packages
// go/format and go/printer), special care must be taken to update comments
-// when a File's syntax tree is modified: For printing, comments are inter-
-// spersed between tokens based on their position. If syntax tree nodes are
+// when a File's syntax tree is modified: For printing, comments are interspersed
+// between tokens based on their position. If syntax tree nodes are
// removed or moved, relevant comments in their vicinity must also be removed
// (from the File.Comments list) or moved accordingly (by updating their
// positions). A CommentMap may be used to facilitate some of these operations.
//
-// Whether and how a comment is associated with a node depends on the inter-
-// pretation of the syntax tree by the manipulating program: Except for Doc
+// Whether and how a comment is associated with a node depends on the
+// interpretation of the syntax tree by the manipulating program: Except for Doc
// and Comment comments directly associated with nodes, the remaining comments
// are "free-floating" (see also issues #18593, #20744).
//
diff --git a/src/go/parser/parser.go b/src/go/parser/parser.go
index 1b4309b5da..2b58724521 100644
--- a/src/go/parser/parser.go
+++ b/src/go/parser/parser.go
@@ -1707,8 +1707,8 @@ func (p *parser) parseSimpleStmt(mode int) (ast.Stmt, bool) {
}
// The label declaration typically starts at x[0].Pos(), but the label
// declaration may be erroneous due to a token after that position (and
- // before the ':'). If SpuriousErrors is not set, the (only) error re-
- // ported for the line is the illegal label error instead of the token
+ // before the ':'). If SpuriousErrors is not set, the (only) error
+ // reported for the line is the illegal label error instead of the token
// before the ':' that caused the problem. Thus, use the (latest) colon
// position for error reporting.
p.error(colon, "illegal label declaration")
diff --git a/src/math/big/ratconv.go b/src/math/big/ratconv.go
index a6a401c857..4bc6ef7e80 100644
--- a/src/math/big/ratconv.go
+++ b/src/math/big/ratconv.go
@@ -40,8 +40,8 @@ func (z *Rat) Scan(s fmt.ScanState, ch rune) error {
// SetString sets z to the value of s and returns z and a boolean indicating
// success. s can be given as a fraction "a/b" or as a floating-point number
// optionally followed by an exponent. The entire string (not just a prefix)
-// must be valid for success. If the operation failed, the value of z is un-
-// defined but the returned value is nil.
+// must be valid for success. If the operation failed, the value of z is
+// undefined but the returned value is nil.
func (z *Rat) SetString(s string) (*Rat, bool) {
if len(s) == 0 {
return nil, false
From 579120323fdf0c6939fa3e3c6c63b669b6437e31 Mon Sep 17 00:00:00 2001
From: Keith Randall
Date: Sat, 5 Aug 2017 09:58:41 -0700
Subject: [PATCH 36/36] runtime: mapassign_* should use typedmemmove to update
keys
We need to make sure that when the key contains a pointer, we use
a write barrier to update the key.
Also mapdelete_* should use typedmemclr.
Fixes #21297
Change-Id: I63dc90bec1cb909c2c6e08676c9ec853d736cdf8
Reviewed-on: https://go-review.googlesource.com/53414
Run-TryBot: Keith Randall
TryBot-Result: Gobot Gobot
Reviewed-by: Austin Clements
Reviewed-by: Josh Bleecher Snyder
Reviewed-by: Ian Lance Taylor
---
src/runtime/hashmap_fast.go | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/runtime/hashmap_fast.go b/src/runtime/hashmap_fast.go
index 1f9b313219..67b9787909 100644
--- a/src/runtime/hashmap_fast.go
+++ b/src/runtime/hashmap_fast.go
@@ -495,7 +495,7 @@ again:
}
// store new key/value at insert position
- *((*uint32)(insertk)) = key
+ typedmemmove(t.key, insertk, unsafe.Pointer(&key))
*inserti = top
h.count++
@@ -583,7 +583,7 @@ again:
}
// store new key/value at insert position
- *((*uint64)(insertk)) = key
+ typedmemmove(t.key, insertk, unsafe.Pointer(&key))
*inserti = top
h.count++
@@ -723,7 +723,7 @@ func mapdelete_fast32(t *maptype, h *hmap, key uint32) {
if key != *k {
continue
}
- *k = 0
+ typedmemclr(t.key, unsafe.Pointer(k))
v := unsafe.Pointer(uintptr(unsafe.Pointer(b)) + dataOffset + bucketCnt*4 + i*uintptr(t.valuesize))
typedmemclr(t.elem, v)
b.tophash[i] = empty
@@ -778,7 +778,7 @@ func mapdelete_fast64(t *maptype, h *hmap, key uint64) {
if key != *k {
continue
}
- *k = 0
+ typedmemclr(t.key, unsafe.Pointer(k))
v := unsafe.Pointer(uintptr(unsafe.Pointer(b)) + dataOffset + bucketCnt*8 + i*uintptr(t.valuesize))
typedmemclr(t.elem, v)
b.tophash[i] = empty