]> Cypherpunks repositories - gostls13.git/log
gostls13.git
3 years agoruntime: update framepointer_enabled doc
Romanos Skiadas [Wed, 23 Mar 2022 11:47:08 +0000 (13:47 +0200)]
runtime: update framepointer_enabled doc

Change-Id: I69e64ebf8c11145ce32aa4c11178e3a47d22fb84
Reviewed-on: https://go-review.googlesource.com/c/go/+/394915
Reviewed-by: Michael Pratt <mpratt@google.com>
Trust: Michael Knyszek <mknyszek@google.com>

3 years agocmd/link: do not add label symbols for DWARF on Windows/ARM64
Cherry Mui [Wed, 23 Mar 2022 22:57:16 +0000 (18:57 -0400)]
cmd/link: do not add label symbols for DWARF on Windows/ARM64

Label symbols are only useful for relocations from text. No need
to do it for DWARF. And the PE symbol table doesn't like them.

May fix #51903.

Change-Id: Ibe6ea880d8533ba1dcc017030072c7dffee0e9e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/395215
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>
3 years agocmd/gofmt: return a proper error for empty Go files
Daniel Martí [Fri, 18 Mar 2022 10:57:02 +0000 (10:57 +0000)]
cmd/gofmt: return a proper error for empty Go files

I was testing edge cases in gofumpt, a fork of gofmt,
and noticed that gofmt will return a bare io error on empty files,
as demonstrated by the added test case without a fix:

        > ! exec $GOROOT/bin/gofmt empty.go nopackage.go
        [stderr]
        EOF
        nopackage.go:1:1: expected 'package', found not

The problem is the code that detects concurrent modifications.
It relies on ReadFull and correctly deals with io.ErrUnexpectedEOF,
but it did not pay attention to io.EOF, which can happen when size==0.

Change-Id: I6092391721edad4584fb5922d3e3a8fb3da86493
Reviewed-on: https://go-review.googlesource.com/c/go/+/393757
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Trust: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agocmd/compile: clarify help message for -L flag
Robert Griesemer [Wed, 23 Mar 2022 20:29:43 +0000 (13:29 -0700)]
cmd/compile: clarify help message for -L flag

The file names reported in error messages by the compiler are
printed unchanged from the file names provided to the compiler;
the -L flag has no impact on the file names themselves, contrary
to what the old flag description suggested.

If an error is reported on a line that is affected by a //line
directive, an error message reports the file name and line as
controlled by the directive (i.e., the actual source position
is not known).

If the -L flag is provided, the actual source position is also
reported in square brackets.

This change documents this with an updated help string for the
flag.

For #36988.

Change-Id: I39ee35e6ff6cd5cfa44d87dabb05b8d78575d631
Reviewed-on: https://go-review.googlesource.com/c/go/+/395115
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
3 years agocmd/compile: refactor walkIndexMap
Cuong Manh Le [Mon, 24 May 2021 05:15:17 +0000 (12:15 +0700)]
cmd/compile: refactor walkIndexMap

So all runtime map functions will use the same code path, make it easier
for future CL to handle stack object for map key.

Passes toolstash -cmp.

For #43753

Change-Id: I374fa4e351c1eba079e2ccb637b1ef5adad1488f
Reviewed-on: https://go-review.googlesource.com/c/go/+/321713
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agotest: remove unused oldescape_linkname.dir directory
Matthew Dempsky [Wed, 23 Mar 2022 23:06:19 +0000 (16:06 -0700)]
test: remove unused oldescape_linkname.dir directory

CL 187617 removed oldescape_linkname.go, but forgot to remove this
directory too.

Change-Id: I6d208c4d96d636b3df93adec1ee22fe1d4f5f61d
Reviewed-on: https://go-review.googlesource.com/c/go/+/395259
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agotest: remove obsolete test case that misuses -p
Matthew Dempsky [Fri, 18 Mar 2022 19:37:56 +0000 (12:37 -0700)]
test: remove obsolete test case that misuses -p

bug302 compiles p.go with -p=p, and then manually creates a pp.a
archive, and imports it as both "p" and "pp". This is a misuse of
cmd/compile's -p flag, and it isn't representative of how any actual
Go build systems work anyway.

This test made sense back when cmd/compile still wrote out bare object
files, which was then split into separate __.PKGDEF and _go_.o archive
entries when added to a pack archive. But since CL 102236, cmd/compile
always writes out pack files.

Updates #51734.

Change-Id: I4b5de22d348ecc0a72c98b512351c2d267c77736
Reviewed-on: https://go-review.googlesource.com/c/go/+/393896
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agotest: use dot-relative imports where appropriate
Matthew Dempsky [Wed, 23 Mar 2022 22:09:31 +0000 (15:09 -0700)]
test: use dot-relative imports where appropriate

Currently, run.go's *dir tests allow "x.go" to be imported
interchangeably as either "x" or "./x". This is generally fine, but
can cause problems when "x" is the name of a standard library
package (e.g., "fixedbugs/bug345.dir/io.go").

This CL is an automated rewrite to change all `import "x"` directives
to use `import "./x"` instead. It has no effect today, but will allow
subsequent CLs to update test/run.go to resolve "./x" to "test/x" to
avoid stdlib collisions.

Change-Id: Ic76cd7140e83b47e764f8a499e59936be2b3c876
Reviewed-on: https://go-review.googlesource.com/c/go/+/395116
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agocmd/compile: update riscv64 CALL* ops
Meng Zhuo [Sun, 31 Oct 2021 13:16:15 +0000 (21:16 +0800)]
cmd/compile: update riscv64 CALL* ops

This CL allow the CALL ops to take variable number of arguments.

Change-Id: If84bb306c2f23a0a934e31dfeabbca7bed0c1796
Reviewed-on: https://go-review.googlesource.com/c/go/+/360216
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>
3 years agocmd/compile/internal/types: simplify AllowsGoVersion
Cuong Manh Le [Wed, 23 Mar 2022 10:13:38 +0000 (17:13 +0700)]
cmd/compile/internal/types: simplify AllowsGoVersion

After CL 394556, only LocalPkg is passed to AllowsGoVersion, so simplify
the code to not depend on Pkg anymore.

Change-Id: I8f9bfd4090100eec60cf3959c0d8fa92a26fc32a
Reviewed-on: https://go-review.googlesource.com/c/go/+/394954
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>
3 years agocmd/compile: remove types.Field.{Broken,SetBroken}
Cuong Manh Le [Tue, 22 Mar 2022 18:27:11 +0000 (01:27 +0700)]
cmd/compile: remove types.Field.{Broken,SetBroken}

SetBroken is never called and Broken always returns false.

Updates #51691

Change-Id: I7e3fd3f2121268596d2e93a28c69e895bcf802ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/394558
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agocmd/compile/internal/types: remove anyBroke
Cuong Manh Le [Tue, 22 Mar 2022 18:25:45 +0000 (01:25 +0700)]
cmd/compile/internal/types: remove anyBroke

anyBroke now always return false, we can get rid of it.

Updates #51691

Change-Id: Idab5bc9f9f222cc63e50bdde2b23b9404a4bd74e
Reviewed-on: https://go-review.googlesource.com/c/go/+/394557
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agocmd/compile: remove AllowsGoVersion checks in old typechecker
Cuong Manh Le [Tue, 22 Mar 2022 18:20:11 +0000 (01:20 +0700)]
cmd/compile: remove AllowsGoVersion checks in old typechecker

