1
0
mirror of https://github.com/golang/go synced 2024-11-24 04:00:13 -07:00
Commit Graph

49748 Commits

Author SHA1 Message Date
Tobias Klauser
8699425b55 syscall: remove use of IN_KUBERNETES in test
CL 201737 dropped the use of IN_KUBERNETES in tests, but it looks like
it did not catch all occurrences.

For #12815
For #34956

Change-Id: I72b89bfb850ba2890e9e6aa39b87167291ab7e9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/349789
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2021-09-14 14:09:54 +00:00
Paul E. Murphy
b3c6de9dcd cmd/internal/obj/ppc64: allow VR register arguments to VS registers
Likewise, reorder register numbers such that extended mnemonics which
use FPR arguments can be transparently encoded as a VSR argument for
the move to/from VSR class of instructions. Specifically, ensure the
following holds for all FPx and VRx constants: FPRx & 63 == x, and
VRx & 63 == x + 32.

This simplifies encoding machine instructions, and likewise helps
ppc64 assembly writers to avoid hokey workarounds when switching from
vector to vector-scalar register notation. Notably, many VSX
instructions are limited to vector operands due to encoding
restrictions.

Secondly, this explicitly rejects dubious usages of the m[tf]vsr
family of instructions which had previously been accepted.

 * Reject two GPR arguments for non-MTVSRDD opcodes. These
   have no defined behavior today, and may set RFU bits. e.g
   MTVSRD R1, R2, VS1

 * Reject FPR destinations for MTVSRDD, and only accept with two GPR
   arguments. This copies two GPR values into either half of a VSR. e.g
   MTVSRDD R1, R2, F1
   MTVSRDD R1, F1

Change-Id: If13dd88c3791d1892dbd18ef0e34675a5285fff9
Reviewed-on: https://go-review.googlesource.com/c/go/+/342929
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-09-14 13:53:08 +00:00
Cuong Manh Le
ee91bb8319 cmd/compile: prevent typecheck importer reading type parameter twice
This is a port of CL 349009 to typecheck importer.

Fixes #48306

Change-Id: Iec3f078089346bd85f0ab739896e079940325011
Reviewed-on: https://go-review.googlesource.com/c/go/+/349011
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
2021-09-14 02:53:17 +00:00
Cuong Manh Le
2953cd0083 go/internal/gcimporter: prevent importReader reading type parameter twice
This is port of CL 349009 to go/internal/gcimporter.

Updates #48280

Change-Id: I7d40d8b67333538ca58fe012535d54e891d0ed16
Reviewed-on: https://go-review.googlesource.com/c/go/+/349010
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-09-14 02:52:48 +00:00
Cuong Manh Le
b8c802b116 cmd/compile: prevent importReader reading type parameter twice
The importReader always reads type parameter before declaring type stub
declaration. Thus, for recursive type, the type parameter is going to be
read twice, cause the bound more than once error.

To fix this, only read the type parameter after declaring stub obj, thus
r.doDecl can see the type was already inserted and terminate the
recursive call earlier.

Fixes #48280

Change-Id: I272e2f214f739fb8ec71a8628ba297477e1b7755
Reviewed-on: https://go-review.googlesource.com/c/go/+/349009
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
2021-09-14 02:52:21 +00:00
Alexander Melentyev
4a4221e818 all: remove some unused code
Change-Id: I519b8021fa79dccc5c0ee79134547491116fc4cc
GitHub-Last-Rev: 48869f5434
GitHub-Pull-Request: golang/go#48071
Reviewed-on: https://go-review.googlesource.com/c/go/+/346231
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Keith Randall <khr@golang.org>
2021-09-14 00:49:39 +00:00
Ian Lance Taylor
71adc658de runtime: change time.now to ABIInternal
This reduces the number of instructions executed for time.now by nine,
by eliminating the wrapper. Somehow BenchmarkNow is 0.2ns slower.
On the other hand BenchmarkNowUnixNano is 0.8ns faster.

name                                                       old time/op      new time/op      delta
AfterFunc-12                                                   66.7µs ± 4%      67.3µs ± 2%     ~     (p=0.573 n=20+18)
After-12                                                       97.6µs ± 4%      97.4µs ± 4%     ~     (p=0.758 n=20+20)
Stop-12                                                        66.7µs ±12%      64.8µs ±10%     ~     (p=0.072 n=20+20)
SimultaneousAfterFunc-12                                        109µs ± 0%       110µs ± 1%   +1.47%  (p=0.000 n=17+20)
StartStop-12                                                   31.9µs ±15%      32.7µs ±14%     ~     (p=0.799 n=20+20)
Reset-12                                                       3.67µs ± 2%      3.68µs ± 2%     ~     (p=0.132 n=20+20)
Sleep-12                                                        132µs ± 2%       133µs ± 2%   +0.70%  (p=0.035 n=20+19)
Ticker-12                                                      32.4µs ± 1%      32.3µs ± 2%     ~     (p=0.270 n=20+19)
TickerReset-12                                                 3.71µs ± 2%      3.74µs ± 2%   +0.89%  (p=0.012 n=20+20)
TickerResetNaive-12                                            65.7µs ±10%      67.2µs ±10%     ~     (p=0.174 n=20+20)
Now-12                                                         29.6ns ± 1%      29.8ns ± 0%   +0.78%  (p=0.000 n=17+17)
NowUnixNano-12                                                 31.1ns ± 1%      30.3ns ± 0%   -2.69%  (p=0.000 n=19+18)
NowUnixMilli-12                                                30.9ns ± 0%      31.1ns ± 0%   +0.90%  (p=0.000 n=18+20)
NowUnixMicro-12                                                30.9ns ± 0%      31.1ns ± 1%   +0.68%  (p=0.000 n=20+18)
Format-12                                                       304ns ± 1%       301ns ± 2%   -0.81%  (p=0.004 n=18+19)
FormatNow-12                                                    187ns ± 2%       185ns ± 2%   -0.90%  (p=0.036 n=20+18)
MarshalJSON-12                                                  267ns ± 3%       265ns ± 3%   -1.00%  (p=0.004 n=18+18)
MarshalText-12                                                  267ns ± 2%       265ns ± 3%   -0.87%  (p=0.038 n=19+20)
Parse-12                                                        150ns ± 1%       149ns ± 1%   -0.83%  (p=0.000 n=18+20)
ParseDuration-12                                               79.6ns ± 0%      80.1ns ± 1%   +0.61%  (p=0.000 n=20+20)
Hour-12                                                        4.42ns ± 1%      4.45ns ± 0%   +0.83%  (p=0.000 n=20+20)
Second-12                                                      4.42ns ± 0%      4.42ns ± 1%     ~     (p=0.075 n=18+20)
Year-12                                                        11.1ns ± 1%      11.1ns ± 1%     ~     (p=0.489 n=20+19)
Day-12                                                         14.8ns ± 1%      14.8ns ± 0%     ~     (p=0.616 n=20+18)
ISOWeek-12                                                     17.2ns ± 1%      17.2ns ± 0%     ~     (p=0.179 n=20+19)

