When the write barrier pass emits typedmemmove/typedmemclr calls,
even the arguments are in registers, we still need to leave space
for the spill slots. Count that space. Otherwise when the callee
spills arguments it may clobber locals on the caller's frame.
Change-Id: I5326943427feaf66cab7658a5bef55b3baf5d345
Reviewed-on: https://go-review.googlesource.com/c/go/+/307824
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: David Chase <drchase@google.com>
Follow-up on https://golang.org/cl/305573.
As a consequence, re-enable test case that caused problems with that CL.
Change-Id: Ibffee3f016f4885a55b8e527a5680dd437322209
Reviewed-on: https://go-review.googlesource.com/c/go/+/307216
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Make position comparison generally available.
Change-Id: I94b6f658fa19a15b30574dbb2181879115c131a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/307215
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Type parameters for methods are not part of the accepted language,
but maintaining the code for type-checking them ensures regularity
of the type checker implementation. For now, keep the flag internally,
disabled by default. The flag is set when running tests.
Change-Id: Ic99934bd00bd2608dc1178e4131f46dd1507f0f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/307214
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Constraint type inference is part of the proposed language.
Use an internal flag to control the feayure for debugging.
Change-Id: I7a9eaee92b5ffc23c25d9e68a729acc0d705e879
Reviewed-on: https://go-review.googlesource.com/c/go/+/306770
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Rather than splitting up type inference into function argument
and constraint type inference, provide a single Checker.infer
that accepts type parameters, type arguments, value parameters,
and value arguments, if any. Checker.infer returns the completed
list of type arguments, or nil.
Updated (and simplified) call sites.
Change-Id: I9200a44b9c4ab7f2d21eed824abfffaab68ff766
Reviewed-on: https://go-review.googlesource.com/c/go/+/306170
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
There's a problem in liveness, where liveness of any
part of an aggregate keeps the whole aggregate alive,
but the not-live parts don't get spilled. The GC
can observe those live-but-not-spilled slots, which
can contain junk.
A better fix is to change liveness to work
pointer-by-pointer, but that is also a riskier,
trickier fix.
To avoid this, in the case of
(1) an aggregate input parameter
(2) containing pointers
(3) passed in registers
pre-spill the pointers.
Updates #40724.
Change-Id: I6beb8e0a353b1ae3c68c16072f56698061922c04
Reviewed-on: https://go-review.googlesource.com/c/go/+/307909
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
CL 302231 added some optimization rules with instructions CSETM, CSINC,
CSINV, and CSNEG, but did not deal with the situation where flag is
constant, resulting in some cases that could be more optimized cannot
be optimized, and the FlagConstant value is passed to codegen pass. This
CL adds these missing rules.
Fixes#45359
Change-Id: I700608cfb9a6a768a18d1fd5d374d7e92aa6f838
Reviewed-on: https://go-review.googlesource.com/c/go/+/307650
Reviewed-by: eric fang <eric.fang@arm.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
Run-TryBot: eric fang <eric.fang@arm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: eric fang <eric.fang@arm.com>
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
A non-trivial Cgo program may need to use callbacks and interact with
go objects per goroutine. Because of the rules for passing pointers
between Go and C, such a program needs to store handles to associated
Go values. This often causes much extra effort to figure out a way to
correctly deal with: 1) map collision; 2) identifying leaks and 3)
concurrency.
This CL implements a Handle representation in runtime/cgo package, and
related methods such as Value, Delete, etc. which allows Go users can
use a standard way to handle the above difficulties.
In addition, the CL allows a Go value to have multiple handles, and the
NewHandle always returns a different handle compare to the previously
returned handles. In comparison, CL 294670 implements a different
behavior of NewHandle that returns a unique handle when the Go value is
referring to the same object.
Benchmark:
name time/op
Handle/non-concurrent-16 487ns ± 1%
Handle/concurrent-16 674ns ± 1%
Fixes#37033
Change-Id: I0eadb9d44332fffef8fb567c745246a49dd6d4c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/295369
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Cherry Zhang <cherryyz@google.com>
This change refactors the existing funcLayout tests and sets them up to
support the new register ABI by explicitly setting the register counts
to zero. This allows the test to pass if GOEXPERIMENT=regabiargs is set.
A follow-up change will add tests for a non-zero register count.
For #40724.
Change-Id: Ibbe061b4ed4fd70566eb38b9e6182dca32b81127
Reviewed-on: https://go-review.googlesource.com/c/go/+/307869
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
runtime.raceread/racewrite/racewriterange are functions that are
called from compiler instrumented code, follwoing ABIInternal.
They are assembly functions defined as ABIInternal in the runtime,
in order to avoid wrappers because they need to get the caller's
PC. This CL makes them to use the actual internal ABI.
Change-Id: Id91d73cf257f7b11a858958d85c38c4aa904d9c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/307812
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Change-Id: I6d78e0e742cb0e7f5ea3f430e9cec0f5d1ee03e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/307652
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
This significantly simplifies the implementation of editRequirements
in preparation for making it lazy. It should have no effect on which
version combinations are rejected by 'go get', nor on which solutions
are found if downgrades are needed.
This change results in a small but observable change in error logging.
Before, we were reporting an error line for each argument that would
have exceeded its specified version, attributing it to one arbitrary
cause. Now, we are reporting an error line for each argument that
would cause any other argument to exceed its specified version. As a
result, if one argument would cause two others to exceed their
versions, we will now report one line instead of two; if two arguments
would independently cause one other to exceed its version, we will now
report two lines instead of one.
This change may result in a small performance improvement. Because we
are now scanning and rejecting incompatible requirements earlier, we
may waste less time computing upgrades and downgrades that ultimately
won't matter due to conflicting constraints.
For #36460
Change-Id: I125aa09b4be749dc5bacef23a859333991960e85
Reviewed-on: https://go-review.googlesource.com/c/go/+/305009
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
This caused a problem with
GOEXPERIMENT=regabi,regabiargs go test -c crypto/x509
Updates #40724.
Change-Id: Ia3cdbe9968816c77836cb3e3ba89642aafd1b18d
Reviewed-on: https://go-review.googlesource.com/c/go/+/307529
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
When a function panics then recovers, it needs to return to the
caller with named results having the correct values. For
in-register results, we need to load them into registers at the
defer return path.
For non-open-coded defers, we already generate correct code, as
the defer return path is part of the SSA CFG and contains the
instructions that are the same as an ordinary return statement,
including putting the results to the right places.
For open-coded defers, we have a special code generation that
emits a disconnected block that currently contains only the
deferreturn call and a RET instruction. It leaves the result
registers unset. This CL adds instructions that load the result
registers on that path.
Updates #40724.
Change-Id: I1f60514da644fd5fb4b4871a1153c62f42927282
Reviewed-on: https://go-review.googlesource.com/c/go/+/307231
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Austin Clements <austin@google.com>
This is a simple workaround for a bug where runtime.GC() can return
before finishing a full sweep, causing gcTestIsReachable to throw. The
right thing is to fix runtime.GC(), but this should get this test
passing reliably in the meantime.
Updates #45315.
Change-Id: Iae141e6dbb26a9c2649497c1feedd4aaeaf540c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/307809
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
For #36460
Change-Id: Idb0b333a28d2470bc9482fe1829ccb6ddf8abd34
Reviewed-on: https://go-review.googlesource.com/c/go/+/304909
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Now that we use square brackets for instantiations, we
can tell type arguments from ordinary arguments without
"guessing" which permits a simpler implementation.
Specifically, replace use of Checker.exprOrTypeList with
Checker.exprList, and delete Checker.exprOrTypeList and
Checker.multiExprOrType.
Disable a test for an (esoteric) failure due to an
unrelated problem with error matching when running
the test.
Change-Id: I17f18fffc32f03fa90d93a68ebf56e5f2fcc9dab
Reviewed-on: https://go-review.googlesource.com/c/go/+/306171
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Now that we use square brackets for instantiations, we
can tell type arguments from ordinary arguments without
"guessing" which permits a simpler implementation.
While at it, also fix a minor position error for type
instantiations (now matching the code for function
instantiations).
Change-Id: I20eca51c5b06259703767b5906e89197d6cd595a
Reviewed-on: https://go-review.googlesource.com/c/go/+/306169
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
This moves the two helper functions startPos and endPos into
the syntax package where they belong. Export the functions and
adjust dependent code.
Change-Id: I8170faeadd7cfa8f53009f81fcffd50ec0fc6a98
Reviewed-on: https://go-review.googlesource.com/c/go/+/305578
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
The exact same test case covered by this file is also in
fixedbugs/bug121.go. No need for duplication.
Also, the actual syntax error tested (multiple method names
with a single signature) is an unlikely syntax error, and
only here for historical reasons (in the very beginning, this
was actually possible to write). Now, virtually nobody is making
this mistake.
Change-Id: I9d68e0aee2a63025f44e6338647f8250ecc3077a
Reviewed-on: https://go-review.googlesource.com/c/go/+/307789
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
In TestMorestack, on macOS, for some reason it got most of the
samples in synchronization (e.g. pthread_cond_signal and
pthread_cond_wait) and sometimes in other "syscalls" (usleep,
nanotime1), and very few samples in stack copying, sometimes 0,
which causes the test to fail. Maybe synchronization is slower on
macOS? (It doesn't seem so to me.) Or it is the OS's accounting
problem, where it is more likely to trigger a profiling signal
at a syscall (or certain kinds of syscalls)?
As the test is really about whether it can connect stack copying
with the function that grows the stack, this CL makes it spend
more time in copying stack than synchronization. Now it's getting
~100 samples for stack copying on a 5 second interval on my
machine, and the test passes reliably.
Fixes#44418.
Change-Id: I3a462c8c39766f2d67d697598f8641bbe64f16ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/307730
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
When an SSA pass ICEs, it calls f.Fatalf, which terminates the
compiler. When GOSSAFUNC is set, the current pass is not written
to ssa.html. This CL makes it write ssa.html when it calls Fatalf,
for the ease of debugging.
Change-Id: I5d55e4258f0693d89c48c0a84984f2f893b0811d
Reviewed-on: https://go-review.googlesource.com/c/go/+/307509
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: David Chase <drchase@google.com>
C_LECON and C_SECON classifications are not generated on ppc64, however
there are many optab entries which match against them. Remove them to
resolve their related TODOs.
Likewise, reorder the optab entries for better readability.
Change-Id: I894a209a148014e5aa438b7303e7fbdda4727c4e
Reviewed-on: https://go-review.googlesource.com/c/go/+/307429
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Carlos Eduardo Seo <carlos.seo@linaro.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Trust: Carlos Eduardo Seo <carlos.seo@linaro.org>
(*gcSizes).Sizeof was requiring the last field of a zero-sized struct to
be at least one byte. But that rule (fix for #9401, see logic in
calcStructOffset) only applies to a struct that has some non-zero sized
fields. Fix (*gcSizes).Sizeof to have the logic like calcStructOffset.
Fixes running the gotests with -G=3 enabled.
Fixes#45390
Change-Id: I011f40e3de3a327392bbbb791b9422be75336313
Reviewed-on: https://go-review.googlesource.com/c/go/+/307549
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
Change-Id: I1d7382bf522aeda7148431b348f6ab9a162be097
Reviewed-on: https://go-review.googlesource.com/c/go/+/304531
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Robert Griesemer <gri@golang.org>
reflectcall expects the ABI0 calling convention, but it's marked as
ABIInternal. When it gets called this way, naturally it doesn't work
very well.
For #40724.
Change-Id: Ic76237420cd8c72f5df1c1ac7972ad6f989f8402
Reviewed-on: https://go-review.googlesource.com/c/go/+/306931
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This change eliminates the use of funcPC to determine if an PC is in
abort. Using funcPC for this purpose is problematic when using plugins
because symbols no longer have unique PCs. funcPC also grabs the wrapper
for runtime.abort which isn't what we want for the new register ABI, so
rather than mark runtime.abort as ABIInternal, use funcID.
For #40724.
Change-Id: I2730e99fe6f326d22d64a10384828b94f04d101a
Reviewed-on: https://go-review.googlesource.com/c/go/+/307391
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Austin Clements <austin@google.com>
In CL 305829 a problematic change was made to the compiler's
amd64-specific "zerorange" function. In zerorange the compiler uses
different sets of strategies depending on the size of the stack frame
it needs to zero; turns out that only on plan9-amd64 was it hitting
the final fallback strategy, which is a REPSTOSQ instruction. REPSTOSQ
takes RAX as an input, hence the changes made in CL 305829 (switching
to R13) were incorrect.
This patch restores the zerorange REPSTOSQ sequence (back to use RAX).
This is going to be an interim solution, since long term we need to
avoid touching RAX in the function prolog (since if the new register
ABI is in effect, it will hold a live value).
Fixes#45372.
Change-Id: Ic89a6a2a76d6e03b9fbda99275101e96b70fdf5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/307469
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David du Colombier <0intro@gmail.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Currently the assembly code marshals arguments in ABI0 layout.
Call the ABI0 functions. We may want to move to ABIInternal at
some point (maybe when register args is always enabled).
Updates #40724.
Change-Id: I23bb3073f3f6420a8d0c119b65ae3e577578aadb
Reviewed-on: https://go-review.googlesource.com/c/go/+/307237
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Austin Clements <austin@google.com>
For most ABI wrappers we don't need it because we're never going
to defer an ABI wrapper for a function that then recovers, so
that's would just be unnecessary code in the ABI wrapper.
However, for functions that could be on the path of invoking a
deferred function that can recover (runtime.reflectcall,
reflect.callReflect, and reflect.callMethod), we do want the
panic+recover adjustment. Set the Wrapper flag for them.
Currently, those functions are defined as ABIInternal to avoid
the ABI wrappers. But the assembly code still follows ABI0
calling convention, which would not work with the register-based
calling convention. In particlar, it is not possible to make
runtime.reflectcall ABIInternal, because it tail calls
runtime.callNN functions, which are splittable. Later CLs will
make them ABI0 and use the wrappers.
Updates #40724.
Change-Id: Ic7a45bbc6f726d29b5cb4932951a9d71578dcaf6
Reviewed-on: https://go-review.googlesource.com/c/go/+/307236
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
This will allow us to make changes to the internals confidently, without
risking causing issues in consensus applications. It will also prevent
architecture-specific divergence, like #40475.
Fixes#40478
Change-Id: I8c2b31406ca88add6941f14d8df8cecb96379cde
Reviewed-on: https://go-review.googlesource.com/c/go/+/304349
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Filippo Valsorda <filippo@golang.org>
Trust: Katie Hockman <katie@golang.org>
There is a single function in the flag package whose implementation
uses string concatenation instead of the recommended strings.Builder.
The function was last touched before strings.Builder was introduced
in Go 1.10, which explains the old style code. This PR updates
the implementation.
Fixes#45392
Change-Id: Id2d8f1788765a0c4faaeb1e6870914f72b3c8442
GitHub-Last-Rev: 0e12fe3045
GitHub-Pull-Request: golang/go#45393
Reviewed-on: https://go-review.googlesource.com/c/go/+/307329
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
This fixes a compile crash for
GOEXPERIMENT=regabi,regabiargs go test -c go/constant
Updates #40724.
Change-Id: I238cef436e045647815326fc8fdb025c30ba1f5c
Reviewed-on: https://go-review.googlesource.com/c/go/+/307309
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
The notice is shown when 'go get' is invoked with the -d flag, and
the arguments match at least one main package.
This reverts CL 274552.
For #43684
Change-Id: I42e6731455f22988bf72dde1d5a76d197e9e3954
Reviewed-on: https://go-review.googlesource.com/c/go/+/305670
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Pass information about original end position for c function arguments
processed in pointer checking generated code.
Fixes#42580
Change-Id: Ic8a578168362f0ca6055064dbbea092ad37477a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/269760
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
The matching rules will match C_SPR for the commonly used SPR
entries (xer, lr, ctr).
Change-Id: I93759c1ce2891f6825661b99c5cbb89250b64ab7
Reviewed-on: https://go-review.googlesource.com/c/go/+/304429
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Carlos Eduardo Seo <carlos.seo@linaro.org>
Trust: Carlos Eduardo Seo <carlos.seo@linaro.org>
If the current time is computed from extend string
and the zone file contains multiple zones with the
same name, the lookup by name might find incorrect
zone.
This happens for example with the slim Europe/Dublin
time zone file in the embedded zip. This zone file
has last transition in 1996 and rest is covered by
extend string.
tzset returns IST as the zone name to use, but there
are two records with IST name. Lookup by name finds
the wrong one. We need to check offset and isDST too.
In case we can't find an existing zone, we allocate
a new zone so that we use correct offset and isDST.
I have renamed zone variable to zones as it shadowed
the zone type that we need to allocate the cached zone.
Fixes#45370
Change-Id: I79102e4873b6de20d8a65f8a3057519ff5fae608
Reviewed-on: https://go-review.googlesource.com/c/go/+/307190
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Currently, when converting a float (say float64), we use convT64
function. In the runtime convT64 expects a uint64 argument. In
the compiler, convT64 is defined as taking an "any" argument (so
it works with also uint64-like types such as [1]uint64). The "any"
type is instantiated with the concrete type in walk. So the
backend will see instances such as convT64([1]uint64).
Currently, float64 is treated as uint64-like. So the backend will
see convT64(float64). With a memory-based calling convention this
is fine. With a register-based calling convention, however, it
will pass the argument in a floating point register, whereas the
runtime expects the argument in an integer register (as it is
declared as uint64).
To fix this, this CL introduces runtime functions convT32F and
convT64F. They behave the same as convT32/convT64, but with a
float argument. In the compiler, use convT32F/convT64F to convert
float-like type to interface.
With this, "GOEXPERIMENT=regabi,regabiargs go test math fmt"
works.
Updates #40724.
Change-Id: I8b2e232096a95e4a7c4ab81795d77ef224ffaab3
Reviewed-on: https://go-review.googlesource.com/c/go/+/307232
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Update references missed in CL 263142.
For #41190
Change-Id: I778760a6a69bd0440fec0848bdef539c9ccb4ee1
GitHub-Last-Rev: dda42b09ff
GitHub-Pull-Request: golang/go#42874
Reviewed-on: https://go-review.googlesource.com/c/go/+/273946
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Cherry Zhang <cherryyz@google.com>
Currently, there are Wrapper and ABIWrapper attributes. Wrapper
is set when compiler generates an wrapper function (e.g. method
wrapper). ABIWrapper is set when compiler generates an ABI
wrapper. It also sets Wrapper flag for ABI wrappers.
Currently, they have the following meanings:
- Wrapper flag hides the frame from (normal) traceback.
- Wrapper flag enables special panic+recover adjustment, so it
can correctly recover when a wrapper function is deferred.
- ABIWrapper flag disables the panic+recover adjustment, because
we never defer an ABI wrapper that can recover.
This CL changes them to:
- Both Wrapper and ABIWrapper flags hide the frame from (normal)
traceback. (Setting one is enough.)
- Wrapper flag enables special panic+recover adjustment.
ABIWrapper flag no longer has effect on this.
This makes it clearer if we do want an ABI wrapper that also does
the panic+recover adjustment. In the old mechanism we'd have to
unset ABIWrapper flag, even if the function is actually an ABI
wrapper. In the new mechanism we just need to set both ABIWrapper
and Wrapper flags.
Updates #40724.
Change-Id: I7fbc83f85d23676dc94db51dfda63dcacdf1fc19
Reviewed-on: https://go-review.googlesource.com/c/go/+/307235
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Currently, the IR of tailcall does not connect the arguments with
the OTAILCALL node, so the arguments are not marshaled correctly.
Disable tail call for now.
Updates #40724.
Change-Id: I39de3ea8e19a23eb63768ab7282d2f870e9c266e
Reviewed-on: https://go-review.googlesource.com/c/go/+/307234
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Austin Clements <austin@google.com>
memequal_varlen is put into a closure and is called in internal
ABI in the runtime. Emit an ABIInternal reference.
Updates #40724.
Change-Id: I914555f8188561882625e008b595389e50a3a167
Reviewed-on: https://go-review.googlesource.com/c/go/+/307233
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Austin Clements <austin@google.com>