types2 handles those checks instead.

The only exception is noder.checkEmbed, since when types2
have not known about "//go:embed" pragma yet.

Updates #51691

Change-Id: I74ded03536023fe838f23fa7421e04513f904f66
Reviewed-on: https://go-review.googlesource.com/c/go/+/394556
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>
3 years agocmd/compile: remove typecheck.FuncBody
Cuong Manh Le [Tue, 22 Mar 2022 13:57:19 +0000 (20:57 +0700)]
cmd/compile: remove typecheck.FuncBody

CL 388535 removed the only usage of this function.

Change-Id: Ie5a61cce75b03d83162f62989fe52388b069c9bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/394576
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agocmd/compile: remove ir.Node.SetDiag
Cuong Manh Le [Tue, 22 Mar 2022 13:55:38 +0000 (20:55 +0700)]
cmd/compile: remove ir.Node.SetDiag

And use base.Fatalf in code that use n.SetDiag(true) instead.

Updates #51691

Change-Id: Ib3c0b9c89b8d95717391cbe7d424240e288ada1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/394575
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agocmd/compile: remove types.Type.SetBroken
Cuong Manh Le [Tue, 22 Mar 2022 13:43:43 +0000 (20:43 +0700)]
cmd/compile: remove types.Type.SetBroken

And use base.Fatalf in code that use t.SetBroke(true) instead.

Updates #51691

Change-Id: I9f3613379dd82d0dd069cdf7b61cbb281810e2e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/394574
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agocmd/compile: remove reportTypeLoop
Cuong Manh Le [Tue, 22 Mar 2022 13:25:37 +0000 (20:25 +0700)]
cmd/compile: remove reportTypeLoop

reportTypeLoop used to be used to report invalid recursive types in old
typechecker.

However, types2 now reports this error, so this can be removed.

Updates #51691

Change-Id: I5e73369dadafb0cc56e682668b32cbd1e1210f2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/394554
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agogo/types, types2: report struct type for literals with too few/many elements
Robert Griesemer [Wed, 23 Mar 2022 04:28:32 +0000 (21:28 -0700)]
go/types, types2: report struct type for literals with too few/many elements

This change essentially matches the 1.17 compiler error message for
this error.

Fixes #51877.

Change-Id: I24ec2f9cc93d8cd2283d097332a39bc1a0eed3a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/394914
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years agodebug/gosym: skip non-real functions in LineToPC lookup
Cherry Mui [Wed, 23 Mar 2022 16:02:36 +0000 (12:02 -0400)]
debug/gosym: skip non-real functions in LineToPC lookup

The code iterates through the func table to find a function with
a given file and line number. The code panics if it sees a non-
real function (e.g. go.buildid), because its CU offset is -1,
which causes an index-out-of-bounds error. The debug/gosym package
recovers the panic and returns "not found", without looping
through the rest of the entries.

Skip the non-real functions. They cannot be looked up by line
number anyway.

Fixes #51890.

Change-Id: I96f64c17b4a53ffdce047c8244b35a402a0d39ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/395074
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
3 years agocmd/compile: don't mark non-generic defined type symbol dupok
Cherry Mui [Tue, 22 Mar 2022 00:07:06 +0000 (20:07 -0400)]
cmd/compile: don't mark non-generic defined type symbol dupok

For a non-generic defined type, we generate its type descriptor
symbol only in the defining package. So there is no duplicate and
it doesn't need to be dupok.

For unnamed types and instantiated types, the type descriptor can
be generated in multiple packages and so still need to be dupok.

Change-Id: I92ed68c998ad68c5917b77b1dfd62eac4ced6bcf
Reviewed-on: https://go-review.googlesource.com/c/go/+/394636
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
3 years agocmd/compile: default to -p=main for main package
Cherry Mui [Tue, 22 Mar 2022 21:08:56 +0000 (17:08 -0400)]
cmd/compile: default to -p=main for main package

With the previous CL the compiler emits an unlinkable object if
the -p flag is not specified. It is actually okay (and convenient)
to omit the -p flag for (just) the main package. This CL makes it
so.

Change-Id: I978d54d14c45b3bb9ed7471e40a2c47f269b56f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/394834
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
3 years agogo/types, types2: remove uses of "type list" and "operational type" (cleanup)
Robert Griesemer [Tue, 22 Mar 2022 19:49:09 +0000 (12:49 -0700)]
go/types, types2: remove uses of "type list" and "operational type" (cleanup)

Fixes #49193.

Change-Id: Ief31ea6b3dddf9452efb94763c89b8639aa3ce9e
Reviewed-on: https://go-review.googlesource.com/c/go/+/394656
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agocmd/compile/internal/importer: key tparams by Package instead of pkgname
Robert Findley [Mon, 21 Mar 2022 20:08:38 +0000 (16:08 -0400)]
cmd/compile/internal/importer: key tparams by Package instead of pkgname

The importer type param index used package name type parameter key,
causing type parameters to be reused/overwritten if two packages in the
import graph had the same combination of (name, declaration name, type
parameter name).

Fix this by instead using the *Package in the key.

Fixes #51836

Change-Id: I881ceaf3cf7c1ab4e0835962350feb552e79b233
Reviewed-on: https://go-review.googlesource.com/c/go/+/394219
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
3 years agoruntime/pprof: rerun magnitude test on failure
Rhys Hiltner [Fri, 18 Mar 2022 18:36:39 +0000 (11:36 -0700)]
runtime/pprof: rerun magnitude test on failure

Restructure TestCPUProfileMultithreadMagnitude so it will run again with
a longer duration on failure. Log the split between the user vs system
CPU time that rusage reports.

For #50232

Change-Id: Ice5b38ee7594dbee1eaa5686d32b968c306e3e85
Reviewed-on: https://go-review.googlesource.com/c/go/+/393934
Run-TryBot: Rhys Hiltner <rhys@justin.tv>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Trust: Michael Knyszek <mknyszek@google.com>

3 years agocmd/link: write output in temp dir in TestUnlinkableObj
Cherry Mui [Tue, 22 Mar 2022 20:38:13 +0000 (16:38 -0400)]
cmd/link: write output in temp dir in TestUnlinkableObj

For unlinkable object the link will fail, but it opens the output
file in writable mode first then delete it on failure. This fails
if the current directory is not writable. Write to the temporary
directory instead.

Change-Id: Iefd73b5cc8efdc0f11b12edc0920169a8ad3f37c
Reviewed-on: https://go-review.googlesource.com/c/go/+/394755
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agoruntime: make static/dynamic startup detection work with musl on ppc64le
Paul E. Murphy [Tue, 22 Mar 2022 16:52:02 +0000 (11:52 -0500)]
runtime: make static/dynamic startup detection work with musl on ppc64le

The glibc loader explicitly sets the first doubleword on the stack (R1)
to $0 to indicate it was dynamically loaded.

An ELFv2 ABI compliant loader will set R3/R4 to argc/argv when starting
the process, and R13 to TLS. musl is not compliant. Instead it passes
argc/argv like the kernel, but R3/R4 are in an undefined state and R13
is valid.

With the knowledge above, the startup code can be modified to
dynamically handle all three cases when linked internally.

Fixes #51787

