1
0
mirror of https://github.com/golang/go synced 2024-11-17 17:44:46 -07:00
Commit Graph

57486 Commits

Author SHA1 Message Date
Tobias Klauser
9c3ffbf424 os: remove unused func itox
It was added by CL 288792 but was never used.

Change-Id: I0c21237c0c32ee5df2ebe99b6ecd8831f9c28649
Reviewed-on: https://go-review.googlesource.com/c/go/+/518316
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2023-08-11 02:53:21 +00:00
qiulaidongfeng
1d3a77e5e6 math/big: using the min built-in function
Change-Id: I9e95806116a8547ec782f66226d1b1382c6156de

Change-Id: I9e95806116a8547ec782f66226d1b1382c6156de
GitHub-Last-Rev: 5b4ce994c1
GitHub-Pull-Request: golang/go#61829
Reviewed-on: https://go-review.googlesource.com/c/go/+/516895
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-08-11 02:52:49 +00:00
Michael Matloob
33cdafed52 cmd/go: enter vendor mode depending on new modules.txt workspace line
modules.txt gets a new ## workspace line at the start of the file if
it's generated in workspace mode. Then, when deciding whether the go
command runs in mod=vendor, we only do so if we're in the same mode
(workspace or not) as the modules.txt specifies.

For #60056

Change-Id: If478a9891a7135614326fcb80c4c33a431e4e531
Reviewed-on: https://go-review.googlesource.com/c/go/+/513756
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
2023-08-11 01:59:23 +00:00
Matthew Dempsky
5abf00e4f0 cmd/internal/objabi: add support for bisect.Matcher debug flags
Makes it more convenient to add new bisection targets.

Change-Id: I7ac14018bac1e25751234a2267f8747a281b6088
Reviewed-on: https://go-review.googlesource.com/c/go/+/517616
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
2023-08-10 23:08:09 +00:00
Keith Randall
bf2a6d1957 cmd/compile: ensure write barrier branches get marked uninterruptible
The branch itself can't be marked, so we ensure we mark the last
ssa.Value in the block as uninterruptible, because that's where the
branch ends up getting its uninterruptibility from.

This is somewhat conservative, as we're marking an instruction as
uninterruptible that doesn't need to be. But it is an easy fix.

TODO: figure out a test

Change-Id: Icd314f0bbdce8f80019bafb9e861baca4e7ecbb1
Reviewed-on: https://go-review.googlesource.com/c/go/+/518055
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2023-08-10 21:54:31 +00:00
Roland Shoemaker
162469b3cf crypto/tls: add GODEBUG to control max RSA key size
Add a new GODEBUG setting, tlsmaxrsasize, which allows controlling the
maximum RSA key size we will accept during TLS handshakes.

Change-Id: I52f060be132014d219f4cd438f59990011a35c96
Reviewed-on: https://go-review.googlesource.com/c/go/+/517495
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-08-10 20:33:01 +00:00
Than McIntosh
6eb31c1a00 cmd/compile/internal/inline: refactor inline budget computation
Split out the code that computes the initial inline "hairyness" budget
for a function so that it can be reused (in a later patch). This is a
pure refactoring; no change in compiler functionality.

Change-Id: I9b1b7b10a7c480559b837492b10eb08771b7a145
Reviewed-on: https://go-review.googlesource.com/c/go/+/514795
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2023-08-10 18:54:11 +00:00
Than McIntosh
7087b8ac4c cmd/compile/internal/ir: export 'reassigned', handle OASOP
Rename the ir-local function "reassigned" to "Reassigned" so that it
can be used as part of inline heuristic analysis. Fix up the header
comment along that way, which had some stale material. Add support for
detecting reassignments via OASOP (as opposed to just simple
assignments).

Updates #61502.

Change-Id: I50f40f81263c0d7f61f30fcf0258f0b0f93acdca
Reviewed-on: https://go-review.googlesource.com/c/go/+/511560
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
2023-08-10 18:53:18 +00:00
Than McIntosh
b888ec4ac3 cmd/compile/internal/inline: add framework to compute func "properties"
Add some machinery to support computing function "properties" for use
in driving inlining heuristics, and a unit testing framework to check
to see if the property computations are correct for a given set of
canned Go source files. This CL is mainly the analysis skeleton and a
testing framework; the code to compute the actual props will arrive in
a later patch.

