]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
2 years ago[dev.fuzz] Merge remote-tracking branch 'origin/dev.fuzz' into merge-fuzz
Jay Conrod [Mon, 20 Sep 2021 22:13:52 +0000 (15:13 -0700)]
[dev.fuzz] Merge remote-tracking branch 'origin/dev.fuzz' into merge-fuzz

Change-Id: I3976e624fe2817d06b708005c994f6832f6d4357

2 years ago[dev.fuzz] all: merge master (b0fa2f5) into dev.fuzz
Katie Hockman [Mon, 20 Sep 2021 22:11:54 +0000 (18:11 -0400)]
[dev.fuzz] all: merge master (b0fa2f5) into dev.fuzz

Merge List:

+ 2021-09-20 b0fa2f5b09 cmd/compile: fix ExampleInfo output

Change-Id: Iccc726a8925082688faa94d07b829a5705f58dda

2 years agocmd/compile: fix ExampleInfo output
Amelia Downs [Mon, 20 Sep 2021 17:04:49 +0000 (13:04 -0400)]
cmd/compile: fix ExampleInfo output

Move the "TODO" to outside of the function so that the "Output" comment
block is the last comment block. Output is only checked when it is the
last comment block. See golang/go#48362 for this issue.

Fixes: golang/go#48494
Change-Id: I7a31d7c13710e58fa876c96240a927a9bb8273ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/350995
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: David Chase <drchase@google.com>

2 years ago[dev.fuzz] all: merge master (af72ddf) into dev.fuzz
Katie Hockman [Mon, 20 Sep 2021 19:45:51 +0000 (15:45 -0400)]
[dev.fuzz] all: merge master (af72ddf) into dev.fuzz

This now includes the fix in CL 350729, which means
we no longer need to skip the test in dev.fuzz.

Conflicts:

- src/cmd/compile/internal/noder/unified_test.go

Merge List:

+ 2021-09-20 af72ddfcd7 cmd/compile: extend dump-to-file to handle "genssa" (asm) case.
+ 2021-09-20 3c764babe7 cmd/go: write go.mod requirements more consistently for go 1.17+
+ 2021-09-20 6268468e02 cmd/link: generate DIE for types referenced only through dictionaries
+ 2021-09-20 6acac8b685 cmd/compile: delay all transforms for generic funcs/methods
+ 2021-09-20 988f18d61d go/types: export Named._Orig as Named.Origin
+ 2021-09-20 b6dddaccd7 cmd/compile: fix transform.AssignOp to deal with tricky case
+ 2021-09-20 9e60c37147 cmd/compile: document register-based ABI for ppc64
+ 2021-09-20 79159f2e83 cmd/compile: fix simplification rules on arm/arm64
+ 2021-09-20 eff27e858b cmd/compile: ensure constant shift amounts are in range for arm
+ 2021-09-20 9ebe7c8ec6 go/test: add a test for issue 48344
+ 2021-09-20 6f35430faa cmd/compile: allow rotates to be merged with logical ops on arm64
+ 2021-09-20 2d9b486420 cmd/compile: update doc at top of iexport.go on the changes for typeparams
+ 2021-09-20 a81b0dc6ee cmd/compile: rename instType -> instanceType
+ 2021-09-20 119213566a cmd/cgo: remove hardcoded '-pie' ldflag for linux/arm
+ 2021-09-20 a83a558733 cmd/compile: fix export/import of range loop.
+ 2021-09-19 315dbd10c9 cmd/compile: fold double negate on arm64
+ 2021-09-19 83b36ffb10 cmd/compile: implement constant rotates on arm64
+ 2021-09-19 771b8ea4f4 cmd/compile: fix missing markHiddenClosureDead in deadcode pass
+ 2021-09-18 c894b442d1 net/rpc: remove warnings on incompatible methods at registration
+ 2021-09-17 4b654c0eec cmd/compile: SSA ".this" variable
+ 2021-09-17 f01721efb9 cmd/compile: remove self copies in tail-call wrappers
+ 2021-09-17 163871feb1 time: re-add space-padded day of year to docs
+ 2021-09-17 ac7c34767d time: support fractional timezone minutes in MarshalBinary
+ 2021-09-17 07b30a4f77 cmd/compile: delay transformAssign if lhs/rhs have typeparam
+ 2021-09-17 c10b980220 cmd/compile: restore tail call for method wrappers
+ 2021-09-17 50e4508269 cmd/compile: fix import/export of Init and Def fields.
+ 2021-09-17 3fa35b5f97 go/types: ensure that we always get a new signature in expandNamed
+ 2021-09-17 3fa7dbeff5 cmd/go: fix GOARCH value in GOAMD64 docs
+ 2021-09-17 974b0166d6 syscall: implement Pipe using pipe2 syscall on all linux platforms
+ 2021-09-17 1a49dcb82f syscall: remove //sysnb comment generating Setreuid for linux/arm64
+ 2021-09-17 cea7a71d40 cmd/compile: fix generic type handling in crawler
+ 2021-09-17 74e384f50d internal/poll: inject a hook into the runtime finalizer to count the closed pipes
+ 2021-09-17 323c6f74d3 log: don't format if writing to io.Discard
+ 2021-09-17 7f36ef0aff cmd/compile/internal/noder: hide TestUnifiedCompare behind -cmp flag
+ 2021-09-17 70493b3eb0 runtime/cgo: save and restore X3 (aka GP) for crosscall1 on riscv64
+ 2021-09-17 6d02ce8584 runtime: fix prettyprinting of parametric types in gdb
+ 2021-09-17 6602c86a38 cmd/internal/obj/riscv: improve instruction validation
+ 2021-09-17 14e812bfc5 syscall: do not use handle lists on windows when NoInheritHandles is true
+ 2021-09-16 8d2a9c32a2 all: remove incorrectly repeated words in comments
+ 2021-09-16 af9da137a9 A+C: update name to real name and add to AUTHORS
+ 2021-09-16 265b59aefd cmd/cgo: for godefs, don't let field prefix removal cause duplicates
+ 2021-09-16 4efdaa7bc7 testing: skip panics when picking the line number for decoration
+ 2021-09-16 e09dcc211a go/types, types2: add an additional shift test case
+ 2021-09-16 5402b4376c spec: fix incorrect type in a shift example
+ 2021-09-16 d09e09bc61 cmd/compile: fixing writebarrier.go for -G=3
+ 2021-09-16 bcdc61d830 cmd/compile: preserve statements better in expandCalls
+ 2021-09-16 48e2b1ea91 cmd/compile: fix LocResults formatting
+ 2021-09-16 b1bedc0774 cmd/go: add GOAMD64 environment variable
+ 2021-09-16 04f5116c98 cmd/go: clean paths before checking same directory
+ 2021-09-16 e7dbe3908e cmd/cgo: add missing tab in exports for a result of void
+ 2021-09-15 cfa233d76b cmd/compile: remove unneeded early transforms, with dictionary change
+ 2021-09-15 59a9a035ff cmd/compile: switch to computing dict format on instantiated functions
+ 2021-09-15 0edc6c4fa0 cmd/internal/obj/ppc64: generate prologue code compatible with new ABI
+ 2021-09-15 03df68d3c3 runtime: fix setting of cpu features for amd64
+ 2021-09-15 6196979365 cmd/go/internal/modload: prevent tidy downgrading disambiguating modules
+ 2021-09-15 72bb8185b5 cmd/compile: emit DWARF info about dictionary entries
+ 2021-09-15 5b48fca1fa cmd/compile: mark wrapper functions with DW_AT_trampoline
+ 2021-09-15 e4dfd788e6 go/internal/gcimporter,cmd/compile: minor clean-up in iimport.go
+ 2021-09-15 4847c47cb8 cmd/compile/internal/types2: eliminate Named.instPos
+ 2021-09-15 3100f54f20 cmd/compile/internal/types2: merge Named type loading and expansion
+ 2021-09-15 738cebb174 cmd/compile/internal/types2: implement Identical for *Union types
+ 2021-09-15 b26d325cb1 cmd/compile/internal/types2: remove some unnecessary loading/expansion of Named types
+ 2021-09-15 9fc28892cb cmd/compile/internal/types2: export TypeHash, return value without blanks
+ 2021-09-15 2da3375e9b runtime: in adjustTimers back up as far as necessary
+ 2021-09-15 c7f2f51fed cmd/go: remove subcommand prefix from error messages
+ 2021-09-15 0bb40b08c4 go/types: implement Identical for *Union types
+ 2021-09-15 cb4e1de021 go/types: minor cleanup of instantiation
+ 2021-09-15 a0f3129466 go/types: instantiate methods when instantiating Named types
+ 2021-09-14 bf26e43d0f go/types: eliminate Named.instPos
+ 2021-09-14 2933c451a0 go/types: merge Named type loading and expansion
+ 2021-09-14 137543bb93 cmd/compile: set IsShape based on type being in the Shapes pkg
+ 2021-09-14 3a72175cdc cmd/compile: fix test/typeparam/mdempsky/4.go for -G=3
+ 2021-09-14 b2c04f0d48 runtime: avoid loop variable capture in test
+ 2021-09-14 181e8cde30 go/internal/gcimporter: remove outdated comment
+ 2021-09-14 8699425b55 syscall: remove use of IN_KUBERNETES in test
+ 2021-09-14 b3c6de9dcd cmd/internal/obj/ppc64: allow VR register arguments to VS registers
+ 2021-09-14 ee91bb8319 cmd/compile: prevent typecheck importer reading type parameter twice
+ 2021-09-14 2953cd0083 go/internal/gcimporter: prevent importReader reading type parameter twice
+ 2021-09-14 b8c802b116 cmd/compile: prevent importReader reading type parameter twice
+ 2021-09-14 4a4221e818 all: remove some unused code
+ 2021-09-14 71adc658de runtime: change time.now to ABIInternal
+ 2021-09-14 146e8d4994 reflect: use Value.Len instead of conversion to slice header
+ 2021-09-13 9a58aa267e spec: fix prose about terminating statements
+ 2021-09-13 42057e9848 cmd/compile: save the note of fields when translating struct
+ 2021-09-13 960d036f8f cmd/go: add missing parenthesis in a call to "PrintVersion"
+ 2021-09-13 81a4fe6fd2 cmd/link/internal/ld: re-enable DWARF tests on solaris/illumos
+ 2021-09-13 f93a63addb reflect: add a floating point section to DeepEqual tests
+ 2021-09-13 a0c409cbc8 reflect: add fast paths for common, simple Kinds to DeepEqual
+ 2021-09-13 ac40c9872f reflect: fix _faststr optimization
+ 2021-09-13 c8a58f29dc cmd/go: add test to check for a potential workspace loading issue
+ 2021-09-13 e74e363a6b strings: add Clone function
+ 2021-09-13 bced369a50 cmd/link: minor code cleanup in dwarf gen
+ 2021-09-13 c3b217a0e5 cmd/go: document 'go install cmd@version' ignores vendor directories
+ 2021-09-12 ad97d204f0 go/types: remove some unnecessary loading/expansion of Named types
+ 2021-09-12 0d8a4bfc96 bufio: add Writer.AvailableBuffer
+ 2021-09-11 23832ba2e2 reflect: optimize for maps with string keys
+ 2021-09-11 a50225a0dc bufio: make Reader.Reset and Writer.Reset work on the zero value
+ 2021-09-10 cf2fe5d6f1 doc/asm: fix HTML markup
+ 2021-09-10 1bf2cd1291 debug/elf: retain original error message when getSymbols fails.
+ 2021-09-10 5a4b9f9494 time: reference -tags=timetzdata in testing panic
+ 2021-09-10 025308fe08 testing: increase alternation precedence
+ 2021-09-10 5a94a90d84 cmd/compile/internal/types2: better error message for invalid array decls
+ 2021-09-10 da1aa65053 cmd/compile/internal/syntax: correct follow token for type parameter lists
+ 2021-09-10 96ab854ab0 cmd/compile/internal: better AST line highlight in ssa.html
+ 2021-09-10 90c5660616 embed: guarantee the returned file of FS.Open implements io.Seeker
+ 2021-09-10 c69f5c0d76 cmd/compile: add support for Abs and Copysign intrinsics on riscv64
+ 2021-09-10 2091bd3f26 cmd/compile: simiplify arm64 bitfield optimizations
+ 2021-09-09 b32209d22d cmd/compile: fix test case for unified IR (fix build)
+ 2021-09-09 1a708bcf1d cmd/compile: don't crash while reporting invalid alias cycle
+ 2021-09-09 426ff3746f cmd/cgo, runtime/cgo: avoid GCC/clang conversion warnings
+ 2021-09-09 73483df406 cmd/compile/internal/syntax: better error message for missing type constraint
+ 2021-09-09 e1c3f2158f time: propagate "," separator for fractional seconds into Format
+ 2021-09-09 c981874a5a cmd/compile: fix implement for closure in a global assignment
+ 2021-09-09 2c4f389c02 cmd/link: enable internal linker in more cases for ppc64le
+ 2021-09-09 fb84e99eb7 test: add compiler regress tests for #46461
+ 2021-09-09 b9e1a24581 cmd/compile: fix case where init info of OAS node is dropped
+ 2021-09-09 f9271e4f85 go/types, types2: rename RParams -> RecvTypeParams
+ 2021-09-09 ea434450c2 reflect: add hooks for dealing with narrow width floats
+ 2021-09-09 a53e3d5f88 net: deprecate (net.Error).Temporary
+ 2021-09-09 19457a58e5 cmd/compile: stenciled conversions might be NOPs
+ 2021-09-09 a295b3cec8 test: re-enable AsmCheck tests for types2-based frontends
+ 2021-09-09 66f0d35f71 go/types: reduce number of delayed functions
+ 2021-09-09 d2a77f1c76 go/types: handle recursive type parameter constraints
+ 2021-09-09 9e1eea6f8b go/types: detect constraint type inference cycles
+ 2021-09-09 b86e8dd0f3 test/typeparam: fix issue48094b test build
+ 2021-09-09 c84f3a4004 syscall: drop fallback to pipe in Pipe on linux/arm
+ 2021-09-09 376a079762 cmd/compile: fix unified IR panic when expanding nested inline function
+ 2021-09-09 6edc57983a internal/poll: report open fds when TestSplicePipePool fails
+ 2021-09-09 2481f6e367 cmd/compile: fix wrong instantiated type for embedded receiver
+ 2021-09-09 d62866ef79 cmd/compile: move checkptr alignment to SSA generation
+ 2021-09-09 8fad81cd62 cmd/compile: fold handling OCONV logic to separate function
+ 2021-09-09 9cbc76bdf9 cmd/internal/obj/arm64: add checks for incorrect use of REGTMP register
+ 2021-09-09 42563f89d7 cmd/compile: remove 'ext' fields from unified IR reader/writer types
+ 2021-09-09 4c52eac49b cmd/compile: simplify value coding for unified IR
+ 2021-09-09 e30a09013b cmd/compile: extrapolate $GOROOT in unified IR
+ 2021-09-08 a1f6208e56 go/types, types2: add Environment to Config
+ 2021-09-08 f5f8a911d8 cmd/compile/internal/types2: spell out 'Type' in type parameter APIs
+ 2021-09-08 bff39cf6cb cmd/compile: add automated rewrite cycle detection
+ 2021-09-08 b61e1ed863 cmd/compile/internal/types2: temporarily pin the Checker to Interface during checking
+ 2021-09-08 47f3e1e02c cmd/compile/internal/types2: move NewTypeParam off of Checker
+ 2021-09-08 ccc927b8f6 cmd/compile/internal/types2: move typeHash to environment.go
+ 2021-09-08 30e9bfbcef cmd/compile/internal/types2: implement deduplication of instances using the Environment
+ 2021-09-08 0406d3a8e5 go/ast: rename MultiIndexExpr to IndexListExpr