name                                                       old avg-late-ns  new avg-late-ns  delta
ParallelTimerLatency-12                                          380k ± 4%        379k ± 3%     ~     (p=0.879 n=20+19)
StaggeredTickerLatency/work-dur=300µs/tickers-per-P=1-12         137k ± 3%        137k ± 2%     ~     (p=0.261 n=19+18)
StaggeredTickerLatency/work-dur=300µs/tickers-per-P=2-12         106k ±16%         95k ± 8%   -9.76%  (p=0.003 n=19+20)
StaggeredTickerLatency/work-dur=300µs/tickers-per-P=3-12        88.6k ±22%       74.6k ± 3%  -15.78%  (p=0.000 n=19+20)
StaggeredTickerLatency/work-dur=300µs/tickers-per-P=4-12        76.1k ±18%       70.8k ± 5%   -7.04%  (p=0.020 n=20+20)
StaggeredTickerLatency/work-dur=300µs/tickers-per-P=5-12        67.3k ±27%       65.6k ±13%     ~     (p=0.211 n=16+18)
StaggeredTickerLatency/work-dur=300µs/tickers-per-P=6-12        59.5k ±24%       57.3k ±32%     ~     (p=0.607 n=19+20)
StaggeredTickerLatency/work-dur=300µs/tickers-per-P=7-12        41.8k ±34%       46.2k ±33%  +10.54%  (p=0.039 n=17+20)
StaggeredTickerLatency/work-dur=300µs/tickers-per-P=8-12        57.5k ±37%       65.6k ±46%     ~     (p=0.283 n=17+20)
StaggeredTickerLatency/work-dur=300µs/tickers-per-P=9-12         118k ±60%        136k ±59%     ~     (p=0.169 n=19+18)
StaggeredTickerLatency/work-dur=300µs/tickers-per-P=10-12      3.66M ±236%       2.55M ±36%     ~     (p=0.158 n=16+20)
StaggeredTickerLatency/work-dur=2ms/tickers-per-P=1-12          81.7k ± 4%       80.7k ± 5%     ~     (p=0.107 n=20+19)

name                                                       old max-late-ns  new max-late-ns  delta
ParallelTimerLatency-12                                        5.88M ±124%      7.28M ±183%     ~     (p=0.640 n=20+20)
StaggeredTickerLatency/work-dur=300µs/tickers-per-P=1-12         384k ±17%        371k ±11%     ~     (p=0.540 n=17+17)
StaggeredTickerLatency/work-dur=300µs/tickers-per-P=2-12        503k ±180%        373k ±19%     ~     (p=0.057 n=17+18)
StaggeredTickerLatency/work-dur=300µs/tickers-per-P=3-12        519k ±129%        340k ±17%  -34.47%  (p=0.000 n=18+19)
StaggeredTickerLatency/work-dur=300µs/tickers-per-P=4-12        491k ±141%        341k ±26%  -30.52%  (p=0.015 n=18+17)
StaggeredTickerLatency/work-dur=300µs/tickers-per-P=5-12        457k ±123%        405k ±48%     ~     (p=0.786 n=17+17)
StaggeredTickerLatency/work-dur=300µs/tickers-per-P=6-12         491k ±85%        502k ±74%     ~     (p=0.916 n=18+19)
StaggeredTickerLatency/work-dur=300µs/tickers-per-P=7-12        572k ±100%        574k ±65%     ~     (p=0.858 n=18+17)
StaggeredTickerLatency/work-dur=300µs/tickers-per-P=8-12       1.95M ±205%      1.65M ±155%     ~     (p=0.641 n=18+19)
StaggeredTickerLatency/work-dur=300µs/tickers-per-P=9-12       7.77M ±104%      8.72M ±103%     ~     (p=0.512 n=20+20)
StaggeredTickerLatency/work-dur=300µs/tickers-per-P=10-12      29.5M ±187%       18.5M ±43%     ~     (p=0.186 n=18+20)
StaggeredTickerLatency/work-dur=2ms/tickers-per-P=1-12           981k ±14%       1033k ±12%   +5.30%  (p=0.048 n=20+18)

Change-Id: Ie794a932a929b46053a6c3020b67d640b98d2335
Reviewed-on: https://go-review.googlesource.com/c/go/+/315369
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2021-09-14 00:29:16 +00:00
Nevkontakte
146e8d4994 reflect: use Value.Len instead of conversion to slice header
This change is functionally equivalent, but reduces reliance on unsafe
features. This would allow GopherJS to avoid an additional patch to the
standard library we'd have to maintain in order to remain compatible
with Go 1.17+.

Change-Id: I4f113db0c572ec0b81ebfecf5a137145f6c8c41d
GitHub-Last-Rev: 94ebb393ba
GitHub-Pull-Request: golang/go#48346
Reviewed-on: https://go-review.googlesource.com/c/go/+/349469
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-09-14 00:16:36 +00:00
Robert Griesemer
9a58aa267e spec: fix prose about terminating statements
CL 85215 added prose to provide some minimal intuition for the
definition of a "terminating statement". While the original definition
was perfectly fine, the added prose was actually incorrect: If the
terminating statement is a goto, it might jump to a labeled statement
following that goto in the same block (it could be the very next
statement), and thus a terminating statement does not in fact
"prevent execution of all statements that lexically appear after
it in the same block".