Updates #61502.

Change-Id: I7970b64f713d17d7fdd7e8e9ccc7d9b0490571bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/511557
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-08-10 18:53:06 +00:00
Than McIntosh
03d457a221 cmd/compile: function "property" defs for inl heuristics
Add definitions for a set of Go function "properties" intended to be
useful for driving inlining decisions. This CL just defines a set of
flags and a container to hold them; a subsequent CL will add code to
compute the properties for a function given its IR/AST representation.

Updates #61502.

Change-Id: Ifa26c1ad055c02ca0ce9cf37078cee7b3385e18a
Reviewed-on: https://go-review.googlesource.com/c/go/+/511556
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2023-08-10 18:52:53 +00:00
Bryan C. Mills
7c2b69080a cmd/go/internal/web: remove a redundant return value
The URL return value from the fetch helper in web.get was always
either the passed in URL (on success) or nil (on failure).
Remove it to reduce code complexity.

For #61877.

Change-Id: I0ce4602b921d1c996aa988e7d3f83996511ccd72
Reviewed-on: https://go-review.googlesource.com/c/go/+/518016
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
2023-08-10 17:34:27 +00:00
Bryan C. Mills
8cb5c55118 cmd/go/internal/web: release the net token when an HTTP request fails due to CheckRedirect
Fixes #61877.

Change-Id: I38c63565aaf9dc9b0c8085974521daccfbcbc790
Reviewed-on: https://go-review.googlesource.com/c/go/+/518015
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-08-10 17:34:25 +00:00
Russ Cox
faa549e4c7 cmd/go: keep BuildInfo list sorted even with -pgo
The -pgo build setting is added late, so sort it into place.
Noticed while working on CL 504536.

Change-Id: I080d2389dc0b3176fb72c9e2434e5f3ae70e294e
Reviewed-on: https://go-review.googlesource.com/c/go/+/504537
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-08-10 15:55:10 +00:00
Russ Cox
c14655da98 cmd/compile: add -env key=value flag
This flag is not terribly useful with the go command, which will pass
all environment variables through to subprocesses it invokes,
but it can be useful in other build systems, notably blaze and bazel,
to pass compiler-debugging variables like GOSSAFUNC through to
the compiler.

We have been maintaining this as a patch against Google's internal
toolchain for many years, and it has proven useful in those non-go-command
contexts.

Change-Id: Ic123193319f3c838a694eda2575347c516b85ac7
Reviewed-on: https://go-review.googlesource.com/c/go/+/507977
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
2023-08-10 15:53:49 +00:00
Bryan C. Mills
e34de96d58 os: define TestIssue60181 only on Unix platforms
In CL 517755 the test was added in the unconstrained os_test.go
because it appeared to be portable, but it turned out not to be
valid on plan9.

