Documentation around the use of types.Context is unclear about whether
contexts guarantee deduplication of identical instances. Add explicit
disclaimers that this is not the case.
Fixesgolang/go#51680
Change-Id: I6651587315d3cbf9e8d70a69d3e2ec5cedd00da5
Reviewed-on: https://go-review.googlesource.com/c/go/+/396536
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
CL 367755 added soleComponent for handling 1-byte type interface conversion.
This implementation must be kept in sync with Type.SoleComponent, but it
does not. When seeing a blank field in struct, we must continue looking
at the field type to find sole component, if any. The current code just
terminate immediately, which causes wrong sole component type returned.
Fixes#52020
Change-Id: I4f506fe094fa7c5532de23467a4f9139476bb0a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/396614
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
After CL 281543, checkassign do not have to check assignment in range
loop anymore, thus its first parameter is un-used.
Change-Id: Idbc46fcb81c3dd5edc87308d228c1a15ca5faf7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/396615
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
RFC 1950 section 2.2 "Data format" says "CINFO (Compression info)... For
CM = 8... Values of CINFO above 7 are not allowed".
Change-Id: Ibbc1213125c7dc045f09901ee7746660e90b5fcd
Reviewed-on: https://go-review.googlesource.com/c/go/+/395734
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Trust: Nigel Tao <nigeltao@golang.org>
There are several of places that save and restore the C callee-saved registers,
the operation is the same everywhere, so this CL defines several macros
to do this, which will help reduce code redundancy and unify the operation.
This CL also replaced consecutive MOVD instructions with STP and LDP instructions
in several places where these macros do not apply.
Change-Id: I815f39fe484a9ab9b6bd157dfcbc8ad99c1420fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/374397
Trust: Eric Fang <eric.fang@arm.com>
Run-TryBot: Eric Fang <eric.fang@arm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
The Addr should be zero if SHF_ALLOC is not set.
Update #51939
Change-Id: I030f6243d05efabe6b9ebf558e9c0201f7922d23
Reviewed-on: https://go-review.googlesource.com/c/go/+/395919
Trust: mzh <mzh@golangcn.org>
Run-TryBot: mzh <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This CL adds
- spill functions used by runtime
- ABIInternal to functions
Adding new stubs_riscv64 file to eliminate vet issues while compiling.
Change-Id: I2a9f6088a1cd2d9708f26b2d97895b4e5f9f87e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/360296
Trust: mzh <mzh@golangcn.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Use the 1.17 compiler error message together with the receiver base type.
Also, simplify and flatten the receive testing logic for clarity.
Change-Id: I71e58f261900dd7a85d2eb89a310c36b68d1b0b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/396298
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
These are the opcodes required to lower math/bits.Add64 and
math/bits.Sub64 directly into ssa form. Likewise, opcodes which
clobber CA are marked.
This does not alter code generation. It prepares for future changes
to support scheduling carry chaining ops more effectively, and then
changes to lower into PPC64 opcodes.
Change-Id: I2723deee4a98b3c365f691857512df53280ae40f
Reviewed-on: https://go-review.googlesource.com/c/go/+/394594
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
If a GC related task preempts between hitting the main.main breakpoint
and stepping, the test program may halt forever waiting on a GC
operation. This happens if gdb is configured to halt other threads
while executing a step.
Configure gdb to continue running all threads during a step by
setting the scheduler-locking option to off.
Fixes#49852
Change-Id: Iacc9732cbd23526bde0a295e6fa8a0d90f733f59
Reviewed-on: https://go-review.googlesource.com/c/go/+/370775
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Cherry Mui <cherryyz@google.com>
This is the first step towards decomposing aggregate operations
which create or consume the CA bit of the XER.
This helps optimize the canned sequence of Add64Carry (and
Sub64Borrow if it were implemented similarly) by minimizing
extraneous operations related to loading the CA bit,
reloading CA in chained operations, or extracting it when
unused.
Likewise, mark the operations which clobber CA.
Change-Id: I33e6dd2654a8cc39fcdbb9690a495f03558cdc97
Reviewed-on: https://go-review.googlesource.com/c/go/+/346869
Trust: Paul Murphy <murp@ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Use the 1.17 compiler error message.
Change-Id: Ic62de5bfc9681674069934afc590f5840729f8e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/396297
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Use the 1.17 compiler error message, sans "array" prefix.
Change-Id: I0e70781c5ff02dca30a2004ab4d0ea82b0849eae
Reviewed-on: https://go-review.googlesource.com/c/go/+/396296
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
net.ParseCIDR already rejects input in the form of 2001:db8::%a/32, but
netip.ParsePrefix previously accepted the input and silently dropped the
zone. Make the two consistent by always returning an error if an IPv6
zone is present in CIDR input for ParsePrefix.
Fixes#51899.
Change-Id: Iee7d8d4a5161e0b54a4ee1bd68b02c1a287ff399
Reviewed-on: https://go-review.googlesource.com/c/go/+/396299
Trust: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Damien Neil <dneil@google.com>
For #51572
Change-Id: Ib27be79379c8b3f72e29365b58067d7ee1919e52
Reviewed-on: https://go-review.googlesource.com/c/go/+/396295
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
This updates the cmd/compile/internal/importer to natively support the
"final" unified IR export format. This is really just for unit tests
and symmetry with go/internal/gcimporter though, since
cmd/compile/internal/noder has its own types2.Importer.
Change-Id: I52fbb6134dbc0a903d62c1b04f95d33bd29e0414
Reviewed-on: https://go-review.googlesource.com/c/go/+/388617
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
The new "unix" build tag matches any Unix or Unix-like system.
This is only recognized on go:build lines, not in file names.
For #20322Fixes#51572
Change-Id: I3a991f9e69353b25e259bc6462709cdcd83640fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/389934
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Keep returning nil for the cases where we historically returned nil,
even though this is slightly different for TrimLeft and TrimRight.
Fixes#51793
Change-Id: Ifbdfc6b09d52b8e063cfe6341019f9b2eb8b70e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/393876
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
So far unified IR has been relying on the backwards-compat iexport
data to supply package fingerprints for imports. To be able to drop
the iexport data and natively use unified IR everywhere.
This CL applies basically the same idea that iexport used: simply
hash all of the export data as it's being written out, and then tack
on an 8-byte hash at the end.
Change-Id: Iaca5fbfd7443088bc7f422a1c58be3e762c29014
Reviewed-on: https://go-review.googlesource.com/c/go/+/396196
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
At least on some platforms (e.g. PE dynamic loader) relocations
need to be sorted in address order. Currently we don't always emit
relocations in address order: e.g. for array literal with out-of-
order element initializers, or out-of-order DATA instructions in
assembly code. Sort them.
No test for now as I can't reproduce the failure for #51923.
Fixes#51923.
Change-Id: Ifec5d3476e027bb927bcefd6e45c40ebeccee4ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/396195
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
We are limited to 64 registers in the allocator today, and PPC64
has not been allocating F0,F26-F31 for quite some time without
performance impact.
Change-Id: If9d60be5037c94991fdd90a44461c3a6b96315cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/395835
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
These FP registers on PPC64 have no restrictions, they can
be used like the others. F27-F31 were sequested long ago for
scratch storage which has long since been reverted, but they
weren't added back to the allocator pool.
Change-Id: I9074660e2fc91a2044c9768f700a8215802cba51
Reviewed-on: https://go-review.googlesource.com/c/go/+/395834
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
These fields are also valid for _Star.
Change-Id: I2582000ac1737c41416e69f91404f7cac279d718
Reviewed-on: https://go-review.googlesource.com/c/go/+/395916
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Use bytealg.IndexByteString(str, 0) instead of looping through the
string to check for a zero byte. A quick and dirty benchmark shows 10x
performance improvement (on amd64 machine, using go 1.17.3).
BytePtrFromString is used by many functions with string arguments.
This change should make many functions in os package, such as those
accepting a filename (os.Open, os.Stat, etc.), a tad faster.
PS I am aware that syscall package is deprecated and frozen, but this
change is mainly for the os package and the likes. The alternative
would be for os to switch to x/sys, which is a much bigger change.
Change-Id: I18fdd50f9fbfe0a23a4a71bc4bd0a5f5b0eaa475
Reviewed-on: https://go-review.googlesource.com/c/go/+/368457
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
All the code in ioutil just forwards functionality to code
in either the io or os packages, per issue 42026.
This change adds the "Deprecated" marker to all the
functions in this package.
For #42026Fixes#51927
Change-Id: Ia807bc5c0edb06cc80ec7e35917dcfe2ad50f0ea
GitHub-Last-Rev: 3c3603f368
GitHub-Pull-Request: golang/go#51961
Reviewed-on: https://go-review.googlesource.com/c/go/+/395918
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
CL 390474 removed last usages of ConstValue, it can now be removed, and
also Float64Val, since when it's only used by ConstValue.
CanInt64 is un-used for a long time, its original form last usage was
removed in CL 221802.
Change-Id: Id142b0da49c319faca73ef1b2090325f81431321
Reviewed-on: https://go-review.googlesource.com/c/go/+/396078
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Use the syscall method instead of repeating the type conversions for each OS.
Change-Id: I1db975b3aaa189cf724d7b1b7c5c41bc64dd964d
Reviewed-on: https://go-review.googlesource.com/c/go/+/374574
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
The existing implementation of the xml decoder uses the line number
only for reporting syntax errors. The line number of the last read
token and the column within the line is useful for the users even
in non-error conditions.
Fixes#45628
Change-Id: I37b5033ff5ff8411793d8f5180f96aa4537e83f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/311270
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
CL 394074 broke the noopt builder. Something about time.After's inlining
depends on the build flags to make.bash, not the build flags that run.go
passes.
Change-Id: Ib284c66ea2008a4d32829c055d57c54a34ec3fb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/396037
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Same as BSFQ, if the input is known to be nonzero we don't need a CMOV
to correct for the weird all-zero behavior of the BSRQ instruction.
Fixes#51964
Change-Id: Ic1d14fdf3e7e698ff2f47efecfd761d8a036012a
Reviewed-on: https://go-review.googlesource.com/c/go/+/396034
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
In CL 367756 we remove ReadFileRevs function, We simplified
the implementation of the interface Repo. and the type FileRev
is no longer used.
Change-Id: Iec9e2f0d6bb227f4d0d0f565e897137dcf392a3a
Reviewed-on: https://go-review.googlesource.com/c/go/+/373375
Trust: Lee Baokun <bk@golangcn.org>
Run-TryBot: Lee Baokun <bk@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
This reverts commit e550c30545.
Reason for revert: Method bound calls are no longer implemented using interface calls, so it is no longer necessary. Leaving the test, though.
Change-Id: I80f1e4cd921063cd27ca8f07998316ca282e075b
Reviewed-on: https://go-review.googlesource.com/c/go/+/395594
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
When we have x.M(args) where x is a value of type parameter type, we
currently cast x to the bound of that type parameter (which is an interface)
and then invoke the method on that interface. That's pretty inefficient
because:
1) We need to convert x to an interface, which often requires allocation.
With CL 378178 it is at least stack allocation, but allocation nontheless.
2) We need to call through wrapper functions to unpack the interface
into the right argument locations for the callee.
Instead, let's just call the target directly. The previous CL to this one
added method expression closures to the dictionary, which is a simple
captureless closure that implements T.M for type parameter T and method M.
So to implement x.M(args) for x of type T, we use methodexpr(T,M)(x, args).
We just need to move x from the receiver slot to the first argument, and
use the dictionary entry to implement the polymorphism. This works because
we stencil by shape, so we know how to marshal x for the call even though
we don't know its exact type.
We should be able to revert CL 378178 after this one, as that optimization
will no longer be necssary as we're not converting values to interfaces
to implement this language construct anymore.
Update #50182
Change-Id: I813de4510e41ab63626e58bd1167f9ae93016202
Reviewed-on: https://go-review.googlesource.com/c/go/+/385274
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Currently we do quite a dance for method expressions on generic
types. We write a new closure, and in that closure convert the
receiver to an interface with the required method, then call the
target using an interface call.
Instead in this CL, we just allocate a (captureless) closure in the
dictionary which implements that method expression.
This CL makes method expressions faster and simpler. But the real win
is some followon CLs, where we can use the same closure to implement
bound method calls using the same closure, instead of converting to
interface and having wrappers convert back. Much faster and simpler.
Still thinking about how to do method values. The receiver still
needs to be captured, so there must be some closure involved, I think.
Update #50182
Change-Id: I1fbd57e7105663f8b049955b8f4111649a5f4aa8
Reviewed-on: https://go-review.googlesource.com/c/go/+/385254
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Add the riscv64 register ABI constants and allow regabi
value to be set for riscv64
Change-Id: I3ce98bf9a29d2acc00f92650b27bc59884ed62ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/359336
Trust: mzh <mzh@golangcn.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: mzh <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>