Rather than explaining the special case for gotos with targets that
are lexically following the goto in the same block, this CL opts for
a simpler approach.

Thanks to @3bodar (Github) for finding this.

Fixes #48323.

Change-Id: I8031346250341d038938a1ce6a75d3e687d32c37
Reviewed-on: https://go-review.googlesource.com/c/go/+/349172
Trust: Robert Griesemer <gri@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-09-13 22:57:34 +00:00
korzhao
42057e9848 cmd/compile: save the note of fields when translating struct
Fixes #48317

Change-Id: I756ae6253022870071004332dd8f49169307f7e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/349013
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Trust: Dan Scales <danscales@google.com>
2021-09-13 21:48:41 +00:00
Hossein Zolfi
960d036f8f cmd/go: add missing parenthesis in a call to "PrintVersion"
For #45713

Change-Id: I16e548e6c10e58da815d08897f4ba5d71eeb17e4
GitHub-Last-Rev: 4a0c5d0cda
GitHub-Pull-Request: golang/go#48360
Reviewed-on: https://go-review.googlesource.com/c/go/+/349599
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-09-13 21:19:51 +00:00
Tobias Klauser
81a4fe6fd2 cmd/link/internal/ld: re-enable DWARF tests on solaris/illumos
It looks like these are fixed on current tip after CL 84655
marked them to be skipped.

Fixes #23168

Change-Id: I0020e6da1042f723eb54186ef0fe925df5326230
Reviewed-on: https://go-review.googlesource.com/c/go/+/349250
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-09-13 20:42:44 +00:00
Josh Bleecher Snyder
f93a63addb reflect: add a floating point section to DeepEqual tests
The floating point tests were all added into the Inequalities section,
instead of separated into Equalities vs Inequalities.

Rather than separate them, add a new floating point section.

Change-Id: I3713a5aff5850dcc0caf68a754633d695a03ded9
Reviewed-on: https://go-review.googlesource.com/c/go/+/349612
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Trust: Joe Tsai <joetsai@digital-static.net>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Joe Tsai <joetsai@digital-static.net>
Reviewed-by: Joe Tsai <joetsai@digital-static.net>
TryBot-Result: Go Bot <gobot@golang.org>
2021-09-13 20:17:35 +00:00
Josh Bleecher Snyder
a0c409cbc8 reflect: add fast paths for common, simple Kinds to DeepEqual
Though the normal equality check suffices, it allocates.
Handle common, simple kinds without allocating.

For some real world types compared with DeepEqual
in the Tailscale code base, the impact of these changes:

name             old time/op    new time/op    delta
HostInfoEqual-8    25.9µs ± 0%    14.4µs ± 0%  -44.32%  (p=0.008 n=5+5)

name             old alloc/op   new alloc/op   delta
HostInfoEqual-8    18.8kB ± 0%    12.6kB ± 0%  -32.58%  (p=0.008 n=5+5)

name             old allocs/op  new allocs/op  delta
HostInfoEqual-8       548 ± 0%        90 ± 0%  -83.58%  (p=0.008 n=5+5)

For the benchmarks added in this commit:

name                      old time/op    new time/op    delta
DeepEqual/int8-8            40.1ns ± 4%    31.3ns ± 4%   -21.79%  (p=0.000 n=19+20)
DeepEqual/[]int8-8           169ns ± 1%     123ns ± 1%   -27.05%  (p=0.000 n=17+18)
DeepEqual/int16-8           39.9ns ± 2%    30.8ns ± 4%   -22.81%  (p=0.000 n=17+20)
DeepEqual/[]int16-8          172ns ± 0%     122ns ± 1%   -28.91%  (p=0.000 n=17+18)
DeepEqual/int32-8           40.4ns ± 3%    31.1ns ± 4%   -23.07%  (p=0.000 n=20+20)
DeepEqual/[]int32-8          180ns ± 1%     124ns ± 1%   -31.06%  (p=0.000 n=20+18)
DeepEqual/int64-8           40.1ns ± 2%    31.4ns ± 4%   -21.82%  (p=0.000 n=20+20)
DeepEqual/[]int64-8          180ns ± 1%     124ns ± 1%   -31.47%  (p=0.000 n=16+19)
DeepEqual/int-8             40.1ns ± 4%    30.9ns ± 3%   -22.88%  (p=0.000 n=20+18)
DeepEqual/[]int-8            180ns ± 0%     123ns ± 2%   -31.59%  (p=0.000 n=19+20)
DeepEqual/uint8-8           39.8ns ± 3%    31.9ns ± 5%   -19.72%  (p=0.000 n=20+20)
DeepEqual/[]uint8-8          168ns ± 1%     114ns ± 1%   -32.48%  (p=0.000 n=18+19)
DeepEqual/uint16-8          40.3ns ± 4%    31.4ns ± 6%   -22.14%  (p=0.000 n=20+20)
DeepEqual/[]uint16-8         173ns ± 1%     124ns ± 1%   -28.20%  (p=0.000 n=20+16)
DeepEqual/uint32-8          40.1ns ± 3%    30.7ns ± 3%   -23.48%  (p=0.000 n=20+20)
DeepEqual/[]uint32-8         180ns ± 1%     123ns ± 1%   -31.56%  (p=0.000 n=20+18)
DeepEqual/uint64-8          40.0ns ± 4%    31.3ns ± 4%   -21.80%  (p=0.000 n=19+19)
DeepEqual/[]uint64-8         180ns ± 1%     124ns ± 0%   -31.45%  (p=0.000 n=18+18)
DeepEqual/uint-8            39.8ns ± 3%    31.1ns ± 4%   -21.95%  (p=0.000 n=19+20)
DeepEqual/[]uint-8           181ns ± 1%     122ns ± 1%   -32.33%  (p=0.000 n=17+20)
DeepEqual/uintptr-8         40.3ns ± 3%    31.2ns ± 3%   -22.66%  (p=0.000 n=20+18)
DeepEqual/[]uintptr-8        181ns ± 1%     124ns ± 1%   -31.46%  (p=0.000 n=19+16)
DeepEqual/float32-8         40.3ns ± 2%    31.2ns ± 3%   -22.52%  (p=0.000 n=16+20)
DeepEqual/[]float32-8        180ns ± 1%     122ns ± 1%   -32.18%  (p=0.000 n=17+17)
DeepEqual/float64-8         40.6ns ± 3%    30.9ns ± 5%   -23.91%  (p=0.000 n=19+20)
DeepEqual/[]float64-8        182ns ± 2%     121ns ± 1%   -33.33%  (p=0.000 n=18+20)
DeepEqual/complex64-8       43.0ns ±11%    32.1ns ± 5%   -25.33%  (p=0.000 n=20+18)
DeepEqual/[]complex64-8      182ns ± 1%     122ns ± 2%   -32.60%  (p=0.000 n=18+19)
DeepEqual/complex128-8      42.4ns ± 4%    34.2ns ± 3%   -19.35%  (p=0.000 n=20+19)
DeepEqual/[]complex128-8     197ns ± 1%     122ns ± 1%   -38.01%  (p=0.000 n=19+19)
DeepEqual/bool-8            40.3ns ± 3%    32.9ns ± 5%   -18.33%  (p=0.000 n=20+20)
DeepEqual/[]bool-8           169ns ± 1%     124ns ± 1%   -26.90%  (p=0.000 n=18+19)
DeepEqual/string-8          41.4ns ± 3%    33.7ns ± 5%   -18.50%  (p=0.000 n=19+20)
DeepEqual/[]string-8         216ns ± 0%     128ns ± 1%   -41.05%  (p=0.000 n=19+17)
DeepEqual/[]uint8#01-8       507ns ± 1%     112ns ± 2%   -77.92%  (p=0.000 n=20+20)
DeepEqual/[][]uint8-8        613ns ± 1%     210ns ± 1%   -65.76%  (p=0.000 n=18+19)
DeepEqual/[6]uint8-8         228ns ± 1%     162ns ± 1%   -29.00%  (p=0.000 n=20+19)
DeepEqual/[][6]uint8-8       546ns ± 2%     269ns ± 1%   -50.72%  (p=0.000 n=20+19)

