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

51845 Commits

Author SHA1 Message Date
Meng Zhuo
8fefeabb35 runtime: add runtime changes for register ABI on riscv64
This CL adds
- spill functions used by runtime
- ABIInternal to functions

Adding new stubs_riscv64 file to eliminate vet issues while compiling.

Change-Id: I2a9f6088a1cd2d9708f26b2d97895b4e5f9f87e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/360296
Trust: mzh <mzh@golangcn.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-03-30 01:12:57 +00:00
Robert Griesemer
7cb1ae3e8e go/types, types2: better error message for some invalid receiver errors (cleanup)
Use the 1.17 compiler error message together with the receiver base type.
Also, simplify and flatten the receive testing logic for clarity.

Change-Id: I71e58f261900dd7a85d2eb89a310c36b68d1b0b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/396298
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-03-29 22:09:32 +00:00
Paul E. Murphy
3d7ca9f7c0 cmd/compile: add PPC64 ssa ops to support carry chain arithmetic
These are the opcodes required to lower math/bits.Add64 and
math/bits.Sub64 directly into ssa form. Likewise, opcodes which
clobber CA are marked.

This does not alter code generation. It prepares for future changes
to support scheduling carry chaining ops more effectively, and then
changes to lower into PPC64 opcodes.

Change-Id: I2723deee4a98b3c365f691857512df53280ae40f
Reviewed-on: https://go-review.googlesource.com/c/go/+/394594
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-03-29 22:08:15 +00:00
Paul E. Murphy
dac0220841 runtime: avoid potential hang in TestGdbAutotmpTypes
If a GC related task preempts between hitting the main.main breakpoint
and stepping, the test program may halt forever waiting on a GC
operation. This happens if gdb is configured to halt other threads
while executing a step.

Configure gdb to continue running all threads during a step by
setting the scheduler-locking option to off.

Fixes #49852

Change-Id: Iacc9732cbd23526bde0a295e6fa8a0d90f733f59
Reviewed-on: https://go-review.googlesource.com/c/go/+/370775
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Cherry Mui <cherryyz@google.com>
2022-03-29 22:06:31 +00:00
Paul E. Murphy
a4a0f9b148 cmd/compile: make XER allocatable register on PPC64
This is the first step towards decomposing aggregate operations
which create or consume the CA bit of the XER.

This helps optimize the canned sequence of Add64Carry (and
Sub64Borrow if it were implemented similarly) by minimizing
extraneous operations related to loading the CA bit,
reloading CA in chained operations, or extracting it when
unused.

Likewise, mark the operations which clobber CA.

Change-Id: I33e6dd2654a8cc39fcdbb9690a495f03558cdc97
Reviewed-on: https://go-review.googlesource.com/c/go/+/346869
Trust: Paul Murphy <murp@ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-29 18:55:09 +00:00
Robert Griesemer
f71daa6fe6 go/types, types2: better error message for blank interface method name (cleanup)
Use the 1.17 compiler error message.

Change-Id: Ic62de5bfc9681674069934afc590f5840729f8e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/396297
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-03-29 17:21:21 +00:00
Robert Griesemer
9038c24498 go/types, types2: better index-out-of-bounds error message (cleanup)
Use the 1.17 compiler error message, sans "array" prefix.

Change-Id: I0e70781c5ff02dca30a2004ab4d0ea82b0849eae
Reviewed-on: https://go-review.googlesource.com/c/go/+/396296
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-03-29 17:21:15 +00:00
Ian Lance Taylor
a2baae6851 all: use new "unix" build tag where appropriate
For #20322
For #51572

Change-Id: Id0b4799d097d01128e98ba4cc0092298357bca45
Reviewed-on: https://go-review.googlesource.com/c/go/+/389935
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2022-03-29 16:24:51 +00:00
Matt Layher
ae9ce822ff net/netip: return an error from ParsePrefix with IPv6 zone input
net.ParseCIDR already rejects input in the form of 2001:db8::%a/32, but
netip.ParsePrefix previously accepted the input and silently dropped the
zone. Make the two consistent by always returning an error if an IPv6
zone is present in CIDR input for ParsePrefix.

Fixes #51899.

