1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:34:51 -07:00
Commit Graph

53851 Commits

Author SHA1 Message Date
Andy Pan
979956a732 os: delete unused errClosed
errClosed was introduced by CL 163058 and was supposed to be removed by CL 243906,
but somehow it was left out, now we should get it deleted.

Change-Id: I74c4b36b8bbc4844e1860acb022a16b0aa3272b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/427035
Run-TryBot: Andy Pan <panjf2000@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-06 16:57:58 +00:00
Tobias Klauser
dc029f286e runtime: add missing copyright header to signal_windows_test.go
The file was added in CL 181839 which was submitted in 2019.

Also delete the superfluous //go:build windows build constraint which is
already part of the file name.

Change-Id: Iecdf3d75848a7b8e2a76cd18c9fff4fb90acdac2
Reviewed-on: https://go-review.googlesource.com/c/go/+/427854
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-09-06 16:53:53 +00:00
cuiweixie
1110222bee sync: convert Once.done to atomic type
Change-Id: I49f8c764d49cabaad4d6859c219ba7220a389c1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/427140
Run-TryBot: xie cui <523516579@qq.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-09-06 16:53:51 +00:00
Alok Menghrajani
9363f356bd math/big: replace dead link in a comment with link to an archive.org copy
Happy to use another service if web.archive.org isn't suitable.

Note: the original page redirects and then links to some nsfw content.

