1
0
mirror of https://github.com/golang/go synced 2024-11-05 22:36:10 -07:00
Commit Graph

52597 Commits

Author SHA1 Message Date
Yasuhiro Matsumoto
917f201f95 make.bat: call env.bat with .\env.bat
When set NoDefaultCurrentDirectoryInExePath=1, call env.bat does not work.

Change-Id: If63b02e236079681bdadadbdebc0b39abce01219
Reviewed-on: https://go-review.googlesource.com/c/go/+/405774
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
2022-05-12 13:50:51 +00:00
Tobias Klauser
0d8345df66 net/netip: skip some TestAddrStringAllocs tests on noopt builders
CL 403914 introduced TestAddrStringAllocs which checks that there is
only 1 alloc in Addr.String for v4-in-v6 addresses. This requires
optimizations to be enabled, otherwise there are 2 allocs. Skip the
ipv4-in-ipv6 sub-tests on noopt builders to fix failing
TestAddrStringAllocs on the noopt builders.

Change-Id: I0285264260b264b53cf822dc7cec4829e9854531
Reviewed-on: https://go-review.googlesource.com/c/go/+/405834
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-05-12 13:42:39 +00:00
Robert Griesemer
2bea43b0e7 spec: state that variable names must be unique in short var decls
Fixes #45652.

Change-Id: I5e1434480c12815369a6ce204f3729eb63139125
Reviewed-on: https://go-review.googlesource.com/c/go/+/405757
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-05-12 04:47:29 +00:00
Robert Griesemer
c01feba15d spec: clarify "continue" statement
Taking into account the discussion and relevant feedback on a
change proposed in 2013 (see e-mail thread mentioned in issue).

Fixes #48864.

Change-Id: I811d518b7cbdf6b815695174f1da3d4251f491c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/405756
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-05-12 04:47:23 +00:00
Robert Griesemer
7e11ff3816 spec: correct assignment rules with respect to type parameters
Fixes #52628.

Change-Id: If4261abc25868d62f7689253d40f872692c23a4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/405755
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2022-05-12 04:47:18 +00:00
Robert Griesemer
5d0400c72d spec: adjust scope of function/method type parameters
Change scope rules per the accepted proposal #52038.
Match prose for type parameters of type declarations.
Fixing the implementation is tracked by #51503.

Fixes #52038.
For #51503.

Change-Id: Iebd88a82c896b7b2e8520cd514ef6a2cc903e807
Reviewed-on: https://go-review.googlesource.com/c/go/+/405754
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-05-12 04:47:13 +00:00
Xiaodong Liu
900ae5b35a cmd/compile/internal/ssagen: enable intrinsic operation on loong64
Contributors to the loong64 port are:
  Weining Lu <luweining@loongson.cn>
  Lei Wang <wanglei@loongson.cn>
  Lingqin Gong <gonglingqin@loongson.cn>
  Xiaolin Zhao <zhaoxiaolin@loongson.cn>
  Meidan Li <limeidan@loongson.cn>
  Xiaojuan Zhai <zhaixiaojuan@loongson.cn>
  Qiyuan Pu <puqiyuan@loongson.cn>
  Guoqi Chen <chenguoqi@loongson.cn>

This port has been updated to Go 1.15.6:
  https://github.com/loongson/go

Updates #46229

Change-Id: If28fe03297e1de62f348373f2779dce07f54611c
Reviewed-on: https://go-review.googlesource.com/c/go/+/367042
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-05-12 04:08:07 +00:00
Xiaodong Liu
756fcd8fc2 cmd/compile/internal/ssa: config functions used in lower pass for loong64
Contributors to the loong64 port are:
  Weining Lu <luweining@loongson.cn>
  Lei Wang <wanglei@loongson.cn>
  Lingqin Gong <gonglingqin@loongson.cn>
  Xiaolin Zhao <zhaoxiaolin@loongson.cn>
  Meidan Li <limeidan@loongson.cn>
  Xiaojuan Zhai <zhaixiaojuan@loongson.cn>
  Qiyuan Pu <puqiyuan@loongson.cn>
  Guoqi Chen <chenguoqi@loongson.cn>

This port has been updated to Go 1.15.6:
  https://github.com/loongson/go

Updates #46229

Change-Id: I50d20eb22f2108d245513de8ac95ebe0b7e1a1dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/367037
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-05-12 01:08:28 +00:00
Xiaodong Liu
a2d12076b9 cmd/compile/internal/ssa: add support on loong64 for schedule phase
Contributors to the loong64 port are:
  Weining Lu <luweining@loongson.cn>
  Lei Wang <wanglei@loongson.cn>
  Lingqin Gong <gonglingqin@loongson.cn>
  Xiaolin Zhao <zhaoxiaolin@loongson.cn>
  Meidan Li <limeidan@loongson.cn>
  Xiaojuan Zhai <zhaixiaojuan@loongson.cn>
  Qiyuan Pu <puqiyuan@loongson.cn>
  Guoqi Chen <chenguoqi@loongson.cn>