name                      old alloc/op   new alloc/op   delta
DeepEqual/int8-8             0.00B          0.00B           ~     (all equal)
DeepEqual/[]int8-8           2.00B ± 0%     0.00B       -100.00%  (p=0.000 n=20+20)
DeepEqual/int16-8            0.00B          0.00B           ~     (all equal)
DeepEqual/[]int16-8          4.00B ± 0%     0.00B       -100.00%  (p=0.000 n=20+20)
DeepEqual/int32-8            0.00B          0.00B           ~     (all equal)
DeepEqual/[]int32-8          8.00B ± 0%     0.00B       -100.00%  (p=0.000 n=20+20)
DeepEqual/int64-8            0.00B          0.00B           ~     (all equal)
DeepEqual/[]int64-8          16.0B ± 0%      0.0B       -100.00%  (p=0.000 n=20+20)
DeepEqual/int-8              0.00B          0.00B           ~     (all equal)
DeepEqual/[]int-8            16.0B ± 0%      0.0B       -100.00%  (p=0.000 n=20+20)
DeepEqual/uint8-8            0.00B          0.00B           ~     (all equal)
DeepEqual/[]uint8-8          2.00B ± 0%     0.00B       -100.00%  (p=0.000 n=20+20)
DeepEqual/uint16-8           0.00B          0.00B           ~     (all equal)
DeepEqual/[]uint16-8         4.00B ± 0%     0.00B       -100.00%  (p=0.000 n=20+20)
DeepEqual/uint32-8           0.00B          0.00B           ~     (all equal)
DeepEqual/[]uint32-8         8.00B ± 0%     0.00B       -100.00%  (p=0.000 n=20+20)
DeepEqual/uint64-8           0.00B          0.00B           ~     (all equal)
DeepEqual/[]uint64-8         16.0B ± 0%      0.0B       -100.00%  (p=0.000 n=20+20)
DeepEqual/uint-8             0.00B          0.00B           ~     (all equal)
DeepEqual/[]uint-8           16.0B ± 0%      0.0B       -100.00%  (p=0.000 n=20+20)
DeepEqual/uintptr-8          0.00B          0.00B           ~     (all equal)
DeepEqual/[]uintptr-8        16.0B ± 0%      0.0B       -100.00%  (p=0.000 n=20+20)
DeepEqual/float32-8          0.00B          0.00B           ~     (all equal)
DeepEqual/[]float32-8        8.00B ± 0%     0.00B       -100.00%  (p=0.000 n=20+20)
DeepEqual/float64-8          0.00B          0.00B           ~     (all equal)
DeepEqual/[]float64-8        16.0B ± 0%      0.0B       -100.00%  (p=0.000 n=20+20)
DeepEqual/complex64-8        0.00B          0.00B           ~     (all equal)
DeepEqual/[]complex64-8      16.0B ± 0%      0.0B       -100.00%  (p=0.000 n=20+20)
DeepEqual/complex128-8       0.00B          0.00B           ~     (all equal)
DeepEqual/[]complex128-8     32.0B ± 0%      0.0B       -100.00%  (p=0.000 n=20+20)
DeepEqual/bool-8             0.00B          0.00B           ~     (all equal)
DeepEqual/[]bool-8           2.00B ± 0%     0.00B       -100.00%  (p=0.000 n=20+20)
DeepEqual/string-8           0.00B          0.00B           ~     (all equal)
DeepEqual/[]string-8         32.0B ± 0%      0.0B       -100.00%  (p=0.000 n=20+20)
DeepEqual/[]uint8#01-8       12.0B ± 0%      0.0B       -100.00%  (p=0.000 n=20+20)
DeepEqual/[][]uint8-8        12.0B ± 0%      0.0B       -100.00%  (p=0.000 n=20+20)
DeepEqual/[6]uint8-8         0.00B          0.00B           ~     (all equal)
DeepEqual/[][6]uint8-8       12.0B ± 0%      0.0B       -100.00%  (p=0.000 n=20+20)