Change-Id: I5de33862c161900d9161817388bbc13a65fdc69c
Reviewed-on: https://go-review.googlesource.com/c/go/+/394654
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Paul Murphy <murp@ibm.com>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>

3 years agoruntime: delete useless TPIDR macro on arm64
eric fang [Fri, 17 Dec 2021 08:26:06 +0000 (08:26 +0000)]
runtime: delete useless TPIDR macro on arm64

The TPIDR macro in tls_arm64.h is not used anywhere, so remove it
to reduce confusion.

Change-Id: I04aa5e64ee30753f28f43bc67b44559d81d093c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/373357
Trust: Eric Fang <eric.fang@arm.com>
Run-TryBot: Eric Fang <eric.fang@arm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
3 years agocmd/link: simplify content hashed symbol handling
Cherry Mui [Mon, 21 Mar 2022 19:46:32 +0000 (15:46 -0400)]
cmd/link: simplify content hashed symbol handling

Symbol's content hash used to depend on package path expansion in
symbol names, so we have special logic handling hashed symbols
when path expansion is needed. As we required -p in the compiler
the symbol names are now fully expanded. Remove that logic.

Change-Id: I888574f63ea3789455d96468a6abd500e0958230
Reviewed-on: https://go-review.googlesource.com/c/go/+/394218
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agocmd/compile, cmd/link: produce unlinkable object when compile without -p
Cherry Mui [Mon, 21 Mar 2022 17:45:50 +0000 (13:45 -0400)]
cmd/compile, cmd/link: produce unlinkable object when compile without -p

CL 391014 requires the compiler to be invoked with the -p flag, to
specify the package path. People are used to run "go tool compile"
from the command line with the -p flag. This is mostly for simple
testing, or debugging the compiler. The produced object file is
almost never intended to be linked.

This CL makes the compiler allow "go tool compile" without the -p
flag again. It will produce an unlinkable object. If the linker
sees such an object it will error out.

Change-Id: I7bdb162c3cad61dadd5c456d903b92493a3df20f
Reviewed-on: https://go-review.googlesource.com/c/go/+/394217
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agocmd/compile: add short self-link to ABI spec
Austin Clements [Tue, 22 Mar 2022 16:44:01 +0000 (12:44 -0400)]
cmd/compile: add short self-link to ABI spec

This makes the short link discoverable.

Change-Id: I9a2f091652bc096feebbbd79a854aa68efe702bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/394634
Trust: Austin Clements <austin@google.com>
Reviewed-by: Eli Bendersky‎ <eliben@golang.org>
3 years agoA+C: change email of Ben Shi (individual CLA)
Ben Shi [Tue, 22 Mar 2022 14:29:39 +0000 (14:29 +0000)]
A+C: change email of Ben Shi (individual CLA)

Change-Id: Icff75d5fbbeae7aa5003a848ea49b79ddde9933a
GitHub-Last-Rev: 489a69fc6bb02a57689a43ae8fb718e5e0177ae6
GitHub-Pull-Request: golang/go#51869
Reviewed-on: https://go-review.googlesource.com/c/go/+/394595
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Cherry Mui <cherryyz@google.com>

3 years agonet/http: fix nil body causing ParseMultipartForm to panic
hopehook [Wed, 9 Feb 2022 12:20:06 +0000 (20:20 +0800)]
net/http: fix nil body causing ParseMultipartForm to panic

ParseMultipartForm relies on a valid multipartReader, if the request body is nil,
the multipartReader should return an error. This way ParseMultipartForm can return
an error instead of causing mr.ReadForm(maxMemory) to panic

Fixes #48206

Change-Id: Ief906f2340c7ab29cacbd5f56892117202a0b911
Reviewed-on: https://go-review.googlesource.com/c/go/+/384454
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>

3 years agoos: skip TestOpenFileLimit on openbsd/mips64
Ian Lance Taylor [Sun, 20 Mar 2022 16:32:00 +0000 (09:32 -0700)]
os: skip TestOpenFileLimit on openbsd/mips64

For #46279
For #51713

Change-Id: I444f309999bf5576449a46a9808b23cf6537e7dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/394094
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
3 years agocmd/link: delete oReader.flags
Cherry Mui [Mon, 21 Mar 2022 19:15:40 +0000 (15:15 -0400)]
cmd/link: delete oReader.flags

Same information is provided from the fields of the embedded
goobj.Reader, and are accessed through it. Delete the flags field.

Change-Id: I7a4f5dca054e567443d719b2931fceff231d6efc
Reviewed-on: https://go-review.googlesource.com/c/go/+/394216
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>
3 years agogo/types, types: add additional generic cases for the Selections API
Robert Findley [Tue, 8 Mar 2022 21:16:49 +0000 (16:16 -0500)]
go/types, types: add additional generic cases for the Selections API

Change-Id: Icc5240db7447846061d0d81f5e15f788758d4d64
Reviewed-on: https://go-review.googlesource.com/c/go/+/393372
Trust: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agocmd/link: add DT_NEEDED for all 64-bit ELF dynimplib
Byoungchan Lee [Thu, 25 Nov 2021 11:40:21 +0000 (20:40 +0900)]
cmd/link: add DT_NEEDED for all 64-bit ELF dynimplib

Also change the relevant test to be tested on the linux-arm64 platform
as well.

Fixes #49789

Change-Id: Id2eac7a45279f037957442862f8ed63838b8e929
Reviewed-on: https://go-review.googlesource.com/c/go/+/366855
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agoruntime: combine wbuf checks in tryGetFast and putFast
Jakub Ciolek [Fri, 18 Mar 2022 08:10:02 +0000 (09:10 +0100)]
runtime: combine wbuf checks in tryGetFast and putFast

Less text and improves codegen a bit.

compilecmp on ARM64:

runtime
(*gcWork).putFast 160 -> 144  (-10.00%)
(*gcWork).tryGetFast 144 -> 128  (-11.11%)
scanobject 784 -> 752  (-4.08%)
greyobject 800 -> 784  (-2.00%)

AMD64:

runtime
greyobject 765 -> 748  (-2.22%)
(*gcWork).tryGetFast 102 -> 85  (-16.67%)
scanobject 837 -> 820  (-2.03%)
(*gcWork).putFast 102 -> 89  (-12.75%)

Change-Id: I6bb508afe1ba416823775c0bfc08ea9dc21de8a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/393754
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>

3 years agocmd/gofmt: don't descend into /testdata directories in tests (fix long builders)
Robert Griesemer [Mon, 21 Mar 2022 21:37:38 +0000 (14:37 -0700)]
cmd/gofmt: don't descend into /testdata directories in tests (fix long builders)

Now that the go/types and types2 test files end in .go we must
avoid trying to format them as that won't work in general.

Change-Id: I05fdd95a0d26cbe746f6d618b22b48dc1f1ea749
Reviewed-on: https://go-review.googlesource.com/c/go/+/394295
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agogo/types, types2: add an assertion that named type origin is idempotent
Robert Findley [Wed, 16 Mar 2022 20:52:30 +0000 (16:52 -0400)]
go/types, types2: add an assertion that named type origin is idempotent

For #46794

Change-Id: I19edc19640a2dfa6bc7504dd8e1742a261ba29f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/393368
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>