(The build error was masked on the misc-compile TryBots by #61923.)

Although the test can also compile and run on Windows, the bug it
checks for is specific to Linux and only really needs to run there, so
I am moving it to os_unix_test.go instead of adding yet another test
file for “Unix and Windows but not Plan 9”.

Updates #60181.

Change-Id: I41fd11b288217e95652b5daa72460c0d26bde606
Reviewed-on: https://go-review.googlesource.com/c/go/+/518255
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-08-10 15:36:04 +00:00
Cosmos Nicolaou
fdc9cf3c3a runtime/pprof: fix build breakage on ios
CL 503919 breaks tests for ios, this change fixes that.

Fixes #61891

Change-Id: I58508a780abb7a2150faec83c0f002cb22abafb7
Reviewed-on: https://go-review.googlesource.com/c/go/+/517795
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
2023-08-10 15:35:31 +00:00
Andy Pan
8ecdc4e593 syscall: avoid setting O_NONBLOCK needlessly by checking flags beforehand
Change-Id: I097a2941f1d1a7fd98ccf1534940d03f47ac3229
Reviewed-on: https://go-review.googlesource.com/c/go/+/517675
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
2023-08-10 14:38:22 +00:00
Ian Lance Taylor
d13f7aa0ae archive/tar: correct value passed to Uname method
For #50102

Change-Id: I28b5579611b07952b6379bc4603daf29a86a3be0
Reviewed-on: https://go-review.googlesource.com/c/go/+/518056
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Tianon Gravi (Andrew) <admwiggin@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
2023-08-10 14:37:50 +00:00
Junxian Zhu
ada5f8a46d cmd/compile: fold most repetitive operations to simplify riscv64 rules
Most of repetitive rules in riscv64 are simple, so that we can simplify and fold it with | without losting rules readability.

No change in the actual compiler code after running rulegen.

Change-Id: Id0bbfd93e63b49b7f66ecb62eb9440b4900c7938
Reviewed-on: https://go-review.googlesource.com/c/go/+/498455
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: M Zhuo <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: M Zhuo <mzh@golangcn.org>
2023-08-10 11:46:05 +00:00
Matthew Dempsky
d9f7e1dc73 runtime: fix asan asm on amd64
On amd64, the 8-byte move instruction is MOVQ, not MOVD.

Change-Id: I48d9b6f5f9f6c7f2e3fe20fd017b816cfb3983a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/517635
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-08-10 00:43:30 +00:00
Tobias Klauser
e6637f3293 os: test that copying to append-only files doesn't fail on Linux
Before CL 494915, this test would fail on Linux in io.Copy with error
"write /dev/stdout: copy_file_range: bad file descriptor" because the
copy_file_range syscall doesn't support destination files opened with
O_APPEND, see
https://man7.org/linux/man-pages/man2/copy_file_range.2.html#ERRORS

For #60181

Change-Id: I2eb4bcac71175121821e0033eb2297a2bc4ec759
Reviewed-on: https://go-review.googlesource.com/c/go/+/517755
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
2023-08-09 21:29:36 +00:00
Michael Anthony Knyszek
6c5fc6d7ce all: update vendored dependencies
Generated by:

	go install golang.org/x/tools/cmd/bundle@latest
	go install golang.org/x/build/cmd/updatestd@latest
	updatestd -goroot=$GOROOT -branch=master

For #36905.

Change-Id: I11c3376452b0b03eb91a87619b70d74e6ce897bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/517875
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-08-09 21:28:32 +00:00
Cuong Manh Le
b2a56b7053 cmd/compile: make backingArrayPtrLen to return typecheck-ed nodes
Fixes #61908

Change-Id: Ief8e3a6c42c0644c9f71ebef5f28a294cd7c153f
Reviewed-on: https://go-review.googlesource.com/c/go/+/517936
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2023-08-09 19:30:45 +00:00
Michael Matloob
58447d757c cmd/go: fix missing case checking for empty slice
When we were comparing the first element of import stacks when sorting
depserrors we checked if the first stack was non empty, but not the
second one. Do the check for both stacks.

Fixes #61816
For #59905

Change-Id: Id5c11c2b1104eec93196a08c53372ee2ba97c701
Reviewed-on: https://go-review.googlesource.com/c/go/+/516739
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
2023-08-09 17:34:46 +00:00
Cuong Manh Le
5b2ddfadb2 cmd/compile: mark instantiated functions from package runtime as norace
Fixes #60439

Change-Id: I09fcd2d3deb7f80ed012a769fdb6f53b09c0290b
Reviewed-on: https://go-review.googlesource.com/c/go/+/502895
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: 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: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2023-08-09 17:03:21 +00:00
Matthew Dempsky
8c5a54f698 cmd/compile: keep all open-coded defer slots as used
Open-coded defer slots are assigned indices upfront, so they're
logically like elements in an array. Without reassigning the indices,
we need to keep all of the elements alive so their relative offsets
are correct.

Fixes #61895.

Change-Id: Ie0191fdb33276f4e8ed0becb69086524fff022b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/517856
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-08-09 16:43:33 +00:00
cuiweixie
d32b4798f8 runtime: improve performance of empty map with interface key type
name                            old time/op    new time/op    delta
MegEmptyMapWithInterfaceKey-10    15.5µs ± 0%     0.0µs ± 0%  -99.97%  (p=0.000 n=20+16)

name                            old alloc/op   new alloc/op   delta
MegEmptyMapWithInterfaceKey-10     0.00B          0.00B          ~     (all equal)

name                            old allocs/op  new allocs/op  delta
MegEmptyMapWithInterfaceKey-10      0.00           0.00          ~     (all equal)

Change-Id: I46248223100e98b7877464da640075d272c14802
Reviewed-on: https://go-review.googlesource.com/c/go/+/502075
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: xie cui <523516579@qq.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2023-08-09 16:41:16 +00:00
qmuntal
cd589c8a73 os: make MkdirAll support volume names
MkdirAll fails to create directories under root paths using volume
names (e.g. //?/Volume{GUID}/foo). This is because fixRootDirectory
only handle extended length paths using drive letters (e.g. //?/C:/foo).

This CL fixes that issue by also detecting volume names without path
separator.

Updates #22230
Fixes #39785

Change-Id: I813fdc0b968ce71a4297f69245b935558e6cd789
Reviewed-on: https://go-review.googlesource.com/c/go/+/517015
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2023-08-09 15:15:57 +00:00
qiulaidongfeng
f617a6c8bf cmd/dist: remove unnecessary parts of bootstrapDirs
Change-Id: I7658f2f1716f74b4ff0b4b9f8ccd386e99dd9d51

Change-Id: I7658f2f1716f74b4ff0b4b9f8ccd386e99dd9d51
GitHub-Last-Rev: f55b84dafb
GitHub-Pull-Request: golang/go#61831
Reviewed-on: https://go-review.googlesource.com/c/go/+/516935
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2023-08-09 15:09:55 +00:00
Matthew Dempsky
288fd6eb9d internal/bisect: fix PrintMarker and examples
PrintMarker was printing 50 NUL bytes before the marker.

Also, the examples for writing your own ShouldEnable helper suggest
"if m == nil { return false }", but this is inconsistent with how
Matcher.ShouldEnable handles nil pointers.

Change-Id: Ie45075ba7fb8fcc63eadce9d793a06ef0c8aa9f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/517615
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
2023-08-09 14:36:30 +00:00
Ian Lance Taylor
a3ced4a633 runtime/cgo: use frame address to set g0 stack bound
This extends CL 419434 to all Unix targets. Rather than repeating
the code, pull all the similar code into a single function.

CL 419434 description:

For a cgo binary, at startup we set g0's stack bounds using the
address of a local variable (&size) in a C function x_cgo_init and
the stack size from pthread_attr_getstacksize. Normally, &size is
an address within the current stack frame. However, when  it is
compiled with ASAN, it may be instrumented to __asan_stack_malloc_0
and the address may not live in the current stack frame, causing
the stack bound to be set incorrectly, e.g. lo > hi.

Using __builtin_frame_address(0) to get the stack address instead.

Change-Id: I914a09d32c66a79515b6f700be18c690f3c0c77b
Reviewed-on: https://go-review.googlesource.com/c/go/+/517335
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2023-08-09 03:13:11 +00:00
Damien Neil
2d5ce9b729 net/http: sanitize User-Agent header in request writer
Apply the same transformations to the User-Agent header value that we
do to other headers.

Avoids header and request smuggling in Request.Write and
Request.WriteProxy. RoundTrip already validates values in
Request.Header, and didn't allow bad User-Agent values to
make it as far as the request writer.

Fixes #61824

Change-Id: I360a915c7e08d014e0532bd5af196a5b59c89395
Reviewed-on: https://go-review.googlesource.com/c/go/+/516836
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-08-08 23:10:58 +00:00
Damien Neil
6e43407931 path/filepath: don't drop .. elements when cleaning invalid Windows paths
Fix a bug where Clean could improperly drop .. elements from a
path on Windows, when the path contains elements containing a ':'.

For example, Clean("a/../b:/../../c") now correctly returns "..\c"
rather than "c".

Fixes #61866

Change-Id: I97b0238953c183b2ce19ca89c14f26700008ea72
Reviewed-on: https://go-review.googlesource.com/c/go/+/517216
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
2023-08-08 21:48:12 +00:00
David Chase
fe1daf2e43 cmd/compile: use new for loop semantics for Go 1.22+ compilations
This includes version-dependent support for GOEXPERIMENT and
-d=loopvar, -d=loopvarhash, to allow testing/porting of old code.

Includes tests of downgrade (1.22 -> 1.21) and upgrade (1.21 -> 1.22)
based on //go:build lines (while running a 1.22 build/compiler).

Change-Id: Idd3be61a2b46acec33c7e7edac0924158cc726b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/508819
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-08-08 21:20:26 +00:00
Ian Lance Taylor
6d8d88a707 database/sql: use reflect.TypeFor for known types
For #60088

Change-Id: Ib05ba3d456b22f7370459037b3d263c4b3ebe3b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/514975
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2023-08-08 20:57:57 +00:00
Bryan C. Mills
0c13bd637c cmd/cgo/internal/testplugin: simplify TestForkExec and log stderr output
This test used to run with a separate goroutine for timeout behavior,
presumably because it was difficult to set an appropriate timeout.

Now that the test is in cmd instead of misc, we can use
internal/testenv.Command, which makes adding the test timeout much
simpler and eliminates the need for the explicit goroutine.

For #61846.

Change-Id: I68ea09fcf2aa394bed1e900cf30ef7d143fa249f
Reviewed-on: https://go-review.googlesource.com/c/go/+/517095
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
2023-08-08 17:51:44 +00:00
qmuntal
94e40d5603 os: follow all name surrogate reparse points in Stat on Windows
Previously, os.Stat only followed IO_REPARSE_TAG_SYMLINK
and IO_REPARSE_TAG_MOUNT_POINT reparse points.

This CL generalize the logic to detect which reparse points to follow
by using the reparse tag value to determine whether the reparse point
refers to another named entity, as documented in
https://learn.microsoft.com/en-us/windows/win32/fileio/reparse-point-tags.

The new behavior adds implicit support for correctly stat-ing reparse
points other than mount points and symlinks, e.g.,
IO_REPARSE_TAG_WCI_LINK and IO_REPARSE_TAG_IIS_CACHE.

Updates #42184

Change-Id: I51f56127d4dc6c0f43eb5dfa3bfa6d9e3922d000
Reviewed-on: https://go-review.googlesource.com/c/go/+/516555
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
2023-08-08 16:00:00 +00:00
Carl Johnson
2c95fa4f31 slices: add Concat
Fixes #56353

Change-Id: I985e1553e7b02237403b833e96fb5ceec890f5b8
GitHub-Last-Rev: 96a35e524c
GitHub-Pull-Request: golang/go#60929
Reviewed-on: https://go-review.googlesource.com/c/go/+/504882
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-08-08 14:31:39 +00:00
Junxian Zhu
24f83ed4e2 cmd/internal/obj/mips: add SEB/SEH instructions
Add support for SEB/SEH instructions, which are introduced in mips32r2.

SEB/SEH can be used to sign-extend byte/halfword in registers directly without passing through memory.

Ref: The MIPS32 Instruction Set, Revision 5.04: https://s3-eu-west-1.amazonaws.com/downloads-mips/documents/MD00086-2B-MIPS32BIS-AFP-05.04.pdf

Updates #60072

Change-Id: I33175ae9d943ead5983ac004bd2a158039046d65
Reviewed-on: https://go-review.googlesource.com/c/go/+/515475
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
2023-08-08 12:17:12 +00:00
Ian Lance Taylor
87fe5faffc internal/syscall/unix: don't define libc_getentropy_trampoline on ios
It is only used on Darwin. This fixes "go vet" on ios.

Fixes #61667

Change-Id: Iaf00fcee5d89eb8e454f75bb1c0ea62c3950b684
Reviewed-on: https://go-review.googlesource.com/c/go/+/514495
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2023-08-08 04:43:24 +00:00
Mauri de Souza Meneguzzo
3393155abf internal/bytealg: optimize Count/CountString in amd64
Another optimization by aligning a hot loop.

```
                   │   sec/op    │   sec/op     vs base                │
Count/10-16          11.29n ± 1%   10.50n ± 1%   -7.04% (p=0.000 n=10)
Count/32-16          11.06n ± 1%   11.36n ± 2%   +2.76% (p=0.000 n=10)
Count/4K-16          2.852µ ± 1%   1.953µ ± 1%  -31.52% (p=0.000 n=10)
Count/4M-16          2.884m ± 1%   1.958m ± 1%  -32.11% (p=0.000 n=10)
Count/64M-16         46.27m ± 1%   30.86m ± 0%  -33.31% (p=0.000 n=10)
CountEasy/10-16      9.873n ± 1%   9.669n ± 1%   -2.07% (p=0.000 n=10)
CountEasy/32-16      11.07n ± 1%   11.23n ± 1%   +1.49% (p=0.000 n=10)
CountEasy/4K-16      73.47n ± 1%   54.20n ± 0%  -26.22% (p=0.000 n=10)
CountEasy/4M-16      61.12µ ± 1%   49.42µ ± 0%  -19.15% (p=0.000 n=10)
CountEasy/64M-16     1.303m ± 3%   1.082m ± 4%  -16.97% (p=0.000 n=10)
CountSingle/10-16    4.150n ± 1%   3.679n ± 1%  -11.36% (p=0.000 n=10)
CountSingle/32-16    4.815n ± 1%   4.588n ± 1%   -4.71% (p=0.000 n=10)
CountSingle/4M-16    72.18µ ± 2%   75.38µ ± 1%   +4.44% (p=0.000 n=10)
CountHard3-16        462.6µ ± 1%   484.4µ ± 1%   +4.73% (p=0.000 n=10)

                   │   old.txt    │               new.txt                │
                   │     B/s      │     B/s       vs base                │
Count/10-16          844.1Mi ± 1%   908.3Mi ± 1%   +7.60% (p=0.000 n=10)
Count/32-16          2.695Gi ± 1%   2.623Gi ± 2%   -2.66% (p=0.000 n=10)
Count/4K-16          1.337Gi ± 1%   1.953Gi ± 1%  +46.06% (p=0.000 n=10)
Count/4M-16          1.355Gi ± 1%   1.995Gi ± 1%  +47.29% (p=0.000 n=10)
Count/64M-16         1.351Gi ± 1%   2.026Gi ± 0%  +49.95% (p=0.000 n=10)
CountEasy/10-16      965.9Mi ± 1%   986.3Mi ± 1%   +2.11% (p=0.000 n=10)
CountEasy/32-16      2.693Gi ± 1%   2.653Gi ± 1%   -1.48% (p=0.000 n=10)
CountEasy/4K-16      51.93Gi ± 1%   70.38Gi ± 0%  +35.54% (p=0.000 n=10)
CountEasy/4M-16      63.91Gi ± 1%   79.05Gi ± 0%  +23.68% (p=0.000 n=10)
CountEasy/64M-16     47.97Gi ± 3%   57.77Gi ± 4%  +20.44% (p=0.000 n=10)
CountSingle/10-16    2.244Gi ± 1%   2.532Gi ± 1%  +12.80% (p=0.000 n=10)
CountSingle/32-16    6.190Gi ± 1%   6.496Gi ± 1%   +4.94% (p=0.000 n=10)
CountSingle/4M-16    54.12Gi ± 2%   51.82Gi ± 1%   -4.25% (p=0.000 n=10)
```

Change-Id: I847b36125d2b11e2a88d31f48f6c160f041b3624
GitHub-Last-Rev: faacba662e
GitHub-Pull-Request: golang/go#61793
Reviewed-on: https://go-review.googlesource.com/c/go/+/516455
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
2023-08-07 23:13:36 +00:00
Damien Neil
b9153f6ef3 net/http: permit requests with invalid Host headers
Historically, the Transport has silently truncated invalid
Host headers at the first '/' or ' ' character. CL 506996 changed
this behavior to reject invalid Host headers entirely.
Unfortunately, Docker appears to rely on the previous behavior.

When sending a HTTP/1 request with an invalid Host, send an empty
Host header. This is safer than truncation: If you care about the
Host, then you should get the one you set; if you don't care,
then an empty Host should be fine.

Continue to fully validate Host headers sent to a proxy,
since proxies generally can't productively forward requests
without a Host.

For #60374
Fixes #61431

Change-Id: If170c7dd860aa20eb58fe32990fc93af832742b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/511155
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
2023-08-07 22:48:40 +00:00
Austin Clements
26e0660811 Revert "runtime: move pcvalue cache to M"
This reverts CL 515276.

This broke the longtest builders. For example:
https://build.golang.org/log/351a1a198a6b843b1881c1fb6cdef51f3e413e8b

Change-Id: Ie79067464fe8e226da31721cf127f3efb6011452
Reviewed-on: https://go-review.googlesource.com/c/go/+/516856
Auto-Submit: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2023-08-07 22:27:53 +00:00
Austin Clements
5f674f64e4 Revert "runtime: drop stack-allocated pcvalueCaches"
This reverts CL 515277

Change-Id: Ie10378eed4993cb69f4a9b43a38af32b9d743155
Reviewed-on: https://go-review.googlesource.com/c/go/+/516855
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2023-08-07 22:27:50 +00:00
Robert Findley
008ab9adb8 go/types: fix panic in allowVersion when pos is invalid
CL 515656 updated go/types to use file base as key in the posVers map,
but introduced a panic when the corresponding *token.File is nil.

Check that pos is valid before performing the lookup.

Fixes #61822

Change-Id: I1ac9d48c831a470de8439a50022ba5f59b3e0bed
Reviewed-on: https://go-review.googlesource.com/c/go/+/516738
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Robert Findley <rfindley@google.com>
2023-08-07 21:16:51 +00:00
Austin Clements
aca6577196 runtime: drop stack-allocated pcvalueCaches
Now that pcvalue keeps its cache on the M, we can drop all of the
stack-allocated pcvalueCaches and stop carefully passing them around
between lots of operations. This significantly simplifies a fair
amount of code and makes several structures smaller.

This series of changes has no statistically significant effect on any
runtime Stack benchmarks.

I also experimented with making the cache larger, now that the impact
is limited to the M struct, but wasn't able to measure any
improvements.

Change-Id: I4719ebf347c7150a05e887e75a238e23647c20cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/515277
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2023-08-07 19:31:26 +00:00
Austin Clements
d367ec6a0e runtime: move pcvalue cache to M
Currently, the pcvalue cache is stack allocated for each operation
that needs to look up a lot of pcvalues. It's not always clear where
to put it, a lot of the time we just pass a nil cache, it doesn't get
reused across operations, and we put a surprising amount of effort
into threading these caches around.

This CL moves it to the M, where it can be long-lived and used by all
pcvalue lookups, and we don't have to carefully thread it across
operations.

Change-Id: I675e583e0daac887c8ef77a402ba792648d96027
Reviewed-on: https://go-review.googlesource.com/c/go/+/515276
Run-TryBot: Austin Clements <austin@google.com>
Auto-Submit: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2023-08-07 19:31:24 +00:00
Austin Clements
6be2639aff runtime: store start PC in pcvalueCache
Currently, pcvalue only returns a valid start PC if cache is nil.
We're about to eliminate the cache argument and always use a pcvalue
cache, so make sure the cache stores the start PC and always return it
from pcvalue.

Change-Id: Ie8854af4b7e7ba1c2a17a495d9229320821daa23
Reviewed-on: https://go-review.googlesource.com/c/go/+/515275
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-08-07 19:31:22 +00:00
Muhammad Falak R Wani
0dc513b65a sort: use the builtin min function
Change-Id: I9603de9abff8d5c8fb9efdf688ff1a5f8c7d19b2
GitHub-Last-Rev: c6fe3acc41
GitHub-Pull-Request: golang/go#61808
Reviewed-on: https://go-review.googlesource.com/c/go/+/516635
Auto-Submit: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2023-08-07 18:49:55 +00:00
Muhammad Falak R Wani
215bcbc6ac testing: use the builtin max/min function
Change-Id: I1250b6a33f5f3509a216d307f1783ad4aa5937fc
GitHub-Last-Rev: 98dc6b1a11
GitHub-Pull-Request: golang/go#61809
Reviewed-on: https://go-review.googlesource.com/c/go/+/516616
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2023-08-07 18:49:54 +00:00