Change-Id: Iee7d8d4a5161e0b54a4ee1bd68b02c1a287ff399
Reviewed-on: https://go-review.googlesource.com/c/go/+/396299
Trust: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Damien Neil <dneil@google.com>
2022-03-29 15:43:06 +00:00
Robert Findley
9b90838712 go/types, types2: preserve parent scope when substituting receivers
Fixes #51920

Change-Id: I29e44a52dabee5c09e1761f9ec8fb2e8795f8901
Reviewed-on: https://go-review.googlesource.com/c/go/+/395538
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-29 10:35:56 +00:00
Ian Lance Taylor
1724077b78 doc/go1.19: mention new unix build constraint
For #51572

Change-Id: Ib27be79379c8b3f72e29365b58067d7ee1919e52
Reviewed-on: https://go-review.googlesource.com/c/go/+/396295
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2022-03-29 02:25:12 +00:00
Ben Shi
94727bed02 cmd/internal/obj/riscv: add two-operand form to more instructions
Add two-operand form "op rs, rd" to
ADDW/SUBW/SLLW/SRLW/SRAW/SLLIW/SRLIW/SRAIW.

Do the following map:
"ADDW $imm, rd" -> "ADDIW $imm, rd"
"SLLW $imm, rd" -> "SLLIW $imm, rd"
"SRLW $imm, rd" -> "SRLIW $imm, rd"
"SRAW $imm, rd" -> "SRAIW $imm, rd"

Change-Id: Ie9632ba198ba8c05faac91504e4b97fc45ca1196
GitHub-Last-Rev: c6ccc9d5d0
GitHub-Pull-Request: golang/go#51984
Reviewed-on: https://go-review.googlesource.com/c/go/+/396134
Run-TryBot: Ben Shi <powerman1st@163.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
2022-03-29 01:48:39 +00:00
Matthew Dempsky
9a9bd10290 cmd/compile/internal/importer: support final unified IR export format
This updates the cmd/compile/internal/importer to natively support the
"final" unified IR export format. This is really just for unit tests
and symmetry with go/internal/gcimporter though, since
cmd/compile/internal/noder has its own types2.Importer.

Change-Id: I52fbb6134dbc0a903d62c1b04f95d33bd29e0414
Reviewed-on: https://go-review.googlesource.com/c/go/+/388617
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
2022-03-29 00:02:55 +00:00
Ian Lance Taylor
c3fcd01177 go/build: recognize "unix" build tag
The new "unix" build tag matches any Unix or Unix-like system.
This is only recognized on go:build lines, not in file names.

For #20322
Fixes #51572

Change-Id: I3a991f9e69353b25e259bc6462709cdcd83640fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/389934
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-28 22:28:20 +00:00
Ian Lance Taylor
32fdad19a2 bytes: restore old Trim/TrimLeft behavior for nil
Keep returning nil for the cases where we historically returned nil,
even though this is slightly different for TrimLeft and TrimRight.

Fixes #51793

Change-Id: Ifbdfc6b09d52b8e063cfe6341019f9b2eb8b70e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/393876
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2022-03-28 22:06:49 +00:00
Ian Lance Taylor
460fd63ccc io/fs, path/filepath: honor SkipDir on second WalkDirFunc error call
Fixes #51617

Change-Id: I03e9e575d9bad1481e7e4f051b50a077ba5f2fe0
Reviewed-on: https://go-review.googlesource.com/c/go/+/392154
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2022-03-28 22:03:07 +00:00
Ian Lance Taylor
3c7f9b8022 net/mail: accept UT as a timezone
Fixes #39906

Change-Id: I8fcaf4c1ccc4131d770cff08d9c80f520885a6b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/396214
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2022-03-28 21:59:25 +00:00
Matthew Dempsky
42ca44494c internal/pkgbits: add fingerprints to unified IR export format
So far unified IR has been relying on the backwards-compat iexport
data to supply package fingerprints for imports. To be able to drop
the iexport data and natively use unified IR everywhere.

This CL applies basically the same idea that iexport used: simply
hash all of the export data as it's being written out, and then tack
on an 8-byte hash at the end.