name                      old allocs/op  new allocs/op  delta
DeepEqual/int8-8              0.00           0.00           ~     (all equal)
DeepEqual/[]int8-8            2.00 ± 0%      0.00       -100.00%  (p=0.000 n=20+20)
DeepEqual/int16-8             0.00           0.00           ~     (all equal)
DeepEqual/[]int16-8           2.00 ± 0%      0.00       -100.00%  (p=0.000 n=20+20)
DeepEqual/int32-8             0.00           0.00           ~     (all equal)
DeepEqual/[]int32-8           2.00 ± 0%      0.00       -100.00%  (p=0.000 n=20+20)
DeepEqual/int64-8             0.00           0.00           ~     (all equal)
DeepEqual/[]int64-8           2.00 ± 0%      0.00       -100.00%  (p=0.000 n=20+20)
DeepEqual/int-8               0.00           0.00           ~     (all equal)
DeepEqual/[]int-8             2.00 ± 0%      0.00       -100.00%  (p=0.000 n=20+20)
DeepEqual/uint8-8             0.00           0.00           ~     (all equal)
DeepEqual/[]uint8-8           2.00 ± 0%      0.00       -100.00%  (p=0.000 n=20+20)
DeepEqual/uint16-8            0.00           0.00           ~     (all equal)
DeepEqual/[]uint16-8          2.00 ± 0%      0.00       -100.00%  (p=0.000 n=20+20)
DeepEqual/uint32-8            0.00           0.00           ~     (all equal)
DeepEqual/[]uint32-8          2.00 ± 0%      0.00       -100.00%  (p=0.000 n=20+20)
DeepEqual/uint64-8            0.00           0.00           ~     (all equal)
DeepEqual/[]uint64-8          2.00 ± 0%      0.00       -100.00%  (p=0.000 n=20+20)
DeepEqual/uint-8              0.00           0.00           ~     (all equal)
DeepEqual/[]uint-8            2.00 ± 0%      0.00       -100.00%  (p=0.000 n=20+20)
DeepEqual/uintptr-8           0.00           0.00           ~     (all equal)
DeepEqual/[]uintptr-8         2.00 ± 0%      0.00       -100.00%  (p=0.000 n=20+20)
DeepEqual/float32-8           0.00           0.00           ~     (all equal)
DeepEqual/[]float32-8         2.00 ± 0%      0.00       -100.00%  (p=0.000 n=20+20)
DeepEqual/float64-8           0.00           0.00           ~     (all equal)
DeepEqual/[]float64-8         2.00 ± 0%      0.00       -100.00%  (p=0.000 n=20+20)
DeepEqual/complex64-8         0.00           0.00           ~     (all equal)
DeepEqual/[]complex64-8       2.00 ± 0%      0.00       -100.00%  (p=0.000 n=20+20)
DeepEqual/complex128-8        0.00           0.00           ~     (all equal)
DeepEqual/[]complex128-8      2.00 ± 0%      0.00       -100.00%  (p=0.000 n=20+20)
DeepEqual/bool-8              0.00           0.00           ~     (all equal)
DeepEqual/[]bool-8            2.00 ± 0%      0.00       -100.00%  (p=0.000 n=20+20)
DeepEqual/string-8            0.00           0.00           ~     (all equal)
DeepEqual/[]string-8          2.00 ± 0%      0.00       -100.00%  (p=0.000 n=20+20)
DeepEqual/[]uint8#01-8        12.0 ± 0%       0.0       -100.00%  (p=0.000 n=20+20)
DeepEqual/[][]uint8-8         12.0 ± 0%       0.0       -100.00%  (p=0.000 n=20+20)
DeepEqual/[6]uint8-8          0.00           0.00           ~     (all equal)
DeepEqual/[][6]uint8-8        12.0 ± 0%       0.0       -100.00%  (p=0.000 n=20+20)

Change-Id: Ic21f0e2305f2cf5e6674c81b9ca609120b3006d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/318169
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Trust: Joe Tsai <joetsai@digital-static.net>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Joe Tsai <joetsai@digital-static.net>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Joe Tsai <joetsai@digital-static.net>
2021-09-13 20:17:24 +00:00
Keith Randall
ac40c9872f reflect: fix _faststr optimization
CL 345486 introduced an optimization to reflect's map accesses
which is not quite correct. We can't use the optimized code if the
value type is >128 bytes.

See cmd/compile/internal/walk/walk.go:mapfast

Fixes #48357

Change-Id: I8e3c7858693083dd4393a8de48ca5fa47bab66f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/349593
Trust: Keith Randall <khr@golang.org>
Trust: Joe Tsai <joetsai@digital-static.net>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Trust: Martin Möhrmann <martin@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Run-TryBot: Joe Tsai <joetsai@digital-static.net>
Reviewed-by: Joe Tsai <joetsai@digital-static.net>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Martin Möhrmann <martin@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-09-13 18:38:15 +00:00
Michael Matloob
c8a58f29dc cmd/go: add test to check for a potential workspace loading issue
This test checks that we load the same graph regardless of the path to
the requested module in the workspace.

We currently don't. This will be fixed in a future change that redoes
workspace mode's usage of the Requirements structure.

For #45713

Change-Id: Id02cbb60a38619d840dbf1e70173ce853c0c167a
Reviewed-on: https://go-review.googlesource.com/c/go/+/348649
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-09-13 18:05:59 +00:00
Martin Möhrmann
e74e363a6b strings: add Clone function
The new strings.Clone function copies the input string
without the returned cloned string referencing the
input strings memory.

goarch: amd64
cpu: Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz

name     time/op
Clone-8  24.2ns ± 2%

name     alloc/op
Clone-8   48.0B ± 0%

name     allocs/op
Clone-8    1.00 ± 0%

Update #45038
Fixes #40200

Change-Id: Id9116c21c14328ec3931ef9a67a2e4f30ff301f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/345849
Trust: Martin Möhrmann <martin@golang.org>
Run-TryBot: Martin Möhrmann <martin@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Joe Tsai <joetsai@digital-static.net>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-09-13 18:02:42 +00:00
Than McIntosh
bced369a50 cmd/link: minor code cleanup in dwarf gen
Minor code cleanup to get rid of a few unused parameters and return
values in the linker's dwarf generation code. No functional changes.