Change-Id: Ie93ca0c6aad871881f35b7e5609b96da5c14cfc0
GitHub-Last-Rev: ced5a97eb5
GitHub-Pull-Request: golang/go#54857
Reviewed-on: https://go-review.googlesource.com/c/go/+/428236
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2022-09-06 16:37:29 +00:00
Austin Clements
60ef4b2c1e runtime: in traceback, only jump stack if M doesn't change
CL 424257 modified gentraceback to switch gp when jumping from a
system stack to a user stack to simplify reasoning through the rest of
the function. This has the unintended side-effect of also switching
all references to gp.m. The vast majority of the time, g0.m and curg.m
are the same across a stack switch, making this a no-op, but there's
at least one case where this isn't true: if a profiling signal happens
in execute between setting mp.curg and setting gp.m. In this case,
mp.curg.m is briefly nil, which can cause gentraceback to crash with a
nil pointer dereference. We see this failure (surprisingly
frequently!) in profiling tests in the morestack=mayMoreStackPreempt
testing mode (#48297).

Fix this by making only jumping stacks if doing so will not switch Ms.
This restores the original property that gp.m doesn't change across
the stack jump, and makes gentraceback a little more conservative
about jumping stacks.

Fixes #54885.

Change-Id: Ib1524c41c748eeff35896e0f3abf9a7efbe5969f
Reviewed-on: https://go-review.googlesource.com/c/go/+/428656
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Austin Clements <austin@google.com>
2022-09-06 16:04:07 +00:00
cuiweixie
e3885c4ee5 log: use strings.Builder
Change-Id: I02c4664f1ba72623a5470e92bbebabb2f4862428
Reviewed-on: https://go-review.googlesource.com/c/go/+/428264
Reviewed-by: Robert Griesemer <gri@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>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-06 15:49:33 +00:00
cuiweixie
7c47c9773c io: use strings.Builder
Change-Id: Ibab20627ccd1f79e77e3972e2bc6ca42c2c7de13
Reviewed-on: https://go-review.googlesource.com/c/go/+/428263
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-06 15:49:32 +00:00
cuiweixie
c35bc69c97 image/jpeg: use strings.Builder
Change-Id: I0a51aa9e7800689c123ce3eaf74742a4641b7681
Reviewed-on: https://go-review.googlesource.com/c/go/+/428261
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@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>
2022-09-06 15:49:30 +00:00
cuiweixie
07b19bf5ab html/template: use strings.Builder
Change-Id: Iab6ef8c6c74c09e8358f7d7088a82089725479ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/428260
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-09-06 15:48:16 +00:00
cuiweixie
91a1b55489 flag: use strings.Builder
Change-Id: Iee846c4ac0f111ff97aa618dd42f6b2d14aa4342
Reviewed-on: https://go-review.googlesource.com/c/go/+/428259
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-06 15:47:09 +00:00
cuiweixie
ab87db8b46 encoding: use strings.Builder
Change-Id: Ib07699df8ea41fd8d1bca8ad050859fac24623de
Reviewed-on: https://go-review.googlesource.com/c/go/+/428258
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-09-06 15:46:20 +00:00
cuiweixie
a89c3d76ba debug: use strings.Builder
Change-Id: I59db11212758b478248f34c031501a167335348c
Reviewed-on: https://go-review.googlesource.com/c/go/+/428257
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-06 15:44:55 +00:00
cuiweixie
32f68b5ab7 bufio: use strings.Builder
Change-Id: Ief82f12a5c48c46165c28140997d5fc83700c758
Reviewed-on: https://go-review.googlesource.com/c/go/+/428256
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@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>
2022-09-06 15:44:28 +00:00
cuiweixie
6fcd9b42e7 archive: use strings.Builder
Change-Id: I07e022ffc022bca6aa12165871e723db3ed83141
Reviewed-on: https://go-review.googlesource.com/c/go/+/428255
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
2022-09-06 15:44:27 +00:00
cuiweixie
c761409e01 misc: use strings.Builder
Change-Id: Icb53d32f2de13287b1b4f4f67dab90fe5ee7a3df
Reviewed-on: https://go-review.googlesource.com/c/go/+/428254
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-06 15:44:25 +00:00
Daniel Martí
a60a3dc5bc Revert "runtime: convert local var stop,ready at TestDebugCallUnsafePoint to atomic type"
This reverts https://go.dev/cl/427135.

Reason for revert: broke the test it modified on linux-amd64-noopt.

    --- FAIL: TestDebugCallUnsafePoint (0.00s)
        debug_test.go:265: want "call not at safe point", got %!s(<nil>)

Change-Id: I044c9720aed2d5e48b56bd7ab2781462270dcae9
Reviewed-on: https://go-review.googlesource.com/c/go/+/428395
Reviewed-by: xie cui <523516579@qq.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: hopehook <hopehook@golangcn.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-09-06 14:44:23 +00:00
cuiweixie
8a32354219 internal/trace: use strings.Builder
Change-Id: Ic7f827b8ee758c991ed76be65026b0330207deea
Reviewed-on: https://go-review.googlesource.com/c/go/+/428262
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-09-06 12:35:13 +00:00
Daniel Martí
1c50484335 Revert "internal/poll: drop redundant ENOSYS and EXDEV error checks in CopyFileRange()"
This reverts https://go.dev/cl/425881.

Reason for revert: broke make.bash on linux/amd64 with Linux 5.19.6.

	[...]
	Building Go toolchain2 using go_bootstrap and Go toolchain1.
	go install internal/unsafeheader: copying /tmp/go-build4206185186/b007/_pkg_.a to /home/mvdan/tip/pkg/linux_amd64/internal/unsafeheader.a: write /home/mvdan/tip/pkg/linux_amd64/internal/unsafeheader.a: copy_file_range: invalid cross-device link
	go install internal/goarch: copying /tmp/go-build4206185186/b006/_pkg_.a to /home/mvdan/tip/pkg/linux_amd64/internal/goarch.a: write /home/mvdan/tip/pkg/linux_amd64/internal/goarch.a: copy_file_range: invalid cross-device link
	[...]

Change-Id: I793856935d4315a870c2d31da46be00cc342b5f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/428396
Reviewed-by: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: hopehook <hopehook@golangcn.org>
Reviewed-by: Andy Pan <panjf2000@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-09-06 11:14:09 +00:00
Kir Kolyshkin
4c1ca42aa2 internal/syscall/unix: KernelVersion nitpicks
A few minor improvements for KernelVersion for the sake of readability.

Change-Id: I06d2df60ecee8ee0ae603952470fb73e7dcd5d74
Reviewed-on: https://go-review.googlesource.com/c/go/+/427676
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
2022-09-05 21:39:28 +00:00
Kir Kolyshkin
e2e69ec82a internal/syscall/unix: simplify KernelVersion
Since values[2] elements are initialized with 0, the switch statement
doesn't do anything. Remove it.

Change-Id: I41176692cdf0c01fe8e85315f0c0dc8b0f3d41fd
Reviewed-on: https://go-review.googlesource.com/c/go/+/427675
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-05 21:39:15 +00:00
Leonard Wang
bd5595d7fa runtime: refactor finalizer goroutine status
Use an atomic.Uint32 to represent the state of finalizer goroutine.
fingStatus will only be changed to fingWake in non fingWait state,
so it is safe to set fingRunningFinalizer status in runfinq.

name            old time/op  new time/op  delta
Finalizer-8      592µs ± 4%   561µs ± 1%  -5.22%  (p=0.000 n=10+10)
FinalizerRun-8   694ns ± 6%   675ns ± 7%    ~     (p=0.059 n=9+8)

Change-Id: I7e4da30cec98ce99f7d8cf4c97f933a8a2d1cae1
Reviewed-on: https://go-review.googlesource.com/c/go/+/400134
Reviewed-by: Joedian Reid <joedian@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-09-05 08:28:34 +00:00
cuiweixie
67e6542467 go/ast: add Range token.Pos to RangeStmt
For #50429

Change-Id: Idb027244f901d9f482c894b5b979a054d0f07de5
Reviewed-on: https://go-review.googlesource.com/c/go/+/426091
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
2022-09-05 08:12:37 +00:00
Andy Pan
40ced0c00b internal/poll: drop redundant ENOSYS and EXDEV error checks in CopyFileRange()
The initial CL 229101 didn't limit the kernel version, but relies on error checking to
ensure the kernel version >= 4.5 or >= 5.3 when it's calling copy_file_range(2) to copy data across file systems.

Since we have now put the kernel version checking at the beginning of the function, introduced by CL 268338,
which returns early instead of going forward to the code behind when the kernel verion is older than 5.3,
therefore, those subsequent related error checks are no longer needed.

Change-Id: Ifc4a530723e21f0bde91d6420cde9cb676081922
Reviewed-on: https://go-review.googlesource.com/c/go/+/425881
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: hopehook <hopehook@golangcn.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-09-05 08:10:03 +00:00
cuiweixie
af7f417665 runtime: convert local var stop at TestAfterStress to atomic type
For #53821

Change-Id: I7e86dac34691f7752f68879ff379061f3435cd45
Reviewed-on: https://go-review.googlesource.com/c/go/+/427139
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: xie cui <523516579@qq.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-09-05 08:08:24 +00:00
cuiweixie
4ad55cd93f runtime: convert local var started,progress at TestStackGrowth to atomic type
For #53821

Change-Id: I9c777ff642ea4b70073335279551cea6a2394569
Reviewed-on: https://go-review.googlesource.com/c/go/+/427138
Run-TryBot: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-09-05 08:08:18 +00:00
cuiweixie
02700e55a5 runtime: convert local var cunlock at doTestParallelReaders to atomic type
For #53821

Change-Id: I17440ea30827976a8d3755851a2496f26aea13b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/427137
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: xie cui <523516579@qq.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-09-05 08:08:09 +00:00
cuiweixie
7d83d320c0 runtime: convert local var ready at TestMemmoveAtomicity to atomic type
For #53821

Change-Id: I2487b8d18a4cd3fc6e64fbbb531419812bfe0f08
Reviewed-on: https://go-review.googlesource.com/c/go/+/427136
Run-TryBot: xie cui <523516579@qq.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-09-05 08:07:56 +00:00
cuiweixie
357b922517 runtime: convert local var stop,ready at TestDebugCallUnsafePoint to atomic type
For #53821

Change-Id: Id972d4ccadc72de69dea46f8be146c9843d1d095
Reviewed-on: https://go-review.googlesource.com/c/go/+/427135
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: xie cui <523516579@qq.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-05 08:07:47 +00:00
Eliza Weisman
4e7e7ae140 net/http: don't time out idle server connections after ReadHeaderTimeout
Consistently wait for idle connections to become readable before
starting the ReadHeaderTimeout timer. Previously, connections with no
idle timeout skipped directly to reading headers, so the
ReadHeaderTimeout also included time spent idle.

Fixes #54784

Change-Id: Iff1a876f00311d03dfa0fbef5b577506c62f7c41
GitHub-Last-Rev: 09332743ad
GitHub-Pull-Request: golang/go#54785
Reviewed-on: https://go-review.googlesource.com/c/go/+/426895
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2022-09-05 07:17:56 +00:00
Tomasz Jezierski
a295890c5c net: precompute rfc6724policyTable in addrselect
As net package has one of the biggest init time in standard library, I have tried to improve performance by doing two things in net/addrselect.go:
1. Precompute slice with RFC rules. Currently the rules are computed and sorted in init() function. We could save the time and allocations by using prepopulated values in sorted manner. The rules haven't changed since 2015. To be extra safe we could move order validation as test case. It should slightly speed up startup of each binary with "net" package and go dns resolver. It also saves 38 allocations, ~50% of allocations in init phase of `net` module.
2. Replace internal net.IP usage with netip.Addr in `sortByRFC6724` function. It results in ~40% performance improvement on samples from tests.

The only risk is the difference between net.IP and netip.Addr behaviour.

Init benchmark:
Init-8               1.89µs ± 2%    0.12µs ± 3%  -93.79%  (p=0.000 n=5+5)

name               old alloc/op   new alloc/op   delta
Init-8               1.05kB ± 0%    0.38kB ± 0%     ~     (zero variance)

name               old allocs/op  new allocs/op  delta
Init-8                 39.0 ± 0%       1.0 ± 0%     ~     (zero variance)

Whole sortByRFC6724 function benchmark:
name               old time/op    new time/op    delta
SortByRFC6724/0-8     463ns ± 3%     303ns ± 4%  -34.72%  (p=0.000 n=5+5)
SortByRFC6724/1-8     481ns ± 8%     306ns ± 1%  -36.46%  (p=0.000 n=5+5)
SortByRFC6724/2-8     470ns ± 4%     307ns ± 4%  -34.77%  (p=0.000 n=5+5)
SortByRFC6724/3-8     567ns ± 3%     367ns ± 3%  -35.28%  (p=0.000 n=5+5)
SortByRFC6724/4-8     918ns ± 3%     560ns ± 2%  -38.93%  (p=0.000 n=5+5)

Updates #54032

Change-Id: Ic18df1ea73805cb184c6ceb73470ca7f0b922032
Reviewed-on: https://go-review.googlesource.com/c/go/+/419356
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2022-09-05 07:16:00 +00:00
Andy Pan
3fbcf05d40 runtime: convert g.atomicstatus to internal atomic type
Note that this changes some unsynchronized operations of g.atomicstatus to synchronized operations.

Updates #53821

Change-Id: If249d62420ea09fbec39b570942f96c63669c333
Reviewed-on: https://go-review.googlesource.com/c/go/+/425363
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-09-05 07:14:08 +00:00
Cuong Manh Le
be26aa70d4 cmd/go: make cfg.BuildContext.ToolTags same order with build.Default.ToolTags
So it's consistent when running "go list -f '{{context.ToolTags}}'" and
printing the content of "build.Default.ToolTags".

Updates #45454

Change-Id: I7a3cbf3cdf9a6ce2b8c89e9bcf5fc5e9086d48e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/422615
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-09-05 04:17:02 +00:00
Yuval Pavel Zholkover
535fe2b226 runtime: fast clock_gettime on FreeBSD, use physical/virtual ARM timer
as setup by the kernel on GOARCH=arm64.

Update #50947

Change-Id: I2f44be9b36e9ce8d264eccc0aa3df10825c5f4f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/422977
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Dmitri Goutnik <dgoutnik@gmail.com>
Run-TryBot: Yuval Pavel Zholkover <paulzhol@gmail.com>
2022-09-04 04:17:04 +00:00
Kir Kolyshkin
a73506cff5 internal/syscall/unix: consolidate kernelVersion implementations
Currently, there are 3 functions returning Linux kernel version numbers.

Two of them are identical:
 - in net, initially added by commit 0a9dd47dd817904e;
 - in internal/poll, initially added by commit 1c7650aa93bd53;

(both were later fixed by commit 66c0264506).

The third one is a more complex, regexp-based implementation in
runtime/pprof, which is only used for a test.

Instead of adding one more, let's consolidate existing ones.

Remove the complex implementation, and move the simple one into
internal/syscall/unix. Use it from all the three places mentioned above.

Change-Id: I4a34d9ca47257743c16def30e4dd634e36056091
Reviewed-on: https://go-review.googlesource.com/c/go/+/424896
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-03 18:39:45 +00:00
Robert Griesemer
2392b7061c go/types, types2: use strings.Builder instead of bytes.Buffer where possible
Also, consistently use declaration: var buf strings.Builder.
We don't change exported signatures to match go/types (where we
can't change the exported signatures for backward-compatibility).

Change-Id: I75350886aa231889ae2fd5c4008dd4be9ed6e09f
Reviewed-on: https://go-review.googlesource.com/c/go/+/428094
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2022-09-03 18:29:30 +00:00
Sasha Melentyev
7a86ef2ad8 all: use strings.Builder instead of bytes.Buffer
Change-Id: I6d7213d29ade591b8366d5640833bd5a20474165
GitHub-Last-Rev: 9419583287
GitHub-Pull-Request: golang/go#54834
Reviewed-on: https://go-review.googlesource.com/c/go/+/427814
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: hopehook <hopehook@golangcn.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2022-09-03 18:23:33 +00:00
Kir Kolyshkin
a0f05823e4 syscall: fix skipping some tests on Linux
The kernel knob /proc/sys/kernel/unprivileged_userns_clone is
only available in Debian (and Ubuntu) kernels, so if the tests
are run on e.g. Fedora, skipUnprivilegedUserClone() skips a lot
of tests.

Modify it to treat ENOENT as "it should work".

Change-Id: I959201ede139ede989cc8ab646c9bf51e0539ada
Reviewed-on: https://go-review.googlesource.com/c/go/+/417694
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-03 18:21:45 +00:00
Bryan C. Mills
32964f9dce net: skip TestLookupPTR when LookupAddr fails with "DNS server failure"
For #38111.

Change-Id: I43bdd756bde0adcd156cf9750b49b3b989304df7
Reviewed-on: https://go-review.googlesource.com/c/go/+/427915
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
2022-09-03 18:19:12 +00:00
Carlo Alberto Ferraris
f798dc6825 fmt: recycle printers with large buffers
Previously when a printer had a large buffer we dropped both
the buffer and the printer. There is no need to drop the printer
in this case, as a printer with a nil buffer is valid. So we
just drop the buffer and recycle the printer anyway.
This saves one allocation in case the buffer is over the limit.

Also tighten some of the tests for other unrelated cases.

Change-Id: Iba1b6a71ca4691464b8c68ab0b6ab0d4d5d6168c
Reviewed-on: https://go-review.googlesource.com/c/go/+/427395
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-03 15:45:36 +00:00
Matthew Dempsky
9fc09d2ffb cmd/compile/internal/noder: optimize itabs section of runtime dicts
Currently, the itabs section for runtime dictionaries includes its own
redundant *runtime._type pointers for typ and iface, which were
sometimes necessary. This simplified the initial implementation, but
is a little wasteful of space when the same type or interface appeared
across multiple (typ, iface) pairs.

This CL instead reuses the pointers from the rtypes section.

Change-Id: I48448515c319c0403c1a8e7706794d443176f0a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/427754
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2022-09-03 06:26:16 +00:00
Joel Sing
3e11e61f3c cmd/compile: optimise subtraction with const on riscv64
Convert subtraction from const to a negated ADDI with negative const
value, where possible. At worst this avoids a register load and uses
the same number of instructions. At best, this allows for further
optimisation to occur, particularly where equality is involved.

For example, this sequence:

   li      t0,-1
   sub     t1,t0,a0
   snez    t1,t1

Becomes:

   addi    t0,a0,1
   snez    t0,t0

Removes more than 2000 instructions from the Go binary on linux/riscv64.

Change-Id: I68f3be897bc645d4a8fa3ab3cef165a00a74df19
Reviewed-on: https://go-review.googlesource.com/c/go/+/426263
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Joel Sing <joel@sing.id.au>
2022-09-02 20:14:40 +00:00
Joel Sing
646c3eee06 cmd/compile: negate comparision with FNES/FNED on riscv64
The FNES and FNED instructions are pseudo-instructions, which the
assembler expands to FEQS/NEG or FEQD/NEG - if we're comparing the
result via a branch instruction, we can avoid an instruction by
negating both the branch comparision and the floating point
comparision.

This only removes a handful of instructions from the Go binary,
however, it will provide benefit to floating point intensive code.

Change-Id: I4e3124440b7659acc4d9bc9948b755a4900a422f
Reviewed-on: https://go-review.googlesource.com/c/go/+/426261
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Joel Sing <joel@sing.id.au>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-09-02 20:14:16 +00:00
Julie Qiu
9154d4a2a4 .github: add quotations around label
Change-Id: I69eaf470ba2c241a99e3693a0a93d9b24c78a2af
Reviewed-on: https://go-review.googlesource.com/c/go/+/427959
Reviewed-by: Tatiana Bradley <tatiana@golang.org>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2022-09-02 19:40:34 +00:00
Michael Pratt
e406112011 runtime: document implicit fields at the end of _func
Currently these are only implicitly documented by the code that
generates and consumes them. Add explicit documentation.

Change-Id: I25a1294f04dc11785242643bec83370c66ff7a20
Reviewed-on: https://go-review.googlesource.com/c/go/+/427954
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
2022-09-02 19:38:45 +00:00
Julie Qiu
d1681120be .github: change label for vulndb and vulndb issues
Change-Id: Ie384bfb366abc4005e9333b24dbbb70d66b74c0c
Reviewed-on: https://go-review.googlesource.com/c/go/+/427956
Reviewed-by: Tatiana Bradley <tatiana@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Julie Qiu <julieqiu@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Julie Qiu <julieqiu@google.com>
2022-09-02 19:32:45 +00:00
Wayne Zuo
b226cc5ca0 cmd/internal/obj/riscv: fix comment typo
Change-Id: Ica74977898f0af8c9abf42a003d8f02dbdc03d34
Reviewed-on: https://go-review.googlesource.com/c/go/+/427994
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-09-02 19:32:40 +00:00
Robert Griesemer
0fda8b1932 go/types, types2: consistently write "x | y" rather than "x|y" for unions
Use the same spacing convention ("x | y") for union terms everythere,
matching the gofmt precedent.

Fixes #53279.

Change-Id: Ic3ccd7433b5f62402ba41cf05a75f9a1d99a8086
Reviewed-on: https://go-review.googlesource.com/c/go/+/410955
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-09-02 19:22:26 +00:00
Austin Clements
55ca6a20af runtime: simplify stkframe.argMapInternal
Use an early return to reduce indentation and clarify flow.

For #54466.

Change-Id: I12ce810bea0f22b8707a175dc5ba66241c0a9a21
Reviewed-on: https://go-review.googlesource.com/c/go/+/425936
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-02 19:09:03 +00:00
Austin Clements
35026f3732 runtime: consolidate stkframe and its methods into stkframe.go
The stkframe struct and its methods are strewn across different source
files. Since they actually have a pretty coherent theme at this point,
migrate it all into a new file, stkframe.go. There are no code changes
in this CL.

For #54466, albeit rather indirectly.

Change-Id: Ibe53fc4b1106d131005e1c9d491be838a8f14211
Reviewed-on: https://go-review.googlesource.com/c/go/+/424516
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Auto-Submit: Austin Clements <austin@google.com>
2022-09-02 19:08:58 +00:00
Austin Clements
b91e373729 runtime: make getStackMap a method of stkframe
This places getStackMap alongside argBytes and argMapInternal as
another method of stkframe.

For #54466, albeit rather indirectly.

Change-Id: I411dda3605dd7f996983706afcbefddf29a68a85
Reviewed-on: https://go-review.googlesource.com/c/go/+/424515
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Austin Clements <austin@google.com>
Auto-Submit: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-02 19:08:56 +00:00