Change-Id: Iaca5fbfd7443088bc7f422a1c58be3e762c29014
Reviewed-on: https://go-review.googlesource.com/c/go/+/396196
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-03-28 19:58:45 +00:00
Cherry Mui
1a9972ec87 cmd/internal/obj: sort relocations
At least on some platforms (e.g. PE dynamic loader) relocations
need to be sorted in address order. Currently we don't always emit
relocations in address order: e.g. for array literal with out-of-
order element initializers, or out-of-order DATA instructions in
assembly code. Sort them.

No test for now as I can't reproduce the failure for #51923.

Fixes #51923.

Change-Id: Ifec5d3476e027bb927bcefd6e45c40ebeccee4ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/396195
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-03-28 19:46:07 +00:00
Paul E. Murphy
33987b408c cmd/compile: reallocate FPR31 to XER for PPC64 regalloc
We are limited to 64 registers in the allocator today, and PPC64
has not been allocating F0,F26-F31 for quite some time without
performance impact.

Change-Id: If9d60be5037c94991fdd90a44461c3a6b96315cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/395835
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-28 19:34:14 +00:00
Paul E. Murphy
e84a37068b cmd/compile: make F0,F27-F31 allocatable on PPC64
These FP registers on PPC64 have no restrictions, they can
be used like the others. F27-F31 were sequested long ago for
scratch storage which has long since been reverted, but they
weren't added back to the allocator pool.

Change-Id: I9074660e2fc91a2044c9768f700a8215802cba51
Reviewed-on: https://go-review.googlesource.com/c/go/+/395834
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
2022-03-28 19:34:01 +00:00
Cherry Mui
0a69c98214 all: delete PPC64 non-register ABI fallback path
Change-Id: Ie058c0549167b256ad943a0134907df3aca4a69f
Reviewed-on: https://go-review.googlesource.com/c/go/+/394215
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-28 18:20:56 +00:00
Matthew Dempsky
26a8cf56e0 cmd/compile/internal/syntax: fix scanner.{op,prec} docs
These fields are also valid for _Star.

Change-Id: I2582000ac1737c41416e69f91404f7cac279d718
Reviewed-on: https://go-review.googlesource.com/c/go/+/395916
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2022-03-28 18:17:41 +00:00
Kir Kolyshkin
0d651041a9 syscall: optimize Byte{Ptr,Slice}FromString
Use bytealg.IndexByteString(str, 0) instead of looping through the
string to check for a zero byte. A quick and dirty benchmark shows 10x
performance improvement (on amd64 machine, using go 1.17.3).

BytePtrFromString is used by many functions with string arguments.
This change should make many functions in os package, such as those
accepting a filename (os.Open, os.Stat, etc.), a tad faster.

PS I am aware that syscall package is deprecated and frozen, but this
change is mainly for the os package and the likes. The alternative
would be for os to switch to x/sys, which is a much bigger change.

Change-Id: I18fdd50f9fbfe0a23a4a71bc4bd0a5f5b0eaa475
Reviewed-on: https://go-review.googlesource.com/c/go/+/368457
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-28 16:55:57 +00:00
Dmitry Vyukov
d6a1ffd624 runtime/race: update runtime (v3)
New tsan runtime (v3) built on llvm commit 1784fe0532a6.

The new runtime features:
 - 2x smaller shadow memory (2x of app memory)
 - faster fully vectorized (on x86) race detection
 - small fixed-size vector clocks (512b)
 - fast vectorized vector clock operations
 - unlimited number of alive threads/goroutines

Some random subset of benchmarks:

encoding/json:
CodeEncoder-72           20.3ms ± 6%     11.7ms ± 4%   -42.02%  (p=0.000 n=10+8)
CodeMarshal-72           22.3ms ±11%     12.7ms ±11%   -43.28%  (p=0.000 n=10+10)
CodeDecoder-72           46.1ms ±42%     20.2ms ± 7%   -56.18%  (p=0.000 n=10+10)
CodeUnmarshal-72         16.7ms ±14%     13.2ms ± 9%   -20.93%  (p=0.000 n=10+10)
CodeUnmarshalReuse-72    17.7ms ±17%     12.8ms ± 8%   -27.58%  (p=0.000 n=10+10)