This port has been updated to Go 1.15.6:
  https://github.com/loongson/go

Updates #46229

Change-Id: Id533912c62d8c4e2aa3c124561772b543d685d7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/367041
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-05-12 00:24:40 +00:00
Xiaodong Liu
a6c95e75d9 cmd/compile/internal/ssa: inline memmove with known size
Contributors to the loong64 port are:
  Weining Lu <luweining@loongson.cn>
  Lei Wang <wanglei@loongson.cn>
  Lingqin Gong <gonglingqin@loongson.cn>
  Xiaolin Zhao <zhaoxiaolin@loongson.cn>
  Meidan Li <limeidan@loongson.cn>
  Xiaojuan Zhai <zhaixiaojuan@loongson.cn>
  Qiyuan Pu <puqiyuan@loongson.cn>
  Guoqi Chen <chenguoqi@loongson.cn>

This port has been updated to Go 1.15.6:
  https://github.com/loongson/go

Updates #46229

Change-Id: I1534b66b527efaf2bbaa8e6e6ac0618aac0b5930
Reviewed-on: https://go-review.googlesource.com/c/go/+/367040
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-05-11 23:58:56 +00:00
Alexander Yastrebov
c14ed5b37c Revert "net/http: close accepted connection"
This reverts CL 353714.

The change closes accepted connection also in graceful shutdown which
breaks the fix for #33313 (and apparent duplicate #36819).

The proper fix should close accepted connection only if server is closed
but not in graceful shutdown.

Updates #48642

Change-Id: I2f7005f3f3037e6563745731bb2693923b654004
GitHub-Last-Rev: f6d885aa37
GitHub-Pull-Request: golang/go#52823
Reviewed-on: https://go-review.googlesource.com/c/go/+/405454
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-05-11 23:44:16 +00:00
Xiaodong Liu
ec5bdefd0a cmd/compile/internal/ssa{,/gen}: define rules and operation on loong64
The rules and operation definition is used to generate rewrite functions
and OpKind type constant.

Contributors to the loong64 port are:
  Weining Lu <luweining@loongson.cn>
  Lei Wang <wanglei@loongson.cn>
  Lingqin Gong <gonglingqin@loongson.cn>
  Xiaolin Zhao <zhaoxiaolin@loongson.cn>
  Meidan Li <limeidan@loongson.cn>
  Xiaojuan Zhai <zhaixiaojuan@loongson.cn>
  Qiyuan Pu <puqiyuan@loongson.cn>
  Guoqi Chen <chenguoqi@loongson.cn>

This port has been updated to Go 1.15.6:
  https://github.com/loongson/go

Updates #46229

Change-Id: Ia362ed7ba5d84046697aadbc8d6d4cbe495f6076
Reviewed-on: https://go-review.googlesource.com/c/go/+/367039
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-05-11 23:39:27 +00:00
Tobias Klauser
f2cd6d60ae net/netip: reduce allocations in Addr.String for v4-in-v6 addresses
ip.Unmap will always return an Addr with ip.z == z4 in case of an
v4-in-v6 address. Thus, Addr.string4 can be called directly without the
additional indirection.

name                      old time/op    new time/op    delta
IPString/v6_v4-4             108ns ± 3%      74ns ± 4%  -31.23%  (p=0.000 n=9+10)
IPStringExpanded/v6_v4-4    89.6ns ± 6%    77.2ns ± 3%  -13.91%  (p=0.000 n=10+10)
AddrPortString/v6_v4-4       253ns ± 8%     197ns ± 3%  -22.13%  (p=0.000 n=10+10)

name                      old alloc/op   new alloc/op   delta
IPString/v6_v4-4             40.0B ± 0%     24.0B ± 0%  -40.00%  (p=0.000 n=10+10)
IPStringExpanded/v6_v4-4     48.0B ± 0%     48.0B ± 0%     ~     (all equal)
AddrPortString/v6_v4-4       77.0B ± 0%     61.0B ± 0%  -20.78%  (p=0.000 n=10+10)

name                      old allocs/op  new allocs/op  delta
IPString/v6_v4-4              2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)
IPStringExpanded/v6_v4-4      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
AddrPortString/v6_v4-4        4.00 ± 0%      3.00 ± 0%  -25.00%  (p=0.000 n=10+10)

Change-Id: Id4affaf7a493aa11579c48721294f2e5889a8bef
Reviewed-on: https://go-review.googlesource.com/c/go/+/403914
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
2022-05-11 23:26:11 +00:00
Xiaodong Liu
83ee6c1d16 cmd/compile/internal/ssa: increase the bit width of BlockKind type
After the BlockKind of loong64 is introduced, it exceeds the maximum
range that int8 can represent.