3 years agocmd/compile: replace Type.OrigSym with Type.OrigType
Matthew Dempsky [Mon, 21 Mar 2022 17:06:48 +0000 (10:06 -0700)]
cmd/compile: replace Type.OrigSym with Type.OrigType

First law of cmd/compile frontend development: thou shalt not rely on
types.Sym.

This CL replaces Type.OrigSym with Type.OrigType, which semantically
matches what all of the uses within the frontend actually care about,
and avoids using types.Sym, which invariably leads to mistakes because
symbol scoping in the frontend doesn't work how anyone intuitively
expects it to.

Fixes #51765.

Change-Id: I4affe6ee0718103ce5006ab68aa7e1bb0cac6881
Reviewed-on: https://go-review.googlesource.com/c/go/+/394274
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
3 years agogo/types, types2: remove predecl. test functions from ordinary tests
Robert Griesemer [Fri, 18 Mar 2022 00:35:11 +0000 (17:35 -0700)]
go/types, types2: remove predecl. test functions from ordinary tests

The type checker implements additional built-in functions (assert
and trace) that are useful for debugging. Only permit them in
manual tests (go test -run Manual), not for other tests where they
are not needed.

Change-Id: Idc7723d9e3f6b2c27769b34743561e9d0339565c
Reviewed-on: https://go-review.googlesource.com/c/go/+/393659
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years agogo/types, types2: rename testfile suffixes from .src to .go
Robert Griesemer [Fri, 18 Mar 2022 00:15:38 +0000 (17:15 -0700)]
go/types, types2: rename testfile suffixes from .src to .go

Also, manually renamed some irregularly numbered files to
make their file names more regular.

With this rename, all test files now end uniformly in .go.

go fmt doesn't descend into testdata directories, so this
is fine and makes all test files behave like regular .go
files in editors with Go language support.

Change-Id: I3abde32c35c494b94b17787788cd3d7e35662296
Reviewed-on: https://go-review.googlesource.com/c/go/+/393658
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years agogo/types, types2: rename testfile suffixes from .go2 to .go
Robert Griesemer [Thu, 17 Mar 2022 23:46:18 +0000 (16:46 -0700)]
go/types, types2: rename testfile suffixes from .go2 to .go

We don't need the distinction anymore.
Also, made corresponding adjustments to check_test.go.

Change-Id: I3c9a768c16a251d76bc6b3ebabd37822773e4ef5
Reviewed-on: https://go-review.googlesource.com/c/go/+/393657
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years agogo/types, types2: use new flag mechanims to handle importC test
Robert Griesemer [Thu, 17 Mar 2022 21:04:37 +0000 (14:04 -0700)]
go/types, types2: use new flag mechanims to handle importC test

Change-Id: I6f0cb850ee23184380c03a53c12425c350aa16e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/393714
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years agogo/types, types2: implement flexible flag-setting mechanism for tests
Robert Griesemer [Thu, 17 Mar 2022 01:19:31 +0000 (18:19 -0700)]
go/types, types2: implement flexible flag-setting mechanism for tests

Use it so set the language version. Adjust relevant tests.

Fixes #49074.

Change-Id: Ida6d0002bdba65b5add6e8728a1700305de18351
Reviewed-on: https://go-review.googlesource.com/c/go/+/393514
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years agogo/types, types2: remove mechanism to exclude tests for unified build
Robert Griesemer [Wed, 16 Mar 2022 22:17:36 +0000 (15:17 -0700)]
go/types, types2: remove mechanism to exclude tests for unified build

The unified build will become the norm and the excluded tests run now.

Change-Id: I0f0873eb73483a4f04736d167d2eb796ee8a857b
Reviewed-on: https://go-review.googlesource.com/c/go/+/393438
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
3 years agogo/types, types2: improved tracing output throughout (debugging support)
Robert Griesemer [Thu, 24 Feb 2022 21:10:34 +0000 (13:10 -0800)]
go/types, types2: improved tracing output throughout (debugging support)

This change fine-tunes tracing output and adds additional
descriptions for delayed actions that were missing tracing.

Change-Id: Ib5e70e8f40ef564194cdb0e8d12c38e15388b987
Reviewed-on: https://go-review.googlesource.com/c/go/+/387919
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years agogo/types, types2: ensure we have a fully resolved type in validType
Robert Griesemer [Wed, 16 Mar 2022 21:09:56 +0000 (14:09 -0700)]
go/types, types2: ensure we have a fully resolved type in validType

This addresses a situation where Named.fromRHS is nil which
is causing validType to panic when the debug flag is set.

Change-Id: Ie1af3f4d412efc2ce2ee7707af5375ed130a1f2a
Reviewed-on: https://go-review.googlesource.com/c/go/+/393436
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years agogo/types, types2: better error msg when using fallthrough in type switch
Robert Griesemer [Mon, 14 Mar 2022 21:05:53 +0000 (14:05 -0700)]
go/types, types2: better error msg when using fallthrough in type switch

Fixes #51533.

Change-Id: Ia41a2e96d1ef94f740887e3167e6396e4f52035c
Reviewed-on: https://go-review.googlesource.com/c/go/+/392759
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years agogo/types, types2: re-enable panic if unification stack-overflows
Robert Griesemer [Mon, 14 Mar 2022 20:26:42 +0000 (13:26 -0700)]
go/types, types2: re-enable panic if unification stack-overflows

With all the unification/type-inference fixes in place now, we
should not see stack overflows anymore. Re-enable the panic if
we do overflow, so we can address those issues should they arise.

Fixes #51377.

Change-Id: Ied64435ea5936811504cb30bda1126c7d85980f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/392755
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years agogo/types, types2: alias type declarations may refer to constraint types
Robert Griesemer [Mon, 14 Mar 2022 19:10:11 +0000 (12:10 -0700)]
go/types, types2: alias type declarations may refer to constraint types

Fixes #51616.

Change-Id: I388a6d91d9bfe5410b5eb32e1606257ec668d618
Reviewed-on: https://go-review.googlesource.com/c/go/+/392715
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years agogo/types, types2: factor out isInterface(x) && !isTypeParam(x) (cleanup)
Robert Griesemer [Fri, 11 Mar 2022 05:50:54 +0000 (21:50 -0800)]
go/types, types2: factor out isInterface(x) && !isTypeParam(x) (cleanup)

Fixes #51581.

Change-Id: I3232428edd7dd86f2930af950fb5841f7394c4e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/391834
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years agocmd/compile/internal/types: remove Sym.Block and Sym.Lastlineno
Matthew Dempsky [Mon, 21 Mar 2022 18:24:24 +0000 (11:24 -0700)]
cmd/compile/internal/types: remove Sym.Block and Sym.Lastlineno

These fields were used for tracking the last scope/position that an
identifier was declared, so that we could report redeclaration
errors. However, redeclaration errors are now diagnosed by types2 (and
typecheck.Redeclared was removed in CL 388537), so these fields can be
safely pruned.

Updates #51691.

Change-Id: Ifd5ea3f6795fadb420913298d59287c95e4669a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/394276
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
3 years agobuild: force GOWORK=off in make.{bash,bat,rc}
Dmitri Shuralyov [Fri, 18 Mar 2022 23:57:43 +0000 (19:57 -0400)]
build: force GOWORK=off in make.{bash,bat,rc}

While building Go from source, workspace mode should be disabled,
even if the external environment tries to configure it otherwise.

