Note that this changes a non-atomic operation to atomic operation in gcStart().
For #53821
Change-Id: I754d254f6f190855144ff62151b6bae673b47867
Reviewed-on: https://go-review.googlesource.com/c/go/+/425776
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
And add some documentation for the debug query param.
Fixes#27737Fixes#53971
Change-Id: I629aaa2d4a43175381eb04872f1caad238519a41
Reviewed-on: https://go-review.googlesource.com/c/go/+/421635
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
If x+delta cannot overflow/underflow, we can derive:
x+delta < x if delta<0 (this CL included)
x+delta > x if delta>0 (this CL not included due to
a recursive stack overflow)
Remove 95 bounds checks during ./make.bat
Fixes#51622
Change-Id: I60d9bd84c5d7e81bbf808508afd09be596644f09
Reviewed-on: https://go-review.googlesource.com/c/go/+/406175
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Do not intercept integer compares that are used to increment libFuzzer's
8-bit counters. This is unnecessary and has a negative impact on the
fuzzing performance. This fixes#53760.
Change-Id: Id22efac968b18014eedabb6f0762e1456897024e
GitHub-Last-Rev: 52f69fd68c
GitHub-Pull-Request: golang/go#53786
Reviewed-on: https://go-review.googlesource.com/c/go/+/416796
Run-TryBot: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
go:notinheap will be replaced by runtime/internal/sys.NotInHeap, and for
longer term, we want to restrict all of its usages inside the runtime
package only.
Updates #46731
Change-Id: I267adc2a19f0dc8a1ed29b5b4aeec1a7dc7318d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/421880
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Looks like CL 413361 which added CaseClause.RTypes missed the need
to regenerate this file.
Also CL 413357 added DynamicTypeAssertExpr.SrcRType, same issue.
Change-Id: I45e4d0685cc2f9bdcef1fad2cfc92e7005ef363e
Reviewed-on: https://go-review.googlesource.com/c/go/+/426675
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
CL 327871 changes methodWrapper to always perform inlining after global
escape analysis. However, inlining the method may reveal closures, which
require walking all function bodies to decide whether to capture free
variables by value or by ref.
To fix it, just not doing inline if the method contains any closures.
Fixes#53702
Change-Id: I4b0255b86257cc6fe7e5fafbc545cc5cff9113e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/426334
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Shape-based stenciling in unified IR is done by converting type argument
to its underlying type. So it agressively check that type argument is
not a TFORW. However, for recursive instantiated type argument, it may
still be a TFORW when shapifying happens. Thus the assertion failed,
causing the compiler crashing.
To fix it, just allow fully instantiated type when shapifying.
Fixes#54512Fixes#54722
Change-Id: I527e3fd696388c8a37454e738f0324f0c2ec16cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/426335
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
When a base+displacement kind of operand is given in an index-mode
instruction, the assembler does not flag it as an invalid instruction
causing the user to get an incorrect encoding of that instruction
leading to incorrect execution of the program.
Enable assembler to recognize valid and invalid operands used in index
mode instructions by classifying SOREG type into two further types
XOREG (used uniquely in index addressing mode instructions) and SOREG
for instructions working on base+displacement operands.
Also cleaned up usage of obj.Addr.Scale on PPC64.
Change-Id: Ib4d84343ae57477c6c074f44c4c2749496e11b91
Reviewed-on: https://go-review.googlesource.com/c/go/+/405542
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Archana Ravindar <aravind5@in.ibm.com>
When spilling arg to stack or register, if it's a newly created value,
the arg position should be preserved. Otherwise, we may end up using
position information from deadcode lines.
This fixes the minimized test case in #54625 by mdempsky@, and make
building std successfully. However, the inline trees for these tests
still be corrupted:
- fixedbugs/issue53982.go
- typeparam/issue47775.go
- typeparam/issue47775b.go
- typeparam/issue49432.go
We probably still mess up the inline position somewhere else.
Updates #54625
Change-Id: I0d87e26b9ab451b85b6e79787da74a2b79a16209
Reviewed-on: https://go-review.googlesource.com/c/go/+/425785
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
The current implementation always returns false for non-comparable
values, update the doc to reflect that.
Change-Id: I87f2da408874b0a209c8f51949e3310da15c5904
Reviewed-on: https://go-review.googlesource.com/c/go/+/426195
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: hopehook <hopehook@golangcn.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
CL 426079 started checking errors from RecentTag.
Unfortunately, we forgot to run "-longtest" SlowBots, and it turns out
to have broken non-short tests for non-git VCS implementations,
because those don't implement the RecentTag method.
Updates #53935.
Change-Id: I5935f2f4b3f684515e99e8bf70a840154c36249f
Reviewed-on: https://go-review.googlesource.com/c/go/+/426495
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Avoid allocating large amounts of memory for corrupt input.
No test case because the problem can only happen for invalid data.
Let the fuzzer find cases like this.
Change-Id: I2d1745200611f0af06ca58adcc3e2309ad6742d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/425882
Run-TryBot: Dan Kortschak <dan@kortschak.io>
Auto-Submit: Dan Kortschak <dan@kortschak.io>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
The existing documentation did not explain the difference between
placing a _test.go file in the same package as what is being
tested vs. adding it to a separate _test package. This explains the
distinction and adds an example.
Concept is explained well here: https://stackoverflow.com/a/31443271Fixes#25223
Change-Id: Iebaba15207d8aa24f0b370d8dd4062eadb504b5c
GitHub-Last-Rev: 7f49c5f462
GitHub-Pull-Request: golang/go#54160
Reviewed-on: https://go-review.googlesource.com/c/go/+/420415
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
The existing implementation creates more branches with more states: -1, 0, 1,
which makes it not very intuitive to understand, let's use sync.Once and boolean
instead to make it more straightforward.
Change-Id: I05766e5fdf7dba37d6565f84d3db4373f9342fe5
Reviewed-on: https://go-review.googlesource.com/c/go/+/425880
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
In initLocal for GOOS=js, use internal/itoa introduced in CL 301549
instead of a local implementation.
Change-Id: If107d5cf0ce56f4d926507db2cbd6da422c6d15a
Reviewed-on: https://go-review.googlesource.com/c/go/+/425302
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Change-Id: Iebe31b91c6e81438120f50a8089a8efca3d5339d
Reviewed-on: https://go-review.googlesource.com/c/go/+/426115
Run-TryBot: Dan Kortschak <dan@kortschak.io>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Change-Id: Ice7e3762d4a1d71e23d619be699697f5c6523cc5
Reviewed-on: https://go-review.googlesource.com/c/go/+/425879
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
The current implementation ignores the error when it tries to get
the recent tag on revisions, which results in incorrect pseudo
version (v0.0.0-) is derived.
Fixes#53935
Change-Id: I153d851eb913fb7e40051e194c92b9ca5bf0e906
GitHub-Last-Rev: 6ba1d90df5
GitHub-Pull-Request: golang/go#54701
Reviewed-on: https://go-review.googlesource.com/c/go/+/426079
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Time.appendFormatRFC3339 is a specialized implementation of
Time.appendFormat. We expect the two to be identical.
Add a fuzz test to ensure this property.
Updates #54093
Change-Id: I0bc41ee6e016d3dac75d1ac372d8c9c7266d0299
Reviewed-on: https://go-review.googlesource.com/c/go/+/425100
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
FileServer provides a read-only service. Methods other than GET or HEAD should
be denied with an Allow header.
Fixes#53501
Change-Id: I1d31b405eefd90565ecd474ac3f8d8d6e3b15072
Reviewed-on: https://go-review.googlesource.com/c/go/+/413554
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Previously the first operand of FMOVD and FMOVS could be $0, which
would be converted to the ZR register. This is prohibited by CL 404316,
also it broken the encoding of "FMOVD/FMOVS ZR, Rn", this CL restores
this instruction format and fixes the encoding issue.
Fixes#54655.
Fixes#54729.
Change-Id: I9c42cd41296bed7ffd601609bd8ecaa27d11e659
Reviewed-on: https://go-review.googlesource.com/c/go/+/425188
Run-TryBot: Eric Fang <eric.fang@arm.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
If array element is not interface, array or struct, we just need to
check whether the array element type is comparable.
Change-Id: I1ab94cfa17ae86feb6cd3fbdf878af5a776e7bec
Reviewed-on: https://go-review.googlesource.com/c/go/+/426194
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Prior to this commit, png.Decode would allow TrueColor PNG images that
have one but not both of PLTE and tRNS chunks.
Fixes#54142
Change-Id: I259c1fff86a0aa5640dbadf7ad834e05fbd1430c
Reviewed-on: https://go-review.googlesource.com/c/go/+/424916
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Nigel Tao (INACTIVE; USE @golang.org INSTEAD) <nigeltao@google.com>
uint32(sz) != n*uint32(ddSz) can go wrong if
the RHS overflows, so do it in wider precision.
Fixes#54640.
Change-Id: I776563330e46de6cdacd4055f6ff08e7de67797f
Reviewed-on: https://go-review.googlesource.com/c/go/+/425364
Reviewed-by: Dan Kortschak <dan@kortschak.io>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Correctly set this flag while parsing the syscall result.
The FlagUp flag can not distinguish the following situations:
1. interface is plugged, automatically up, and in running(UP) state
2. interface is not plugged, administratively or manually set to up,
but in DOWN state
So, We can't distinguish the state of a NIC by the FlagUp flag alone.
Fixes#53482
Change-Id: I43796bea1a7f72d1fddfef914efe603c81995e1b
GitHub-Last-Rev: 686b5d888e
GitHub-Pull-Request: golang/go#53484
Reviewed-on: https://go-review.googlesource.com/c/go/+/413454
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ryan Schuster <shuey19831@gmail.com>
Reviewed-by: Jianwei Mao <maojianwei2020@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
R_PPC64_SECTOFF_LO_DS is defined as reloc 62 on all PPC64 ELF ABIs.
Fixes#53356
Change-Id: I5fabf6be32f3310c5aed47d4d654e05fb7bc9de0
Reviewed-on: https://go-review.googlesource.com/c/go/+/411915
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
For #46746
Change-Id: I879124974cdb55932cd9d07d3b384d49d5059857
Reviewed-on: https://go-review.googlesource.com/c/go/+/423794
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
A recent change was made for ppc64x to treat ANDCCconst as
a tuple, allowing ANDconst to be removed from the list
of ops. Included in that change were some improvements to the
rules to avoid some extra code, mainly the elimination of a
cmp 0 following an andi. and in some cases the following
isel. While those changes worked for most cases, in a few
cases some extra unnecessary code was generated.
Currently the snippet appears in archive/zip.(*FileHeader).Mode:
ANDCC R4,$1,R5 // andi. r5,r4,1
ANDCC R4,$16,R5 // andi. r5,r4,16
CMPW R5,R0 // cmpw r5,r0
ADDIS $0,$-32768,R5 // lis r5,-32768
OR R5,$511,R5 // ori r5,r5,511
MOVD $438,R6 // li r6,438
ISEL $2,R6,R5,R5 // isel r5,r6,r5,eq
MOVD $-147,R6 // li r6,-147
AND R6,R5,R6 // and r6,r5,r6
ANDCC R4,$1,R4 // andi. r4,r4,1
ISEL $2,R5,R6,R4 // isel r4,r5,r6,eq
The first ANDCC is never used and should not be there.
From the ssa.html file, the scheduler is not putting the Select1
close to the ISEL, which results in the flag being clobbered
before it can be used. By changing the score for a Select0 or Select1
with type Flags, the extra ANDCC does not occur.
Change-Id: I82f4bc7c02afb1c2b1c048dc6995e0b3f9363fb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/424294
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Paul Murphy <murp@ibm.com>
This removes one of the branches in the atomicCas sequences for
ppc64/ppc64le.
Change-Id: Ibb46fbfdce052889c69e3da298f28caff540d99b
Reviewed-on: https://go-review.googlesource.com/c/go/+/422014
Reviewed-by: Archana Ravindar <aravind5@in.ibm.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Paul Murphy <murp@ibm.com>
Both FileServer and NewFileTransport can try to seek a file, specifically
when MIME type sniffing is performed. This can be somewhat surprising to an
implementer of an fs.FS, as their filesystem will appear to work until a
user tries to access a file with an unrecognized extension (which requires
type sniffing and therefore seeking). With FileServer, this results in a
"seeker can't seek" message, which is not very clear for the developer.
The issue arises because fs.FS does not require Seek, while http.FileSystem
does. Therefore, this change adds a line to the documentation of net/http's
adapter function mentioning the requirement.
Change-Id: Ieb955b7a7f34e2be39dd696cb712513c70100b3a
GitHub-Last-Rev: fddccdae36
GitHub-Pull-Request: golang/go#48781
Reviewed-on: https://go-review.googlesource.com/c/go/+/353874
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
To make it easier to extract the HTTP/2 error code (if any) from
net/http errors, implement an As method on the vendored copy of
golang.org/x/net/http2.StreamError. The new As method lets users work
with the vendored error type as though it were the x/net/http2
StreamError.
Fixes#53896.
Change-Id: Ib18eb428adc05a3c0e19a946ece936e2378e1c7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/425104
Run-TryBot: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: David Chase <drchase@google.com>
Fixes#48866
Change-Id: I2bd2c806e44eb4064b1fb9a6509d79cecbbef013
Reviewed-on: https://go-review.googlesource.com/c/go/+/363094
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Tim King <taking@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: David Chase <drchase@google.com>
Atomic types may be used anywhere in the runtime,
so they must omit its usual stack overflow checks to avoid errors from stack splits.
Change-Id: Icb497334c860bcaa284a2d5a3edc47ee89844301
Reviewed-on: https://go-review.googlesource.com/c/go/+/425484
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
assistTimePool and lastUpdate are now atomic.Int64, so they are
guaranteed to have 64-bit alignment, even on 32-bit platforms.
Change-Id: Ib6062a47c3a92d46d43899e1ae9d119e7f5b8bb0
Reviewed-on: https://go-review.googlesource.com/c/go/+/425460
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Avoid allocating large amounts of memory for corrupt input.
No test case because the problem can only happen for invalid data.
Let the fuzzer find cases like this.
Change-Id: Ib09d5fea54aabcb6941e541b42689222fba69632
Reviewed-on: https://go-review.googlesource.com/c/go/+/425303
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Dan Kortschak <dan@kortschak.io>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: hopehook <hopehook@qq.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This fixes a regression introduced when the "race" mode tag was moved to
the ToolTags field in CL 358539.
Fixes#54468
Change-Id: I107771948a4fe9d743cc13d1c15f324212b08e03
GitHub-Last-Rev: d211e351ef
GitHub-Pull-Request: golang/go#54618
Reviewed-on: https://go-review.googlesource.com/c/go/+/425154
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Note that this changes a few unsynchronized operations of forcegcstate.idle to synchronized operations.
Updates #53821
Change-Id: I041654cc84a188fad45e2df7abce3a434f9a1f15
Reviewed-on: https://go-review.googlesource.com/c/go/+/425361
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
On the write side, g.selectDone has been converted
from non-atomic to atomic access.
For #53821.
Change-Id: Iac46bc6acce7eed51dfd990285dd57f0d58b4ae2
Reviewed-on: https://go-review.googlesource.com/c/go/+/425414
Run-TryBot: hopehook <hopehook@qq.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Note that this changes a non-atomic operation to atomic operation.
For #53821
Change-Id: I798914f505c8d7f85f9d7629fdc6493363a20aa1
Reviewed-on: https://go-review.googlesource.com/c/go/+/425782
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: hopehook <hopehook@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
In typebits.Set we check that the offset is a multiple of the
alignment, which makes perfect sense. But for values like
atomic.Int64, which has 8-byte alignment even on 32-bit platforms
(i.e. the alignment is larger than PtrSize), if it is on stack it
may be under-aligned, as the stack frame is only PtrSize aligned.
Normally we would prevent such values on stack, as the escape
analysis force values with higher alignment to heap. But for a
composite literal assignment like x = AlignedType{...}, the
compiler creates an autotmp for the RHS then copies it to the LHS.
The autotmp is on stack and may be under-aligned. Currently this
may cause an ICE in the typebits.Set check.
This CL makes it align the _offset_ of the autotmp to 8 bytes,
which satisfies the check. Note that this is actually lying: the
actual address at run time may not necessarily be 8-byte
aligned as we only align SP to 4 bytes.
The under-alignment is probably okay. The only purpose for the
autotmp is to copy the value to the LHS, and the copying code we
generate (at least currently) doesn't care the alignment beyond
stack alignment.
Fixes#54638.
Change-Id: I13c16afde2eea017479ff11dfc24092bcb8aba6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/425256
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Fixes#54669
Change-Id: I34cbe729d187437ddeafbaa910af6ed001b2603f
Reviewed-on: https://go-review.googlesource.com/c/go/+/425461
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
This matches types2 behavior.
For #54511.
Change-Id: Iea906e9fec7e334b7aa7f481de87373fa93d1c7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/425715
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
The change in typexpr.go matches types2 behavior.
For #54511.
Change-Id: I79c922a94f2ee0440c1814140935c321439c7d25
Reviewed-on: https://go-review.googlesource.com/c/go/+/425714
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
There are only two tests that rely on the "ERROR HERE" markers;
yet those tests are trivialy adjustable (by adding an explicit
semicolon) such that they can just use the "ERROR" markers.
For #54511.
Change-Id: Idbb96ca8d35ae2584d195a4ac7c92640b8b492c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/425674
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
This change updates the gctrace docs to include stacks and globals in
the format line, and prints lastStackScan for "# MB stacks" instead of
maxStackScan, which is more accurate.
Fixes#54649.
Change-Id: Ibff2c390c9c9bf2b24b5b4e98ca346cc98d7cb2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/425366
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
MarshalPKIXPublicKey, CreateCertificate, CreateCertificateRequest,
MarshalECPrivateKey, and MarshalPKCS8PrivateKey started raising a panic
when encoding an invalid ECDSA key in Go 1.19. Since they have an error
return value, they should return an error instead.
Fixes#54288
Change-Id: Iba132cd2f890ece36bb7d0396eb9a9a77bdb81df
Reviewed-on: https://go-review.googlesource.com/c/go/+/422298
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
When inlining function calls, we rewrite the position information on
all of the nodes to keep track of the inlining context. This is
necessary so that at runtime, we can synthesize additional stack
frames so that the inlining is transparent to the user.
However, for function literals, we *don't* want to apply this
rewriting to the underlying function. Because within the function
literal (when it's not itself inlined), the inlining context (if any)
will have already be available at the caller PC instead.
Unified IR was already getting this right in the case of user-written
statements within the function literal, which is what the unit test
for #46234 tested. However, it was still using inline-adjusted
positions for the function declaration and its parameters, which
occasionally end up getting used for generated code (e.g., loading
captured values from the closure record).
I've manually verified that this fixes the hang in
https://go.dev/play/p/avQ0qgRzOgt, and spot-checked the
-d=pctab=pctoinline output for kube-apiserver and kubelet and they
seem better.
However, I'm still working on a more robust test for this (hence
"Updates" not "Fixes") and internal assertions to verify that we're
emitting correct inline trees. In particular, there are still other
cases (even in the non-unified frontend) where we're producing
corrupt (but at least acyclic) inline trees.
Updates #54625.
Change-Id: Iacfd2e1eb06ae8dc299c0679f377461d3d46c15a
Reviewed-on: https://go-review.googlesource.com/c/go/+/425395
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Elapsed returns the measured elapsed time of the benchmark,
but does not change the running state of the timer.
Fixes#43620.
Change-Id: Idd9f64c4632518eec759d2ffccbf0050d84fcc03
Reviewed-on: https://go-review.googlesource.com/c/go/+/420254
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: hopehook <hopehook@qq.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Given a composite literal type S, rather than always printing
(S literal) for a composite literals, print S{} if the literal
has no elements, and print S{…} as a short form (suitable for
error messages) if there are elements. This matches types2 and
also Go1.17 compiler behavior (except that the original compiler
would print ... rather than …). Using … rather than ... makes
it clearer that we don't have real Go syntax, and it's also more
compact.
For #54511.
Change-Id: I5991e8060232f16ecbf4a1fe4ae091598fc76b68
Reviewed-on: https://go-review.googlesource.com/c/go/+/425006
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
On LR architectures, morestack (and morestack_noctxt) are called
with a special calling convention, where the caller doesn't save
LR on stack but passes it as a register, which morestack will save
to g.sched.lr. The stack unwinder currently doesn't understand it,
and would fail to unwind from it. morestack already writes SP (as
it switches stack), but morestack_noctxt (which tailcalls
morestack) doesn't. If a profiling signal lands right in
morestack_noctxt, the unwinder will try to unwind the stack and
go off, and possibly crash.
Marking morestack_noctxt SPWRITE stops the unwinding.
Ideally we could teach the unwinder about the special calling
convention, or change the calling convention to be less special
(so the unwinder doesn't need to fetch a register from the signal
context). This is a stop-gap solution, to stop the unwinder from
crashing.
Fixes#54332.
Change-Id: I75295f2e27ddcf05f1ea0b541aedcb9000ae7576
Reviewed-on: https://go-review.googlesource.com/c/go/+/425396
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Also:
- fine-tune the implementation for some of the new builtin functions
- make sure the go/types code is an exact as possible copy of the
types2 code
- fix the description and examples for errorcodes.go
Follow-up on CL 423754.
For #53003.
Change-Id: I5c70b74e90c724cf6c842cedc6f8ace26fde372b
Reviewed-on: https://go-review.googlesource.com/c/go/+/425454
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
For "type T interface{ M() }", go/types users expect T's underlying
interface type to specify T as the receiver parameter type (#49906).
The unified importer handles this by cloning the interface to rewrite
the receiver parameters before calling SetUnderlying.
I missed in CL 425360 that these interfaces would need to have
Complete called too.
Manually tested to confirm that this actually fixes "go test -race
golang.org/x/tools/go/analysis/internal/checker" now (when both CLs
are ported to the x/tools importer).
Updates #54653.
Change-Id: I51e6db925db56947cd39dbe880230f14734ca01c
Reviewed-on: https://go-review.googlesource.com/c/go/+/425365
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
To support concurrent use of the go/types API, importers need to call
Interface.Complete on constructed interfaces before returning.
There's an issue that the interfaces may contain embedded defined
types, whose underlying type isn't known yet. This issue will
eventually go away once CL 424876 lands, but that CL needs to wait for
CL 424854 to re-land, which needs to wait for CL 421879 to land...
In the mean time, this CL implements the same solution used by the
indexed importer: maintaining a list of constructed interfaces, and
calling Interface.Complete on them after the SetUnderlying loop and
just before returning the imported package.
Updates #54653.
Change-Id: I0f42c915a4b7d28c628bbab7ac2eab2415c7858f
Reviewed-on: https://go-review.googlesource.com/c/go/+/425360
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
This is a follow up of CL 425101 on RISCV64.
According to RISCV Volume 1, Unprivileged Spec v. 20191213 Chapter 7.1:
If both the high and low bits of the same product are required, then the
recommended code sequence is: MULH[[S]U] rdh, rs1, rs2; MUL rdl, rs1, rs2
(source register specifiers must be in same order and rdh cannot be the
same as rs1 or rs2). Microarchitectures can then fuse these into a single
multiply operation instead of performing two separate multiplies.
So we should not split Muluhilo to separate instructions.
Updates #54607
Change-Id: If47461f3aaaf00e27cd583a9990e144fb8bcdb17
Reviewed-on: https://go-review.googlesource.com/c/go/+/425203
Auto-Submit: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
These tests invoke the system C compiler and linker.
Skipping them saves a little over half a second of time in short mode.
Updates #54423.
Change-Id: I3e8aa7b53c0c91f7d1e001ec2cd5f7b4954de52d
Reviewed-on: https://go-review.googlesource.com/c/go/+/425206
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Ever since 'go build' was added (in CL 5483069), it has used an atexit
handler to clean up working directories. At some point (prior to CL
95900044), Init was called multiple times per builder, registering
potentially many atexit handlers that execute asynchronously and make
debugging more difficult.
The use of an AtExit handler also makes the Builder (and anything that
uses it) prone to races: the base.AtExit API is not designed for
concurrent use, but cmd/go is becoming increasingly concurrent over
time. The AtExit handler also makes the Builder inappropriate to use
within a unit-test, since the handlers do not run during the test
function and accumulate over time.
This change makes NewBuilder safe for concurrent use by registering
the AtExit handler only once (during BuildInit, which was already not
safe for concurrent use), and using a sync.Map to store the set of
builders that need cleanup in case of an unclean exit. In addition, it
causes the test variant of cmd/go to fail if any Builder instance
leaks from a clean exit, helping to ensure that functions that create
Builders do not leak them indefinitely, especially in tests.
Updates #54423.
Change-Id: Ia227b15b8fa53c33177c71271d756ac0858feebe
Reviewed-on: https://go-review.googlesource.com/c/go/+/425254
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Ever since 'go build' was added (in CL 5483069), it has used an atexit
handler to clean up working directories.
CL 154109 introduced 'cc' command to the script test framework that
called Init on a builder once per invocation. Unfortunately, since
base.AtExit is unsynchronized, the Init added there caused any script
that invokes that command to be unsafe for concurrent use.
This change fixes the race by having the 'cc' command pass in its
working directory instead of allowing the Builder to allocate one.
Following modern Go best practices, it also replaces the in-place Init
method (which is prone to typestate and aliasing bugs) with a
NewBuilder constructor function.
Fixes#54423.
Change-Id: I8fc2127a7d877bb39a1174e398736bb51d03d4d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/425205
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
This CL changes the inliner to process transitive inlining iteratively
after the AST has actually been edited, rather than recursively and
immediately. This is important for handling indirect function calls
correctly, because ir.reassigned walks the function body looking for
reassignments; whereas previously the inlined reassignments might not
have been actually added to the AST yet.
Fixes#54632.
Change-Id: I0dd69813c8a70b965174e0072335bc00afedf286
Reviewed-on: https://go-review.googlesource.com/c/go/+/425257
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
If a struct or array is comparable, then we can leverage rtype.equal,
which is almost always faster than what Go reflection can achieve.
As a secondary optimization, pre-compute Value.Len and Value.NumField
outside of the loop conditional.
Performance:
name old time/op new time/op delta
IsZero/ArrayComparable 136ns ± 4% 16ns ± 1% -88.28% (p=0.008 n=5+5)
IsZero/ArrayIncomparable 197ns ±10% 123ns ± 1% -37.74% (p=0.008 n=5+5)
IsZero/StructComparable 26.4ns ± 0% 9.6ns ± 1% -63.68% (p=0.016 n=4+5)
IsZero/StructIncomparable 43.5ns ± 1% 27.8ns ± 1% -36.21% (p=0.008 n=5+5)
The incomparable types gain a performance boost since
they are generally constructed from nested comparable types.
Change-Id: If2c1929f8bb1b5b19306ef0c69f3c95a27d4b60d
Reviewed-on: https://go-review.googlesource.com/c/go/+/411478
Reviewed-by: Dan Kortschak <dan@kortschak.io>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Change-Id: I5987eed00ee825421abe62699a06e9b66499f35f
Reviewed-on: https://go-review.googlesource.com/c/go/+/425016
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
So next CLs can revert changes to "internal/singleflight" in CL #82795,
then replace it with "golang.org/x/sync/singleflight" instead.
For #31697
Change-Id: I873ce30d7e051539aa6dc5d4f21e558869a6d132
Reviewed-on: https://go-review.googlesource.com/c/go/+/423654
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Change-Id: Ied16c3be47c863a94d46bd568191057ded4b7d0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/416734
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: xiaodong liu <teaofmoli@gmail.com>
This causes a problem in the test sometimes. With a mapping like:
00400000-00411000 r--p 00000000 fe:01 4459044 /tmp/go-build1710804385/b001/pprof.test
00411000-00645000 r-xp 00011000 fe:01 4459044 /tmp/go-build1710804385/b001/pprof.test
The removed code would make the first mapping 0x400000-0x645000. Tests
then grab the first few addresses to use as PCs, thinking they are in
an executable range. But those addresses are really not in an
executable range, causing the tests to fail.
Change-Id: I5a69d0259d1fd70ff9745df1cbad4d54c5898e7b
Reviewed-on: https://go-review.googlesource.com/c/go/+/424295
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
JoinPath would fail to remove relative elements from the start of
the path when the first path element is "".
In addition, JoinPath would return the original path unmodified
when provided with no elements to join, violating the documented
behavior of always cleaning the resulting path.
Correct both these cases.
JoinPath("http://go.dev", "../go")
// before: http://go.dev/../go
// after: http://go.dev/go
JoinPath("http://go.dev/../go")
// before: http://go.dev/../go
// after: http://go.dev/goFixes#54385.
Change-Id: I6d22cd160d097c50703dd96e4f453c6c118fd5d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/423514
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Detect rotate instructions while still in architecture-independent form.
It's easier to do here, and we don't need to repeat it in each
architecture file.
Change-Id: I9396954b3f3b3bfb96c160d064a02002309935bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/421195
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Eric Fang <eric.fang@arm.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
Reviewed-by: Ruinan Sun <Ruinan.Sun@arm.com>
Run-TryBot: Keith Randall <khr@golang.org>
From the append docs in the builtin package:
As a special case, it is legal to append a string to a byte slice, like this:
slice = append([]byte("hello "), "world"...)
Change-Id: Ib14039a7476873b12a3aefccd8863e8d628b9249
Reviewed-on: https://go-review.googlesource.com/c/go/+/425102
Reviewed-by: hopehook <hopehook@qq.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
No debug/plan9obj test case because the problem can only happen for
invalid data. Let the fuzzer find cases like this.
For #47653Fixes#54585
Change-Id: I8d3e15725b9bc09dd0e6f2750769987021f5e982
Reviewed-on: https://go-review.googlesource.com/c/go/+/425115
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
If narch is very large we would allocate a lot of memory for seenArches.
In practice we aren't going to see many different architectures so
don't bother to specify a size for the seenArches map.
No debug/macho test case because the problem can only happen for
invalid data. Let the fuzzer find cases like this.
For #47653
For #52523
Change-Id: I5a3b0e3aa6172ddffd6f44d9ae513c39a00d8764
Reviewed-on: https://go-review.googlesource.com/c/go/+/425114
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
When one has a []byte on hand, but desires to call the Parse functions,
the conversion from []byte to string would allocate.
var b []byte = ...
v, err := strconv.ParseXXX(string(b), ...)
This changes it such that the input string never escapes from
any of the Parse functions. Together with the compiler optimization
where the compiler stack allocates any string smaller than 32B
this makes most valid inputs for strconv.ParseXXX(string(b), ...)
not require an allocation for the input string.
For example, the longest int64 or uint64 encoded in decimal is 20B.
Also, the longest decimal formatting of a float64 in appendix B
of RFC 8785 is 25B.
Previously, this was not possible since the input leaked to the error,
which causes the prover to give up and instead heap copy the []byte.
We fix this by copying the input string in the error case.
The advantage of this change is that you can now call strconv.ParseXXX
with a []byte without allocations (most times) in the non-error case.
The detriment is that the error-case now has an extra allocation.
We should optimize for the non-error path, rather than the error path.
The effects of this change is transitively seen through packages
that must use strconv.ParseXXX on a []byte such as "encoding/json":
name old time/op new time/op delta
UnmarshalFloat64 186ns 157ns -15.89% (p=0.000 n=10+10)
name old alloc/op new alloc/op delta
UnmarshalFloat64 148B 144B -2.70% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
UnmarshalFloat64 2.00 1.00 -50.00% (p=0.000 n=10+10)
In order for "encoding/json" to benefit, there needs to be a
small change made to how "encoding/json" calls strconv.ParseXXX.
That will be a future change.
Credit goes to Jeff Wendling for a similar patch.
Fixes#42429
Change-Id: I512d6927f965f82e95bd7ec14a28a587f23b7203
Reviewed-on: https://go-review.googlesource.com/c/go/+/345488
Reviewed-by: Martin Möhrmann <martin@golang.org>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Use explicit name pdNil for nil semaphore of a pollDesc to make it self-explanatory like pdReady and pdWait.
Change-Id: Ibfb246e14419d366edadbccac4d3717f0c135cb0
Reviewed-on: https://go-review.googlesource.com/c/go/+/424923
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
This is both simpler and more performant.
Change-Id: I66ef8e49c059a722932392ee3ecfb951d9b8e121
Reviewed-on: https://go-review.googlesource.com/c/go/+/412339
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Some code paths in the runtime (cgo, heapdump) request heap bits
without first checking that the span is !noscan. Instead of trying
to find and work around all those cases, just set the pointer bits
of noscan spans correctly. It's somewhat safer than ensuring we
caught all the possible cases.
Fixes#54557Fixes#54558
Change-Id: Ibd476e6cdea77c962e4d15aad26f29df66fd94e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/425194
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Normally, when moving Go values of type T from one location to another,
we don't need to worry about partial overlaps. The two Ts must either be
in disjoint (nonoverlapping) memory or in exactly the same location.
There are 2 cases where this isn't true:
1) Using unsafe you can arrange partial overlaps.
2) Since Go 1.17, you can use a cast from a slice to a ptr-to-array.
https://go.dev/ref/spec#Conversions_from_slice_to_array_pointer
This feature can be used to construct partial overlaps of array types.
var a [3]int
p := (*[2]int)(a[:])
q := (*[2]int)(a[1:])
*p = *q
We don't care about solving 1. Or at least, we haven't historically
and no one has complained.
For 2, we need to ensure that if there might be partial overlap,
then we can't use OpMove; we must use memmove instead.
(memmove handles partial overlap by copying in the correct
direction. OpMove does not.)
Note that we have to be careful here not to introduce a call when
we're marshaling arguments to a call or unmarshaling results from a call.
Fixes#54467
Change-Id: I1ca6aba8041576849c1d85f1fa33ae61b80a373d
Reviewed-on: https://go-review.googlesource.com/c/go/+/425076
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
This reverts CL 424854.
Reason for revert: broke misc/cgo/stdio.TestTestRun on several builders.
Will re-land after CL 421879 is submitted.
Change-Id: I2548c70d33d7c178cc71c1d491cd81c22660348f
Reviewed-on: https://go-review.googlesource.com/c/go/+/425214
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
R0 needs to be cleared at startup as it may not always be cleared
by the kernel on newer kernels.
Fixes#54547
Change-Id: Id7055699aaa8d8b193b7e3e784f075ce29ac3f1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/424927
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
None of cgo, "go test", nor srcimporter make use of go/ast's object
resolution via go/ast.Object. As such, we can skip that work during
parse time, which should save some CPU time.
We don't have any benchmark numbers, as none of the three packages have
any usable benchmarks, but we measured gofmt to be about 5% faster
thanks to this tweak in https://go.dev/cl/401454.
These three packages are quite different to gofmt, but one can expect
similar speed-ups in the 1-5% range.
Two notable exceptions, which do make use of go/ast.Object, are cmd/fix
and cmd/doc - we do not modify those here.
See #46485.
Change-Id: Ie3e65600d4790641c4e4d6f1c379be477fa02cee
Reviewed-on: https://go-review.googlesource.com/c/go/+/401455
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Flush can not check for unclosed elements, as more data might be encoded
after Flush is called. Close implicitly calls Flush and also checks that
all opened elements are closed as well.
Fixes#53346
Change-Id: I889b9f5ae54e5dfabb9e6948d96c5ed7bc1110f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/424777
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
These two functions together duplicated much of the functionality of
modload.Lookup. Use that instead in modcmd.vendorPkg, and reduce the
modload surface area.
Updates #42504
Updates #40775
For #26904
Change-Id: Ib8aaac495d090178dd56971aef9e5aa44ffa818b
Reviewed-on: https://go-review.googlesource.com/c/go/+/332571
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
In CL 424734, I implemented pointer shaping for unified IR. Evidently
though, we didn't have any test cases that check that uses of
pointer-shaped expressions were handled correctly.
In the reported test case, the struct field "children items[*node[T]]"
gets shaped to "children items[go.shape.*uint8]" (underlying type
"[]go.shape.*uint8"); and so the expression "n.children[i]" has type
"go.shape.*uint8" and the ".items" field selection expression fails.
The fix implemented in this CL is that any expression of derived type
now gets an explicit "reshape" operation applied to it, to ensure it
has the appropriate type for its context. E.g., the "n.children[i]"
OINDEX expression above gets "reshaped" from "go.shape.*uint8" to
"*node[go.shape.int]", allowing the field selection to succeed.
This CL also adds a "-d=reshape" compiler debugging flag, because I
anticipate debugging reshaping operations will be something to come up
again in the future.
Fixes#54535.
Change-Id: Id847bd8f51300d2491d679505ee4d2e974ca972a
Reviewed-on: https://go-review.googlesource.com/c/go/+/424936
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: hopehook <hopehook@qq.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
During walk, we sometimes desugar OEQ nodes into multiple "untyped
bool" expressions, and then use typecheck.Conv to convert back to the
original OEQ node's type.
However, typecheck.Conv had a short-circuit path that if the type is
already identical to the target type according to types.Identical,
then we skipped the conversion. This short-circuit is normally fine;
but with generic code and shape types, it considers "untyped bool" and
"go.shape.bool" to be identical types. And we could end up leaving an
expression of "untyped bool", which then fails an internal consistency
check later.
The simple fix is to change Conv to use types.IdenticalStrict, so that
we ensure "untyped bool" gets converted to "go.shape.bool". And for
good measure, make the same change to ConvNop.
This issue was discovered and reported against unified IR, but the
issue was latent within the non-unified frontend too.
Fixes#54537.
Change-Id: I7559a346b063349b35749e8a2da704be18e51654
Reviewed-on: https://go-review.googlesource.com/c/go/+/424937
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
To disambiguate local types, we append a "·N" suffix to their name and
then trim it off again when producing their runtime type descriptors.
However, if a local type is generic, then we were further appending
the type arguments after this suffix, and the code in types/fmt.go
responsible for trimming didn't know to handle this.
We could extend the types/fmt.go code to look for the "·N" suffix
elsewhere in the type name, but this is risky because it could
legitimately (albeit unlikely) appear in struct field tags.
Instead, the most robust solution is to just change the mangling logic
to keep the "·N" suffix at the end, where types/fmt.go can easily and
reliably trim it.
Note: the "·N" suffix is still visible within the type arguments
list (e.g., the "·3" suffixes in nested.out), because we currently use
the link strings in the type arguments list.
Fixes#54456.
Change-Id: Ie9beaf7e5330982f539bff57b8d48868a3674a37
Reviewed-on: https://go-review.googlesource.com/c/go/+/424901
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
When handling a type declaration like:
```
type B A
```
unified IR has been writing out that B's underlying type is A, rather
than the underlying type of A.
This is a bit awkward to implement and adds complexity to importers,
who need to handle resolving the underlying type themselves. But it
was necessary to handle when A was declared like:
```
//go:notinheap
type A int
```
Because we expected A's not-in-heap'ness to be conferred to B, which
required knowing that A was on the path from B to its actual
underlying type int.
However, since #46731 was accepted, we no longer need to support this
case. Instead we can write out B's actual underlying type.
One stumbling point though is the existing code for exporting
interfaces doesn't work for the underlying type of `comparable`, which
is now needed to implement `type C comparable`. As a bit of a hack, we
we instead export its underlying type as `interface{ comparable }`.
Fixes#54512.
Change-Id: I0fb892068d656f1e87bb8ef97da27756051126d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/424854
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
The hours, minutes, and seconds fields for time zones
should not have any plus or minus signs.
Use getnum instead of atoi since the latter implicitly
handles leading signs, while the former does not.
Fixes#54570
Change-Id: If9600170af3af999739c27d81958e3649946913a
Reviewed-on: https://go-review.googlesource.com/c/go/+/425038
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Rob Pike <r@golang.org>
The error return value of the seconds field is overwritten
and not checked in the presence of a fractional second.
Perform an explicit check for errors.
Fixes#54569
Change-Id: I1204c8bdcd5a5a09b773d9e44748141ed1e5cb20
Reviewed-on: https://go-review.googlesource.com/c/go/+/425036
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Rob Pike <r@golang.org>
This modifies the code to match the comment such that
the behavior truly is identical to stdSecond case.
Also, it modifies the behavior to match the documented
behavior where:
Fractional seconds are truncated to nanosecond precision.
Fixes#54567
Updates #48685
Change-Id: Ie64549e4372ab51624c105ad8ab4cc99b9b5a0b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/425037
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
This lock is acquired under trace.lock, which as of CL 418956
(6c2e327e35) must be acquired on the system stack, so this lock must
be, too.
Fixes#54553.
Change-Id: I4fb0c0c2dfc3cb94b76673e842ad416305a31238
Reviewed-on: https://go-review.googlesource.com/c/go/+/425097
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Previously we convert $0 to the ZR register for some reasons, which causes
two problems:
1. Confusion, the special case of the ZR register needs to be considered
when dealing with constants. For encoding, some places we encode ZR, and
some places we encode $0, although we have converted $0 to ZR.
2. Unexpected instruction format. All instructions that support ZR register
operands can be replaced by $0.
This patch removes this conversion. Note that this patch may cause previously
unintendedly supported instruction formats to no longer be supported.
Change-Id: I3d8d2c06711b7614a38191397da7776417f1861c
Reviewed-on: https://go-review.googlesource.com/c/go/+/404316
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Eric Fang <eric.fang@arm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Change-Id: I50e5609ff9c5f2b216b93cec7fb5214d196cae90
Reviewed-on: https://go-review.googlesource.com/c/go/+/412537
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
This is both simpler and more performant.
Change-Id: I398de29230e578fb7caf1765df7b8fe84d4e8876
Reviewed-on: https://go-review.googlesource.com/c/go/+/412336
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Ian Lance Taylor <iant@google.com>
We don't need compression enabled here, because we only set one question in the dns message. So there is nothing to compress. Also it reduces 8 allocs per LookupHost.
Change-Id: I0968f837011daf6d7a7b22d9af4a8cc5b2878f4c
GitHub-Last-Rev: 7eb3362bca
GitHub-Pull-Request: golang/go#54576
Reviewed-on: https://go-review.googlesource.com/c/go/+/425043
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
On ARM64 we use two separate instructions to compute the hi and lo
results of a 64x64->128 multiplication. Lower to two separate ops
so if only one result is needed we can deadcode the other.
Fixes#54607.
Change-Id: Ib023e77eb2b2b0bcf467b45471cb8a294bce6f90
Reviewed-on: https://go-review.googlesource.com/c/go/+/425101
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
There is already a skip in case of a later failure in the same test on
these platforms. Skip the failure if it occurs earlier too.
For #43120.
Change-Id: Id530370caa6a7df8cae593f6fdcb66871b86b125
Reviewed-on: https://go-review.googlesource.com/c/go/+/425096
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Use OpVarDef only when the variable being defined has pointers in it.
VarDef markers are only used for liveness analysis, and that only
runs on pointer-ful variables.
Fixes#53810
Change-Id: I09b0ef7ed31e72528916fe79325f80bbe69ff9b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/419320
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Neither are currently used. These concepts only need to exist
in the ssa backend (as ssa.OpVarDef and ssa.OpVarLive).
Change-Id: I8d6bd14aa7967b2156e5e9a103b95146e5552f36
Reviewed-on: https://go-review.googlesource.com/c/go/+/419319
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
os/exec.Cmd.Wait closes the read end of os/exec.Cmd.StdoutPipe, meaning
that io.ReadAll can return fs.ErrClosed if the child exits too early,
allowing Wait to complete. The StdoutPipe docs already note this sharp
edge.
Move cmd.Wait until after we finish waiting on stdout. If the child
crashes for some reason, the write end of the pipe will implicitly close
causing io.ReadAll to return as well, so we won't get stuck.
Fixes#52725.
Change-Id: Ifae5745d86206879af2f1523a664236972e07252
Reviewed-on: https://go-review.googlesource.com/c/go/+/420597
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
The existing decode() method offers the ability to keep just one
frame of the GIF image, however it will read and decompress all
subsequent frames regardless.
Fixes#41142
Change-Id: I0c3c11f9c11cd487b6c365e9a8b98e617d555db0
GitHub-Last-Rev: 03ebc8ee7b
GitHub-Pull-Request: golang/go#46813
Reviewed-on: https://go-review.googlesource.com/c/go/+/329329
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Paul Tyng <paul@paultyng.net>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Nigel Tao (INACTIVE; USE @golang.org INSTEAD) <nigeltao@google.com>
Check for malformed data when reading the number of aux
symbols associated with a symbol table entry.
Fixes#54584.
Change-Id: Ic2a8d4d6a1d481d585a065b8182de86294c3d3d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/425049
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
I was profiling the cpu usage of go/printer's only benchmark,
and found that token.File.Unpack was one of the top offenders.
It was mainly the deferred unlock that took a big chunk of time,
and to my surprise, reoving the use of defer helped significantly:
name old time/op new time/op delta
Print-16 5.61ms ± 2% 5.38ms ± 1% -4.04% (p=0.000 n=10+8)
name old speed new speed delta
Print-16 9.27MB/s ± 2% 9.64MB/s ± 1% +4.03% (p=0.000 n=9+8)
name old alloc/op new alloc/op delta
Print-16 332kB ± 0% 332kB ± 0% ~ (p=0.363 n=10+10)
name old allocs/op new allocs/op delta
Print-16 3.45k ± 0% 3.45k ± 0% ~ (all equal)
It seems like #38471 is to blame, as the defer prevents Unlock from
being inlined. Add a TODO as a reminder to come back here once the
compiler issue is fixed.
Change-Id: I5a1c6d36a8e8357435a305a1bc0970ee0358b08a
Reviewed-on: https://go-review.googlesource.com/c/go/+/424920
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
ReadData follows the error semantics of io.ReadFull for small sizes,
it should do so as well for large sizes.
Change-Id: I6a11b00d903ac5332e1dda074473790dcf21f32a
Reviewed-on: https://go-review.googlesource.com/c/go/+/424919
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
To avoid false positives from the reflectvaluecompare checker #43993
Use v.IsValid() instead of
var zero reflect.Value
v != zero
Also avoid comparing directly with the singleton reflect.Value
representing a missing value. Detect the missing value by type instead.
Change-Id: I3a00d63cf61c077e7c7ae816474aa1f032be325b
Reviewed-on: https://go-review.googlesource.com/c/go/+/308769
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This makes it possible to use `disasm` with ASLR windows binaries.
For #46639
Change-Id: I08aff38dc0b33fdfb07e0206766db066e33207d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/416976
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Occasionally the signal will be sent to a Go thread, which will cause
the program to exit with SIGQUIT rather than SIGSEGV.
Add TestSignalForwardingGo to test the case where the signal is
expected to be delivered to a Go thread.
This is a roll forward of CL 419014 which was rolled back in CL 424954.
This CL differs from 419014 in that it skips TestSignalForwardingGo
on darwin-amd64.
Fixes#53907
Change-Id: I5df3fd610c068df3bd48d9b3d7a9379248b97999
Reviewed-on: https://go-review.googlesource.com/c/go/+/425002
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Change-Id: Idc1f8b3fb6b4b2fdcc6dade048cc14c53715319f
Reviewed-on: https://go-review.googlesource.com/c/go/+/424197
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Avoid allocating large amounts of memory for corrupt input.
No test case because the problem can only happen for invalid data.
Let the fuzzer find cases like this.
Fixes#53787
Change-Id: I1b75a4c000b8d1112110309ec44b0ba9b4638d71
Reviewed-on: https://go-review.googlesource.com/c/go/+/416861
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dan Kortschak <dan@kortschak.io>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Avoid allocating large amounts of memory for corrupt input.
No test case because the problem can only happen for invalid data.
Let the fuzzer find cases like this.
Fixes#52521
Change-Id: I6a046f2e28e1255cf773ce135c5bb2b967ef43e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/414234
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dan Kortschak <dan@kortschak.io>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This follows on CL 407176 which added this function (in both
packages). This CL makes it consistent with the Cut function,
which uses “before” and “after” in return variable names.
Change-Id: Id4345d2fe0f50bf301a880803e87bf356986b518
Reviewed-on: https://go-review.googlesource.com/c/go/+/424922
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Depending on the implementation of the getrusage syscall/function, the
value of rusage.Maxrss may be undefined in case of an error. Thus, only
report MaxRSS in case of no error.
Change-Id: I7572ccc53c49eb460e53bded3eb41736eed8d2ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/424815
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Use "method has no receiver" and "method has multiple receivers"
in error messages for invalid receiver counts, matching the
corresponding types2 errors.
For #54511.
Change-Id: I96fc99440d6206c74e9416069db052234baa8248
Reviewed-on: https://go-review.googlesource.com/c/go/+/424934
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Use "middle" and "final" rather than "2nd" and "3rd" in error messages
for invalid slice expressions. This is the original compiler error
message and many tests check for this specific message.
For #54511.
Change-Id: I86eb739aa7218b7f393fab1ab402732cb9e9a1f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/424906
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Use "invalid" rather than "incomparable" in error message for map key
types that are not comparable. This is the original compiler error
message and many tests check for this specific message. The type
checker does provide an additional explanation if the reason for
the error is not obvious (e.g. for type parameters).
For #54511.
Change-Id: Idb76c48b4dfbfd66a7deac728a552e07f14e06d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/424905
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Use same approach to parsing const and var declarations
as the syntax package. Specifically, don't complain if
the first const specification in a const declaration
doesn't have a type and initialization expression. This
removes some duplicate errors when combined with the
type checker.
Adjust corresponding type checker tests accordingly.
For #54511.
Change-Id: I96702eba51dda6b581dad44577a7f93e4c02c857
Reviewed-on: https://go-review.googlesource.com/c/go/+/424904
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Change-Id: Ia00acf248f3498d75e2451548f82d3c57cfed06f
Reviewed-on: https://go-review.googlesource.com/c/go/+/424995
Run-TryBot: Michael Pratt <mpratt@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Make spelling consistent with uses in other error messages.
Change-Id: I584cd22413842fb8bae1632ed34c8b0e7ef163cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/424902
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
All code may be generic. Remove machinery to select parsing
mode (generic vs non-generic) since the parser doesn't support
this anymore. Adjust tests to more closely match corresponding
types2 code.
Change-Id: Id2398afe64d58714974ec96656fdf67c02ff5d04
Reviewed-on: https://go-review.googlesource.com/c/go/+/424900
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Generics are part of the language now; there's no need anymore
to switch back to a syntax without generics. Remove the associated
machinery and adjust short tests accordingly.
Change-Id: I6b16c5c75fd9354ee87e3b9bee110f49f514565a
Reviewed-on: https://go-review.googlesource.com/c/go/+/424857
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
The validity of an import path string is checked by the type checker
(and possibly other tools); it doesn't need to be done by the parser.
Remove the respective code and tests.
Also, adjust a corresponding go/types test which resolves a TODO.
For #54511.
Change-Id: Id1fc80df4e3e83be3ef123da3946ccb8f759779f
Reviewed-on: https://go-review.googlesource.com/c/go/+/424855
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Since the examples tests are now identical between the two type checkers,
remove the local copy of the examples tests and (for now) use the tests
in go/types/testdata/examples instead. Eventually we may decide to move
all tests out of the type checker directories and place them in a
shared space (e.g. internal/types/testdata).
For #54511.
Change-Id: Ibd8599d09e781b2219a23114b4b2049757971181
Reviewed-on: https://go-review.googlesource.com/c/go/+/424695
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Follow-up on CL 424674. With this change, the files in
testdata/examples are identical to the corresponding
files for types2.
For #54511.
Change-Id: Ic61c089bbf61492094e31057ad2635803f50a30d
Reviewed-on: https://go-review.googlesource.com/c/go/+/424714
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This was never permitted in Go but the flexibility to do so
was introduced through the generics prototype code where we
experimented with parentheses to enclose type parameters.
Restore original (pre-generics) behavior.
Fixes#51655.
Change-Id: Ia7a4b2e393e0214a70e840c8663cf4474c5c754b
Reviewed-on: https://go-review.googlesource.com/c/go/+/424694
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Older kernels which require the double check of the __kuser_cmpxchg
result are no longer supported as of Go 1.18 which requires at least
Linux 2.6.32.
For #45964
Change-Id: Ic3d6691bf006353ac51b9d43e742d970e3d4e961
Reviewed-on: https://go-review.googlesource.com/c/go/+/424556
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Offsetwriter refers to the design of SectionReader and removes
the section parameter n.
Since the size of the written data is determined by the user,
we cannot know where the end offset of the original data is.
The offset of SeekEnd is not valid in Seek method.
Fixes#45899.
Change-Id: I9d9445aecfa0dd4fc5168f2f65e1e3055c201b45
Reviewed-on: https://go-review.googlesource.com/c/go/+/406776
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
AppendRune appends the UTF-16 encoding of a rune to a []uint16.
BenchmarkEncodeValidASCII-12 24.61ns 16B 1allocs
BenchmarkEncodeValidJapaneseChars-12 18.79ns 8B 1allocs
BenchmarkAppendRuneValidASCII-12 6.826ns 0B 0allocs
BenchmarkAppendRuneValidJapaneseChars-12 3.547ns 0B 0allocs
The ASCII case is written to be inlineable.
Fixes#51896
Change-Id: I593b1029f603297ef6e80e036f2fee2a0938d38d
Reviewed-on: https://go-review.googlesource.com/c/go/+/409054
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
Though it increases the execution time, the function is already quite
fast for most users, the allocation is much more important.
name old time/op new time/op delta
ByteReplacerWriteString-8 1.23µs ± 0% 2.16µs ± 1% +75.31% (p=0.000 n=10+10)
name old alloc/op new alloc/op delta
ByteReplacerWriteString-8 2.69kB ± 0% 0.00kB -100.00% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
ByteReplacerWriteString-8 1.00 ± 0% 0.00 -100.00% (p=0.000 n=10+10)
Change-Id: I6a36df5fcb8e11ef27e6c7b252aa88e869592f3c
Reviewed-on: https://go-review.googlesource.com/c/go/+/424136
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joedian Reid <joedian@golang.org>
Support for Linux kernel versions requiring the fallback to CloseOnExec
was dropped from recent Go versions. The minimum Linux kernel version is
2.6.32 as of Go 1.18. The SOCK_CLOEXEC flag for the socket syscall is
supported since kernel version 2.6.27.
Follows a similar change for net.sysSocket in CL 403634.
For #45964
Change-Id: I8b6311f07c4ed7900a9af3ecb2e146c49db08665
Reviewed-on: https://go-review.googlesource.com/c/go/+/422374
Reviewed-by: Joedian Reid <joedian@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
The constants for these were auto-generated from the C includes
into zerrors_linux* files quite some time ago. The generator is
currently broken, but some new flags need to be added nevertheless.
As the flags won't change and the values are the same for all
architectures, we can just define them statically (as it's already
done in the runtime package):
- remove the CLONE_* constants from zerrors_linux_*.go;
- patch mkerrors.sh to not generate CLONE_ constants
(in case it will be fixed and used in the future);
- add the constants and some comments about them to exec_linux.go,
using Linux v5.17 include/uapi/sched.h as the ultimate source.
This adds the following new flags:
- CLONE_CLEAR_SIGHAND
- CLONE_INTO_CGROUP
- CLONE_NEWCGROUP
- CLONE_NEWTIME
- CLONE_PIDFD
For #51246.
Change-Id: I0c635723926218bd403d37e113ee4d62194463a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/407574
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joedian Reid <joedian@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
In order to prevent false sharing of cache lines, structs are
padded with some number of bytes. These bytes are unused, serving
only to make the size of the struct a multiple of the size of the
cache line.
The current calculation of how much to pad is an overestimation,
when the struct size is already a multiple of the cache line size
without padding. For these cases, no padding is necessary, and
the size of the inner pad field should be 0. The bug is that the
pad field is sized to a whole 'nother cache line, wasting space.
Here is the current formula that can never return 0:
cpu.CacheLinePadSize - unsafe.Sizeof(myStruct{})%cpu.CacheLinePadSize
This change simply mods that calculation by cpu.CacheLinePadSize,
so that 0 will be returned instead of cpu.CacheLinePadSize.
Change-Id: I26a2b287171bf47a3b9121873b2722f728381b5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/414214
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Avoid allocating large amounts of memory for corrupt input.
No test case because the problem can only happen for invalid data.
Let the fuzzer find cases like this.
Fixes#53369
Change-Id: I67c5e75bf181ad84988d6d6da12507df0e6df8e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/413979
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
A single dot in a search statement doesn't affect DNS lookup, so just ignore it and a syntax error.
Fixes#54124
Change-Id: Idd43bd34c5c16af50cba51f0b6e24f992eec6e57
Reviewed-on: https://go-review.googlesource.com/c/go/+/423875
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Call only initHPETTimecounter on the system stack.
Use O_CLOEXEC flag when opening the HPET device.
FreeBSD 12.3-RELEASE-p2, AMD FX-8300
paulzhol@relic:~/go/src/time % ~/gocode/bin/benchcmp old_hpet.txt new_hpet.txt
benchcmp is deprecated in favor of benchstat: https://pkg.go.dev/golang.org/x/perf/cmd/benchstat
benchmark old ns/op new ns/op delta
BenchmarkNow-8 1420 1397 -1.62%
BenchmarkNowUnixNano-8 1421 1404 -1.20%
BenchmarkNowUnixMilli-8 1423 1405 -1.26%
BenchmarkNowUnixMicro-8 1423 1404 -1.34%
Update #50947
Change-Id: I553b5427fb0b86d7e070af4516b36326bc0aaf00
Reviewed-on: https://go-review.googlesource.com/c/go/+/391856
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Unified IR is now at feature parity with the non-unified frontend.
Change-Id: I2a8cd41267a66f5eb1f425b89d18c6d501676e07
Reviewed-on: https://go-review.googlesource.com/c/go/+/422235
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Since the spec tests are now identical between the two type checkers,
remove the local copy of the spec tests and (for now) use the tests
in go/types/testdata/spec instead. Eventually we may decide to move
all tests out of the type checker directories and place them in a
shared space (e.g. internal/types/testdata).
For #54511.
Change-Id: Ibc62230553a5ff215160dcc97696b333ae9cf685
Reviewed-on: https://go-review.googlesource.com/c/go/+/424676
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Besides applying gofmt (which doesn't damage the tests in this case),
this removes a TODO for a set of nil-related tests.
The test files are now identical.
For #54511.
Change-Id: I0a286ad607f317f43972c1f5ee741b4f5bc9576d
Reviewed-on: https://go-review.googlesource.com/c/go/+/424675
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Besides applying gofmt (which doesn't damage the tests in this case),
the ERROR comments in the types2 files now match the go/types files.
But because types2 still reports some errors are different positions,
the checking code now allows for some position discrepancy (similar
to what we do for other tests).
Except for an outstanding TODO in go/types/testdata/examples/types.go
the test files are now identical.
For #54511.
Change-Id: I5748e0f678d11c5c0bdf4fdf28bd04f0b11b5b23
Reviewed-on: https://go-review.googlesource.com/c/go/+/424674
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Instead of simply reporting an error but otherwise dropping the
index expression from the parse tree when an index is missing
(as in: x[]), create an index expression with a "bad expression"
as index. This matches the behavior of go/parser and permits the
use of the same test case for both parsers.
(It would be simpler to adjust the go/parser to match the syntax
parser's behavior, but that would break backward-compatibility
of the go/parser.)
Adjust the affected test files.
For #54511.
Change-Id: If7668973794604593e869a24b560da92e100b812
Reviewed-on: https://go-review.googlesource.com/c/go/+/424654
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Update the version of BoringCrypto to boringssl tag
fips-20210429, for which FIPS approval is "in process".
Add GOARCH=arm64 BoringCrypto support.
Shuffle build to run as distinct steps in Docker so that
we can rerun later parts like build-goboring.sh without
rerunning all the setup.
Strip unnecessary parts of the syso using --strip-unneeded,
which cuts the amd64 syso from 10MB to 2.5MB.
The new arm64 syso is 2MB, so even though we added a new
architecture, we have half as much syso to distribute.
Change-Id: I0f7327389a3a485b82577abea9153d006418298f
Reviewed-on: https://go-review.googlesource.com/c/go/+/423362
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
This resolves a TODO. Also, it allows go/types and types2 to use
identical test files in testdata/spec, a prerequisition for sharing
them eventually.
For #54511.
Change-Id: Ia9d11b15ada237c18b6ce8f72732f70134a1a06f
Reviewed-on: https://go-review.googlesource.com/c/go/+/424537
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This does not enable any new functionality. It should
behave identically to GOPPC64=power9.
Updates #44549
Change-Id: I9a860544527fcfe97cbaf89686459d40dcf9593e
Reviewed-on: https://go-review.googlesource.com/c/go/+/352791
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
CL 424396 and CL 424397 changed timer0When/timerModifiedEarliest to
atomic.Uint64, just they're guaranted to have 64-bit alignment.
Change-Id: Idaff1059da2aac84520b9b0e34f9721a74dbba5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/424794
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Not used any more.
Fixes#53860
Change-Id: Id0b1c3ed30b576d6c5f08f064d1262de337262b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/418374
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
With the introduction of stack objects, VARKILL information is
no longer needed.
With stack objects, an object is dead when there are no more static
references to it, and the stack scanner can't find any live pointers
to it. VARKILL information isn't used to establish live ranges for
address-taken variables any more. In effect, the last static reference
*is* the VARKILL, and there's an additional dynamic liveness check
during stack scanning.
Next CL will actually rip out the VARKILL opcodes.
Change-Id: I030a2ab867445cf4e0e69397911f8a2e2f0ed07b
Reviewed-on: https://go-review.googlesource.com/c/go/+/419234
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
We don't need this special loop construct anymore now that we do
conservative GC scanning of the top of stack. Rewrite instead to a simple
pointer increment on every iteration. This leads to having a potential
past-the-end pointer at the end of the last iteration, but that value
immediately goes dead after the loop condition fails, and the past-the-end
pointer is never live across any call.
This simplifies and speeds up loops.
R=go1.20
TODO: actually delete all support for OFORUNTIL. It is now never generated,
but code to handle it (e.g. in ssagen) is still around.
TODO: in "for _, x := range" loops, we could get rid of the index
altogether and use a "pointer to the last element" reference to determine
when the loop is complete.
Fixes#53409
Change-Id: Ifc141600ff898a8bc6a75f793e575f8862679ba1
Reviewed-on: https://go-review.googlesource.com/c/go/+/414876
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
The non-unified frontend had repeated issues with inlining and
generics (#49309, #51909, #52907), which led us to substantially
restrict inlining when shape types were present.
However, these issues are evidently not present in unified IR's
inliner, and the safety restrictions added for the non-unified
frontend can simply be disabled in unified mode.
Fixes#54497.
Change-Id: I8e6ac9f3393c588bfaf14c6452891b9640a9d1bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/424775
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
As a consistency check in devirtualization, when we determine `i` (of
interface type `I`) always has dynamic type `T`, we insert a type
assertion `i.(T)`. This emits an itab check for `go:itab.T,I`, but
it's always true (and so SSA optimizes it away).
However, if `I` is instead the generic interface type `I[T]`, then
`go:itab.T,I[int]` and `go:itab.T,I[go.shape.int]` are equivalent but
distinct itabs. And notably, we'll have originally created the
interface value using the former; but the (non-dynamic) TypeAssertExpr
created by devirtualization would ultimately emit a comparison against
the latter. This comparison would then evaluate false, leading to a
spurious type assertion panic at runtime.
The comparison is just meant as an extra safety check, so it should be
safe to just disable. But for now, it's simpler/safer to just punt on
devirtualization in this case. (The non-unified frontend doesn't
devirtualize this either.)
Change-Id: I6a8809bcfebc9571f32e289fa4bc6a8b0d21ca46
Reviewed-on: https://go-review.googlesource.com/c/go/+/424774
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
For local variables of derived type, Delve relies on ir.Name.DictIndex
being set to the type's rtype index within the function's dictionary.
This CL implements that functionality within unified IR.
Manually double checked that Delve behaves correctly, at least as far
as I can tell from casual use. Specifically, I confirmed that running
the test program from TestDictIndex, stepping into testfn, and then
running `print mapvar` prints `map[int]main.CustomInt []`, which
matches the behavior under GOEXPERIMENT=nounified. (Also compare that
when ir.Name.DictIndex is *not* set by unified IR, `print mapvar`
instead prints `map[int]go.shape.int []`.)
Fixes#54514.
Change-Id: I90d443945895abfba04dc018f15e00217930091c
Reviewed-on: https://go-review.googlesource.com/c/go/+/424735
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This CL implements pointer shaping in unified IR, corresponding to the
existing pointer shaping implemented in the non-unified frontend.
For example, if `func F[T any]` is instantiated as both `F[*int]` and
`F[*string]`, we'll now generate a single `F[go.shape.*uint8]` shaped
function that can be used by both.
Fixes#54513.
Change-Id: I2cef5ae411919e6dc5bcb3cac912abecb4cd5218
Reviewed-on: https://go-review.googlesource.com/c/go/+/424734
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
So they match with when/nextwhen fields of timer struct.
Updates #53821
Change-Id: Iad0cceb129796745774facfbbfe5756df3a320b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/423117
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Even though the -race option works for ppc64le, some of the
testsanitizer test have failed in the past on our builders. These
same failures can't be reproduced on other systems.
This is an experiment to re-enable this test on ppc64le to see if
it still fails on the builders.
Updates #45040
Change-Id: I0729bec5864e6c4cc752968485e89179df027063
Reviewed-on: https://go-review.googlesource.com/c/go/+/424534
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Archana Ravindar <aravind5@in.ibm.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
printer.print is an overloaded method for multiple purposes.
When fed a position, it updates the current position.
When fed a string, it prints the string.
When fed a token, it prints the token. And so on.
However, this overloading comes at a significant cost.
Because the parameters are a list of the `any` interface type,
any type which is not of pointer or interface kind will allocate when
passed as an argument, as interfaces can only contain pointers.
A large portion of the arguments passed to the print method are of type
token.Pos, whose underlying type is int - so it allocates.
Removing those allocations has a significant benefit,
at the cost of some verbosity in the code:
name old time/op new time/op delta
Print-16 6.10ms ± 2% 5.39ms ± 2% -11.72% (p=0.000 n=10+10)
name old speed new speed delta
Print-16 8.50MB/s ± 2% 9.63MB/s ± 2% +13.28% (p=0.000 n=10+10)
name old alloc/op new alloc/op delta
Print-16 443kB ± 0% 332kB ± 0% -25.10% (p=0.000 n=10+9)
name old allocs/op new allocs/op delta
Print-16 17.3k ± 0% 3.5k ± 0% -80.10% (p=0.000 n=10+10)
There should be more significant speed-ups left, particularly for the
token.Token, string, and whiteSpace types fed to the same method.
They are left for a future CL, in case this kind of optimization is not
a path we want to take.
Change-Id: I3ff8387242c5a935bb003e60e0813b7b9c65402e
Reviewed-on: https://go-review.googlesource.com/c/go/+/412557
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: hopehook <hopehook@qq.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
These are only used once right after being set in castagnoliInit and
ieeeInit, respectively.
Change-Id: Ifc5df1fe3040b97b1d252cc6d6d28d8fbc132fa5
Reviewed-on: https://go-review.googlesource.com/c/go/+/423854
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
The golang.org/x/sys/unix package is already imported for Utsname and
Uname. Use ByteSliceToString from that package as well to replace the
locally defined utsString helper which serves the same purpose and
matches ByteSliceToString's implementation.
Change-Id: I5d9de186a5aeb1feed1387beedefbcd260fe22ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/415654
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
No test case because the problem can only happen for invalid data.
Let the fuzzer find cases like this.
For #47653Fixes#53530
Change-Id: If1cebbbcabb188fec8be30ef043c8c4c935a9564
Reviewed-on: https://go-review.googlesource.com/c/go/+/413995
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
The documentation for LoadLocation contains an enumerated list,
but does not render as such because it's missing leading spaces.
Output verified with the go doc command and godoc server.
Change-Id: I88b61d34048b7d01ee5cd77c32849af266e2f4c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/423297
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Support for operating system versions requiring the fallback to
CloseOnExec/SetNonblock was dropped from recent Go versions. The minimum
Linux kernel version is 2.6.32 as of Go 1.18. FreeBSD 10 is no longer
supported as of Go 1.13.
Follows a similar change for net.sysSocket in CL 403634 and
syscall.Socket in CL 422374.
For #45964
Change-Id: I60848415742a1d8204e1fda585462ff35ad6722f
Reviewed-on: https://go-review.googlesource.com/c/go/+/422375
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Most newer architectures (e.g. arm64, riscv64, loong64) don't provide the
epoll_create syscall. Some systems (e.g. Android) block it even if it
were available. In the kernel, the epoll_create syscall is implemented
[1] the same way EpollCreate is implemented in this package for
platforms without the epoll_create syscall. The epoll_create1 syscall is
available since Linux kernel 2.6.27 and the minimum required kernel
version is 2.6.32 since Go 1.18 (see #45964). Thus, avoid the separate
wrapper and consistently implement EpollCreate using EpollCreate1.
[1] https://elixir.bootlin.com/linux/v5.15-rc1/source/fs/eventpoll.c#L2006
The same change was already done in CL 349809 for golang.org/x/sys/unix.
For #45964
Change-Id: I5463b208aa7ae236fa2c175d6d3ec6568f1840b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/411594
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
The previous implementation of isCaseSensitive called t.Fatalf in the
wrong place, causing tests after the first to proceed past an error
determining case-sensitivity. That could lead to confusing errors.
(Moreover, I would like to try to disentangle the script engine from
testing.T so that I can also use it to generate serving contents in
the replacement for vcs-test.golang.org.)
The implementation of goVersion called ts.fatalf, which is probably
fine but prevents the script environment from being computed outside
of a test, as we might want to do for debugging and other scripting.
For #27494.
Change-Id: Ibfee0704523fdcd6174b544ff84267216435025b
Reviewed-on: https://go-review.googlesource.com/c/go/+/419874
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
When the GOOS or GOARCH of the cmd/go test binary does not match the
GOOS or GOARCH of the installed 'go' binary itself, the test currently
attempts to trick 'go test' into thinking that there were no test
functions to run.
That makes it very difficult to discover how to actually run the
tests, which in turn makes it difficult to diagnose and fix
regressions in, say, the linux-386-longtest builders. (We have had a
few of those lately, and they shouldn't be as much of an ordeal to fix
as they currently are.)
There are three underlying problems:
1. cmd/go uses its own GOOS and GOARCH to figure out which variant of
other tools to use, and the cache keys for all installed tools and
libraries include the IDs of the tools used to build them. So when
cmd/go's GOARCH changes, all installed tools and binaries appear
stale *even if* they were just installed by invoking the native
cmd/go with the appropriate GOARCH value set.
2. The "go/build" library used by cmd/go toggles its default
CGO_ENABLED behavior depending on whether the GOOS and GOARCH being
imported match runtime.GOOS and runtime.GOARCH.
3. A handful of cmd/go tests explicitly use gccgo, but the user's
installed gccgo binary cannot necessarily cross-compile to the same
platforms as cmd/go.
To address the cache-invalidation problem, we modify the test variant
of cmd/go to use the host's native toolchain (as indicated by the new
TESTGO_GOHOSTOS and TESTGO_GOHOSTARCH environment variables) instead
of the toolchain matching the test binary itself. That allows a test
cmd/go binary compiled with GOARCH=386 to use libraries and tools
cross-compiled by the native toolchain, so that
$ GOARCH=386 go install std cmd
suffices to make the packages in std and cmd non-stale in the
tests.
To address the CGO_ENABLED mismatch, we set CGO_ENABLED explicitly in
the test's environment whenever it may differ from the default. Since
script tests that use cgo are already expected to use a [cgo]
condition, setting the environment to match that condition fixes the
cgo-specific tests.
To address the gccgo-specific cross-compilation failures, we add a new
script condition, [cross], which evaluates to true whenever the
platform of the test binary differs from that of the native toolchain.
We can then use that condition to explicitly skip the handful of gccgo
tests that fail under cross-compilation.
Fixes#53936.
Change-Id: I8633944f674eb5941ccc95df928991660e7e8137
Reviewed-on: https://go-review.googlesource.com/c/go/+/356611
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
This CL switches unified IR to use shape-based stenciling with runtime
dictionaries, like the existing non-unified frontend. Specifically,
when instantiating generic functions and types `X[T]`, we now also
instantiated shaped variants `X[shapify(T)]` that can be shared by
`T`'s with common underlying types.
For example, for generic function `F`, `F[int](args...)` will be
rewritten to `F[go.shape.int](&.dict.F[int], args...)`.
For generic type `T` with method `M` and value `t` of type `T[int]`,
`t.M(args...)` will be rewritten to `T[go.shape.int].M(t,
&.dict.T[int], args...)`.
Two notable distinctions from the non-unified frontend:
1. For simplicity, currently shaping is limited to simply converting
type arguments to their underlying type. Subsequent CLs will implement
more aggressive shaping.
2. For generic types, a single dictionary is generated to be shared by
all methods, rather than separate dictionaries for each method. I
originally went with this design because I have an idea of changing
interface calls to pass the itab pointer via the closure
register (which should have zero overhead), and then the interface
wrappers for generic methods could use the *runtime.itab to find the
runtime dictionary that corresponds to the dynamic type. This would
allow emitting fewer method wrappers.
However, this choice does have the consequence that currently even if
a method is unused and its code is pruned by the linker, it may have
produced runtime dictionary entries that need to be kept alive anyway.
I'm open to changing this to generate per-method dictionaries, though
this would require changing the unified IR export data format; so it
would be best to make this decision before Go 1.20.
The other option is making the linker smarter about pruning unneeded
dictionary entries, like how it already prunes itab entries. For
example, the runtime dictionary for `T[int]` could have a `R_DICTTYPE`
meta-relocation against symbol `.dicttype.T[go.shape.int]` that
declares it's a dictionary associated with that type; and then each
method on `T[go.shape.T]` could have `R_DICTUSE` meta-relocations
against `.dicttype.T[go.shape.T]+offset` indicating which fields
within dictionaries of that type need to be preserved.
Change-Id: I369580b1d93d19640a4b5ecada4f6231adcce3fd
Reviewed-on: https://go-review.googlesource.com/c/go/+/421821
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
The splice syscall is buggy prior to Linux 2.6.29. CL 113999 added a
workaround to detect buggy versions and disable use of splice for these.
As of Go 1.18 the minumum Linux version is 2.6.32. Thus, a non-buggy
implementation of the splice syscall can be assumed.
For #45964Fixes#54505
Change-Id: Ied3a3334da7a3f7fa1280b7c5b1dfb9030219336
Reviewed-on: https://go-review.googlesource.com/c/go/+/422979
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Either ones where kind == kindNonBlock or those we've successfully called syscall.SetNonblock() on.
Restore blocking behavior if we detect an error registering with the netpoller and our flow was
successful in setting the inital syscall.SetNonblock().
Update #54100
Change-Id: I08934e4107c7fb36c15a7ca23ac880490b4df235
Reviewed-on: https://go-review.googlesource.com/c/go/+/420334
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Goutnik <dgoutnik@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Yuval Pavel Zholkover <paulzhol@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Plan 9 a.out was not implemented for debug/buildinfo, which
was causing test failures on Plan 9. This adds an implementation,
and causes the tests to pass.
Fixes#53949
Change-Id: I90a307ef9babf8cf381f8746d731cac2206b234a
Reviewed-on: https://go-review.googlesource.com/c/go/+/418014
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Generics lets us write Cache[K, V] instead of using unsafe.Pointer,
which lets us remove all the uses of package unsafe around the
uses of the cache.
I tried to do Cache[*K, *V] instead of Cache[K, V] but that was not possible.
Change-Id: If3b54cf4c8d2a44879a5f343fd91ecff096537e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/423357
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Change-Id: I4dad103d23121a21b04800ec157487fdf79f89a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/424398
Run-TryBot: hopehook <hopehook@qq.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
'go tool' sets environment variables, including the GOAMD64 value
from the user's go.env file.
'go tool dist test' then rebuilds and reinstalls the toolchain and
standard library based on those variables. It should not; instead, it
should test exactly the configuration installed by the make scripts.
Fixes#54084.
Change-Id: I7cc8a21cc1d8331e06d7b7c55b14d170f8e2faab
Reviewed-on: https://go-review.googlesource.com/c/go/+/420055
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
We have a very complex process to make VDSO calls on ARM. Create a
wrapper helper function which reduces duplication and allows for
additional calls from other packages.
vdsoCall has a few differences from the original code in
walltime/nanotime:
* It does not use R0-R3, as they are passed through as arguments to fn.
* It does not save g if g.m.gsignal.stack.lo is zero. This may occur if
it called at startup on g0 between assigning g0.m.gsignal and setting
its stack.
For #49182
Change-Id: I51aca514b4835b71142011341d2f09125334d30f
Reviewed-on: https://go-review.googlesource.com/c/go/+/362795
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Export cipher.xorBytes as subtle.XORBytes, for proposal #53021,
to provide fast XOR to cryptography libraries outside crypto/cipher.
Along with the move, implement the alignment check TODO
in xor_generic.go, so that systems with neither unaligned
accesses nor custom assembly can still XOR a word at a time
in word-based algorithms like GCM. This removes the need
for the separate cipher.xorWords.
Fixes#53021.
Change-Id: I58f80a922f1cff671b5ebc6168eb046e702b5a4c
Reviewed-on: https://go-review.googlesource.com/c/go/+/421435
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
This avoids an import conflict with crypto/subtle.
CL 424175 does the same for x/crypto.
Change-Id: Id4a319b3283b8affaaf769062388325b31fe1715
Reviewed-on: https://go-review.googlesource.com/c/go/+/424194
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Test is still flaky.
For #22857
Change-Id: Ic0d979778eb4c2d3779b18a983e7077789ae08a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/424535
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Request.Cookie(name string) will return the first cookie
when cookie name is "". Since readCookies in
file net/http/cookie.go at line 247 return all cookies
when second parameter is a empty string.
To fix it, Return ErrNoCookie from Request.Cookie(""),
instead of the first cookie in the request.
Fixes#53181
Change-Id: Ie623ca4c53da64ef7623a7863292a2d771f76832
GitHub-Last-Rev: 01098cd5db
GitHub-Pull-Request: golang/go#53183
Reviewed-on: https://go-review.googlesource.com/c/go/+/409754
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
This test was disabled for flakiness.
The underlying code has been rewritten.
Reenabling the test to see if it has been fixed.
Fixes#22857.
Change-Id: If488ee5f4692cdf4ed534b8f08b4a54b80a60943
Reviewed-on: https://go-review.googlesource.com/c/go/+/423454
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
GoTool was added in CL 20967, and revised in CL 21292, for #14901.
I don't fully understand what problem the GoTool function was added to
solve: the discussion on that issue was pretty sparse, but it seems
like when we run tests of GOROOT packages they always know their own
location relative to GOROOT (and thus always know where to find the
'go' tool).
Lacking that understanding, I don't want to change its behavior, but I
do at least want to verify that it resolves to the real 'go' tool in
the common case (running 'go test' on a package in GOROOT/src).
For #50892
For #50893
Updates #14901
Change-Id: I06d831e6765be631dfc4854d7fddc3d27fc1de34
Reviewed-on: https://go-review.googlesource.com/c/go/+/381834
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Optimize Time.GoString by avoiding multiple calls to absDate.
name old time/op new time/op delta
GoString-8 313ns ± 2% 197ns ± 1% -37.08% (p=0.008 n=5+5)
name old alloc/op new alloc/op delta
GoString-8 80.0B ± 0% 80.0B ± 0% ~ (all equal)
name old allocs/op new allocs/op delta
GoString-8 1.00 ± 0% 1.00 ± 0% ~ (all equal)
Fixes#54436
Change-Id: I8e6f8e7bbb9857b4bc0cdf6ed29a6b2415775db7
Reviewed-on: https://go-review.googlesource.com/c/go/+/423634
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Brings freebsd/amd64 on par with other OSes/archs.
Updates #53479
Change-Id: I05164c887d776dd4a0ae51eafd4014042b782999
Reviewed-on: https://go-review.googlesource.com/c/go/+/413366
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Following proposal discussion in #38687, add go generate -skip
to allow easier skipping of specific //go:generate directives.
Fixes#38687.
Change-Id: Ied5b4042965dd6a2b93c1c517045fccae2d95c3f
Reviewed-on: https://go-review.googlesource.com/c/go/+/421440
Auto-Submit: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Brings freebsd/386 on par with other OSes/archs.
Updates #53479
Change-Id: I16a7d051233e06e589b19919e68f07b6bf92f73c
Reviewed-on: https://go-review.googlesource.com/c/go/+/413365
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
The existing implementation has an execution time higher in the benchmark than this one.
This is an optimized implementation using the copy() function and a constant 256 bytes string with the values to be copied.
```
name old time/op new time/op delta
NewEncoding-4 329ns ± 1% 231ns ± 1% -29.72% (p=0.008 n=5+5)
name old speed new speed delta
NewEncoding-4 778MB/s ± 1% 1108MB/s ± 1% +42.29% (p=0.008 n=5+5)
```
Fixes#53211
Change-Id: I80fe62aa40623125ef81ae9164a8405eed30b71b
GitHub-Last-Rev: 55dce6f636
GitHub-Pull-Request: golang/go#53212
Reviewed-on: https://go-review.googlesource.com/c/go/+/410194
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
No test case because the problem can only happen for invalid data.
Let the fuzzer find cases like this.
For #47653Fixes#52526
Change-Id: Id90a5e391a4f684f45f8d7e32608eb03b8081076
Reviewed-on: https://go-review.googlesource.com/c/go/+/413875
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Don't allocate slices that are too large; choose a smaller capacity
and build the slice using append. Use this in debug/macho to avoid
over-allocating if a fat header is incorrect.
No debug/macho test case because the problem can only happen for
invalid data. Let the fuzzer find cases like this.
For #47653Fixes#52523
Change-Id: I372c9cdbdda8626a3225e79d713650beb350ebc7
Reviewed-on: https://go-review.googlesource.com/c/go/+/413874
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Change-Id: Id492ee4e614a38880a6a5830371dcd9a8b37129a
Reviewed-on: https://go-review.googlesource.com/c/go/+/422214
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: hopehook <hopehook@qq.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: hopehook <hopehook@qq.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
For #47653Fixes#53189
Change-Id: If35b968fc53e4c96b18964cfb020cdc003b881bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/412014
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
As CL 422214 did, this CL intends to clean up the rest
unreachable "Continue" after Fatal.
Change-Id: I3b7e1b59bdfccb185e20525ce113e241d277dad3
Reviewed-on: https://go-review.googlesource.com/c/go/+/422514
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: hopehook <hopehook@qq.com>
[This is a retry of CL 407036 + its revert CL 422394. The only
content change is the 1-line change in cmd/internal/obj/objfile.go.]
Read the bitmaps one uintptr at a time instead of one byte at a time.
Performance so far:
Allocation heavy, no retention: ~30% faster in heapBitsSetType
Scan heavy, ~no allocation: ~even in scanobject
Change-Id: I04d899e1dbd23e989e9f552cdc1880318779c14c
Reviewed-on: https://go-review.googlesource.com/c/go/+/422635
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
[this is a retry of CL 407035 + its revert CL 422395. The content is unchanged]
Use just 1 bit per word to record the ptr/nonptr bitmap.
Use word-sized operations to manipulate the bitmap, so we can operate
on up to 64 ptr/nonptr bits at a time.
Use a separate bitmap, one bit per word of the ptr/nonptr bitmap,
to encode a no-more-pointers signal. Since we can check 64 ptr/nonptr
bits at once, knowing the exact last pointer location is not necessary.
As a followon CL, we should make the gcdata bitmap an array of
uintptr instead of an array of byte, so we can load 64 bits of it at once.
Similarly for the processing of gc programs.
Change-Id: Ica5eb622f5b87e647be64f471d67b02732ef8be6
Reviewed-on: https://go-review.googlesource.com/c/go/+/422634
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
Add a new Rewrite hook to ReverseProxy, superseding the Director hook.
Director does not distinguish between the inbound and outbound request,
which makes it possible for headers added by Director to be inadvertently
removed before forwarding if they are listed in the inbound request's
Connection header. Rewrite accepts a value containing the inbound
and outbound requests, with hop-by-hop headers already removed from
the outbound request, avoiding this problem.
ReverseProxy's appends the client IP to the inbound X-Forwarded-For
header by default. Users must manually delete untrusted X-Forwarded-For
values. When used with a Rewrite hook, ReverseProxy now strips
X-Forwarded-* headers by default.
NewSingleHostReverseProxy creates a proxy that does not rewrite the
Host header of inbound requests. Changing this behavior is
cumbersome, as it requires wrapping the Director function created
by NewSingleHostReverseProxy. The Rewrite hook's ProxyRequest
parameter provides a SetURL method that provides equivalent
functionality to NewSingleHostReverseProxy, rewrites the Host
header by default, and can be more easily extended with additional
customizations.
Fixes#28168.
Fixes#50580.
Fixes#53002.
Change-Id: Ib84e2fdd1d52c610e3887af66f517d4a74e594d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/407214
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
(But still not when -buildvcs=auto, the default.)
Fixes#52648.
Change-Id: I87a87d4ea84e8bf9635a4f7c8674c9311c3e21be
Reviewed-on: https://go-review.googlesource.com/c/go/+/409177
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
The design of FileSet encourages it to be used as a global variable.
Each call to AddFile consumes about 3KB, that is never returned,
even after an application no longer cares about the File.
This change adds a RemoveFile method that a long-running application
can use to release a File that is no longer needed, saving memory.
Fixesgolang/go#53200
Change-Id: Ifd34d650fe0d18b1395f922a4cd02a535afbe560
Reviewed-on: https://go-review.googlesource.com/c/go/+/410114
Auto-Submit: Alan Donovan <adonovan@google.com>
Run-TryBot: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
This test was apparently mistakenly removed without a replacement in
CL 213223, but its testdata was left in the tree. This change removes
the orphaned testdata subdirectory, and restores the test that
previously used that data as a self-contained script.
For #27494.
Change-Id: Ice81895a44c558aaab198b8ef7ec046d92f5d58f
Reviewed-on: https://go-review.googlesource.com/c/go/+/417658
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
As far as I can determine, this is the only existing non-script test
that relies on vcs-test.golang.org. I am attempting to eliminate the
vcs-test server, and to keep configuration straightforward I would
like to only set up its replacement for script tests.
For #27494.
Change-Id: Ib978228b9c3f403af5f1c445e08942cbe7915b62
Reviewed-on: https://go-review.googlesource.com/c/go/+/418103
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
$ cd $GOROOT/src/testing
$ go test
root
root
root
root
PASS
$
The root prints have been happening since Go 1.14.
There is a test in sub_test.go that calls b.Run directly
with a benchmark named "root", which triggers the print.
Silence them.
Change-Id: I2f0c186f04c6139bc24fab0e91975fcf0a8e80fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/421437
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Now that syscall.Mmap is defined on solaris (see CL 413374), use it in
mmapFile like on other Unix ports.
For #52875
Change-Id: Ic5c5a84da8613f0c6dc947a52b7fcca50af43d79
Reviewed-on: https://go-review.googlesource.com/c/go/+/413375
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
WithContext makes a shallow copy of a Request, and Clone makes a
deep copy. Both set the context of the new request. The distinction
between the two is clear, and it doesn't seem useful or necessary
to say that "it's rare to need WithContext".
Also update a couple locations that mention WithContext to mention
Clone as well.
Fixes#53413.
Change-Id: I89e6ddebd7d5ca6573e522fe48cd7f50cc645cdd
Reviewed-on: https://go-review.googlesource.com/c/go/+/412778
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
When accessing (*Checker).implements from types.AssignableTo or
types.ComparableTo, we don't need to build error strings -- they won't
be used.
This string manipulation showed up as a hot spot in gopls completion,
which checks a lot of type predicates when searching for candidate
completions.
This CL yields the following results for gopls' completion benchmarks:
StructCompletion-8 24.7ms ±34% 26.0ms ±17% ~ (p=0.447 n=10+9)
ImportCompletion-8 1.41ms ± 2% 1.45ms ± 4% +2.42% (p=0.027 n=8+9)
SliceCompletion-8 27.0ms ±18% 25.2ms ± 3% -6.67% (p=0.008 n=9+8)
FuncDeepCompletion-8 57.6ms ± 4% 22.4ms ± 4% -61.18% (p=0.000 n=8+9)
CompletionFollowingEdit-8 157ms ±13% 103ms ±15% -34.70% (p=0.000 n=10+10)
Notably, deep completion (which searches many candidates) is almost 3x
faster after this change.
Fixes#54172
Change-Id: If8303a411aed3a20bd91f7b61e346d703084166c
Reviewed-on: https://go-review.googlesource.com/c/go/+/423360
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
The new Clone function returns a copy of b[:len(b)]
for the input byte slice b.
The result may have additional unused capacity.
Clone(nil) returns nil.
Fixes#45038
Change-Id: I0469a202d77a7b491f1341c08915d07ddd1f0300
Reviewed-on: https://go-review.googlesource.com/c/go/+/359675
Run-TryBot: Martin Möhrmann <martin@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
So far was only documented in doc/diagnostics.
Fixes: #54183
Change-Id: Iab67a1500547f30325453c614a2f2f6621dfadb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/423275
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
The value of Expires is only checked when a value is set.
This fixes the bug that a cookie with a zero-valued Expire
was considered invalid, even though Expires is an optional
field.
Fixes#52989
Change-Id: I206c50e9b6ea2744a92c74673d589ce2aaa62670
Reviewed-on: https://go-review.googlesource.com/c/go/+/407654
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
The length of slice hashedsyms is always 0, because it's not used after defined
Change-Id: Iba8e263aedfa403d5688678a1b37c2be3119eb7f
GitHub-Last-Rev: c236c4a482
GitHub-Pull-Request: golang/go#53450
Reviewed-on: https://go-review.googlesource.com/c/go/+/413234
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: guangyuan zhou <zhouguangyuan@golangcn.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Use the helper added by CL 422038 instead of manually detecting the
noopt builder.
Change-Id: I353f1a9d5f0184d73869520eb1ae8d0bdbbe2006
Reviewed-on: https://go-review.googlesource.com/c/go/+/423855
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
A few lingering references to Go 1.4 remain.
Fix them, and document the ones that should stay.
For #44505.
Fixes#54301.
Change-Id: Ieb9c0f08e4d1890ea3fdfd9c8df5493934ae7493
Reviewed-on: https://go-review.googlesource.com/c/go/+/423354
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Change-Id: Ie169c226e8973c8b504412cc0ac1f14abcdfdb1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/423755
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
CL 414836 limited the check for implicit dot for method call enabled by
a type bound. However, the checking condition for ODOTMETH only is not
right. For example, for promoted method, we have a OXDOT node instead,
and we still have to check for implicit dot in this case.
However, if the base type and embedded types have the same method name,
e.g in issue #53419, typecheck.AddImplicitDots will be confused and
result in an ambigus selector.
To fix this, we ensure methods for the base type are computed, then only
do the implicit dot check if we can find a matched method.
Fixes#54348
Change-Id: Iefe84ff330830afe35c5daffd499824db108da23
Reviewed-on: https://go-review.googlesource.com/c/go/+/422274
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
This saves 11,000 allocations when loading the standard library
in golang.org/x/tools/go/ssa form.
Change-Id: I8aa32b0641c1a3dde29e6ee76c760006035dd56d
Reviewed-on: https://go-review.googlesource.com/c/go/+/423934
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
This CL make math.sqrt an intrinsic function, math.Sqrt is not affected
since compiler can inline it. With this change, we can remove all assembly
code for math.Sqrt that aims to speed up indirect call. The go compiler can
generate same or faster code (with regabi) for indirect call.
Benchmark on amd64:
name old time/op new time/op delta
SqrtIndirect 2.60ns ± 3% 1.03ns ± 4% -60.24% (p=0.000 n=10+10)
SqrtLatency 3.40ns ± 1% 3.32ns ± 1% -2.26% (p=0.000 n=10+8)
SqrtIndirectLatency 6.09ns ± 0% 3.31ns ± 0% -45.67% (p=0.000 n=10+10)
SqrtGoLatency 36.1ns ± 6% 34.6ns ± 1% ~ (p=0.101 n=10+10)
SqrtPrime 2.53µs ± 2% 2.55µs ± 6% ~ (p=0.398 n=9+9)
Change-Id: If4be0f242c1d9d4feca7d269fc9cd6e6066f163d
Reviewed-on: https://go-review.googlesource.com/c/go/+/421074
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>