net/http:
ClientServerParallel4-72         914µs ±18%      72µs ± 5%  -92.16%  (p=0.000 n=20+18)
ClientServerParallel64-72       1.77ms ±16%    0.12ms ±29%  -93.43%  (p=0.000 n=20+17)
ClientServerParallelTLS4-72     1.99ms ±33%    0.20ms ± 5%  -89.83%  (p=0.000 n=19+17)
ClientServerParallelTLS64-72    2.72ms ±26%    0.25ms ±16%  -90.96%  (p=0.000 n=20+16)

compress/flate:
Decode/Digits/Huffman/1e4-72        2.53ms ± 3%     1.47ms ± 4%   -41.72%  (p=0.000 n=9+10)
Decode/Digits/Speed/1e4-72          2.59ms ± 5%     1.52ms ± 3%   -41.44%  (p=0.000 n=8+9)
Decode/Digits/Default/1e4-72        2.56ms ± 6%     1.51ms ± 4%   -40.96%  (p=0.000 n=10+10)
Decode/Digits/Compression/1e4-72    2.54ms ± 6%     1.52ms ± 2%   -40.14%  (p=0.000 n=10+9)
Decode/Newton/Huffman/1e4-72        2.65ms ± 3%     1.58ms ± 4%   -40.45%  (p=0.000 n=10+10)
Decode/Newton/Speed/1e4-72          2.16ms ± 9%     1.28ms ± 5%   -40.59%  (p=0.000 n=10+10)
Decode/Newton/Default/1e4-72        2.01ms ± 8%     1.16ms ± 6%   -42.11%  (p=0.000 n=10+10)
Decode/Newton/Compression/1e4-72    1.99ms ± 6%     1.17ms ± 3%   -41.05%  (p=0.000 n=9+10)
Encode/Digits/Huffman/1e4-72        2.05ms ± 2%     0.75ms ± 5%   -63.32%  (p=0.000 n=10+10)
Encode/Digits/Speed/1e4-72          2.89ms ± 2%     1.37ms ± 2%   -52.56%  (p=0.000 n=9+10)
Encode/Digits/Default/1e4-72        7.55ms ± 2%     3.86ms ± 4%   -48.93%  (p=0.000 n=8+10)
Encode/Digits/Compression/1e4-72    7.46ms ± 4%     3.88ms ± 4%   -48.07%  (p=0.000 n=9+9)
Encode/Newton/Huffman/1e4-72        2.20ms ± 4%     0.90ms ± 6%   -59.01%  (p=0.000 n=10+10)
Encode/Newton/Speed/1e4-72          2.62ms ± 2%     1.30ms ± 4%   -50.52%  (p=0.000 n=9+10)
Encode/Newton/Default/1e4-72        7.40ms ± 5%     3.72ms ± 2%   -49.65%  (p=0.000 n=10+9)
Encode/Newton/Compression/1e4-72    7.67ms ± 9%     3.85ms ± 4%   -49.87%  (p=0.000 n=10+10)

encoding/json short tests:
Time     2.34sec ± 6%   1.67sec ±11%  -28.85%  (p=0.000 n=10+10)
Memory     266MB ± 1%     190MB ± 9%  -28.78%  (p=0.000 n=10+10)

compress/flate short tests:
Time      4.69sec ± 4%   2.78sec ± 3%  -40.61%  (p=0.000 n=10+10)
Memory      284MB ± 5%     181MB ± 4%  -36.04%  (p=0.000 n=10+9)

sync short tests:
Time     4.87sec ± 4%  0.87sec ± 6%  -82.21%  (p=0.000 n=10+10)
Memory     147MB ± 3%     99MB ± 8%  -32.47%  (p=0.000 n=10+9)

Fixes #47056
Fixes #38184

Change-Id: I0cf228f2e4cac7778d34d33e46df7c081645f5d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/333529
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Trust: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-03-28 16:52:35 +00:00
Jeff Widman
a208aa7f33 io/ioutil: add deprecation markers to ioutil
All the code in ioutil just forwards functionality to code
in either the io or os packages, per issue 42026.

This change adds the "Deprecated" marker to all the
functions in this package.

For #42026

Fixes #51927