Fixes #51558.

Change-Id: Icd7577860271f59a8f94406214b111280e4b65b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/393879
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

3 years agocmd/link: set alignment of compressed section based on arch
Meng Zhuo [Fri, 18 Mar 2022 09:36:52 +0000 (17:36 +0800)]
cmd/link: set alignment of compressed section based on arch

The ELF compression header(Chdr) has Addralign field that is set to the
alignment of the uncompressed section which makes section able to have
a different alignment than the decompressed section. However `file` and
other tools require both Chdr.Addralign and Addralign to be equal.

Ref https://sourceware.org/bugzilla/show_bug.cgi?id=23919
Related #42136

Fixes #51769

Change-Id: I3cf99dbd2359932576420a3c0d342c7e91b99227
Reviewed-on: https://go-review.googlesource.com/c/go/+/393916
Trust: mzh <mzh@golangcn.org>
Reviewed-by: Alessandro Arzilli <alessandro.arzilli@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Fangrui Song <maskray@google.com>
3 years agointernal/abi, internal/buildcfg: always enable register ABI on PPC64
Cherry Mui [Fri, 18 Mar 2022 22:23:44 +0000 (18:23 -0400)]
internal/abi, internal/buildcfg: always enable register ABI on PPC64

In last cycle we developed register ABI for ARM64, enabled by
default as a GOEXPERIMENT. This cycle we turn it on all the time.
Later CLs will clean up fallback code.

Change-Id: Idac4dcff634791cbc3d30988052ecd742b55ab8b
Reviewed-on: https://go-review.googlesource.com/c/go/+/394214
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
3 years agocmd/vendor: update golang.org/x/tools to c717623e3197
Cherry Mui [Mon, 21 Mar 2022 17:44:17 +0000 (13:44 -0400)]
cmd/vendor: update golang.org/x/tools to c717623e3197

To pick up CL 394234.

Done by
go get -d golang.org/x/tools@c717623e3197
go mod tidy
go mod vendor

Change-Id: Ic67a7deb9a22b2679eec895210168f698d8d05eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/394275
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>
3 years agocmd/compile: fix panic with nested dead hidden closures
Cuong Manh Le [Mon, 21 Mar 2022 11:49:37 +0000 (18:49 +0700)]
cmd/compile: fix panic with nested dead hidden closures

CL 342350 fixed deadcode panic with dead hidden closures. However, a
closure may contains nested dead hidden closures, so we need to mark
them dead as well.

Fixes #51839

Change-Id: Ib54581adfc1bdea60e74d733cd30fd8e783da983
Reviewed-on: https://go-review.googlesource.com/c/go/+/394079
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: Cherry Mui <cherryyz@google.com>
3 years agodebug/dwarf: better error detection in parseUnits
Than McIntosh [Fri, 18 Mar 2022 15:36:21 +0000 (11:36 -0400)]
debug/dwarf: better error detection in parseUnits

Tweak the (*Data).parseUnits method to check a bit more carefully for
buffer read errors, so as to avoid infinite looping on malformed
inputs.

Fixes #51758.
Updates #47653.

Change-Id: I6d67fcb53392acf651ceec636789ab9e49ad5a5c
Reviewed-on: https://go-review.googlesource.com/c/go/+/393874
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agocmd/compile: remove regabi magic names
Cherry Mui [Fri, 18 Mar 2022 21:02:52 +0000 (17:02 -0400)]
cmd/compile: remove regabi magic names

When developing register ABI, for early testing the compiler
recognized a few magic names to trigger enabling register ABI.
After the development it is disabled (changed to a name that
cannot be spelled in the source code). Later in the development of
register ABI for ARM64 and PPC64, I don't think the magic names
were used. I think they can now be removed.

Keep the magic pragma for now in case it helps development.

Change-Id: Icbc34e2786a80fd8fffe4a464c569dc03a54cd09
Reviewed-on: https://go-review.googlesource.com/c/go/+/393877
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
3 years agonet/http: flesh out Request.SetBasicAuth docs a bit
Brad Fitzpatrick [Sun, 20 Mar 2022 18:52:02 +0000 (11:52 -0700)]
net/http: flesh out Request.SetBasicAuth docs a bit

Clarify that username can't contain a colon.
See https://go.dev/play/p/aM25UHC6n98

Change-Id: I342575107104cbcd28b1d3442c474adf93b7f03c
Reviewed-on: https://go-review.googlesource.com/c/go/+/394115
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agoREADME.md: update links to go.dev
Jero Bado [Tue, 1 Feb 2022 23:22:31 +0000 (23:22 +0000)]
README.md: update links to go.dev

Fixes #50916.

Change-Id: I51f3269b7a0793a3002eef83de1d871111fc3cdc
GitHub-Last-Rev: fc8c183ac7fa84d6caefdf49ed1d8cac19d7744f
GitHub-Pull-Request: golang/go#50919
Reviewed-on: https://go-review.googlesource.com/c/go/+/381962
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Trust: Daniel Martí <mvdan@mvdan.cc>

3 years agointernal/reflectlite: fix name of type parameter
zhouguangyuan [Sat, 19 Mar 2022 18:10:17 +0000 (02:10 +0800)]
internal/reflectlite: fix name of type parameter

CL 372774 is for reflect, this CL is for internal/reflectlite.

Updates #50208

Change-Id: Ib7e8b1bc031feab218d1addd78388fcfe9b675b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/393918
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: Daniel Martí <mvdan@mvdan.cc>
Trust: Daniel Martí <mvdan@mvdan.cc>

3 years agocmd/compile/internal/riscv64: add initial spill support
Meng Zhuo [Sun, 31 Oct 2021 13:12:45 +0000 (21:12 +0800)]
cmd/compile/internal/riscv64: add initial spill support

This CL adds some initial support for spilling and reloading
registers in the new ABI for RISCV64.

Change-Id: I5e2b4d93c33c528809d569e5a442bb302074be78
Reviewed-on: https://go-review.googlesource.com/c/go/+/360215
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: mzh <mzh@golangcn.org>
Run-TryBot: mzh <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agocmd/compile: pre init shapeMap
cuiweixie [Wed, 12 Jan 2022 12:01:26 +0000 (12:01 +0000)]
cmd/compile: pre init shapeMap

Change-Id: I4fea927b9d34e7bf382ddf148a787c1558176f2f
GitHub-Last-Rev: ff1fa78a3601243092f84a69e7332ec2ba9ec05a
GitHub-Pull-Request: golang/go#50568
Reviewed-on: https://go-review.googlesource.com/c/go/+/377994
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Cherry Mui <cherryyz@google.com>

3 years agocmd/compile/internal: add ABI register info for riscv64
Meng Zhuo [Thu, 28 Oct 2021 07:22:26 +0000 (15:22 +0800)]
cmd/compile/internal: add ABI register info for riscv64

This CL adds register information for riscv64

Updates #40724

Change-Id: If2275d9135596ff856d096881e4fe8bd1eeaacb2
Reviewed-on: https://go-review.googlesource.com/c/go/+/359337
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>

3 years agocmd/compile: remove n.Diag() deadcode paths
Cuong Manh Le [Fri, 18 Mar 2022 17:34:26 +0000 (00:34 +0700)]
cmd/compile: remove n.Diag() deadcode paths

CL 392918 changed n.Diag() to always return false, we can now get rid
of all its deadcode paths.