Change-Id: I7f917d45b0507c122c212305144b0b455618ff54

2 years agocmd/compile: extend dump-to-file to handle "genssa" (asm) case.
David Chase [Thu, 9 Sep 2021 20:34:02 +0000 (16:34 -0400)]
cmd/compile: extend dump-to-file to handle "genssa" (asm) case.

Extend the existing dump-to-file to also do assembly output
to make it easier to write debug-information tests that check
for line-numbering in particular orders.

Includes POC test (which is silent w/o -v):
go test  -v -run TestDebugLines cmd/compile/internal/ssa
=== RUN   TestDebugLines
Preserving temporary directory /var/folders/v6/xyzzy/T/debug_lines_test321
About to run (cd /var/folders/v6/xyzzy/T/debug_lines_test321; \
    GOSSADIR=/var/folders/v6/xyzzy/T/debug_lines_test321 \
    /Users/drchase/work/go/bin/go build -o foo.o \
    '-gcflags=-N -l -d=ssa/genssa/dump=sayhi' \
    /Users/drchase/work/go/src/cmd/compile/internal/ssa/testdata/sayhi.go )
Saw stmt# 8 for submatch '8' on dump line #7 = ' v107   00005 (+8)  MOVQ    AX, "".n(SP)'
Saw stmt# 9 for submatch '9' on dump line #9 = ' v87    00007 (+9)  MOVUPS  X15, ""..autotmp_2-32(SP)'
Saw stmt# 10 for submatch '10' on dump line #46 = ' v65     00044 (+10)     MOVUPS  X15, ""..autotmp_2-32(SP)'
Saw stmt# 11 for submatch '11' on dump line #83 = ' v131    00081 (+11)     MOVQ    "".wg+8(SP), AX'
--- PASS: TestDebugLines (4.95s)
PASS
ok   cmd/compile/internal/ssa 5.685s

Includes a test to ensure that inlining information is printed correctly.

Updates #47880.

Change-Id: I83b596476a88687d71d5b65dbb94641a576d747e
Reviewed-on: https://go-review.googlesource.com/c/go/+/348970
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2 years ago[dev.fuzz] cmd/go: in 'go test' don't allow multiple packages with -fuzz
Jay Conrod [Wed, 15 Sep 2021 22:30:18 +0000 (15:30 -0700)]
[dev.fuzz] cmd/go: in 'go test' don't allow multiple packages with -fuzz

Until we have a system for managing load across multiple fuzz targets
in multiple test executables, we'll only support fuzzing one target in
one package at a time. Users can still run multiple 'go test -fuzz'
commands concurrently, but this may overwhelm some systems unless
-parallel and -p are set carefully.

For #46312

Change-Id: If84c58d1b3e60498ce955eae5ad4d52100dbd4b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/350156
Trust: Jay Conrod <jayconrod@google.com>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2 years agocmd/go: write go.mod requirements more consistently for go 1.17+
Jay Conrod [Thu, 9 Sep 2021 16:38:55 +0000 (09:38 -0700)]
cmd/go: write go.mod requirements more consistently for go 1.17+

If go.mod declares 1.17 or higher, when the go command rewrites go.mod
(for example, after 'go mod tidy'), it will be more consistent about
moving requirements in two blocks, one containing only direct
requirements, and one containing only indirect requirements.

The go command will not move requirements into or out of a block with
comments. It may still update versions and "// indirect" comments, and
it may delete unneeded requirements though.

Fixes #47563
Fixes #47733

Change-Id: Ia6fb3e302be53097893abf01aa7cea60ac7b069a
Reviewed-on: https://go-review.googlesource.com/c/go/+/343432
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2 years agocmd/link: generate DIE for types referenced only through dictionaries
Alessandro Arzilli [Fri, 3 Sep 2021 15:00:41 +0000 (17:00 +0200)]
cmd/link: generate DIE for types referenced only through dictionaries

Generate debug_info entries for types that are only referenced through
dictionaries.