Change-Id: Ia807bc5c0edb06cc80ec7e35917dcfe2ad50f0ea
GitHub-Last-Rev: 3c3603f368
GitHub-Pull-Request: golang/go#51961
Reviewed-on: https://go-review.googlesource.com/c/go/+/395918
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-03-28 16:44:09 +00:00
Cuong Manh Le
b10164b292 cmd/compile/internal/ir: remove un-used code for const
CL 390474 removed last usages of ConstValue, it can now be removed, and
also Float64Val, since when it's only used by ConstValue.

CanInt64 is un-used for a long time, its original form last usage was
removed in CL 221802.

Change-Id: Id142b0da49c319faca73ef1b2090325f81431321
Reviewed-on: https://go-review.googlesource.com/c/go/+/396078
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-03-28 16:29:15 +00:00
Ian Lance Taylor
5fcc6554d9 os: use syscall.Timespec.Unix
Use the syscall method instead of repeating the type conversions for each OS.

Change-Id: I1db975b3aaa189cf724d7b1b7c5c41bc64dd964d
Reviewed-on: https://go-review.googlesource.com/c/go/+/374574
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2022-03-28 04:41:26 +00:00
mzh
ad646b33c9 Revert "reflect, runtime: add reflect support for regabi on riscv64"
This reverts commit 56400fc706.

Reason for revert: this CL requires CL360296 be merged

Change-Id: I4c48c4d23b73b6e892cf86cbbc864698ebc5c992
Reviewed-on: https://go-review.googlesource.com/c/go/+/396076
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: mzh <mzh@golangcn.org>
Run-TryBot: mzh <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-28 01:10:35 +00:00
Patrick Gundlach
0eea25159f encoding/xml: expose decoder line and column
The existing implementation of the xml decoder uses the line number
only for reporting syntax errors. The line number of the last read
token and the column within the line is useful for the users even
in non-error conditions.

Fixes #45628

Change-Id: I37b5033ff5ff8411793d8f5180f96aa4537e83f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/311270
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
2022-03-27 20:26:46 +00:00
zhangjian
234283d8ab go/build: remove unused code in TestDependencies
Change-Id: I7ccffbf96bd30f33bb42b6a2592962e2d4dda9fc
GitHub-Last-Rev: 2d6e214ac5
GitHub-Pull-Request: golang/go#51231
Reviewed-on: https://go-review.googlesource.com/c/go/+/386374
Reviewed-by: mzh <mzh@golangcn.org>
Trust: mzh <mzh@golangcn.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2022-03-27 20:23:47 +00:00
Carl Johnson
0bbd05b826 time: add Duration.Abs
Fixes #51414

Change-Id: Ia3b1674f2a902c8396fe029397536643a3bc1784
GitHub-Last-Rev: 67159648af
GitHub-Pull-Request: golang/go#51739
Reviewed-on: https://go-review.googlesource.com/c/go/+/393515
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2022-03-27 20:23:17 +00:00
Andy Pan
737837c9d4 regexp: use input.step() to advance one rune in Regexp.allMatches()
Change-Id: I32944f4ed519419e168e62f9ed6df63961839259
Reviewed-on: https://go-review.googlesource.com/c/go/+/359197
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-27 20:22:06 +00:00
Keith Randall
018b78cc5b test: fix inline test on noopt builder
CL 394074 broke the noopt builder. Something about time.After's inlining
depends on the build flags to make.bash, not the build flags that run.go
passes.

Change-Id: Ib284c66ea2008a4d32829c055d57c54a34ec3fb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/396037
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2022-03-27 18:38:56 +00:00
Keith Randall
3bd8c78575 cmd/compile: upgrade prove pass to know results of math/bits ops are nonnegative
Fixes #51963

Change-Id: Ib9e0521222e6fc41e787f3150b254e058a19addc
Reviewed-on: https://go-review.googlesource.com/c/go/+/396036
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jakub Ciolek <jakub@ciolek.dev>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Eric Fang <eric.fang@arm.com>
2022-03-27 17:03:16 +00:00
Keith Randall
7d3b64a2e3 cmd/compile: optimize BSRQ with nonzero input
Same as BSFQ, if the input is known to be nonzero we don't need a CMOV
to correct for the weird all-zero behavior of the BSRQ instruction.