Contributors to the loong64 port are:
  Weining Lu <luweining@loongson.cn>
  Lei Wang <wanglei@loongson.cn>
  Lingqin Gong <gonglingqin@loongson.cn>
  Xiaolin Zhao <zhaoxiaolin@loongson.cn>
  Meidan Li <limeidan@loongson.cn>
  Xiaojuan Zhai <zhaixiaojuan@loongson.cn>
  Qiyuan Pu <puqiyuan@loongson.cn>
  Guoqi Chen <chenguoqi@loongson.cn>

This port has been updated to Go 1.15.6:
  https://github.com/loongson/go

Updates #46229

Change-Id: I246d9c22334d0ea9e1440d29df05c9ec2d472b30
Reviewed-on: https://go-review.googlesource.com/c/go/+/367038
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-05-11 23:20:01 +00:00
Cherry Mui
6e03de7b83 cmd/asm: require -p flag
CL 391014 requires the compiler to be invoked with the -p flag, to
specify the package path. Later, CL 394217 makes the compiler to
produce an unlinkable object file, so "go tool compile x.go" can
still be used on the command line. This CL does the same for the
assembler, requiring -p, otherwise generating an unlinkable object.

No special case for the main package, as the main package cannot
be only assembly code, and there is no way to tell if it is the
main package from an assembly file.

Now we guarantee that we always have an expanded package path in
the object file. A later CL will delete the name expansion code
in the linker.

Change-Id: I8c10661aaea2ff794614924ead958d80e7e2487d
Reviewed-on: https://go-review.googlesource.com/c/go/+/404298
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-05-11 22:59:46 +00:00
Cherry Mui
b89a194889 cmd/internal/obj: add a flag to not write referenced symbol names in object file
The Go object file references (some of) symbols from other
packages by indices, not by names. The linker doesn't need the
symbol names to do the linking. The names are included in the
object file so it is self-contained and tools (objdump, nm) can
read the referenced symbol names. Including the names increases
object file size. Add a flag to disable it on demand (off by
default).

Change-Id: I143a0eb656997497c750b8eb1541341b2aee8f30
Reviewed-on: https://go-review.googlesource.com/c/go/+/404297
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-05-11 21:01:09 +00:00
Xiaodong Liu
c1105cfd43 cmd/internal/obj{,/loong64}: instructions and registers for loong64
Implemented an assembler for LoongArch64(loong64 is short name) -
this provides register definitions and instruction encoding as
defined in the LoongArch Instruction Set Manual.

LoongArch Instruction Set Manual:
  https://github.com/loongson/LoongArch-Documentation/releases

Contributors to the linux/loong64 port are:
  Weining Lu <luweining@loongson.cn>
  Lei Wang <wanglei@loongson.cn>
  Lingqin Gong <gonglingqin@loongson.cn>
  Xiaolin Zhao <zhaoxiaolin@loongson.cn>
  Meidan Li <limeidan@loongson.cn>
  Xiaojuan Zhai <zhaixiaojuan@loongson.cn>
  Qiyuan Pu <puqiyuan@loongson.cn>
  Guoqi Chen <chenguoqi@loongson.cn>

This port has been updated to Go 1.15.6:
  https://github.com/loongson/go

Updates #46229

Change-Id: I930d2a19246496e3ca36d55539183c0f9f650ad9
Reviewed-on: https://go-review.googlesource.com/c/go/+/342309
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-05-11 20:11:34 +00:00
David Chase
857cda4625 cmd/compile: convert merge to use appl. bal. trees for sharing
This CL replaces a not-very-shared linear-sized set
representation with a much more shared representation.
For the annoying test program in question, it reduces
the heap size by 95%, and the time slightly.

However, for some programs build time is longer.

This also includes at least one bug fix for problems
uncovered while ensuring compatibility with what it
replaces.

Fixes #51543.

Change-Id: Ie7a4c6ea460775faeed2b0378ab21ddffd15badc
Reviewed-on: https://go-review.googlesource.com/c/go/+/397318
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-05-11 16:34:41 +00:00
Bryan C. Mills
d339d085c9 cmd/go: add timestamps to script test output
Go tests don't include timestamps by default, but we would like to
have them in order to correlate builder failures with server and
network logs.

Since many of the Go tests with external network and service
dependencies are script tests for the 'go' command, logging timestamps
here adds a lot of logging value with one simple and very low-risk
change.

For #50541.
For #52490.
For #52545.
For #52851.

Change-Id: If3fa86deb4a216ec6a1abc4e6f4ee9b05030a729
Reviewed-on: https://go-review.googlesource.com/c/go/+/405714
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
2022-05-11 15:00:05 +00:00
Ian Lance Taylor
949b3e9880 compress/flate: remove compressor.hash field
After CL 20929, the only remaining uses of d.hash are immediately
after it is set.