Updates #51691

Change-Id: I64c07970493e7bdcf89df9508ce88132ef4aa4d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/393915
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agocmd/compile: remove t.Broke() deadcode paths
Cuong Manh Le [Fri, 18 Mar 2022 17:23:33 +0000 (00:23 +0700)]
cmd/compile: remove t.Broke() deadcode paths

CL 392918 changed t.Broke() to always return false, we can now get rid
of all its deadcode paths.

Updates #51691

Change-Id: I0a2a13def07364e780e4785621690452948e219a
Reviewed-on: https://go-review.googlesource.com/c/go/+/393914
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agocmd/go: diagnose unset GOROOT when built with -trimpath
Bryan C. Mills [Fri, 11 Mar 2022 04:40:10 +0000 (23:40 -0500)]
cmd/go: diagnose unset GOROOT when built with -trimpath

For #51483

Change-Id: I4546c20cf968b595020a1eba888fe1d9a1c6cfc5
Reviewed-on: https://go-review.googlesource.com/c/go/+/391811
Reviewed-by: Russ Cox <rsc@golang.org>
Trust: Bryan Mills <bcmills@google.com>

3 years agocmd/go: include the "-trimpath" flag in the stamped build settings
Bryan C. Mills [Wed, 9 Mar 2022 17:01:16 +0000 (12:01 -0500)]
cmd/go: include the "-trimpath" flag in the stamped build settings

The -trimpath flag has a strong effect on the resulting binary:
in particular, it determines whether runtime.GOROOT can report
a meaningful path in the absence of an explicit GOROOT environment variable.

For #51461

Change-Id: Id0d55572c0a0a4e2e4724363ed80dfa05b202186
Reviewed-on: https://go-review.googlesource.com/c/go/+/391810
Trust: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agocmd/go: stamp build settings for binaries in cmd
Bryan C. Mills [Tue, 8 Mar 2022 22:01:12 +0000 (17:01 -0500)]
cmd/go: stamp build settings for binaries in cmd

Also update cmd/dist to avoid setting gcflags and ldflags explicitly
when the set of flags to be set is empty (a verbose way of specifying
the default behavior).

Stamping was disabled for the Go standard library in CL 356014 due to
the cmd/dist flags causing cmd/go to (correctly) report the resulting
binaries as stale.

With cmd/dist fixed, we can also remove the special case in cmd/go,
which will allow tests of binaries in 'cmd' to read the build info
embedded in the test binary. That build info may be useful to
determine (say) whether runtime.GOROOT ought to work without GOROOT
set in the environment.

For #51483
Updates #37475

Change-Id: I64d04f5990190094eb6c0522db829d3bdfa50ef3
Reviewed-on: https://go-review.googlesource.com/c/go/+/391809
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agocmd/go/internal/test: ensure that build.ToolDir is accurate in tests
Bryan C. Mills [Fri, 11 Mar 2022 04:38:25 +0000 (23:38 -0500)]
cmd/go/internal/test: ensure that build.ToolDir is accurate in tests

This fixes a build failure due to inability to locate the "vet" tool
when the test binary is built with -trimpath.

Updates #51461

Change-Id: I81838cc8842e4ff7900cab81af60501ebba86ff1
Reviewed-on: https://go-review.googlesource.com/c/go/+/391808
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agogo/build: avoid setting Default.GOROOT when runtime.GOROOT() is empty
Bryan C. Mills [Tue, 8 Mar 2022 21:29:00 +0000 (16:29 -0500)]
go/build: avoid setting Default.GOROOT when runtime.GOROOT() is empty

Previously, we called path.Clean on the value of runtime.GOROOT() even
if it was empty, which would set it explicitly to ".".
That would cause (*Context).importGo to assume that errors resolving
paths in GOROOT are fatal and return early:
https://cs.opensource.google/go/go/+/master:src/go/build/build.go;l=1121-1127;drc=38174b3a3514629b84dcd76878b2f536b189dd7b

If we instead leave it empty (and are in module mode), then importGo
will fall back to letting the 'go' command resolve the path, which may
succeed if the 'go' command can infer the correct GOROOT (from its own
stamped-in default GOROOT or executable path).

Fixes #51483

Change-Id: I44dce7cec6c3d1c86670e629ddfbca8be461130c
Reviewed-on: https://go-review.googlesource.com/c/go/+/391805
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agointernal/testenv: add GOROOT and use it to fix tests broken with -trimpath
Bryan C. Mills [Wed, 9 Mar 2022 22:19:23 +0000 (17:19 -0500)]
internal/testenv: add GOROOT and use it to fix tests broken with -trimpath

This fixes many (but not all) of the tests that currently fail
(due to a bogus path reported by runtime.GOROOT) when run with
'go test -trimpath std cmd'.

Updates #51461

Change-Id: Ia2cc05705529c4859e7928f32eeceed647f2e986
Reviewed-on: https://go-review.googlesource.com/c/go/+/391806
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agocmd/link: avoid stamping runtime.defaultGOROOT when paths are being trimmed
Bryan C. Mills [Tue, 15 Mar 2022 20:37:50 +0000 (16:37 -0400)]
cmd/link: avoid stamping runtime.defaultGOROOT when paths are being trimmed

Previously, runtime.GOROOT() would return the string "go" in a binary
build with -trimpath. This change stamps the empty string instead,
using a sentinel value passed from cmd/go that looks like the GOROOT
environment variable (either "$GOROOT" or "%GOROOT%", depending on the
platform).

Fixes #51461

Change-Id: I1f10ef2435016a7b6213bd8c547df911f7feeae7
Reviewed-on: https://go-review.googlesource.com/c/go/+/390024
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agointernal/buildcfg: initialize GOROOT to runtime.GOROOT
Bryan C. Mills [Tue, 15 Mar 2022 20:31:02 +0000 (16:31 -0400)]
internal/buildcfg: initialize GOROOT to runtime.GOROOT

In the beginning the Go compiler was in C, and C had a function
'getgoroot' that returned GOROOT from either the environment or a
generated constant. 'getgoroot' was mechanically converted to Go
(as obj.Getgoroot) in CL 3046.

obj.Getgoroot begat obj.GOROOT. obj.GOROOT begat objabi.GOROOT,
which begat buildcfg.GOROOT.

As far as I can tell, today's buildcfg.GOROOT is functionally
identical to runtime.GOROOT(). Let's reduce some complexity by
defining it in those terms.

While we're thinking about buildcfg.GOROOT, also check whether it is
non-empty: if the toolchain is built with -trimpath, the value of
GOROOT might not be valid or meaningful if the user invokes
cmd/compile or cmd/link directly, or via a build tool other than
cmd/go that doesn't care as much about GOROOT. (As of CL 390024,
runtime.GOROOT will return the empty string instead of a bogus one
when built with -trimpath.)

For #51461.

Change-Id: I9fec020d5fa65d4aff0dd39b805f5ca93f86c36e
Reviewed-on: https://go-review.googlesource.com/c/go/+/393155
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agocmd/go: avoid stamping VCS metadata in test binaries
Bryan C. Mills [Fri, 18 Mar 2022 15:40:34 +0000 (11:40 -0400)]
cmd/go: avoid stamping VCS metadata in test binaries