Fixes #51964

Change-Id: Ic1d14fdf3e7e698ff2f47efecfd761d8a036012a
Reviewed-on: https://go-review.googlesource.com/c/go/+/396034
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-03-27 17:02:31 +00:00
Meng Zhuo
56400fc706 reflect, runtime: add reflect support for regabi on riscv64
This CL adds regabi support needed for reflect.

Change-Id: Ib78f8c7765f03e3a7b46e8b115bf8870b8076e6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/360994
Trust: mzh <mzh@golangcn.org>
Run-TryBot: mzh <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-03-27 12:55:16 +00:00
Baokun Lee
79e051ad33 cmd/go/internal/modfetch: remove unused FileRev struct
In CL 367756 we remove ReadFileRevs function, We simplified
the implementation of the interface Repo. and the type FileRev
is no longer used.

Change-Id: Iec9e2f0d6bb227f4d0d0f565e897137dcf392a3a
Reviewed-on: https://go-review.googlesource.com/c/go/+/373375
Trust: Lee Baokun <bk@golangcn.org>
Run-TryBot: Lee Baokun <bk@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-03-27 06:12:30 +00:00
hopehook
b0750de656 os: document DirFS implements fs.StatFS
Fixes #51856

Change-Id: I8328d73bbb7bc166d58281180b64785a634e9bab
Reviewed-on: https://go-review.googlesource.com/c/go/+/394555
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-26 23:18:20 +00:00
Keith Randall
3f69cc7d77 Revert "cmd/compile: stop interface conversions for generic method calls from allocating"
This reverts commit e550c30545.

Reason for revert: Method bound calls are no longer implemented using interface calls, so it is no longer necessary. Leaving the test, though.

Change-Id: I80f1e4cd921063cd27ca8f07998316ca282e075b
Reviewed-on: https://go-review.googlesource.com/c/go/+/395594
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-26 20:36:39 +00:00
Keith Randall
f326964824 cmd/compile: use method expression closures to implement bound method calls
When we have x.M(args) where x is a value of type parameter type, we
currently cast x to the bound of that type parameter (which is an interface)
and then invoke the method on that interface. That's pretty inefficient
because:
 1) We need to convert x to an interface, which often requires allocation.
    With CL 378178 it is at least stack allocation, but allocation nontheless.
 2) We need to call through wrapper functions to unpack the interface
    into the right argument locations for the callee.

Instead, let's just call the target directly. The previous CL to this one
added method expression closures to the dictionary, which is a simple
captureless closure that implements T.M for type parameter T and method M.
So to implement x.M(args) for x of type T, we use methodexpr(T,M)(x, args).
We just need to move x from the receiver slot to the first argument, and
use the dictionary entry to implement the polymorphism. This works because
we stencil by shape, so we know how to marshal x for the call even though
we don't know its exact type.

We should be able to revert CL 378178 after this one, as that optimization
will no longer be necssary as we're not converting values to interfaces
to implement this language construct anymore.

Update #50182

Change-Id: I813de4510e41ab63626e58bd1167f9ae93016202
Reviewed-on: https://go-review.googlesource.com/c/go/+/385274
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-26 20:36:29 +00:00
Keith Randall
7fc38802e1 cmd/compile: implement generic method expressions with closures in dictionary
Currently we do quite a dance for method expressions on generic
types. We write a new closure, and in that closure convert the
receiver to an interface with the required method, then call the
target using an interface call.

Instead in this CL, we just allocate a (captureless) closure in the
dictionary which implements that method expression.

This CL makes method expressions faster and simpler. But the real win
is some followon CLs, where we can use the same closure to implement
bound method calls using the same closure, instead of converting to
interface and having wrappers convert back. Much faster and simpler.

Still thinking about how to do method values. The receiver still
needs to be captured, so there must be some closure involved, I think.

Update #50182

Change-Id: I1fbd57e7105663f8b049955b8f4111649a5f4aa8
Reviewed-on: https://go-review.googlesource.com/c/go/+/385254
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-26 20:36:23 +00:00
Meng Zhuo
0652274c10 internal/abi: define riscv64 register ABI constants
Add the riscv64 register ABI constants and allow regabi
value to be set for riscv64