Benchmarks where benchstat reports a non-zero delta:

name                              old time/op    new time/op    delta
Decode/Newton/Huffman/1e5-12         982µs ± 6%     922µs ± 4%  -6.12%  (p=0.000 n=10+10)
Decode/Newton/Huffman/1e6-12        8.14ms ± 2%    7.71ms ± 2%  -5.19%  (p=0.000 n=10+10)
Encode/Digits/Huffman/1e5-12         241µs ± 0%     239µs ± 0%  -0.62%  (p=0.000 n=9+10)
Encode/Digits/Speed/1e4-12           113µs ± 0%     114µs ± 0%  +1.21%  (p=0.000 n=9+8)
Encode/Digits/Speed/1e5-12          1.04ms ± 0%    1.05ms ± 0%  +0.22%  (p=0.027 n=9+8)
Encode/Digits/Speed/1e6-12          10.3ms ± 0%    10.3ms ± 0%  +0.16%  (p=0.036 n=9+8)
Encode/Digits/Default/1e4-12         193µs ± 0%     195µs ± 1%  +0.77%  (p=0.010 n=8+8)
Encode/Digits/Default/1e5-12        2.92ms ± 1%    2.93ms ± 0%  +0.54%  (p=0.002 n=8+8)
Encode/Digits/Compression/1e4-12     193µs ± 0%     194µs ± 0%  +0.67%  (p=0.000 n=8+8)
Encode/Digits/Compression/1e5-12    2.92ms ± 0%    2.93ms ± 0%  +0.53%  (p=0.002 n=8+8)
Encode/Digits/Compression/1e6-12    31.0ms ± 1%    31.2ms ± 0%  +0.80%  (p=0.000 n=10+9)
Encode/Newton/Huffman/1e4-12        34.8µs ± 1%    34.3µs ± 0%  -1.31%  (p=0.000 n=9+10)
Encode/Newton/Huffman/1e5-12         294µs ± 0%     291µs ± 0%  -1.09%  (p=0.000 n=8+9)
Encode/Newton/Huffman/1e6-12        2.91ms ± 0%    2.89ms ± 0%  -0.89%  (p=0.000 n=8+9)
Encode/Newton/Speed/1e5-12           838µs ± 0%     836µs ± 0%  -0.18%  (p=0.015 n=8+8)
Encode/Newton/Speed/1e6-12          8.35ms ± 0%    8.28ms ± 1%  -0.89%  (p=0.000 n=8+10)
Encode/Newton/Default/1e5-12        3.55ms ± 0%    3.54ms ± 0%  -0.23%  (p=0.027 n=8+9)
Encode/Newton/Default/1e6-12        37.4ms ± 0%    37.3ms ± 0%  -0.18%  (p=0.001 n=9+8)
Encode/Newton/Compression/1e6-12    53.3ms ± 0%    53.1ms ± 0%  -0.25%  (p=0.010 n=10+9)

name                              old speed      new speed      delta
Decode/Newton/Huffman/1e5-12       102MB/s ± 6%   109MB/s ± 4%  +6.48%  (p=0.000 n=10+10)
Decode/Newton/Huffman/1e6-12       123MB/s ± 2%   130MB/s ± 2%  +5.49%  (p=0.000 n=10+10)
Encode/Digits/Huffman/1e5-12       416MB/s ± 0%   418MB/s ± 0%  +0.62%  (p=0.000 n=9+10)
Encode/Digits/Speed/1e4-12        88.9MB/s ± 0%  87.8MB/s ± 0%  -1.19%  (p=0.000 n=9+8)
Encode/Digits/Speed/1e5-12        95.7MB/s ± 0%  95.5MB/s ± 0%  -0.22%  (p=0.025 n=9+8)
Encode/Digits/Speed/1e6-12        97.5MB/s ± 0%  97.3MB/s ± 0%  -0.16%  (p=0.026 n=9+8)
Encode/Digits/Default/1e4-12      51.7MB/s ± 0%  51.3MB/s ± 1%  -0.76%  (p=0.007 n=8+8)
Encode/Digits/Default/1e5-12      34.3MB/s ± 1%  34.1MB/s ± 0%  -0.54%  (p=0.001 n=8+8)
Encode/Digits/Compression/1e4-12  51.8MB/s ± 0%  51.5MB/s ± 0%  -0.66%  (p=0.000 n=8+8)
Encode/Digits/Compression/1e5-12  34.3MB/s ± 0%  34.1MB/s ± 0%  -0.53%  (p=0.002 n=8+8)
Encode/Digits/Compression/1e6-12  32.3MB/s ± 1%  32.0MB/s ± 0%  -0.79%  (p=0.000 n=10+9)
Encode/Newton/Huffman/1e4-12       288MB/s ± 1%   291MB/s ± 0%  +1.33%  (p=0.000 n=9+10)
Encode/Newton/Huffman/1e5-12       340MB/s ± 0%   344MB/s ± 0%  +1.10%  (p=0.000 n=8+9)
Encode/Newton/Huffman/1e6-12       343MB/s ± 0%   346MB/s ± 0%  +0.90%  (p=0.000 n=8+9)
Encode/Newton/Speed/1e5-12         119MB/s ± 0%   120MB/s ± 0%  +0.18%  (p=0.014 n=8+8)
Encode/Newton/Speed/1e6-12         120MB/s ± 0%   121MB/s ± 1%  +0.90%  (p=0.000 n=8+10)
Encode/Newton/Default/1e5-12      28.2MB/s ± 0%  28.3MB/s ± 0%  +0.23%  (p=0.029 n=8+9)
Encode/Newton/Default/1e6-12      26.7MB/s ± 0%  26.8MB/s ± 0%  +0.20%  (p=0.000 n=9+7)
Encode/Newton/Compression/1e6-12  18.8MB/s ± 0%  18.8MB/s ± 0%  +0.25%  (p=0.012 n=10+9)