Change-Id: I1a68ebe0f08d8d32ca7adfdd2fb9db573a4fd5f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/332070
Trust: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-09-13 17:56:18 +00:00
Jay Conrod
c3b217a0e5 cmd/go: document 'go install cmd@version' ignores vendor directories
For #48332

Change-Id: I708eb3e8f3f386f03210b7117d9ab8b0be2125bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/349591
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-09-13 17:26:12 +00:00
Robert Findley
ad97d204f0 go/types: remove some unnecessary loading/expansion of Named types
For Identical an u.nify, only type arguments and pointer identity is
needed.

Change-Id: Id4018d2a53044fa20fd26d28890f28b37b6d6d70
Reviewed-on: https://go-review.googlesource.com/c/go/+/349409
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-09-12 16:46:58 +00:00
Joe Tsai
0d8a4bfc96 bufio: add Writer.AvailableBuffer
This adds a new Writer.AvailableBuffer method that returns
an empty buffer with a possibly non-empty capacity for use
with append-like APIs.

The typical usage pattern is something like:
	b := bw.AvailableBuffer()
	b = appendValue(b, v)
	bw.Write(b)

It allows logic combining append-like APIs with bufio.Writer to avoid
needing to allocate and manage buffers themselves and allows the
append-like APIs to directly write into the buffer for a bufio.Writer.

Fixes #47527

Change-Id: I9cd169f3f8e8c7cd40818caf3daf1944c826fc66
Reviewed-on: https://go-review.googlesource.com/c/go/+/345569
Trust: Joe Tsai <joetsai@digital-static.net>
Run-TryBot: Joe Tsai <joetsai@digital-static.net>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-09-12 01:06:53 +00:00
Joe Tsai
23832ba2e2 reflect: optimize for maps with string keys
Over 80% of all Go map types use a string as the key.
The Go runtime already has a specialized implementation for such maps
in runtime/map_faststr.go. However, the Go reflection implementation
has not historically made use of that implementation.

This CL plumbs the appropriate logic to be accessible from Go reflection
so that it can benefit as well.

    name                            old time/op    new time/op    delta
    Map/StringKeys/MapIndex-4       4.65us ± 5%    2.95us ± 3%  -36.50%  (p=0.016 n=4+5)
    Map/StringKeys/SetMapIndex-4    7.47us ± 5%    5.27us ± 2%  -29.40%  (p=0.008 n=5+5)
    Map/Uint64Keys/MapIndex-4       3.79us ± 3%    3.75us ± 2%     ~     (p=0.548 n=5+5)
    Map/Uint64Keys/SetMapIndex-4    6.13us ± 3%    6.09us ± 1%     ~     (p=0.746 n=5+5)

Change-Id: I5495d48948d8caf2d004a03ae1820ab5f8729670
Reviewed-on: https://go-review.googlesource.com/c/go/+/345486
Trust: Joe Tsai <joetsai@digital-static.net>
Run-TryBot: Joe Tsai <joetsai@digital-static.net>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2021-09-11 05:05:56 +00:00
Joe Tsai
a50225a0dc bufio: make Reader.Reset and Writer.Reset work on the zero value
For batch allocation reasons, it would be useful to nest a
bufio.Reader or bufio.Writer in a struct as a value,
rather than a pointer. When the Reset method is called,
have it use the default buffer size if the buffer is nil.

Fixes #45374

Change-Id: I80df18a13575431428a42ed150a1579de1282637
Reviewed-on: https://go-review.googlesource.com/c/go/+/345570
Trust: Joe Tsai <joetsai@digital-static.net>
Run-TryBot: Joe Tsai <joetsai@digital-static.net>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-09-11 04:44:12 +00:00
Jay Conrod
c8dfa306ba [dev.fuzz] testing: F.Setenv plus various fixes and revisions
I spent some time looking through all the changes we've made to
testing and cmd/go/... on the dev.fuzz branch. CL 348469 shows those
differences. This CL fixes comments, TODOs, and simplifies code in a
few places. It also implements F.Setenv.

Change-Id: I6fd7ef5fbd0bb6055e38d56cb42bddcf6f4ffdaf
Reviewed-on: https://go-review.googlesource.com/c/go/+/349109
Trust: Jay Conrod <jayconrod@google.com>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Jay Conrod <jayconrod@google.com>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2021-09-10 21:28:48 +00:00
Katie Hockman
17f62c0ac3 [dev.fuzz] internal/fuzz: fix bug for -fuzzminimizetime of zero
Updates golang/go#48321

Change-Id: Ib35388f17580f1244a6eae4e5879f8329b6b44ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/349090
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-09-10 20:17:28 +00:00
Katie Hockman
d106089fa6 [dev.fuzz] internal/fuzz: write a newline to the end of a corpus file
If someone manually adds/alters a corpus file to add
extra spacing or remove the final newline, the file
can still be decoded. However, this change ensures that
the fuzzing engine correctly writes the final newline.

Fixes golang/go#48130

Change-Id: Ib5556d4a6e4e0bfd9bc2edab357b7c25bedfd176
Reviewed-on: https://go-review.googlesource.com/c/go/+/349055
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-09-10 19:27:54 +00:00
Katie Hockman
363f2f3df9 [dev.fuzz] testing: allow -fuzzminimizetime to be 0
Fixes golang/go#48321

Change-Id: I1547379eb7a703f7f3c4594d27833eb3587796a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/349089
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-09-10 17:46:52 +00:00
WANG Xuerui
cf2fe5d6f1 doc/asm: fix HTML markup
Change-Id: I33bde4835d3b83fafd55beea483f6236c4c62840
Reviewed-on: https://go-review.googlesource.com/c/go/+/338990
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Than McIntosh <thanm@google.com>
2021-09-10 17:15:37 +00:00
Florin Papa
1bf2cd1291 debug/elf: retain original error message when getSymbols fails.
The original error is currently discarded, and that makes it difficult
to know what failed, in case we want to retry only certain errors.