Change-Id: I3ce98bf9a29d2acc00f92650b27bc59884ed62ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/359336
Trust: mzh <mzh@golangcn.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: mzh <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-26 01:27:54 +00:00
Wayne Zuo
80a7504a13 cmd/compile: enable inlining SELECT
Change-Id: I90c8e12a0be05d82bf6e147b5249859518f35c14
Reviewed-on: https://go-review.googlesource.com/c/go/+/394074
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Trust: Keith Randall <khr@golang.org>
2022-03-25 22:34:45 +00:00
Matthew Dempsky
3dac99ad4c cmd/compile: simplify fingerprint logic
Historically, we sometimes recorded imports based on either package
path ("net/http") or object file path ("net/http.a"). But modern Go
build systems always use package path, and the extra ".a" suffix
doesn't mean anything anyway.

Change-Id: I6060ef8bafa324168710d152a353f4d8db062133
Reviewed-on: https://go-review.googlesource.com/c/go/+/395254
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-03-25 21:58:03 +00:00
Adam Pritchard
3dac914b77 net/netip: fix uses of "IPv4-mapped IPv6" in doc comments
The correct (or at least mostly commonly used) name for addresses of the
form ::ffff:192.0.2.128 is "IPv4-mapped IPv6". Some of the comments in
the netip package used that name, but others used "IPv6-mapped IPv4" or
"v6-mapped". This change makes the usage of the term consistent.

Change-Id: Ic01309ddf9252705a2387322d940b777e88800a5
GitHub-Last-Rev: 56044dcb97
GitHub-Pull-Request: golang/go#51950
Reviewed-on: https://go-review.googlesource.com/c/go/+/395914
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
2022-03-25 20:23:27 +00:00
Russ Cox
2bbf383774 net/mail: improve detection of charset errors
The detection of the "unknown charset" case was too tailored
to one specific address parser. Make it generalize, so that custom
address parsers behave the same way as the default one
for character sets they do not handle.

Fixes #41625.

Change-Id: I347d4bb6844d0a1f23e908b776d21e8be5af3874
Reviewed-on: https://go-review.googlesource.com/c/go/+/283632
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-25 19:04:59 +00:00
Cuong Manh Le
f25631b490 cmd/compile/internal/ir: remove NewClosureExpr
The only usage of NewClosureExpr is inside NewClosureFunc, which is its
alternative version. So just remove NewClosureExpr and inline it there.

Change-Id: I1900f4fbb48d7b4f6e6a857f7f7760cd27302671
Reviewed-on: https://go-review.googlesource.com/c/go/+/395855
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-03-25 18:19:09 +00:00
Maisem Ali
1d19cea740 net/http/httptest: fix race in Server.Close
When run with race detector the test fails without the fix.

Fixes #51799

Change-Id: I273adb6d3a2b1e0d606b9c27ab4c6a9aa4aa8064
GitHub-Last-Rev: a5ddd146a2
GitHub-Pull-Request: golang/go#51805
Reviewed-on: https://go-review.googlesource.com/c/go/+/393974
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2022-03-25 16:08:06 +00:00
Cuong Manh Le
3fd8b8627f cmd/compile: handle sole component for 1-byte type interface conversion
For 1-byte type, we have a special case for converting to interface
type. But we missed an optimization for sole component-ed types, this CL
add that one.

goos: linux
goarch: amd64
cpu: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
Benchmark_BoolField-8    	1000000000	         0.6473 ns/op
Benchmark_ByteField-8    	1000000000	         0.6094 ns/op
Benchmark_Uint8Field-8   	1000000000	         0.6385 ns/op
Benchmark_Int16Field-8   	785179434	         1.481 ns/op
Benchmark_Int32Field-8   	796127782	         1.539 ns/op
Benchmark_Int64Field-8   	718815478	         1.657 ns/op

Fixes #49879

Change-Id: Idc0e9d3ff738c8c8081b8e8d65093dacf2bcf392
Reviewed-on: https://go-review.googlesource.com/c/go/+/367755
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-25 15:15:57 +00:00