Change-Id: I8ba0efcf5d42595d856082656b45f87bb3d7be0f
Reviewed-on: https://go-review.googlesource.com/c/go/+/404696
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-05-11 13:57:00 +00:00
Keith Randall
de9805c702 Revert "testing: document -race goroutine limits"
This reverts commit 4907c62f99.

Reason for revert: Race detector v3, which we just upgraded to, no longer has a goroutine limit.

(small caveat: openbsd/amd64 can't be updated, windows/amd64 isn't updated yet but should be by release time.)

Change-Id: I90017834501e81d3990d888f1b2baf3432452846
Reviewed-on: https://go-review.googlesource.com/c/go/+/405595
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2022-05-11 13:55:35 +00:00
Charlie Vieth
536282763f go/build: replace ioutil.ReadDir with os.ReadDir
Change go/build.readDir to use os.ReadDir instead of ioutil.ReadDir.
This addresses a TODO and improves performance on Darwin and Linux.

Darwin: Apple M1
name              old time/op    new time/op    delta
ImportVendor-10     39.8µs ± 1%    37.0µs ± 1%  -6.91%  (p=0.000 n=10+10)

Linux: Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
name              old time/op    new time/op    delta
ImportVendor-16     22.9µs ±11%    21.2µs ± 5%  -7.47%  (p=0.001 n=10+9)

Updates #45557

Change-Id: Ib1bd2e66210e714e499a035847d6261b61b7e2c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/392074
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-05-11 13:52:09 +00:00
Axel Busch
636c5f0208 runtime: enable vDSO support for s390x architecture
This change adds support for vDSO for s390x architecture. This avoids the use of system calls in nanotime and walltime and accelerates them by factor 4-5.

Benchmarks:
100,000,000 x time.Now():
syscall fallback	13923ms		139.23 ns/op
vDSO enabled		2640ms	 	26.40 ns/op

Change-Id: Ic679fe31048379e59ccf83b400140f13c9d49696
GitHub-Last-Rev: 8f6e918a45
GitHub-Pull-Request: golang/go#49717
Reviewed-on: https://go-review.googlesource.com/c/go/+/365995
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Paul Murphy <murp@ibm.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Jonathan Albrecht <jonathan.albrecht@ibm.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Bill O'Farrell <billotosyr@gmail.com>
2022-05-11 13:30:43 +00:00
Cuong Manh Le
7b314d27ce cmd/compile: fix bad order of evaluation for multi-value f()(g()) calls
The compiler use to compile f()(g()) as:

	t1, t2 := g()
	f()(t1, t2)

That violates the Go spec, since when "..., all function calls, ... are
evaluated in lexical left-to-right order"

This PR fixes the bug by compiling f()(g()) as:

	t0 := f()
	t1, t2 := g()
	t0(t1, t2)

to make "f()" to be evaluated before "g()".

Fixes #50672

Change-Id: I6a766f3dfc7347d10f8fa3a151f6a5ea79bcf818
Reviewed-on: https://go-review.googlesource.com/c/go/+/392834
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-05-11 08:12:15 +00:00
Keith Randall
e0ae8540ab doc: mention jump tables and tsan upgrades in 1.19 release notes
Change-Id: I0ab34f2f931e0e712218e4eb086f4535cc17775c
Reviewed-on: https://go-review.googlesource.com/c/go/+/405614
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-05-11 05:57:07 +00:00
Cuong Manh Le
4388faf964 runtime: use unsafe.Slice in getStackMap
CL 362934 added open code for unsafe.Slice, so using it now no longer
negatively impacts the performance.

Updates #48798

Change-Id: Ifbabe8bc1cc4349c5bcd11586a11fc99bcb388b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/404974
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-05-11 04:25:28 +00:00
Cuong Manh Le
579902d0b1 cmd/compile,runtime: open code unsafe.Slice
So prevent heavy runtime call overhead, and the compiler will have a
chance to optimize the bound check.