Invoking a VCS tool requires that the VCS tool be installed, and also
adds latency to build commands. Unfortunately, we had been mistakenly
loading VCS metadata for tests of "main" packages.

Users almost never care about versioning for test binaries, because
'go test' runs the test in the source tree and test binaries are only
rarely used outside of 'go test'. So the user already knows exactly
which version the test is built against, because the source code is
right there — it's not worth the overhead to stamp.

Fixes #51723.

Change-Id: I96f191c5a765f5183e5e10b6dfb75a0381c99814
Reviewed-on: https://go-review.googlesource.com/c/go/+/393894
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Trust: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agotime: fix zoneinfo.zip locating logic when built with -trimpath
Bryan C. Mills [Thu, 10 Mar 2022 05:19:05 +0000 (00:19 -0500)]
time: fix zoneinfo.zip locating logic when built with -trimpath

When the test binary is built with the -trimpath flag,
runtime.GOROOT() is invalid, and must not be used to locate
GOROOT/lib/time/zoneinfo.zip. (We can use other sources instead.)

However, the test for the package expects zoneinfo.zip to definitely
exist. 'go test' runs the test binary in the directory containing its
source code — in this case GOROOT/src/time — so we can use that
information to find the zoneinfo.zip file when runtime.GOROOT isn't
available.

For #51483

Change-Id: I9de35252a988d146b5d746794323214d400e64e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/391814
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agosort: generate generic variants with E rather than Elem
Ian Lance Taylor [Fri, 18 Mar 2022 00:55:59 +0000 (17:55 -0700)]
sort: generate generic variants with E rather than Elem

For #51698

Change-Id: Ifc5bef2cc41b163644ac80ace7c1470c8a130467
Reviewed-on: https://go-review.googlesource.com/c/go/+/393700
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Eli Bendersky‎ <eliben@golang.org>
3 years agocmd/compile: pointers to notinheap types need their own shape
Keith Randall [Fri, 18 Mar 2022 17:46:15 +0000 (10:46 -0700)]
cmd/compile: pointers to notinheap types need their own shape

They should not share a shape with regular pointers. We could coalesce
multiple pointer-to-not-in-heap types, but doesn't seem worth it - just
make them fully stenciled.

Fixes #51733

Change-Id: Ie8158177226fbc46a798e71c51897a82f15153df
Reviewed-on: https://go-review.googlesource.com/c/go/+/393895
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>
3 years agocmd: update vendored pprof
Heschi Kreinick [Wed, 16 Mar 2022 22:17:58 +0000 (18:17 -0400)]
cmd: update vendored pprof

  go get github.com/google/pprof@latest
  go mod vendor

Plus a tiny change to the pprof command to match an upstream interface
change.

Updates #36905.

Change-Id: I4c7bbe8c317a6eeb217fce971b208f96ab0727fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/393370
Trust: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
Auto-Submit: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
3 years agoall: delete ARM64 non-register ABI fallback path
Cherry Mui [Fri, 18 Mar 2022 17:04:08 +0000 (13:04 -0400)]
all: delete ARM64 non-register ABI fallback path

Change-Id: I3996fb31789a1f8559348e059cf371774e548a8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/393875
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
3 years agocmd/go: run 'go help documentation' through gofmt in TestDocsUpToDate
Russ Cox [Fri, 4 Feb 2022 16:55:33 +0000 (11:55 -0500)]
cmd/go: run 'go help documentation' through gofmt in TestDocsUpToDate

mkalldocs.sh runs gofmt on the output, but the test does not.
If go help documentation and gofmt disagree, the test will fail.
Fix that.

Change-Id: I837374a2d36cb5d71278ecefe2a7b6544622c576
Reviewed-on: https://go-review.googlesource.com/c/go/+/384256
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agointernal/diff: add, replacing cmd/internal/diff
Russ Cox [Sat, 29 Jan 2022 21:13:12 +0000 (16:13 -0500)]
internal/diff: add, replacing cmd/internal/diff

This is an in-process (non-exec'ing) replacement for cmd/internal/diff.
It uses an O(n log n) algorithm instead of the O(n²) algorithm
in standard diff binaries. It does not produce the absolute
shortest diffs, but the results are often more meaningful
than the standard diff, because it doesn't try to align
random blank lines or other noise.

Adding so that tests inside std (especially go/printer)
can print diffs.

Replacing cmd/internal/diff because we don't need two.

Change-Id: I9155dd925e4a813f5bfa84a8ad3dec8ffdbf8550
Reviewed-on: https://go-review.googlesource.com/c/go/+/384255
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Peter Weinberger <pjw@google.com>
Trust: Peter Weinberger <pjw@google.com>

3 years agointernal/abi, internal/buildcfg: always enable register ABI on ARM64
Cherry Mui [Wed, 2 Mar 2022 16:59:48 +0000 (11:59 -0500)]
internal/abi, internal/buildcfg: always enable register ABI on ARM64

In last cycle we developed register ABI for ARM64, enabled by
default as a GOEXPERIMENT. This cycle we turn it on all the time.
Later CLs will clean up fallback code.

To support in-development platforms (e.g. RISC-V), separate the
boolean variables for in-development platforms and always-on
platforms.

Change-Id: I97c27f6aeccc85ccc57eed2abd783b176da3ad80
Reviewed-on: https://go-review.googlesource.com/c/go/+/393364
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agointernal/buildcfg: extract logic specific to cmd/go
Bryan C. Mills [Wed, 16 Mar 2022 20:25:47 +0000 (16:25 -0400)]
internal/buildcfg: extract logic specific to cmd/go

cmd/go/internal/cfg duplicates many of the fields of
internal/buildcfg, but initializes them from a Go environment file in
addition to the usual process environment.

internal/buildcfg doesn't (and shouldn't) know or care about that
environment file, but prior to this CL it exposed hooks for
cmd/go/internal/cfg to write data back to internal/buildcfg to
incorporate information from the file. It also produced quirky
GOEXPERIMENT strings when a non-trivial default was overridden,
seemingly so that 'go env' would produce those same quirky strings in
edge-cases where they are needed.

This change reverses that information flow: internal/buildcfg now
exports a structured type with methods — instead of top-level
functions communicating through global state — so that cmd/go can
utilize its marshaling and unmarshaling functionality without also
needing to write results back into buildcfg package state.

The quirks specific to 'go env' have been eliminated by distinguishing
between the raw GOEXPERIMENT value set by the user (which is what we
should report from 'go env') and the cleaned, canonical equivalent
(which is what we should use in the build cache key).

For #51461.

Change-Id: I4ef5b7c58b1fb3468497649a6d2fb6c19aa06c70
Reviewed-on: https://go-review.googlesource.com/c/go/+/393574
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agoreflect, runtime: drop RegabiArgs conditions
Cherry Mui [Wed, 16 Mar 2022 16:12:50 +0000 (12:12 -0400)]
reflect, runtime: drop RegabiArgs conditions

With the previous CL, internal/abi.IntArgRegs and FloatArgRegs
is controlled by RegabiArgs (or always enabled), so there is no
need to check for that goexperiment.

There are a few places we guard register-ABI specific code and
tests with the RegabiArgs flag. Switch to checking for the number
of argument registers instead.