Change-Id: Id7e927ec242464249c4dfa5cda0f264adef3c898
Reviewed-on: https://go-review.googlesource.com/c/go/+/317851
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Than McIntosh <thanm@google.com>
2021-09-10 17:13:40 +00:00
Josh Bleecher Snyder
5a4b9f9494 time: reference -tags=timetzdata in testing panic
This will spare anyone who hits it having to search for the workaround.

Change-Id: Iff0d449212f2675ac78e30ae5ffc8efb4d924088
Reviewed-on: https://go-review.googlesource.com/c/go/+/334611
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-09-10 17:11:39 +00:00
Ethan Reesor
025308fe08 testing: increase alternation precedence
Updates handling of go test flags -run and -bench to give alternation
precendence over the / delimiter. Currently, `A/B|C/D` is effectively
`A/(B|C)/D` - with this change, it changes to effectively `(A/B)|(C/D)`.

Fixes #39904

Change-Id: Iebe5efd8d91c72eed6351bd63b4689b0fcb0ed0f
Reviewed-on: https://go-review.googlesource.com/c/go/+/343883
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Than McIntosh <thanm@google.com>
2021-09-10 17:09:57 +00:00
Robert Griesemer
5a94a90d84 cmd/compile/internal/types2: better error message for invalid array decls
Fixes #43527.

Change-Id: I988a4d49f2f54b4b1741688fb52a55bf313d39e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/348731
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-09-10 16:51:52 +00:00
Robert Griesemer
da1aa65053 cmd/compile/internal/syntax: correct follow token for type parameter lists
When parsing a type parameter declaration, parts of the code still
expected a ) as closing token. Use the correct follow token ) or ]
depending on parameter list kind.

Also, consistently use tokstring (not tok.String()) for user-facing
(error) messages.

Follow-up on comment in CL 348730.

For #43527.

Change-Id: Ib1d4feb526771a1668a54c3bb7a671f6c8a65940
Reviewed-on: https://go-review.googlesource.com/c/go/+/348742
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-09-10 16:08:21 +00:00
Katie Hockman
b38e853d04 [dev.fuzz] testing: move corpus from testdata/corpus to testdata/fuzz
Fixes golang/go#48128

Change-Id: I04deb17226ff5d5dfcbe408fe089f400d4d3836f
Reviewed-on: https://go-review.googlesource.com/c/go/+/349053
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-09-10 15:20:44 +00:00
Katie Hockman
213d9f9a38 [dev.fuzz] internal/fuzz: improve warning message when not instrumented
Change-Id: I005f66c965014b699de7e22750f417b28a32c03f
Reviewed-on: https://go-review.googlesource.com/c/go/+/349052
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-09-10 15:20:38 +00:00
Zheng Xu
96ab854ab0 cmd/compile/internal: better AST line highlight in ssa.html
We tend to set div class with the line number in HTML AST nodes. So that
the AST nodes can be highlighted with corresponding source and ssa ir.

The pure AST text dump is created first. And then it is parsed and
written to the HTML file.

CL 275785 changed the format of the line information in AST node dump,
which makes the HTMLWriter fail to parse the line information.

This CL updates the code in HTMLWriter to align with the format of AST
node dump.

Fix #48133

Change-Id: I2b56fc5e3e9771456d91f22caf23a427c235eb12
Reviewed-on: https://go-review.googlesource.com/c/go/+/347269
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Than McIntosh <thanm@google.com>
2021-09-10 14:03:35 +00:00
Hajime Hoshi
90c5660616 embed: guarantee the returned file of FS.Open implements io.Seeker
Fixes golang/go#45745

Change-Id: Ib49a9605a38074f544a5d28116862e191cea8c0f
Reviewed-on: https://go-review.googlesource.com/c/go/+/313352
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Than McIntosh <thanm@google.com>
2021-09-10 13:30:50 +00:00
Michael Munday
c69f5c0d76 cmd/compile: add support for Abs and Copysign intrinsics on riscv64
Also, add the FABSS and FABSD pseudo instructions to the assembler.
The compiler could use FSGNJX[SD] directly but there doesn't seem
to be much advantage to doing so and the pseudo instructions are
easier to understand.

Change-Id: Ie8825b8aa8773c69cc4f07a32ef04abf4061d80d
Reviewed-on: https://go-review.googlesource.com/c/go/+/348989
Trust: Michael Munday <mike.munday@lowrisc.org>
Run-TryBot: Michael Munday <mike.munday@lowrisc.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
2021-09-10 10:45:59 +00:00
fanzha02
2091bd3f26 cmd/compile: simiplify arm64 bitfield optimizations
In some rewrite rules for arm64 bitfield optimizations, the
bitfield lsb value and the bitfield width value are related
to datasize, some of them use datasize directly to check the
bitfield lsb value is valid, to get the bitfiled width value,
but some of them call isARM64BFMask() and arm64BFWidth()
functions. In order to be consistent, this patch changes them
all to use datasize.

Besides, this patch sorts the codegen test cases.

Run the "toolstash-check -all" command and find one inconsistent code
is as the following.

new:    src/math/fma.go:104      BEQ	247
master: src/math/fma.go:104      BEQ	248

The above inconsistence is due to this patch changing the range of the
field lsb value in "UBFIZ" optimization rules from "lc+(32|16|8)<64" to
"lc<64", so that the following code is generated as "UBFIZ". The logical
of changed code is still correct.

The code of src/math/fma.go:160:
  const uvinf = 0x7FF0000000000000
  func FMA(a, b uint32) float64 {
  	ps := a+b
  	return Float64frombits(uint64(ps)<<63 | uvinf)
  }

The new assembly code:
  TEXT    "".FMA(SB), LEAF|NOFRAME|ABIInternal, $0-16
  MOVWU   "".a(FP), R0
  MOVWU   "".b+4(FP), R1
  ADD     R1, R0, R0
  UBFIZ   $63, R0, $1, R0
  ORR     $9218868437227405312, R0, R0
  MOVD    R0, "".~r2+8(FP)
  RET     (R30)