With this optimization, changing runtime/stack.go to use unsafe.Slice
no longer negatively impacts stack copying performance:

name                   old time/op    new time/op    delta
StackCopyWithStkobj-8    16.3ms ± 6%    16.5ms ± 5%   ~     (p=0.382 n=8+8)

name                   old alloc/op   new alloc/op   delta
StackCopyWithStkobj-8     17.0B ± 0%     17.0B ± 0%   ~     (all equal)

name                   old allocs/op  new allocs/op  delta
StackCopyWithStkobj-8      1.00 ± 0%      1.00 ± 0%   ~     (all equal)

Fixes #48798

Change-Id: I731a9a4abd6dd6846f44eece7f86025b7bb1141b
Reviewed-on: https://go-review.googlesource.com/c/go/+/362934
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-05-11 04:25:16 +00:00
Matthew Dempsky
ccb798741b runtime: change maxSearchAddr into a helper function
This avoids a dependency on the compiler statically initializing
maxSearchAddr, which is necessary so we can disable the (overly
aggressive and spec non-conforming) optimizations in cmd/compile and
gccgo.

Updates #51913.

Change-Id: I424e62c81c722bb179ed8d2d8e188274a1aeb7b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/396194
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-05-11 03:28:01 +00:00
Jonathan Amsterdam
f12461cb0f go/doc: remove unused top-level declarations from playable example
When we synthesize a playable example, prune declarations that may be
in the original example file but aren't used by the example.

This is ported from pkgsite, where it fixed #43658.

Change-Id: I41e6d4c28afa993c77c8a82b47bd86ba15ed13b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/401758
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-05-10 23:13:45 +00:00
Bryan C. Mills
6fd0520db3 os/exec: eliminate some arbitrary short timeouts
These tests appear to be using timeouts to check for deadlocks or to
cause the test to fail earlier. However, on slower machines these
short timeouts can cause spurious failures, and even on faster
machines if the test locks up we usually want a goroutine dump instead
of a short failure message anyway.

Fixes #52818 (maybe).

Change-Id: Ib8f18d679f9443721e8a924caef6dc8d214fca1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/405434
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-05-10 22:12:11 +00:00
Ian Lance Taylor
bda9da844d cmd/vendor: update to current x/tools revision
go get -d golang.org/x/tools@bc0e26ea127539a752b3a1849d05e007bb549def
go mod tidy
go mod vendor

Change-Id: I42e41c3348b18ffdfe511b34970340f7c7245b04
Reviewed-on: https://go-review.googlesource.com/c/go/+/405554
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-05-10 21:56:21 +00:00
Ian Lance Taylor
d28616d469 syscall: update broken links
Remove one link which isn't very interesting, and update another to
point to the current location.

Fixes #52753

Change-Id: I5f53ede35b0ded197bc0e6d41eabf28d736de5b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/405296
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-05-10 21:29:25 +00:00
nimelehin
e0f99775f2 runtime: store pointer-size words in memclr
GC requires the whole zeroed word to be visible for a memory subsystem.
While the implementation of Enhanced REP STOSB tries to use as efficient
stores as possible, e.g writing the whole cache line and not byte-after-byte,
we should use REP STOSQ to guarantee the requirements of the GC.

The performance is not affected.

Change-Id: I1b0fd1444a40bfbb661541291ab96eba11bcc762
Reviewed-on: https://go-review.googlesource.com/c/go/+/405274
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2022-05-10 20:52:34 +00:00
Cherry Mui
aeaf4b0e5b runtime: not mark save_g NOFRAME on ARM
On ARM, when GOARM<=6 the TLS pointer is fetched via a call to a
kernel helper. This call clobbers LR, even just temporarily. If
the function is NOFRAME, if a profiling signal lands right after
the call returns, the unwinder will find the wrong LR. Not mark it
NOFRAME, so the LR will be saved in the usual way and stack
unwinding should work.

May fix #52829.

Change-Id: I419a31dcf4afbcff8d7ab8f179eec3c477589e60
Reviewed-on: https://go-review.googlesource.com/c/go/+/405482
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
2022-05-10 20:38:07 +00:00
Lynn Boger
2ecf747e08 crypto/aes: add BE support to gcm
This adds the code to allow the gcm assembler code to work on
big endian ppc64.

Updates #18499

Change-Id: Iab1ffc9b8af38a0605a91f2621dd9f4a9397b945
Reviewed-on: https://go-review.googlesource.com/c/go/+/404795
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Paul Murphy <murp@ibm.com>
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-05-10 20:13:31 +00:00
Paul E. Murphy
51859ec229 internal/cpu: report CPU if known on PPC64
The PPC64 maintainers are testing on P10 hardware, so it is helpful
to report the correct cpu, even if this information is not used
elsewhere yet.