Change-Id: Ic36c2e6d9588ec6746793bb213c2dc0e17a8a850
Reviewed-on: https://go-review.googlesource.com/c/go/+/350532
Run-TryBot: Alessandro Arzilli <alessandro.arzilli@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Trust: Dan Scales <danscales@google.com>
Trust: David Chase <drchase@google.com>

2 years agocmd/compile: delay all transforms for generic funcs/methods
Dan Scales [Tue, 7 Sep 2021 00:46:50 +0000 (17:46 -0700)]
cmd/compile: delay all transforms for generic funcs/methods

This change cleans up the code, by just delaying all transforms on
generic function methods/functions until stenciling time. That way, we
don't have extra code to decide whether to delay, or an extra value for
the typecheck flag. We are already doing all possible transforms at
stencil time anyway, so no changes to the stenciling code.

transform.go includes a change for one case where we check for shape
rather than tparam, now that we only apply transforms to stenciled
functions, not generic functions. This change is to allow CONVIFACE node
to be correctly inserted (needed for dictionaries), even with this
strange code that doesn't add the CONVIFACE node if the concrete type is
NOT huge...

Change-Id: I5f1e71fab11b53385902074915b3ad85f8e753fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/350736
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>

2 years agogo/types: export Named._Orig as Named.Origin
Robert Findley [Mon, 20 Sep 2021 17:28:25 +0000 (13:28 -0400)]
go/types: export Named._Orig as Named.Origin

Export the _Orig method for Named types, and rename to Origin.  As
discussed in #47916, Orig is easily confused with Original, which is
not as good a name. Spelling out 'Origin' resolves the ambiguity.

Updates #47916

Change-Id: I377c73de82310d3f6aa0bd82dddcd60ee067155b
Reviewed-on: https://go-review.googlesource.com/c/go/+/350996
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agocmd/compile: fix transform.AssignOp to deal with tricky case
Dan Scales [Mon, 20 Sep 2021 00:17:31 +0000 (17:17 -0700)]
cmd/compile: fix transform.AssignOp to deal with tricky case

When going to dictionary formats derived from the function
instantiations, I had broken out noder.Assignop() to deal specially with
shape types, but didn't quite get the tricky case right. We still need
to allow conversion between shape types, but if the destination is an
interface, we need to use CONVIFACE rather than CONVNOP.

Fixes #48453.

Change-Id: I8c4b39c2e628172ac34f493f1dd682cbac1e55ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/350949
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2 years ago[dev.fuzz] Revert "[dev.fuzz] testing: convert seed corpus values where possible"
Katie Hockman [Thu, 16 Sep 2021 14:03:04 +0000 (10:03 -0400)]
[dev.fuzz] Revert "[dev.fuzz] testing: convert seed corpus values where possible"

This reverts commit 413c125da38990720744c0d98ab65c0d5b1602da.

Reason for revert: Giving this more thought, we've decided that
converting types under the hood may cause unexpected behavior to
users. This is a feature that can always be added after more
consideration has been done, but is not something that can be
removed due to the backwards compatibility promise.

Updates golang/go#45593

Change-Id: I79bab24979d7e4c294e6cb6455d4c7729d6a0efb
Reviewed-on: https://go-review.googlesource.com/c/go/+/350251
Trust: Katie Hockman <katie@golang.org>
Trust: Joe Tsai <joetsai@digital-static.net>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Joe Tsai <joetsai@digital-static.net>
2 years ago[dev.fuzz] internal/fuzz: warn if fuzzing begins with empty corpus
Katie Hockman [Thu, 16 Sep 2021 14:34:46 +0000 (10:34 -0400)]
[dev.fuzz] internal/fuzz: warn if fuzzing begins with empty corpus

Fixes golang/go#46219

Change-Id: I7b32707d490c046d15324a3d297ec8d9f45b6e36
Reviewed-on: https://go-review.googlesource.com/c/go/+/350269
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2 years agocmd/compile: document register-based ABI for ppc64
Lynn Boger [Tue, 17 Aug 2021 12:24:31 +0000 (07:24 -0500)]
cmd/compile: document register-based ABI for ppc64

This adds the ppc64 information to the ABI doc.

Change-Id: I55ce77a59a8b50309d02e3e0de0cea3fc62ad003
Reviewed-on: https://go-review.googlesource.com/c/go/+/342869
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 years agocmd/compile: fix simplification rules on arm/arm64
Keith Randall [Sun, 19 Sep 2021 21:20:56 +0000 (14:20 -0700)]
cmd/compile: fix simplification rules on arm/arm64

Fixes #48473

Change-Id: Ic1e918f916eae223a3b530a51a58f03031924670
Reviewed-on: https://go-review.googlesource.com/c/go/+/350913
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 years agocmd/compile: ensure constant shift amounts are in range for arm
Keith Randall [Mon, 20 Sep 2021 04:09:57 +0000 (21:09 -0700)]
cmd/compile: ensure constant shift amounts are in range for arm

Ensure constant shift amounts are in the range [0-31]. When shift amounts
are out of range, bad things happen. Shift amounts out of range occur
when lowering 64-bit shifts (we take an in-range shift s in [0-63] and
calculate s-32 and 32-s, both of which might be out of [0-31]).

The constant shift operations themselves still work, but their shift
amounts get copied unmolested to operations like ORshiftLL which use only
the low 5 bits. That changes an operation like <<100 which unconditionally
produces 0, to <<4, which doesn't.

Fixes #48476

Change-Id: I87363ef2b4ceaf3b2e316426064626efdfbb8ee3
Reviewed-on: https://go-review.googlesource.com/c/go/+/350969
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 years agogo/test: add a test for issue 48344
Dan Scales [Thu, 16 Sep 2021 16:42:06 +0000 (09:42 -0700)]
go/test: add a test for issue 48344

This was fixed by https://go-review.googlesource.com/c/go/+/349613
and https://go-review.googlesource.com/c/go/+/349614

Fixes #48344

Change-Id: I4c62109fd34b20566b07fcca87fb3946a5702fef
Reviewed-on: https://go-review.googlesource.com/c/go/+/350309
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>

2 years agocmd/compile: allow rotates to be merged with logical ops on arm64
Keith Randall [Sun, 19 Sep 2021 20:51:37 +0000 (13:51 -0700)]
cmd/compile: allow rotates to be merged with logical ops on arm64

Fixes #48002

Change-Id: Ie3a157d55b291f5ac2ef4845e6ce4fefd84fc642
Reviewed-on: https://go-review.googlesource.com/c/go/+/350912
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 years agocmd/compile: update doc at top of iexport.go on the changes for typeparams
Dan Scales [Mon, 20 Sep 2021 01:26:19 +0000 (18:26 -0700)]
cmd/compile: update doc at top of iexport.go on the changes for typeparams

Add in the documentation of the new declarations and type descriptors to
support parameterized functions and types.

Change-Id: Ia21c544caa704309cc8fd639f104c192e1786b72
Reviewed-on: https://go-review.googlesource.com/c/go/+/350951
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agocmd/compile: rename instType -> instanceType
Dan Scales [Mon, 20 Sep 2021 01:18:41 +0000 (18:18 -0700)]
cmd/compile: rename instType -> instanceType

This is to keep in alignment with the naming in go/types.

Change-Id: I19ded29b39665d7b892fdbc8e92c7f15caf7ab66
Reviewed-on: https://go-review.googlesource.com/c/go/+/350950
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>

2 years agocmd/cgo: remove hardcoded '-pie' ldflag for linux/arm
jochen weber [Fri, 14 May 2021 12:45:13 +0000 (12:45 +0000)]
cmd/cgo: remove hardcoded '-pie' ldflag for linux/arm

a minimally invasive fix proposal for #45940. which keeps the fix for #26197.