The master assembly code:
  TEXT    "".FMA(SB), LEAF|NOFRAME|ABIInternal, $0-16
  MOVWU   "".a(FP), R0
  MOVWU   "".b+4(FP), R1
  ADD     R1, R0, R0
  MOVWU   R0, R0
  LSL     $63, R0, R0
  ORR     $9218868437227405312, R0, R0
  MOVD    R0, "".~r2+8(FP)
  RET     (R30)

Change-Id: I9061104adfdfd3384d0525327ae1e5c8b0df5c35
Reviewed-on: https://go-review.googlesource.com/c/go/+/265038
Trust: fannie zhang <Fannie.Zhang@arm.com>
Run-TryBot: fannie zhang <Fannie.Zhang@arm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-09-10 02:44:36 +00:00
Robert Griesemer
b32209d22d cmd/compile: fix test case for unified IR (fix build)
For #48301.

Change-Id: Ie5f57dcce86773c06c5140abf13a6cfff79eb323
Reviewed-on: https://go-review.googlesource.com/c/go/+/348743
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-09-09 23:18:18 +00:00
Robert Griesemer
1a708bcf1d cmd/compile: don't crash while reporting invalid alias cycle
Add a missing nil check in the formatting code for expression
nodes. Matches the nil checks in the same code.

Fixes #48301.

Change-Id: Ia9bfd3535254a94996ee190b544d95e15433d252
Reviewed-on: https://go-review.googlesource.com/c/go/+/348740
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-09-09 22:20:16 +00:00
Ian Lance Taylor
426ff3746f cmd/cgo, runtime/cgo: avoid GCC/clang conversion warnings
Add explicit conversions to avoid warnings from -Wsign-conversion and
-Wshorten-64-to-32. Also avoid runtime errors from -fsanitize=undefined.

Fixes #48121

Change-Id: I29dc8d976884fc42826392c10f1e1759bb1a3989
Reviewed-on: https://go-review.googlesource.com/c/go/+/348739
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-09-09 22:18:05 +00:00
Robert Griesemer
73483df406 cmd/compile/internal/syntax: better error message for missing type constraint
For #43527.

Change-Id: I8c706e68572286d5675383eb2dfd75b5618b646b
Reviewed-on: https://go-review.googlesource.com/c/go/+/348730
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-09-09 22:17:54 +00:00
korzhao
e1c3f2158f time: propagate "," separator for fractional seconds into Format
In CL 300996 that fixed issue #6189, we made Parse recognize
"," as a separator for fractional seconds.
However, we didn't modify Format to propagate the separator
verbatim from Parse. Without this change, we break prior
functionality that relied on a comma being used in Format.

Fixes #48037

Change-Id: I6565a25e8657ca3747a58b25acba58f27cdcddc0
Reviewed-on: https://go-review.googlesource.com/c/go/+/345438
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Cherry Mui <cherryyz@google.com>
2021-09-09 22:17:48 +00:00
korzhao
c981874a5a cmd/compile: fix implement for closure in a global assignment
If closure in a global assignment and has a method receiver.
We should assign receiver as a global variable, not a local variable.

Fixes #48225

Change-Id: I8f65dd6e8baf66a5eff24028d28ad0a594091add
Reviewed-on: https://go-review.googlesource.com/c/go/+/348512
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
2021-09-09 21:28:56 +00:00
Paul E. Murphy
2c4f389c02 cmd/link: enable internal linker in more cases for ppc64le
The internal linker is capable of linking the ppc64le linux
race detector and approved cgo packages.

Likewise, ppc64/linux and ppc64/aix do not support the race
detector. Thus, extra code to enforce external linking when
using the race detector on ppc64/ppc64le can be removed
entirely.

Fixes #21961

Change-Id: I10db14f65ee616ee3291e17409e8333e3af7d4df
Reviewed-on: https://go-review.googlesource.com/c/go/+/304459
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-09-09 19:43:39 +00:00
Matthew Dempsky
fb84e99eb7 test: add compiler regress tests for #46461
gri@ reports that types2 now correctly handles when type parameters
recursively refer back to the parameterized type, so we might as well
add tests to exercise that. Unified IR also correctly handles
importing and exporting these types, but -G=3 currently does not.

Updates #46461.

Change-Id: I272102aa08c40c980b9aeeca9f834291dfbbcc3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/348738
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-09-09 19:37:25 +00:00
Dan Scales
b9e1a24581 cmd/compile: fix case where init info of OAS node is dropped
When an OAS node is converted to an OSELRECV2 node in tcSelect(), the
possible DCL node in the Init field was being dropped, since a
completely new node was being created and the Init field was not set. I
don't expect n.Init() to be set for the ORECV case, but the code now
deals with that too.

Fixed bug in both tcSelect() and transformSelect().

Fixes #48289

Change-Id: I09918a70f7cbaa4aa9a17546169f908a8787df15
Reviewed-on: https://go-review.googlesource.com/c/go/+/348569
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-09-09 19:17:02 +00:00
Katie Hockman
7c648e2acb [dev.fuzz] internal/fuzz: avoid incorrect bytes modification during minimization
During minimization, the "canonical inputs" (vals) are updated
as viable minimized values are found. Previously, these bytes
could be changed later during minimization. This patch updates
the minimization code to revert the bytes back when a candidate
doesn't pass the minimization checks.

Another approach was in CL 340630 which would make a new allocation
each time a candidate was attempted. This will get very expensive
very quickly, as minimization can run several thousand times for every
new crash and every newly discovered interesting input.

Credit to Steven Johnstone (steven.james.johnstone@gmail.com) for the
"single_bytes" test which was added to minimize_test.go.

Fixes golang/go#47587

Change-Id: Ibd12f73458ed812bab7d3f1d4118854a54fc4d0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/348610
Trust: Katie Hockman <katie@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Katie Hockman <katie@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-09-09 17:28:03 +00:00
Robert Findley
f9271e4f85 go/types, types2: rename RParams -> RecvTypeParams
To be consistent with CL 348376, spell out 'RecvTypeParams' in go/types
and types2 API.

Updates #47916

Change-Id: If8b3fd4274ccb944bd0ff04d7007e94e5fba61c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/348810
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-09-09 17:02:45 +00:00