Change-Id: I79fff9fd1e919684ffaf73aba9e7e85d5a9e1629
Reviewed-on: https://go-review.googlesource.com/c/go/+/393363
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agoall: delete regabireflect goexperiment
Cherry Mui [Tue, 15 Mar 2022 17:27:53 +0000 (13:27 -0400)]
all: delete regabireflect goexperiment

regabireflect goexperiment was helpful in the register ABI
development, to control code paths for reflect calls, before the
compiler can generate register ABI everywhere. It is not necessary
for now. Drop it.

Change-Id: I2731197d2f496e29616c426a01045c9b685946a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/393362
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
3 years agosyscall: use bytealg.IndexByte in clen
Tobias Klauser [Fri, 18 Mar 2022 10:49:40 +0000 (11:49 +0100)]
syscall: use bytealg.IndexByte in clen

Change-Id: Ib3f92ea8371a13471acf9304dc9db66c0aae9bf4
Reviewed-on: https://go-review.googlesource.com/c/go/+/393756
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Trust: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agoA+C: update Changkun Ou's email
Changkun Ou [Fri, 26 Nov 2021 09:12:39 +0000 (10:12 +0100)]
A+C: update Changkun Ou's email

Add my current public email in both A+C, but keep old one too.
Add my @changkun.de email to CONTRIBUTORS.

Change-Id: Ic5a585582a5f5142fbdd0a132235c19f05d9e680
Reviewed-on: https://go-review.googlesource.com/c/go/+/367116
Run-TryBot: Changkun Ou <mail@changkun.de>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ben Shi <powerman1st@163.com>
3 years agoruntime: allow TestCtrlHandler to run in ConPTY
Nuno Cruces [Thu, 17 Mar 2022 16:38:00 +0000 (16:38 +0000)]
runtime: allow TestCtrlHandler to run in ConPTY

Fixes #51602. Previous test would not run in a pseudo-console (ConPTY).

New test avoids taskkill entirely by having the child request its own
console window be closed.

Verified that this runs locally (within a real console), over SSH
(within a pseudo-console), and that it breaks if #41884 were reverted.

Change-Id: If868b92ec36647e5d0e4107e29a2a6e048d35ced
GitHub-Last-Rev: b1421e4bed2dc729c266928f002b39374d7e391a
GitHub-Pull-Request: golang/go#51681
Reviewed-on: https://go-review.googlesource.com/c/go/+/392874
Reviewed-by: Bryan Mills <bcmills@google.com>
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Trust: Alex Brainman <alex.brainman@gmail.com>

3 years agosyscall: unskip TestDirentRepeat on freebsd
Tobias Klauser [Thu, 17 Mar 2022 23:01:24 +0000 (00:01 +0100)]
syscall: unskip TestDirentRepeat on freebsd

TestDirentRepeat fails on FreeBSD 11, but seems to pass on newer
versions. Go 1.18 is the last release to support FreeBSD 11 per
https://golang.org/doc/go1.18#freebsd and there are no FreeBSD 11
builders anymore. Thus unskip TestDirentRepeat to verify the issue is
indeed fixed on FreeBSD 12 and later.

For #31416

Change-Id: I189ef06719ff830ffe2e402c74a75874c9e5b97b
Reviewed-on: https://go-review.googlesource.com/c/go/+/393618
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agoruntime/cgo: remove memset in _cgo_sys_thread_start on freebsd/arm
Tobias Klauser [Thu, 17 Mar 2022 21:39:53 +0000 (22:39 +0100)]
runtime/cgo: remove memset in _cgo_sys_thread_start on freebsd/arm

pthread_attr_init on freebsd properly initializes the pthread_attr,
there is no need to zero it before the call. The comment and code were
probably copied from the linux/arm implementation.

This aligns the implementation on freebsd/arm with the implementation on
other freebsd architectures.

Fixes #44248

Change-Id: If82ebb115b877b6c6f4862018a9419ba8d870f12
Reviewed-on: https://go-review.googlesource.com/c/go/+/393617
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Trust: Hajime Hoshi <hajimehoshi@gmail.com>

3 years agosyscall: optimize UTF16{,Ptr}FromString
Tobias Klauser [Thu, 17 Mar 2022 10:41:24 +0000 (11:41 +0100)]
syscall: optimize UTF16{,Ptr}FromString

Use bytealg.IndexByteString in UTF16FromString instead of an open-coded
loop.

Change-Id: I366448382f2d0adeca6b254131e0087a1f489258
Reviewed-on: https://go-review.googlesource.com/c/go/+/393614
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agocrypto/x509: return err ans1.Marshal gives an error
cuiweixie [Tue, 1 Feb 2022 00:36:33 +0000 (00:36 +0000)]
crypto/x509: return err ans1.Marshal gives an error

Fixes #50663

Change-Id: I18754922bf139049443c0395eaa1606049df1331
GitHub-Last-Rev: 57ff5ddfe39c211ccff60aa74a30f97ddf7015fb
GitHub-Pull-Request: golang/go#50667
Reviewed-on: https://go-review.googlesource.com/c/go/+/379094
Reviewed-by: Katie Hockman <katie@golang.org>
Trust: Katie Hockman <katie@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agoA+C: add PlanetScale, Inc.
Matt Layher [Thu, 17 Mar 2022 23:26:55 +0000 (19:26 -0400)]
A+C: add PlanetScale, Inc.

Change-Id: Ide2567dc66e55880b938b5814879f012c88159b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/393697
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Matt Layher <mdlayher@gmail.com>

3 years agoruntime: call testenv.MustHaveCGO in a couple of tests
Ian Lance Taylor [Wed, 16 Mar 2022 04:05:11 +0000 (21:05 -0700)]
runtime: call testenv.MustHaveCGO in a couple of tests

Fixes #51695

Change-Id: Icfe9d26ecc28a7db9040d50d4661cf9e8245471e
Reviewed-on: https://go-review.googlesource.com/c/go/+/392916
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
3 years agonet/rpc: reduce the execution of reflect and decode
fangguizhen [Thu, 27 May 2021 16:11:52 +0000 (16:11 +0000)]
net/rpc: reduce the execution of reflect and decode

Change-Id: Ief4b5e1c2d1002392901124c0694afe58c271573
GitHub-Last-Rev: e3b8a60377becfc9c30178d7ae6131d7a4b82dde
GitHub-Pull-Request: golang/go#46421
Reviewed-on: https://go-review.googlesource.com/c/go/+/323014
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>

3 years agoall: update vendored x dependencies for Go 1.19 development cycle
Heschi Kreinick [Wed, 16 Mar 2022 22:04:43 +0000 (18:04 -0400)]
all: update vendored x dependencies for Go 1.19 development cycle

Generated with x/build/cmd/updatestd.

Updates #36905.

Change-Id: I5d12dfc3b49c1476ce4b8d4cbeb35bd3d3443d26
Reviewed-on: https://go-review.googlesource.com/c/go/+/393369
Trust: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
Auto-Submit: Heschi Kreinick <heschi@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

3 years agocmd/doc: use the 'go' command from buildCtx.GOROOT, not whatever is in $PATH
Bryan C. Mills [Wed, 16 Mar 2022 18:45:42 +0000 (14:45 -0400)]
cmd/doc: use the 'go' command from buildCtx.GOROOT, not whatever is in $PATH

For #51483.

Change-Id: I6150fdf97763d858e9ab012e807515da3387c25f
Reviewed-on: https://go-review.googlesource.com/c/go/+/393366
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>