an alternative for (#26197) could be to fail if we have both flags. adding/removing a flag without an message to the user is inconvenient.

Change-Id: I6ac2524d81ff57202fbe3032a53afd5106270a9e
GitHub-Last-Rev: edaf02fa455329b5d794a139f99874b5e8cc12d1
GitHub-Pull-Request: golang/go#45989
Reviewed-on: https://go-review.googlesource.com/c/go/+/317569
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Bryan C. Mills <bcmills@google.com>

2 years agocmd/compile: fix export/import of range loop.
Dan Scales [Sun, 19 Sep 2021 16:23:21 +0000 (09:23 -0700)]
cmd/compile: fix export/import of range loop.

As with other recent issues, the Init field of a range loop was not
being handled properly. Generally, it is much better to explicitly
import/export the Init statements, else they are incorrectly added
before the associated node, rather than as the Init value of the node.
This was causing labels to not be correctly added to the range loop that
it is immediately preceding.

Made the ORANGE handling completely similar to the OFOR handling.

Fixes #48462

Change-Id: I999530e84f9357f81deaa3dda50660061f710e7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/350911
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Dan Scales <danscales@google.com>

2 years agocmd/compile: fold double negate on arm64
Keith Randall [Sun, 19 Sep 2021 16:23:37 +0000 (09:23 -0700)]
cmd/compile: fold double negate on arm64

Fixes #48467

Change-Id: I52305dbf561ee3eee6c1f053e555a3a6ec1ab892
Reviewed-on: https://go-review.googlesource.com/c/go/+/350910
Trust: Keith Randall <khr@golang.org>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2 years agocmd/compile: implement constant rotates on arm64
Keith Randall [Sun, 19 Sep 2021 16:09:55 +0000 (09:09 -0700)]
cmd/compile: implement constant rotates on arm64

Explicit constant rotates work, but constant arguments to
bits.RotateLeft* needed the additional rule.

Fixes #48465

Change-Id: Ia7544f21d0e7587b6b6506f72421459cd769aea6
Reviewed-on: https://go-review.googlesource.com/c/go/+/350909
Trust: Keith Randall <khr@golang.org>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2 years agocmd/compile: fix missing markHiddenClosureDead in deadcode pass
Cuong Manh Le [Sat, 18 Sep 2021 16:46:47 +0000 (23:46 +0700)]
cmd/compile: fix missing markHiddenClosureDead in deadcode pass

CL 342350 fixed panic with dead hidden closures, by marking discarded
hidden closure as dead, and won't compile them. However, the fix is
incomplete. In case the "if" or "else" block end with panic or return
statement:

if true { return }
# All nodes starts from here are dead

the dead nodes must be processed with markHiddenClosureDead, but they
are not, causing the compiler crashes.

This CL adds that missing part.

Fixes #48459

Change-Id: Ibdd10a61fc6459d139bbf4a66b0893b523ac6b67
Reviewed-on: https://go-review.googlesource.com/c/go/+/350695
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2 years agonet/rpc: remove warnings on incompatible methods at registration
Eli Bendersky [Tue, 14 Sep 2021 22:02:55 +0000 (15:02 -0700)]
net/rpc: remove warnings on incompatible methods at registration

When registering an RPC server, the type being registered may
have additional methods that are not meant to be exposed as
RPC endpoints. Remove the warnings net/rpc produces in
this case. The functionality to report warnings is kept in the code
with a compile-time constant that can be enabled for debugging.

The documentation of net/rpc states that only methods
satisfying a set of criteria will be made available, while other
methods will be ignored.

Fixes #19957

Change-Id: I5f8a148b4be1fdfffb2cd2029871193eaf24b751
Reviewed-on: https://go-review.googlesource.com/c/go/+/350009
Reviewed-by: Daniel Lublin <daniel@lublin.se>
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Carlos Amedee <carlos@golang.org>

2 years agocmd/compile: SSA ".this" variable
Cherry Mui [Fri, 17 Sep 2021 20:26:13 +0000 (16:26 -0400)]
cmd/compile: SSA ".this" variable

We used to not SSA ".this" variable, because in tail-call method
wrappers it relies on updating ".this" in place in memory, and
the tail call IR node and SSA op do not have an explicit use of
".this". It is no longer the case for the new tail call
representation. Remove the restriction.

Change-Id: I4e1ce8459adbb0d5a80c64f1ece982737bd95305
Reviewed-on: https://go-review.googlesource.com/c/go/+/350751
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2 years agocmd/compile: remove self copies in tail-call wrappers
Cherry Mui [Thu, 16 Sep 2021 17:55:45 +0000 (13:55 -0400)]
cmd/compile: remove self copies in tail-call wrappers

The previous CL re-enables tail calls for method wrappers. But
with the changed IR and SSA representation, for stack arguments
it generates self copies. This CL makes the compiler detect the
self copies and remove them.

Change-Id: I7252572a1a47834f28b6706e45906e2356408e02
Reviewed-on: https://go-review.googlesource.com/c/go/+/350349
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2 years agotime: re-add space-padded day of year to docs
Riley Avron [Tue, 14 Sep 2021 18:45:53 +0000 (18:45 +0000)]
time: re-add space-padded day of year to docs

CL 320252 reworked the time docs, but accidentally deleted the format __2
from the sentence describing the three-character day of year component.

Change-Id: I3f583733028657c2a677358a25e062ea81835ce8
GitHub-Last-Rev: 2fa98324191500fd6a37097a9712ae23cc509269
GitHub-Pull-Request: golang/go#48387
Reviewed-on: https://go-review.googlesource.com/c/go/+/349929
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Carlos Amedee <carlos@golang.org>

2 years agotime: support fractional timezone minutes in MarshalBinary
HowJMay [Thu, 16 Sep 2021 18:22:06 +0000 (18:22 +0000)]
time: support fractional timezone minutes in MarshalBinary

If the time is in 'LMT' and has fractional minute, then
`MarshalBinary()` and `UnmarshalBinary()` will encode/decode the time
in `timeBinaryVersionV2` in which the fractional minute is at
bit 15 and 16, and presented in seconds.

Fixes #39616

Change-Id: Ib762fb5fa26f54b1a8377a5dde0b994dd5a1236a
GitHub-Last-Rev: 455d7a2496ba67d4a82890b14d57000e1a8a1415
GitHub-Pull-Request: golang/go#40293
Reviewed-on: https://go-review.googlesource.com/c/go/+/243402
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Carlos Amedee <carlos@golang.org>

2 years agocmd/compile: delay transformAssign if lhs/rhs have typeparam
Dan Scales [Thu, 2 Sep 2021 15:47:40 +0000 (08:47 -0700)]
cmd/compile: delay transformAssign if lhs/rhs have typeparam

This also requires that we sometimes delay transformSelect(), if the
assignments in the Comm part of the select have not been transformed.

Fixes #48137

Change-Id: I163aa1f999d1e63616280dca807561b12b2aa779
Reviewed-on: https://go-review.googlesource.com/c/go/+/347915
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2 years agocmd/compile: restore tail call for method wrappers
Cherry Mui [Sat, 11 Sep 2021 02:05:55 +0000 (22:05 -0400)]
cmd/compile: restore tail call for method wrappers

For certain type of method wrappers we used to generate a tail
call. That was disabled in CL 307234 when register ABI is used,
because with the current IR it was difficult to generate a tail
call with the arguments in the right places. The problem was that
the IR does not contain a CALL-like node with arguments; instead,
it contains an OAS node that adjusts the receiver, than an
OTAILCALL node that just contains the target, but no argument
(with the assumption that the OAS node will put the adjusted
receiver in the right place). With register ABI, putting
arguments in registers are done in SSA. The assignment (OAS)
doesn't put the receiver in register.

This CL changes the IR of a tail call to take an actual OCALL
node. Specifically, a tail call is represented as

OTAILCALL (OCALL target args...)

This way, the call target and args are connected through the OCALL
node. So the call can be analyzed in SSA and the args can be passed
in the right places.

(Alternatively, we could have OTAILCALL node directly take the
target and the args, without the OCALL node. Using an OCALL node is
convenient as there are existing code that processes OCALL nodes
which do not need to be changed. Also, a tail call is similar to
ORETURN (OCALL target args...), except it doesn't preserve the
frame. I did the former but I'm open to change.)

The SSA representation is similar. Previously, the IR lowers to
a Store the receiver then a BlockRetJmp which jumps to the target
(without putting the arg in register). Now we use a TailCall op,
which takes the target and the args. The call expansion pass and
the register allocator handles TailCall pretty much like a
StaticCall, and it will do the right ABI analysis and put the args
in the right places. (Args other than the receiver are already in
the right places. For register args it generates no code for them.
For stack args currently it generates a self copy. I'll work on
optimize that out.) BlockRetJmp is still used, signaling it is a
tail call. The actual call is made in the TailCall op so
BlockRetJmp generates no code (we could use BlockExit if we like).

This slightly reduces binary size:
              old        new
cmd/go     14003088   13953936
cmd/link    6275552    6271456

Change-Id: I2d16d8d419fe1f17554916d317427383e17e27f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/350145
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
2 years agocmd/compile: fix import/export of Init and Def fields.
Dan Scales [Fri, 17 Sep 2021 19:18:19 +0000 (12:18 -0700)]
cmd/compile: fix import/export of Init and Def fields.

Change so that the Init and Def fields of assignments and OSELREVC2
nodes are exported/imported properly.

A quirk of iimport.go is that it automatically converts an ODCL node to
an ODCL/OAS sequence (where the OAS is to just zero out the declared
variable). Given that the Inits are properly fixed, o.stmt needs
adjustment for the OSELRECV2 case to skip over the new OAS nodes that
are inserted only on re-import.

Change-Id: Ic38017efca4b7ca9b3952ffbbfca067380902b7a
Reviewed-on: https://go-review.googlesource.com/c/go/+/350809
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Trust: Dan Scales <danscales@google.com>

2 years agogo/types: ensure that we always get a new signature in expandNamed
Robert Findley [Wed, 15 Sep 2021 21:18:37 +0000 (17:18 -0400)]
go/types: ensure that we always get a new signature in expandNamed

CL 349412 introduced a bug when Checker.subst does not return a new
signature: we were still setting the receiver to the instantiated type.

I'm not sure how this could manifest in practice (other than confusing
object strings). It's possible that I could generate a testdata-driven
test for this, but in the interest of time I just added a test to verify
object strings.

Change-Id: I29bc8e1419ddc4574755c3def52d18cb71c738eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/350143
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agocmd/go: fix GOARCH value in GOAMD64 docs
Tobias Klauser [Fri, 17 Sep 2021 20:34:15 +0000 (22:34 +0200)]
cmd/go: fix GOARCH value in GOAMD64 docs

GOAMD64 is for GOARCH=amd64. Fix the GOAMD64 environment variable docs
introduced by CL 349595.

Change-Id: I794990ebe2e306d21ed275446fc52373bfe4ae7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/350534
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

2 years agosyscall: implement Pipe using pipe2 syscall on all linux platforms
Tobias Klauser [Fri, 17 Sep 2021 12:25:54 +0000 (14:25 +0200)]
syscall: implement Pipe using pipe2 syscall on all linux platforms

Most architectures currently already implement Pipe using the pipe2
syscall. Only 386, amd64 and mips{,le} still use the pipe syscall.
However, some systems (e.g. Android seccomp policies) block that
syscall, see #40828 for an example.

The pipe2 syscall was added in Linux kernel version 2.6.27. The minimum
required Linux kernel version for Go 1.18 will be changed to 2.6.32
per #45964 so it is possible to unify the implementation of Pipe using
the pipe2 syscall.

For #45964

Change-Id: I8ed6a391300c95f3107b4ec6b27d320e42fb535b
Reviewed-on: https://go-review.googlesource.com/c/go/+/350530
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agosyscall: remove //sysnb comment generating Setreuid for linux/arm64
Tobias Klauser [Fri, 17 Sep 2021 12:23:04 +0000 (14:23 +0200)]
syscall: remove //sysnb comment generating Setreuid for linux/arm64

CL 210639 moved the //sysnb for Setreuid from syscall_linux_$GOARCH.go
to syscall_linux.go but forgot to remove the comment from
syscall_linux_arm64.go which leads to Setreuid being generated twice for
linux/arm64. Remove that //sysnb comment to avoid this.

Change-Id: I2c8ad95f786530ca964685b0a4fe463c64764307
Reviewed-on: https://go-review.googlesource.com/c/go/+/350531
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agocmd/compile: fix generic type handling in crawler
Dan Scales [Tue, 14 Sep 2021 01:50:19 +0000 (18:50 -0700)]
cmd/compile: fix generic type handling in crawler

There are a bunch of nodes beside ONAME and OTYPE, (such as OSTRUCTLIT
and OCOMPLIT) which can introduce a generic type that we need to mark.
So, just mark any generic type on any node in markInlBody. In this
particular issue, the type is introduced by an OSTRUCTLIT node.

Updates #48337

Change-Id: I271932518f0c1fb54d91a603e01a855c69df631d
Reviewed-on: https://go-review.googlesource.com/c/go/+/349909
Trust: Dan Scales <danscales@google.com>
Trust: Carlos Amedee <carlos@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2 years agointernal/poll: inject a hook into the runtime finalizer to count the closed pipes
Andy Pan [Wed, 15 Sep 2021 04:37:20 +0000 (12:37 +0800)]
internal/poll: inject a hook into the runtime finalizer to count the closed pipes

Fixes #48066

Change-Id: Icd6974dfcc496c054bb096e5d70de6e135984517
Reviewed-on: https://go-review.googlesource.com/c/go/+/349774
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

2 years agolog: don't format if writing to io.Discard
Ian Lance Taylor [Thu, 9 Sep 2021 21:49:41 +0000 (14:49 -0700)]
log: don't format if writing to io.Discard

Fixes #47164

Change-Id: Ied03842360be4c86f1d9ead816f12c057a1f8dad
Reviewed-on: https://go-review.googlesource.com/c/go/+/348741
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Valentin Deleplace <deleplace@google.com>
2 years agocmd/compile/internal/noder: hide TestUnifiedCompare behind -cmp flag
Matthew Dempsky [Fri, 17 Sep 2021 18:12:31 +0000 (11:12 -0700)]
cmd/compile/internal/noder: hide TestUnifiedCompare behind -cmp flag

This test is fragile and is starting to impede others' work. This CL
disables it until I have time to either find a solution for the issues
or decide to just delete the test altogether.

Change-Id: Icefabb6d3fbedec5d16536de78be4ca20d63133c
Reviewed-on: https://go-review.googlesource.com/c/go/+/350729
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
2 years agoruntime/cgo: save and restore X3 (aka GP) for crosscall1 on riscv64
Joel Sing [Thu, 15 Jul 2021 16:56:08 +0000 (02:56 +1000)]
runtime/cgo: save and restore X3 (aka GP) for crosscall1 on riscv64

The C code that is calling crosscall1 may depend on the GP register, which Go code
will currently clobber. Save and restore both X3 (aka GP) and X4 (aka TP) in this
code path (note that the Go code does not currently clobber X4, however there is
minimal downside to saving and restoring it here, which then also matches crosscall2).

Updates #47100

Change-Id: Icbb706d7889d5dc59de3efb2b510fa6ea2069496
Reviewed-on: https://go-review.googlesource.com/c/go/+/334870
Trust: Joel Sing <joel@sing.id.au>
Trust: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>

2 years agoruntime: fix prettyprinting of parametric types in gdb
Alessandro Arzilli [Fri, 17 Sep 2021 11:48:39 +0000 (13:48 +0200)]
runtime: fix prettyprinting of parametric types in gdb

golang.org/cl/344929 broke the minimal functionality that the python
pretty printer for GDB had, this change restores it to its status prior
to that CL.

Change-Id: I4c7141d4ff726d224a074ecc533d0f896fc0052c
Reviewed-on: https://go-review.googlesource.com/c/go/+/350529
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Trust: Than McIntosh <thanm@google.com>

2 years agocmd/internal/obj/riscv: improve instruction validation
Joel Sing [Mon, 13 Sep 2021 16:21:22 +0000 (02:21 +1000)]
cmd/internal/obj/riscv: improve instruction validation

Ensure that rs2 is none for various instruction encodings. Fix a couple of cases
where it should have been but is not.

Change-Id: I9f8211a0257e49643dbbc89e158e048050ebe6f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/349649
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

2 years agosyscall: do not use handle lists on windows when NoInheritHandles is true
Jason A. Donenfeld [Thu, 16 Sep 2021 22:11:19 +0000 (16:11 -0600)]
syscall: do not use handle lists on windows when NoInheritHandles is true

If NoInheritHandles is passed, then we shouldn't attempt to do anything
with handle lists. Otherwise CreateProcess fails with invalid param,
because it's being told both to not inherit handles and to inherit
certain handles.

This commit fixes that by using the same logic for handle lists as it
does for enabling or disabling handle inheritance. It also adds a test
to make sure this doesn't regress again.

Fixes #48040

Change-Id: I507261baeec263091738ab90157a991d917dc92f
Reviewed-on: https://go-review.googlesource.com/c/go/+/350411
Reviewed-by: Patrik Nyblom <pnyb@google.com>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>

2 years agoall: remove incorrectly repeated words in comments
Dan Kortschak [Sun, 8 Aug 2021 10:14:30 +0000 (19:44 +0930)]
all: remove incorrectly repeated words in comments

Change-Id: Icbf36e1cd8311b40d18177464e7c41dd8cb1c65b
Reviewed-on: https://go-review.googlesource.com/c/go/+/340350
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Carlos Amedee <carlos@golang.org>

2 years agoA+C: update name to real name and add to AUTHORS
ian woolf [Fri, 20 Aug 2021 02:16:20 +0000 (10:16 +0800)]
A+C: update name to real name and add to AUTHORS

Change-Id: I857b0e9aa7d933879239ef7ebc0d1a2812a74c25
Reviewed-on: https://go-review.googlesource.com/c/go/+/343533
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Carlos Amedee <carlos@golang.org>

2 years agocmd/cgo: for godefs, don't let field prefix removal cause duplicates
Ian Lance Taylor [Wed, 15 Sep 2021 23:11:37 +0000 (16:11 -0700)]
cmd/cgo: for godefs, don't let field prefix removal cause duplicates

Fixes #48396

Change-Id: Idd7cb66536ef513806c472d394a929bc271fc26b
Reviewed-on: https://go-review.googlesource.com/c/go/+/350159
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2 years agotesting: skip panics when picking the line number for decoration
Caleb Spare [Sat, 28 Aug 2021 23:06:43 +0000 (16:06 -0700)]
testing: skip panics when picking the line number for decoration

Fixes #31154

Change-Id: I4cfd98b5e79f1abdc93044fb66855ac2cc0a9a49
Reviewed-on: https://go-review.googlesource.com/c/go/+/345909
Run-TryBot: Caleb Spare <cespare@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Carlos Amedee <carlos@golang.org>

2 years agogo/types, types2: add an additional shift test case
Robert Griesemer [Thu, 16 Sep 2021 22:09:31 +0000 (15:09 -0700)]
go/types, types2: add an additional shift test case

The extra test just confirms that the type-checker internally
agrees with the spec with the (otherwise invisible) type given
to an untyped constant in a specific shift expression.

For #48422.

Change-Id: I6d98045f90bd20b0cc0a96a147bec9701039cb07
Reviewed-on: https://go-review.googlesource.com/c/go/+/350410
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2 years agospec: fix incorrect type in a shift example
Robert Griesemer [Thu, 16 Sep 2021 22:00:47 +0000 (15:00 -0700)]
spec: fix incorrect type in a shift example

Thanks to @bodar (Github) for finding this.

Fixes #48422.

Change-Id: I031c3d82a02db1d204e2b86b494d89784d37f073
Reviewed-on: https://go-review.googlesource.com/c/go/+/350409
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2 years agocmd/compile: fixing writebarrier.go for -G=3
wdvxdr [Tue, 14 Sep 2021 05:37:21 +0000 (13:37 +0800)]
cmd/compile: fixing writebarrier.go for -G=3

This is caused by some nodes didn't carry the real line number.
Noder1 wraps these node with ir.ParenExpr. To fix this issue,
wraps this node like what noder1 does.

Change-Id: I212cad09b93b8bf1a7adfad416d229d15711918a
Reviewed-on: https://go-review.googlesource.com/c/go/+/349769
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Keith Randall <khr@golang.org>

2 years agocmd/compile: preserve statements better in expandCalls
David Chase [Mon, 23 Aug 2021 21:19:34 +0000 (17:19 -0400)]
cmd/compile: preserve statements better in expandCalls

Arg/Load/Dereference rewriting was not using the best Pos for
translated values.  I also investigated whether OpCopy processing
was losing statements, and though they flood the debugging output,
doing the "obvious" thing of moving statement marks from copi-er to
copy-ee actually makes the resulting binary score slightly worse on
statement-boundary measures.
(for -N -l, 0.9994 vs 0.9995 from "nostmt -c sqle.test")

Fixes #47793.

Change-Id: I65cb878d0e5a3ceb5da4ef679020ca5f40e9b02b
Reviewed-on: https://go-review.googlesource.com/c/go/+/344769
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2 years agocmd/compile: fix LocResults formatting
Cherry Mui [Mon, 13 Sep 2021 20:23:28 +0000 (16:23 -0400)]
cmd/compile: fix LocResults formatting

When a LocResults is an empty list, it currently prints as ">".
Make it print "<>".

Change-Id: I0f596791b471d74cd4bbc0059e269708c80592dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/350144
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2 years agocmd/go: add GOAMD64 environment variable
nimelehin [Wed, 15 Sep 2021 04:30:49 +0000 (04:30 +0000)]
cmd/go: add GOAMD64 environment variable

The variable represents the microarchitecture level for which to compile.
Valid values are v1 (default), v2, v3, v4.

Updates #45453

Change-Id: I095197fc9239d79f98896d7e745e2341354daca4
GitHub-Last-Rev: f83ed17204606264073be5b9831f9d24f2f9dbc4
GitHub-Pull-Request: golang/go#48359
Reviewed-on: https://go-review.googlesource.com/c/go/+/349595
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Bryan C. Mills <bcmills@google.com>

2 years agocmd/go: clean paths before checking same directory
gerrard [Thu, 16 Sep 2021 07:10:58 +0000 (07:10 +0000)]
cmd/go: clean paths before checking same directory

Replace `filepath.Split`  with `filepath.Dir`. Clean paths before checking whether command line files are in same directory.

Fixes #47392

Change-Id: I259c3024e7670e78833622b02af4710bc4b68b31
GitHub-Last-Rev: c7c4905bb9c62737e95a4663813f076ee540046b
GitHub-Pull-Request: golang/go#47412
Reviewed-on: https://go-review.googlesource.com/c/go/+/337629
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2 years agocmd/cgo: add missing tab in exports for a result of void
Leonard Wang [Sat, 24 Jul 2021 14:17:21 +0000 (22:17 +0800)]
cmd/cgo: add missing tab in exports for a result of void

Change-Id: I45575afbad364c13b7179ebe3f3dfc4ed9671d2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/336891
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
2 years ago[dev.fuzz] internal/fuzz: rework default test behavior before fuzzing
Katie Hockman [Mon, 13 Sep 2021 16:23:43 +0000 (12:23 -0400)]
[dev.fuzz] internal/fuzz: rework default test behavior before fuzzing

This change refactors some of the code to support skipping a run
of the seed corpus by the go command before runFuzzing occurs.
Previously, the go command would run all seed corpus for all targets
that match the provided `run` argument. This will be redundant when
fuzzing a target. Now, the seed corpus is only run by targets other than
the one that's about to be fuzzed, and the worker handles running and
reporting issues with the seed corpus.

Part of the logic that needed close inspection is what to do if a
failure occurs during a testing-only or coverage-only fail. If the input
is already in the seed corpus, the fuzzing engine shouldn't add it. If
the input is currently in the cache, then it should be written to
testdata. In all cases, if an error occurs, we need to report this to
the user with enough information for them to debug it.

This uncovered some issues with our code when fuzzing without
instrumentation, and when -run=None was provided. There are some logic
fixes in this change, and some small refactors.

Fixes golang/go#48327
Fixes golang/go#48296

Change-Id: I9ce2be0219c5b09277ddd308df8bc5a46d4558fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/349630
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2 years agocmd/compile: remove unneeded early transforms, with dictionary change
Dan Scales [Sun, 12 Sep 2021 19:21:48 +0000 (12:21 -0700)]
cmd/compile: remove unneeded early transforms, with dictionary change

Now that we are computing the dictionary format on the instantiated
functions, we can remove the early transformation code that was needed
to create the implicit CONVIFACE nodes in the generic function.

Change-Id: I1695484e7d59bccbfb757994f3e40e84288759a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/349614
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2 years agocmd/compile: switch to computing dict format on instantiated functions
Dan Scales [Mon, 13 Sep 2021 20:53:18 +0000 (13:53 -0700)]
cmd/compile: switch to computing dict format on instantiated functions

Change to computing the dictionary form on each shape-instantiated
function, rather than once on the underlying generic function/method.
The problem with computing the dictionary format on the generic function
is that we had to force early transformations to create all the
needed/implicit CONVIFACE nodes, since many of these nodes cause the
need for a dictionary entry. Also, the dictionary entries needed can
different with different instantiations of the same generic function,
especially depending on whether a type argument is a non-interface or
interface type, or a instantiated type vs. a non-instantiated type.

By computing the dictionary format on the instantiated function, we are
scanning a function where all the transformations have been done to
create implicit CONVFIFACE nodes, and we know the above relevant
information about the type params (which are shapes).

Much of the change is more mechanical changes from typeparams to shapes,
and generic functions/info to instantiated functions/info. Some of the
most important non-mechanical changes are:

 - Separated out the dictionary transformations to nodes into a separate
   dictPass, since we need to analyze instantiated functions after
   stenciling, but before the dictionary transformations.

 - Added type param index to shape types, since we need to be able
   distinguish type params of an instantiation which are different but
   happen to have the same shape.

 - Allow the type substituter to work with shapes again (since for the
   dictionary entries we need to substitute shape params to the concrete
   type args).

 - Support types.IdentityStrict() that does strict type comparison (no
   special case for shapes). This needed for type substitution,
   formatting and creating dictionaries, etc. We can maybe create better
   names for this function.

 - Add new information to instInfo to contain a mapping from the shape
   type params to their instantiated type bound. This is needed when
   doing the dictionary transformations related to type bounds.

Change-Id: I1c3ca312c5384f318c4dd7d0858dba9766396ff6
Reviewed-on: https://go-review.googlesource.com/c/go/+/349613
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2 years agocmd/internal/obj/ppc64: generate prologue code compatible with new ABI
Lynn Boger [Mon, 16 Aug 2021 14:37:07 +0000 (09:37 -0500)]
cmd/internal/obj/ppc64: generate prologue code compatible with new ABI

This changes the ppc64 prologue to avoid clobbering the registers
that could contain incoming argument values. This means preserving
the values in R3 - R10 and R14 - R19 for ppc64.

Instead of modifying R3, R4, R5 and R6 the registers R22, R23, R24
and R25 are used.

The argument registers that could be clobbered by the call to
morestack are saved and restored around that call.

Change-Id: If354c3dc73f2c8537ef4e513e5a4c05d7bd22866
Reviewed-on: https://go-review.googlesource.com/c/go/+/343872
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 years agoruntime: fix setting of cpu features for amd64
nimelehin [Wed, 15 Sep 2021 18:37:08 +0000 (18:37 +0000)]
runtime: fix setting of cpu features for amd64

Because of wrong case of letters, the cpu features flags were not
set properly for amd64.

Fixes #48406.

Change-Id: If19782851670e91fd31d119f4701c47373fa7e71
GitHub-Last-Rev: 91c7321ca49343c86917f071babec8a004ca5c77
GitHub-Pull-Request: golang/go#48403
Reviewed-on: https://go-review.googlesource.com/c/go/+/350151
Trust: Keith Randall <khr@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

2 years ago[dev.fuzz] testing: fix internal error exit condition for fuzz workers
Jay Conrod [Tue, 14 Sep 2021 22:09:06 +0000 (15:09 -0700)]
[dev.fuzz] testing: fix internal error exit condition for fuzz workers

A fuzz worker process should exit with fuzzWorkerExitCode (70) if it
encounters an internal error.

This should generally only happen due to an I/O error on the worker
side. I can't think of a way to write a realistic test case for
this. test_fuzz_io_error.txt triggers an I/O error on the coordinator
side, which is similar.

Change-Id: I40d2e9aaf422e5ed925debcf7a152c252c3a6984
Reviewed-on: https://go-review.googlesource.com/c/go/+/349993
Trust: Jay Conrod <jayconrod@google.com>
Trust: Katie Hockman <katie@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2 years ago[dev.fuzz] internal: fuzzing output adjustments
Katie Hockman [Tue, 14 Sep 2021 19:47:41 +0000 (15:47 -0400)]
[dev.fuzz] internal: fuzzing output adjustments

Print the elapsed time as a nicely formatted duration, and
make small adjustments to the command line output while fuzzing.

Fixes golang/go#48132

Change-Id: Id95f84c0939171a777448c444d9b87d7af26b654
Reviewed-on: https://go-review.googlesource.com/c/go/+/349970
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2 years ago[dev.fuzz] testing: adjust -fuzz multiple match stdout
Katie Hockman [Tue, 14 Sep 2021 19:21:54 +0000 (15:21 -0400)]
[dev.fuzz] testing: adjust -fuzz multiple match stdout

Fixes golang/go#48131

Change-Id: I40ff130c849dffe38363ddc0282e93ceb74ae140
Reviewed-on: https://go-review.googlesource.com/c/go/+/349969
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2 years agocmd/go/internal/modload: prevent tidy downgrading disambiguating modules
Jay Conrod [Tue, 24 Aug 2021 18:51:07 +0000 (11:51 -0700)]
cmd/go/internal/modload: prevent tidy downgrading disambiguating modules

If an indirectly required module does not provide any packages needed
to build packages in the main module but is needed to disambiguate
imports, 'go mod tidy' may keep an indirect requirement on that module
to prevent it from being downgraded. This can prevent the introduction
of new ambiguities. This also ensures tidy keeps sums needed to load
all packages.

Fixes #47738

Change-Id: Ib8e33422b95394707894cda7cfbb71a4b111e0ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/344572
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2 years agocmd/compile: emit DWARF info about dictionary entries
Alessandro Arzilli [Wed, 25 Aug 2021 08:08:07 +0000 (10:08 +0200)]
cmd/compile: emit DWARF info about dictionary entries

When emitting the DIE of the instantiation of a generic function also
emit one DW_TAG_typedef_type entry for each dictionary entry in use,
referencing the shape type and having a custom attribute containing the
index inside the dictionary.

When emitting the DIE of variables that have an instantiated parametric
type, instead of referencing the shape type directly go through the
DW_TAG_typedef_type entry emitted for the dictionary entry describing
the real type of the variable.

Change-Id: Ia45d157ecd4c25e2b60300469e43bbb27a663582
Reviewed-on: https://go-review.googlesource.com/c/go/+/344929
Run-TryBot: Alessandro Arzilli <alessandro.arzilli@gmail.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Trust: Dan Scales <danscales@google.com>
Trust: Jeremy Faller <jeremy@golang.org>

2 years agocmd/compile: mark wrapper functions with DW_AT_trampoline
Alessandro Arzilli [Fri, 3 Sep 2021 13:04:52 +0000 (15:04 +0200)]
cmd/compile: mark wrapper functions with DW_AT_trampoline

Change DWARF generation to tag wrapper functions with the
"DW_AT_trampoline attribute". The intent is that debuggers can pick up
on this attr so as to skip through the wrapper to the eventual target.

DWARF standard allows for a couple of different possible variants of
the trampoline attr; this is the simplest variant (all it tells the
debugger is that the function is a wrapper, doesn't include a
reference to the wrapper routine).

This implementation keys off the WRAPPER LSym attribute, which is set
for method wrappers, ABI wrappers, and a selected set of runtime
assembly routines (ex: "runtime.call32").

Change-Id: Ib53e1bc56c02b86ca3ac5e7da1a541ec262726cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/347352
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Jeremy Faller <jeremy@golang.org>

2 years agogo/internal/gcimporter,cmd/compile: minor clean-up in iimport.go
Robert Findley [Wed, 15 Sep 2021 00:40:09 +0000 (20:40 -0400)]
go/internal/gcimporter,cmd/compile: minor clean-up in iimport.go

Make two superficial fixes to iimport.go: rename instType to
instanceType (suggested in CL 349949), and fix a stale comment.

Done in both go/internal/gcimporter and cmd/compile/internal/importer.

Change-Id: Idfdda11a59b036a35824bbb1c101cba3652aeff4
Reviewed-on: https://go-review.googlesource.com/c/go/+/350031
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agocmd/compile/internal/types2: eliminate Named.instPos
Robert Griesemer [Wed, 15 Sep 2021 00:13:32 +0000 (17:13 -0700)]
cmd/compile/internal/types2: eliminate Named.instPos

This is a clean port of CL 349411 from go/types to types2.

Change-Id: Id5fa04c53f286dad263d7ba7911cb49eebf47b0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/350030
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agocmd/compile/internal/types2: merge Named type loading and expansion
Robert Griesemer [Wed, 15 Sep 2021 00:02:30 +0000 (17:02 -0700)]
cmd/compile/internal/types2: merge Named type loading and expansion

Clean port of CL 349410 from go/types to types2 with 2 adjustments:
using syntax.Pos instead of token.Pos, and using TypeHash instead
of typeHash.

Fixes #47887.

Change-Id: Ifd8495e4187b5e30aaf80702768d82aad5e10cf4
Reviewed-on: https://go-review.googlesource.com/c/go/+/349995
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agocmd/compile/internal/types2: implement Identical for *Union types
Robert Griesemer [Tue, 14 Sep 2021 20:23:37 +0000 (13:23 -0700)]
cmd/compile/internal/types2: implement Identical for *Union types

This is a clean port of CL 349413 from go/types to types2.

Change-Id: I18bad5e29b1e719b30a73fb2aa32fe252538496e
Reviewed-on: https://go-review.googlesource.com/c/go/+/349992
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agocmd/compile/internal/types2: remove some unnecessary loading/expansion of Named types
Robert Griesemer [Tue, 14 Sep 2021 20:18:40 +0000 (13:18 -0700)]
cmd/compile/internal/types2: remove some unnecessary loading/expansion of Named types

This is a clean port of CL 349409 from go/types to types2.

Change-Id: I2deb9ce46e6dcda736fda2169912c02163930d7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/349991
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agocmd/compile/internal/types2: export TypeHash, return value without blanks
Robert Griesemer [Tue, 14 Sep 2021 20:09:19 +0000 (13:09 -0700)]
cmd/compile/internal/types2: export TypeHash, return value without blanks

Change the typeWriter to produce blank-free hashes where easily possible
if used as a type hasher, and replace remaining blanks with '#' is needed.

Exported Environment.TypeHash for use by the compiler.

Change-Id: Icbd364c207f9c139a7a1844bb695512a0c56a4e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/349990
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agoruntime: in adjustTimers back up as far as necessary
Ian Lance Taylor [Fri, 20 Aug 2021 23:55:04 +0000 (16:55 -0700)]
runtime: in adjustTimers back up as far as necessary

When the adjustTimers function removed a timer it assumed it was
sufficient to continue the heap traversal at that position.
However, in some cases a timer will be moved to an earlier
position in the heap. If that timer is timerModifiedEarlier,
that can leave timerModifiedEarliest not correctly representing
the earlier such timer.

Fix the problem by restarting the heap traversal at the earliest
changed position.

Fixes #47762

Change-Id: I152bbe62793ee40a680baf49967bcb89b1f94764
Reviewed-on: https://go-review.googlesource.com/c/go/+/343882
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2 years agocmd/go: remove subcommand prefix from error messages
Jay Conrod [Mon, 13 Sep 2021 17:58:25 +0000 (10:58 -0700)]
cmd/go: remove subcommand prefix from error messages

For example, errors that started before with "go mod download: " now
start with "go: " instead.

Previously, we had a mix of errors with and without subcommand
prefixes, even in packages like modload that ostensibly aren't tied
to any specific command. This change makes usage more consistent,
which makes refactoring much easier.

These prefixes didn't add useful information: the user should know the
subcommand they just ran. But see CL 347152 for an attempt at making
the opposite change: always printing the subcommand prefix.

Note that there are a number of errors that don't start with "go: " or
any subcommand prefix. This CL doesn't affect those.

Change-Id: I16430d8c39ea3f4d0870f55a5205f06fb21943c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/349597
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2 years agogo/types: implement Identical for *Union types
Robert Findley [Sun, 12 Sep 2021 18:33:04 +0000 (14:33 -0400)]
go/types: implement Identical for *Union types

This aligns with the API proposal (#47916).

Change-Id: I732e5b107e729718ed37e053ad3f434993a97ecd
Reviewed-on: https://go-review.googlesource.com/c/go/+/349413
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agogo/types: minor cleanup of instantiation
Robert Findley [Sun, 12 Sep 2021 03:06:41 +0000 (23:06 -0400)]
go/types: minor cleanup of instantiation

This CL addresses a couple TODOs related to instantiation:
 - factor out resolving the best environment
 - don't eagerly resolve substituted instances

Change-Id: I4a5de7ea7939b6f272991071f591d622dec04b53
Reviewed-on: https://go-review.googlesource.com/c/go/+/349429
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agogo/types: instantiate methods when instantiating Named types
Robert Findley [Fri, 10 Sep 2021 20:28:01 +0000 (16:28 -0400)]
go/types: instantiate methods when instantiating Named types

In the API proposal we decided that instantiation must also instantiate
methods. This CL does that, and eliminates the special handling for lazy
instantiation in lookupMethod.

It is possible that we expand an instance before all method signatures
have been type-checked, so for simplicity we introduce a new flag on
Func, 'isIncompleteMethod', which controls whether we must fully
substitute methods before using them. We could avoid this flag by using
some convention for the structure of an incomplete method (such as the
receiver has no position), but in practice using a flag was cleaner and
didn't increase the size of the Func struct.

Updates #47916

Change-Id: I352baa6664cd07f61b06924744382897805f9d29
Reviewed-on: https://go-review.googlesource.com/c/go/+/349412
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agogo/types: eliminate Named.instPos
Robert Findley [Fri, 10 Sep 2021 19:12:57 +0000 (15:12 -0400)]
go/types: eliminate Named.instPos

We no longer need to use the nilness of Named.instPos to signal whether
instance expansion has occurred, so remove it from the Named struct by
instead closing over the instantiation position in the resolver.

This means we cannot print instance markers for unexpanded instances:
instances may escape the type checking pass without being fully
expanded, and we can not check whether they have been expanded in a
concurrency-safe way without introducing a more heavy-weight
syncronization mechanism.

With this change, instantiation should be concurrency safe, modulo bugs
of course as we have little test coverage of concurrency (see #47729).

Fixes #47910

Change-Id: Ifeef6df296f00105579554b333a44d08aae113c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/349411
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agogo/types: merge Named type loading and expansion
Robert Findley [Fri, 10 Sep 2021 14:23:23 +0000 (10:23 -0400)]
go/types: merge Named type loading and expansion

Named type expansion and loading were conceptually similar: a mechanism
for lazily resolving type information in a concurrency-safe manner.
Unify them into a 'resolve' method, that delegates to a resolver func to
produce type parameters, underlying, and methods.

By leveraging the sync.Once field on Named for instance expansion, we
get closer to making instance expansion concurrency-safe, and remove the
requirement that instPos guard instantiation. This will be cleaned up
in a follow-up CL.

This also fixes #47887 by causing substituted type instances to be
expanded (in the old code, this could be fixed by setting instPos when
substituting).

For #47910
Fixes #47887

Change-Id: Ifc52a420dde76e3a46ce494fea9bd289bc8aca4c
Reviewed-on: https://go-review.googlesource.com/c/go/+/349410
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agocmd/compile: set IsShape based on type being in the Shapes pkg
Dan Scales [Tue, 14 Sep 2021 15:39:08 +0000 (08:39 -0700)]
cmd/compile: set IsShape based on type being in the Shapes pkg

Move ShapePkg to types, and change types.NewNamed to automatically set
IsShape/HasShape if a type is in the shapes pkg. This means that
imported shape types will automatically have the correct
IsShape/HasShape flags, even though we are not explicitly
exporting/importing those flags.

Updates #48337

Change-Id: I8b6131a663205f73f395943c9d0c8bdb2a213401
Reviewed-on: https://go-review.googlesource.com/c/go/+/349869
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>

2 years agocmd/compile: fix test/typeparam/mdempsky/4.go for -G=3
wdvxdr [Fri, 10 Sep 2021 12:56:29 +0000 (20:56 +0800)]
cmd/compile: fix test/typeparam/mdempsky/4.go for -G=3

Change-Id: I894ee000561a3c6afede8df697b1bce4576ceef0
Reviewed-on: https://go-review.googlesource.com/c/go/+/349012
Reviewed-by: Dan Scales <danscales@google.com>
Trust: Dan Scales <danscales@google.com>
Trust: Keith Randall <khr@golang.org>

2 years agoruntime: avoid loop variable capture in test
Michael Pratt [Wed, 4 Aug 2021 20:07:47 +0000 (16:07 -0400)]
runtime: avoid loop variable capture in test

In TestSegv, the t.Run closure captures the loop variable 'test'. Since
the subtest calls t.Parallel, the parent test is allowed to keep
running, changing the loop variable and thus changing the value of
'test' in the subtest.

Change-Id: I021ddc50304de08a341e6ffe486aa54e573d3b94
Reviewed-on: https://go-review.googlesource.com/c/go/+/339911
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 years agogo/internal/gcimporter: remove outdated comment
Cuong Manh Le [Tue, 14 Sep 2021 03:36:29 +0000 (10:36 +0700)]
go/internal/gcimporter: remove outdated comment

CL 349010 ported the fix from CL 349009, but forgot to remove the
outdated comment from old solution. This CL removes that one.

Change-Id: Ia401295e9d0984f4a088ddce5db09d306bfd89b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/349729
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agosyscall: remove use of IN_KUBERNETES in test
Tobias Klauser [Tue, 14 Sep 2021 06:56:54 +0000 (08:56 +0200)]
syscall: remove use of IN_KUBERNETES in test

CL 201737 dropped the use of IN_KUBERNETES in tests, but it looks like
it did not catch all occurrences.

For #12815
For #34956

Change-Id: I72b89bfb850ba2890e9e6aa39b87167291ab7e9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/349789
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2 years agocmd/internal/obj/ppc64: allow VR register arguments to VS registers
Paul E. Murphy [Tue, 9 Mar 2021 22:55:31 +0000 (16:55 -0600)]
cmd/internal/obj/ppc64: allow VR register arguments to VS registers

Likewise, reorder register numbers such that extended mnemonics which
use FPR arguments can be transparently encoded as a VSR argument for
the move to/from VSR class of instructions. Specifically, ensure the
following holds for all FPx and VRx constants: FPRx & 63 == x, and
VRx & 63 == x + 32.

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

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

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

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

Change-Id: If13dd88c3791d1892dbd18ef0e34675a5285fff9
Reviewed-on: https://go-review.googlesource.com/c/go/+/342929
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 years agocmd/compile: prevent typecheck importer reading type parameter twice
Cuong Manh Le [Fri, 10 Sep 2021 01:34:03 +0000 (08:34 +0700)]
cmd/compile: prevent typecheck importer reading type parameter twice

This is a port of CL 349009 to typecheck importer.

Fixes #48306

Change-Id: Iec3f078089346bd85f0ab739896e079940325011
Reviewed-on: https://go-review.googlesource.com/c/go/+/349011
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
2 years agogo/internal/gcimporter: prevent importReader reading type parameter twice
Cuong Manh Le [Fri, 10 Sep 2021 01:20:28 +0000 (08:20 +0700)]
go/internal/gcimporter: prevent importReader reading type parameter twice

This is port of CL 349009 to go/internal/gcimporter.

Updates #48280

Change-Id: I7d40d8b67333538ca58fe012535d54e891d0ed16
Reviewed-on: https://go-review.googlesource.com/c/go/+/349010
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agocmd/compile: prevent importReader reading type parameter twice
Cuong Manh Le [Fri, 10 Sep 2021 00:44:02 +0000 (07:44 +0700)]
cmd/compile: prevent importReader reading type parameter twice

The importReader always reads type parameter before declaring type stub
declaration. Thus, for recursive type, the type parameter is going to be
read twice, cause the bound more than once error.

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

Fixes #48280

Change-Id: I272e2f214f739fb8ec71a8628ba297477e1b7755
Reviewed-on: https://go-review.googlesource.com/c/go/+/349009
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
2 years agoall: remove some unused code
Alexander Melentyev [Sat, 11 Sep 2021 06:59:17 +0000 (06:59 +0000)]
all: remove some unused code

Change-Id: I519b8021fa79dccc5c0ee79134547491116fc4cc
GitHub-Last-Rev: 48869f5434c1255d33c3a14714747509235c94df
GitHub-Pull-Request: golang/go#48071
Reviewed-on: https://go-review.googlesource.com/c/go/+/346231
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Keith Randall <khr@golang.org>

2 years agoruntime: change time.now to ABIInternal
Ian Lance Taylor [Fri, 30 Apr 2021 02:08:54 +0000 (19:08 -0700)]
runtime: change time.now to ABIInternal

This reduces the number of instructions executed for time.now by nine,
by eliminating the wrapper. Somehow BenchmarkNow is 0.2ns slower.
On the other hand BenchmarkNowUnixNano is 0.8ns faster.

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

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

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

Change-Id: Ie794a932a929b46053a6c3020b67d640b98d2335
Reviewed-on: https://go-review.googlesource.com/c/go/+/315369
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2 years agoreflect: use Value.Len instead of conversion to slice header
Nevkontakte [Mon, 13 Sep 2021 22:40:30 +0000 (22:40 +0000)]
reflect: use Value.Len instead of conversion to slice header

This change is functionally equivalent, but reduces reliance on unsafe
features. This would allow GopherJS to avoid an additional patch to the
standard library we'd have to maintain in order to remain compatible
with Go 1.17+.

Change-Id: I4f113db0c572ec0b81ebfecf5a137145f6c8c41d
GitHub-Last-Rev: 94ebb393bac93579b6455555822691c0d69e2d42
GitHub-Pull-Request: golang/go#48346
Reviewed-on: https://go-review.googlesource.com/c/go/+/349469
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

2 years agospec: fix prose about terminating statements
Robert Griesemer [Sat, 11 Sep 2021 00:06:43 +0000 (17:06 -0700)]
spec: fix prose about terminating statements

CL 85215 added prose to provide some minimal intuition for the
definition of a "terminating statement". While the original definition
was perfectly fine, the added prose was actually incorrect: If the
terminating statement is a goto, it might jump to a labeled statement
following that goto in the same block (it could be the very next
statement), and thus a terminating statement does not in fact
"prevent execution of all statements that lexically appear after
it in the same block".

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

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

Fixes #48323.

Change-Id: I8031346250341d038938a1ce6a75d3e687d32c37
Reviewed-on: https://go-review.googlesource.com/c/go/+/349172
Trust: Robert Griesemer <gri@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agocmd/compile: save the note of fields when translating struct
korzhao [Fri, 10 Sep 2021 17:14:54 +0000 (01:14 +0800)]
cmd/compile: save the note of fields when translating struct

Fixes #48317

Change-Id: I756ae6253022870071004332dd8f49169307f7e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/349013
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Trust: Dan Scales <danscales@google.com>

2 years agocmd/go: add missing parenthesis in a call to "PrintVersion"
Hossein Zolfi [Mon, 13 Sep 2021 19:16:28 +0000 (19:16 +0000)]
cmd/go: add missing parenthesis in a call to "PrintVersion"

For #45713

Change-Id: I16e548e6c10e58da815d08897f4ba5d71eeb17e4
GitHub-Last-Rev: 4a0c5d0cdaba94e5950effdcb0ef6b736c9556d1
GitHub-Pull-Request: golang/go#48360
Reviewed-on: https://go-review.googlesource.com/c/go/+/349599
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

2 years agocmd/link/internal/ld: re-enable DWARF tests on solaris/illumos
Tobias Klauser [Mon, 13 Sep 2021 15:26:03 +0000 (17:26 +0200)]
cmd/link/internal/ld: re-enable DWARF tests on solaris/illumos

It looks like these are fixed on current tip after CL 84655
marked them to be skipped.

Fixes #23168

Change-Id: I0020e6da1042f723eb54186ef0fe925df5326230
Reviewed-on: https://go-review.googlesource.com/c/go/+/349250
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

2 years agoreflect: add a floating point section to DeepEqual tests
Josh Bleecher Snyder [Mon, 13 Sep 2021 19:49:08 +0000 (12:49 -0700)]
reflect: add a floating point section to DeepEqual tests

The floating point tests were all added into the Inequalities section,
instead of separated into Equalities vs Inequalities.

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

Change-Id: I3713a5aff5850dcc0caf68a754633d695a03ded9
Reviewed-on: https://go-review.googlesource.com/c/go/+/349612
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Trust: Joe Tsai <joetsai@digital-static.net>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Joe Tsai <joetsai@digital-static.net>
Reviewed-by: Joe Tsai <joetsai@digital-static.net>
TryBot-Result: Go Bot <gobot@golang.org>

2 years agoreflect: add fast paths for common, simple Kinds to DeepEqual
Josh Bleecher Snyder [Sat, 8 May 2021 01:39:36 +0000 (18:39 -0700)]
reflect: add fast paths for common, simple Kinds to DeepEqual

Though the normal equality check suffices, it allocates.
Handle common, simple kinds without allocating.

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

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

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

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

For the benchmarks added in this commit:

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

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

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

Change-Id: Ic21f0e2305f2cf5e6674c81b9ca609120b3006d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/318169
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Trust: Joe Tsai <joetsai@digital-static.net>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Joe Tsai <joetsai@digital-static.net>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Joe Tsai <joetsai@digital-static.net>
2 years agoreflect: fix _faststr optimization
Keith Randall [Mon, 13 Sep 2021 16:17:22 +0000 (09:17 -0700)]
reflect: fix _faststr optimization

CL 345486 introduced an optimization to reflect's map accesses
which is not quite correct. We can't use the optimized code if the
value type is >128 bytes.

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

Fixes #48357

Change-Id: I8e3c7858693083dd4393a8de48ca5fa47bab66f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/349593
Trust: Keith Randall <khr@golang.org>
Trust: Joe Tsai <joetsai@digital-static.net>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Trust: Martin Möhrmann <martin@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Run-TryBot: Joe Tsai <joetsai@digital-static.net>
Reviewed-by: Joe Tsai <joetsai@digital-static.net>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Martin Möhrmann <martin@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>