Note, AIX will report the current CPU of the host system, so a
POWER10 will not set the IsPOWER9 flag. This is existing behavior,
and should be fixed in a separate patch.

Change-Id: Iebe23dd96ebe03c8a1c70d1ed2dc1506bad3c330
Reviewed-on: https://go-review.googlesource.com/c/go/+/404394
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-05-10 20:05:43 +00:00
Paul E. Murphy
0c43878baa cmd/compile: lower Add64/Sub64 into ssa on PPC64
math/bits.Add64 and math/bits.Sub64 now lower and optimize
directly in SSA form.

The optimization of carry chains focuses around eliding
XER<->GPR transfers of the CA bit when used exclusively as an
input to a single carry operations, or when the CA value is
known.

This also adds support for handling XER spills in the assembler
which could happen if carry chains contain inter-dependencies
on each other (which seems very unlikely with practical usage),
or a clobber happens (SRAW/SRAD/SUBFC operations clobber CA).

With PPC64 Add64/Sub64 lowering into SSA and this patch, the net
performance difference in crypto/elliptic benchmarks on P9/ppc64le
are:

name                                old time/op    new time/op    delta
ScalarBaseMult/P256                   46.3µs ± 0%    46.9µs ± 0%   +1.34%
ScalarBaseMult/P224                    356µs ± 0%     209µs ± 0%  -41.14%
ScalarBaseMult/P384                   1.20ms ± 0%    0.57ms ± 0%  -52.14%
ScalarBaseMult/P521                   3.38ms ± 0%    1.44ms ± 0%  -57.27%
ScalarMult/P256                        199µs ± 0%     199µs ± 0%   -0.17%
ScalarMult/P224                        357µs ± 0%     212µs ± 0%  -40.56%
ScalarMult/P384                       1.20ms ± 0%    0.58ms ± 0%  -51.86%
ScalarMult/P521                       3.37ms ± 0%    1.44ms ± 0%  -57.32%
MarshalUnmarshal/P256/Uncompressed    2.59µs ± 0%    2.52µs ± 0%   -2.63%
MarshalUnmarshal/P256/Compressed      2.58µs ± 0%    2.52µs ± 0%   -2.06%
MarshalUnmarshal/P224/Uncompressed    1.54µs ± 0%    1.40µs ± 0%   -9.42%
MarshalUnmarshal/P224/Compressed      1.54µs ± 0%    1.39µs ± 0%   -9.87%
MarshalUnmarshal/P384/Uncompressed    2.40µs ± 0%    1.80µs ± 0%  -24.93%
MarshalUnmarshal/P384/Compressed      2.35µs ± 0%    1.81µs ± 0%  -23.03%
MarshalUnmarshal/P521/Uncompressed    3.79µs ± 0%    2.58µs ± 0%  -31.81%
MarshalUnmarshal/P521/Compressed      3.80µs ± 0%    2.60µs ± 0%  -31.67%

Note, P256 uses an asm implementation, thus, little variation is expected.

Change-Id: I88a24f6bf0f4f285c649e40243b1ab69cc452b71
Reviewed-on: https://go-review.googlesource.com/c/go/+/346870
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-05-10 20:03:53 +00:00
Wayne Zuo
526de61c67 test: add test case for #51840
This issue has been fixed in CL 403837.

Fixes #51840.

Change-Id: I282062bb06278696fe25e9ede333c64539dc964e
Reviewed-on: https://go-review.googlesource.com/c/go/+/404914
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-05-10 19:40:04 +00:00
Daniel Martí
bf68170c63 go/printer: align expression list elements containing tabs
A user noticed that, given the input

	{
		S:       "Hello World",
		Integer: 42,
	},
	{
		S:       "	", // an actual <tab>
		Integer: 42,
	},

gofmt would incorrectly format the code as

	{
		S:       "Hello World",
		Integer: 42,
	},
	{
		S: "	", // an actual <tab>
		Integer: 42,
	},

The problem was in the nodeSize method, used to get the printed length
of a node before it's actually printed to the final buffer.
The exprList method calls nodeSize to see if one expression in a list
changes too drastically in size from the previous, which means the
vertical alignment should be broken.

It is worth noting that nodeSize only reports valid lengths if the node
fits into a single line; otherwise, it returns a large number, larger
than an "infinity" currently set to 1e6.

However, the "does it fit in a single line" logic was broken;
it checked if any of the to-be-printed characters is less than ' ',
which does include '\n' and '\f' (the latter used by tabwriter as well),
but also includes '\t', which would make nodeSize incorrectly conclude
that our key-value expression with a tab does not fit into a single line.

While here, make the testdata test cases run as sub-tests,
as I used "-run TestRewrite/tabs.input" to help debug this.

Fixes #51910.

Change-Id: Ib7936e02652bc58f99772b06384ae271fddf09e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/404955
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-05-10 19:22:49 +00:00
David Chase
1284cc2495 cmd/compile: be sure to export types mentioned in f.i.g. method signature
When a fully instantiated generic method is exported, be sure to also
export the types in its signature.

Fixes #52279.

Change-Id: Icc6bca05b01f914cf67faaf1bf184eaa5484f521
Reviewed-on: https://go-review.googlesource.com/c/go/+/405118
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-05-10 19:15:31 +00:00
Cherry Mui
508cb32d4b cmd/link: more cleanups for visibility hidden symbol handling
CL 404296 removes the hidden visibility checks, but a few of them
were left. Remove them as well.

Change-Id: Idbcf37429709c91403803d32684239d398e43543
Reviewed-on: https://go-review.googlesource.com/c/go/+/404303
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-05-10 18:37:58 +00:00
Bryan C. Mills
4d716e4d4a cmd/go/internal/modfetch: simplify handling of weird version tags
This fixes an obscure bug in 'go list -versions' if the repo contains
a tag with an explicit "+incompatible" suffix. However, I've never
seen such a repo in the wild; mostly it's an attempt to wrap my brain
around the code and simplify things a bit for the future.

Updates #51324
Updates #51312

Change-Id: I1b078b5db36470cf61aaa85b5244c99b5ee2c842
Reviewed-on: https://go-review.googlesource.com/c/go/+/387917
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2022-05-10 18:25:37 +00:00
Matthew Dempsky
17dc7b487f cmd/compile: update README.md
This CL updates the description of the frontend packages of the
compiler, which I'm more familiar with.

Updates #30074.

Change-Id: Ic279007f6102b21072d6558fa9035f0fcc267d93
Reviewed-on: https://go-review.googlesource.com/c/go/+/404694
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-05-10 18:15:47 +00:00
Ian Lance Taylor
8d074f61b7 archive/zip: error if using io/fs on zip with duplicate entries
Fixes #50390

Change-Id: I92787cdb3fa198ff88dcaadeccfcb49a3a6a88cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/374954
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-05-10 17:51:16 +00:00
Russ Cox
960ffa98ce os/exec: return clear error for missing cmd.Path
Following up on CL 403694, there is a bit of confusion about
when Path is and isn't set, along with now the exported Err field.
Catch the case where Path and Err (and lookPathErr) are all unset
and give a helpful error.

Fixes #52574
Followup after #43724.

Change-Id: I03205172aef3801c3194f5098bdb93290c02b1b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/403759
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2022-05-10 17:29:08 +00:00
Cherry Mui
7a574ff23f cmd/compile: fix boolean comparison on PPC64
Following CL 405114, for PPC64.

Should fix PPC64 builds.

Updates #52788.

Change-Id: I193ac31cfba18b4f907dd2523b51368251fd6fad
Reviewed-on: https://go-review.googlesource.com/c/go/+/405116
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
2022-05-10 17:20:02 +00:00
Michael Anthony Knyszek
482669db62 runtime: add lock partial order edge for trace and wbufSpans and mheap
This edge represents the case of executing a write barrier under the
trace lock: we might use the wbufSpans lock to get a new trace buffer,
or mheap to allocate a totally new one.

Fixes #52794.

Change-Id: Ia1ac2c744b8284ae29f4745373df3f9675ab1168
Reviewed-on: https://go-review.googlesource.com/c/go/+/405476
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-05-10 16:40:27 +00:00
Jonathan Amsterdam
2226952b8a go/doc: move code from playExample to a separate function
The playExample function is very long. Move the code that finds
top-level declarations and unresolved identifiers to a separate
function.

In a future CL, we will be improving that function by removing
unused declarations.

Change-Id: I5632012674687f23094b2bc90615daaecb2cf525
Reviewed-on: https://go-review.googlesource.com/c/go/+/401757
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
2022-05-10 16:18:12 +00:00
Jonathan Amsterdam
30a2750a91 go/doc: move example tests into files
Move the test cases for doc.Examples from example_test.go into
their own files under testdata/examples.

This makes example_test.go easier to read and collapses several
similar test functions into one.

It will also make it less cumbersome to add large examples later.

Change-Id: Id220c1205e94027d14291898e541b69344842686
Reviewed-on: https://go-review.googlesource.com/c/go/+/401756
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-05-10 16:17:51 +00:00
Michael Anthony Knyszek
8fdd277fe6 runtime: profile finalizer G more carefully in goroutine profile
If SetFinalizer is never called, we might readgstatus on a nil fing
variable, resulting in a crash. This change guards code that accesses
fing by a nil check.

Fixes #52821.

Change-Id: I3e8e7004f97f073dc622e801a1d37003ea153a29
Reviewed-on: https://go-review.googlesource.com/c/go/+/405475
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Rhys Hiltner <rhys@justin.tv>
2022-05-10 15:43:40 +00:00