Writing out the trace footer currently manages trace buffers
differently from the rest of trace code. Rearrange it so it looks like
the rest of the code. In particular, we now write the frequency event
out to the trace buffer rather than returning it in a special byte
slice, and (*traceStackTable).dump threads a traceBufPtr like most
other functions that write to the trace buffers.
Change-Id: I3d0e108e56df884e7bd19823310dfbc0e21af9a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/422974
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Following up on the previous CL, this CL removes a unnecessary stack
copy of a large object in a range loop. This drops another 64 KiB from
(*traceStackTable).dump's stack frame so it is now roughly 80 bytes
depending on architecture, which will easily fit on the system stack.
For #53979.
Change-Id: I16f642f6f1982d0ed0a62371bf2e19379e5870eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/422955
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Currently, the stack frame of (*traceStackTable).dump is 68KiB. We're
about to move (*traceStackTable).dump to the system stack, where we
often don't have this much room.
5140 bytes of this is an on-stack temporary buffer for constructing
potentially large trace events before copying these out to the actual
trace buffer.
Reduce the stack frame size by writing these events directly to the
trace buffer rather than temporary space. This introduces a couple
complications:
- The trace event starts with a varint encoding the event payload's
length in bytes. These events are large and somewhat complicated, so
it's hard to know the size ahead of time. That's not a problem with
the temporary buffer because we can just construct the event and see
how long it is. In order to support writing directly to the trace
buffer, we reserve enough bytes for a maximum size varint and add
support for populating a reserved space after the fact.
- Emitting a stack event calls traceFrameForPC, which can itself emit
string events. If these were emitted in the middle of the stack
event, it would corrupt the stream. We already allocate a []Frame to
convert the PC slice to frames, and then convert each Frame into a
traceFrame with trace string IDs, so we address this by combining
these two steps into one so that all trace string events are emitted
before we start constructing the stack event.
For #53979.
Change-Id: Ie60704be95199559c426b551f8e119b14e06ddac
Reviewed-on: https://go-review.googlesource.com/c/go/+/422954
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
In go.dev/cl/413396, I implemented implicit conversions by setting the
conversion's position to the enclosing statement that necessitated the
conversion. However, users actually want the position information to
be at the expression itself, and this seems sensible anyway.
This was noticed because x/tools had a test for:
fmt.Println(42)
and it was checking where the escape analysis diagnostic for
`42` (really `any(42)`) was reported.
Historically, we reported the column of the `4`; but CL 413396 caused
unified IR to instead report the column of the `(` instead (the
position associated with the call expression, which forced `42` to be
implicitly converted from `int` to `any`).
I chalk this mistake up to being accustomed to working with ir, where
we can't reliably use n.Pos() because of how ONAME positions work, so
I was trying to avoid relying on the implicitly converted expression's
own position.
Change-Id: I762076af6f65ebe6d444d64630722a5016dc2698
Reviewed-on: https://go-review.googlesource.com/c/go/+/422976
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
I structured the test for issue54343.go after issue46725.go, where I
was careful to use `[4]int`, which is a type large enough to avoid the
tiny object allocator (which interferes with finalizer semantics). But
in that test, I didn't note the importance of that type, so I
mistakenly used just `int` in issue54343.go.
This CL switches issue54343.go to use `[4]int` too, and then adds
comments to both pointing out the significance of this type.
Updates #54343.
Change-Id: I699b3e64b844ff6d8438bbcb4d1935615a6d8cc4
Reviewed-on: https://go-review.googlesource.com/c/go/+/423115
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
Broken out of debug/pe. Update debug/pe to use it.
For #47653
Change-Id: Ib3037ee04073e005c4b435d0128b8437a075b00a
Reviewed-on: https://go-review.googlesource.com/c/go/+/408678
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dan Kortschak <dan@kortschak.io>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Version 2022b was released on 2022-08-10 and we can start using it.
Its release announcement was
https://mm.icann.org/pipermail/tz-announce/2022-August/000071.html.
For #22487.
Change-Id: I0ec68968d82561da566f945608bfacb3c8b0e958
Reviewed-on: https://go-review.googlesource.com/c/go/+/422875
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
With GOEXPERIMENT=unified, the order variables are printed in "live at
entry to f.func1" is sensitive to whether regabi is enabled for some
reason. The order shouldn't matter to correctness, but it is odd.
For now, this CL just relaxes the test expectation order to unblock
enabling GOEXPERIMENT=unified by default. I've filed #54402 to
investigate further to confirm this a concern.
Updates #54402.
Change-Id: Iddfbb12c6cf7cc17b2aec8102b33761abd5f93ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/422975
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
For selector expression "x.M" where "M" is a promoted method, irgen is using
the type of receiver "x" for determining the typeparams for instantiation.
However, because M is a promoted method, so its associated receiver is
not "x", but "x.T" where "T" is the embedded field of "x". That casues a
mismatch when converting non-shape types arguments.
Fixing it by using the actual receiver which has the method, instead of
using the base receiver.
Fixes#53982
Change-Id: I1836fc422d734df14e9e6664d4bd014503960bfc
Reviewed-on: https://go-review.googlesource.com/c/go/+/419294
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
When making the recursive call to fprint,
we just need to know how many bytes were written
and whether multiple lines were written.
We don't need a buffer to accomplish those;
a custom writer can keep track of the two in a cheap way,
avoiding the allocation of a byte slice and copying bytes.
name old time/op new time/op delta
Print-16 6.28ms ± 2% 6.12ms ± 1% -2.50% (p=0.000 n=10+9)
name old speed new speed delta
Print-16 8.26MB/s ± 3% 8.47MB/s ± 1% +2.56% (p=0.000 n=10+9)
name old alloc/op new alloc/op delta
Print-16 483kB ± 0% 443kB ± 0% -8.20% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
Print-16 17.8k ± 0% 17.3k ± 0% -2.31% (p=0.000 n=9+10)
Change-Id: Ib8411ae6738a2acae6af6d185da71727ce2eb97a
Reviewed-on: https://go-review.googlesource.com/c/go/+/412555
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
The current implementation of compilerVersion incorrectly gives an
error message that the compiler version is too old even though the
system has a recent compiler. This happens for specifically for the
gcc compiler and causes ASAN tests to be skipped.
Replacing -v with gcc dump version options seems to fix it. Running
./testsanitizers.test -test.v now shows the ASAN tests being run.
--- PASS: TestASAN (16.81s)
--- PASS: TestASAN/asan_useAfterReturn (0.60s)
--- PASS: TestASAN/asan_global5 (0.61s)
--- PASS: TestASAN/asan_unsafe_fail1 (0.73s)
--- PASS: TestASAN/asan_unsafe_fail3 (0.73s)
--- PASS: TestASAN/asan_unsafe_fail2 (0.74s)
--- PASS: TestASAN/asan_global4_fail (0.74s)
--- PASS: TestASAN/asan5_fail (0.74s)
--- PASS: TestASAN/asan3_fail (0.88s)
--- PASS: TestASAN/asan4_fail (0.89s)
--- PASS: TestASAN/asan2_fail (0.99s)
--- PASS: TestASAN/asan_global3_fail (1.00s)
--- PASS: TestASAN/asan_global1_fail (1.01s)
--- PASS: TestASAN/asan1_fail (1.01s)
--- PASS: TestASAN/asan_global2_fail (1.02s)
PASS
Fixes#54370
Change-Id: Iac13a1cf37de54432a6e49555f61e9ec1d781ab8
Reviewed-on: https://go-review.googlesource.com/c/go/+/422574
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Archana Ravindar <aravind5@in.ibm.com>
Reviewed-by: Than McIntosh <thanm@google.com>
The comment claims that reflect users cannot obtain an unsafe.Pointer
without also importing the unsafe package explicitly.
This is no longer true now that the Value.UnsafePointer method
directly returns an unsafe.Pointer.
Change-Id: Ia5bf2e8aead681c8fac5b011129954d075ae5a43
Reviewed-on: https://go-review.googlesource.com/c/go/+/404396
Reviewed-by: 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: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Using build tool tags instead of relying on GOAMD64 env, which can be
overriden at make.bash time.
Change-Id: I96bb4b7416ea0bd1ab552feec9ede45b89a584c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/422614
Reviewed-by: Than McIntosh <thanm@google.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>
When trampolines are needed (e.g. Darwin ARM64), the DWARF LPT (Line
Program Table - see DWARF section 6.1) generation fails because the
replacement symbols are marked as external symbols and skipped during
the DWARF LPT generation phase.
Fixes#54320
Change-Id: I6c93f5378f50e5edf30d5121402a48214abb1ce2
GitHub-Last-Rev: 085bbc55db
GitHub-Pull-Request: golang/go#54321
Reviewed-on: https://go-review.googlesource.com/c/go/+/422154
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Change the type of Conn.handshakeStatus from an atomically
accessed uint32 to an atomic.Bool. Change its name to
Conn.isHandshakeComplete to indicate it is a boolean value.
Eliminate the handshakeComplete() helper function, which checks
for equality with 1, in favor of the simpler
c.isHandshakeComplete.Load().
Change-Id: I084c83956fff266e2145847e8645372bef6ae9df
Reviewed-on: https://go-review.googlesource.com/c/go/+/422296
Auto-Submit: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
This CL adds a helper expression code for receiver addressing; i.e.,
the implicit addressing, dereferencing, and field selections involved
in changing the `x` in `x.M()` into an appropriate expression to pass
as an argument to the method.
Change-Id: I9be933e2a38c8f94f6a85d95b54f34164e5efb0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/421820
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
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>
Unified IR uses static dictionaries for some itabs and function/method
expressions, and they're roughly the right idea. But at the same time,
they're actually somewhat brittle and I need to reorganize some ideas
anyway to get shaped-based stenciling working. So this CL just rips
them out entirely.
Note: the code for emitting runtime dictionaries with *runtime._type
symbols is still present, and continues to demonstrate that basic
runtime dictionary handling is working.
Change-Id: I44eb1c7974fb397909ad5db12987659e7505c2ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/421819
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This CL separates out the handling of selector expressions for field
values, method values, and method expressions. Again part of
refactoring to make it possible to access runtime dictionaries where
needed.
No behavioral change; just duplicating and then streamlining the
existing code paths.
Change-Id: I53b2a344f4bdba2c9f37ef370dc9a091a3941021
Reviewed-on: https://go-review.googlesource.com/c/go/+/421818
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
This CL changes unified IR to explicitly handle function
instantiations within expression handling, rather than leaving it to
the underlying object reading logic.
Change-Id: I009a56013fbe9fbc4dabf80eea98993d34af4272
Reviewed-on: https://go-review.googlesource.com/c/go/+/421817
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>
There was a TODO about quadratic performance, and indeed,
it can get bad. Added a map, made some integers that are
unlikely to exceed a few million into 32-bit integers.
Change-Id: I6facf2eabc00483e943b326ca8dcae2f778093da
Reviewed-on: https://go-review.googlesource.com/c/go/+/422297
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This CL applies the same change to test/live.go that was previously
applied to test/live_regabi.go in golang.org/cl/415240. This wasn't
noticed at the time though, because GOEXPERIMENT=unified was only
being tested on linux-amd64, which is a regabi platform.
Change-Id: I0c75c2b7097544305e4174c2f5ec6ec283c81a8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/422254
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
`go env GOEXPERIMENT` prints what experiments are enabled relative to
the baseline configuration, so it's not a very robust way to detect
what experiments have been statically enabled at bootstrap time.
Instead, we can check build.Default.ToolTags, which has goexperiment.*
for all currently enabled experiments, independent of baseline.
Change-Id: I6132deaa73b1e79ac24176ef4de5af67a507ee26
Reviewed-on: https://go-review.googlesource.com/c/go/+/422234
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>
Those ureader.go files have enough documents and in stable
developement/review as other parts of Unified IR.
Fixes#48194
Change-Id: I08a0cbfef05401135b5390e00fe808e838a96170
Reviewed-on: https://go-review.googlesource.com/c/go/+/422617
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
I've needed this more than once in the past, I hack it in,
then throw it away, seems sensible to make the change and
save it.
Fixes#53937.
Change-Id: I7fe886b1c93d73cbf553bed587f2c30f0f5d5a0b
Reviewed-on: https://go-review.googlesource.com/c/go/+/418015
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
The SERVER_NAME variable in the CGI environment should not
contain the port, according to the section 4.1.14 of the
RFC 3875.
Fixes#53368.
Change-Id: Ifeea70206878cf83bc0bda35cb514d0226bbcd8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/412434
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: xie cui <523516579@qq.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
The test passed on linux/arm64, so re-enable it.
Change-Id: Ib5252d89b58f0de256993065e27b64c4676f5103
Reviewed-on: https://go-review.googlesource.com/c/go/+/414975
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Eric Fang <eric.fang@arm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
For signed comparisons, the following four optimization rules hold:
(CMPconst [0] z:(AND x y)) && z.Uses == 1 => (TST x y)
(CMPWconst [0] z:(AND x y)) && z.Uses == 1 => (TSTW x y)
(CMPconst [0] x:(ANDconst [c] y)) && x.Uses == 1 => (TSTconst [c] y)
(CMPWconst [0] x:(ANDconst [c] y)) && x.Uses == 1 => (TSTWconst [int32(c)] y)
But currently they only apply to jump instructions, not to conditional
instructions within a block, such as cset, csel, etc. This CL extends
the above rules into blocks so that conditional instructions can also be
optimized.
name old time/op new time/op delta
DivisiblePow2constI64-160 1.04ns ± 0% 0.86ns ± 0% -17.30% (p=0.008 n=5+5)
DivisiblePow2constI32-160 1.04ns ± 0% 0.87ns ± 0% -16.16% (p=0.016 n=4+5)
DivisiblePow2constI16-160 1.04ns ± 0% 0.87ns ± 0% -16.03% (p=0.008 n=5+5)
DivisiblePow2constI8-160 1.04ns ± 0% 0.86ns ± 0% -17.15% (p=0.008 n=5+5)
Change-Id: I6bc34bff30862210e8dd001e0340b8fe502fe3de
Reviewed-on: https://go-review.googlesource.com/c/go/+/420434
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Eric Fang <eric.fang@arm.com>
When a generic interface method is used, we use a special
relocation R_USEGENERICIFACEMETHOD to tell the linker the name of
the generic interface method, so it can keep methods with that
name live. The relocation references a symbol whose content is the
name. Currently this is a string symbol, which is content
addessable and may have trailing zero bytes (for better
deduplication). The trailing bytes can cause confusion for the
linker. This symbol doesn't need to be in the final binary and
doesn't need to be deduplicated with other symbol. So we don't use
content addressable symbol but make an (unnamed) symbol
specifically for this.
May fix#54346.
Change-Id: If0c34f7844c3553a7be3846b66cf1c103bc231c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/422300
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Add new line at the end of crash_test.go.
Change-Id: I73c77666066b105e563215f34e7ede6c1d92226b
Reviewed-on: https://go-review.googlesource.com/c/go/+/422299
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
We claim to not maintain pointer bits for noscan objects. But in fact
we do, since whenever we switch a page from scannable to noscan, we
call heapBits.initSpan which zeroes the heap bits.
Switch to ensure that we never scan noscan objects. This ensures that
we don't depend on the ptrbits for noscan objects. That fixes a bug
in the 1-bit bitmap CL which depended on that fact.
Change-Id: I4e66f582605b53732f8fca310c1f6bd2892963cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/422435
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Replace loading and storing an atomic.Value of type pointer with
atomic.Pointer.
Change-Id: I018ac1e18eee4f203ebca65c2833daf991075371
Reviewed-on: https://go-review.googlesource.com/c/go/+/422174
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
Updates github.com/google/pprof to bring in the commit from
https://github.com/google/pprof/pull/717 which fixes mangled
symbol names for type parameters.
Fixes#54105
Change-Id: I01af9f780aba3338b960a03b30906a23642e4448
Reviewed-on: https://go-review.googlesource.com/c/go/+/420234
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Consistently recommend using EscapedPath rather than RawPath directly.
For #33596.
Change-Id: Ibe5c2dfa7fe6b1fbc540efed6db1291fc6532726
Reviewed-on: https://go-review.googlesource.com/c/go/+/418035
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Change-Id: Ia8c67d148fc7e71cac8954ccce6fffb8a6f423df
GitHub-Last-Rev: 9441b8f0c5
GitHub-Pull-Request: golang/go#54036
Reviewed-on: https://go-review.googlesource.com/c/go/+/419322
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Javad Rajabzadeh <ja7ad@live.com>
Reviewed-by: hopehook <hopehook@qq.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Per TODO, this CL just moves code around without behavioral
change. Part of a cleanup process so that it's easier to access object
dictionaries where needed.
Change-Id: I95bb3cdd3cdb46cae47d76d5c1d5d8256661f222
Reviewed-on: https://go-review.googlesource.com/c/go/+/421816
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
This CL adds a test that method expressions where the receiver type is
a derived type and embeds a promoted method work correctly.
Change-Id: I2e7c96007b6d9e6f942dc14228970ac508ff5c15
Reviewed-on: https://go-review.googlesource.com/c/go/+/422199
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
The Go 1.18 frontend handles package-scope generic method values by
spilling the receiver value to a global temporary variable, which pins
it into memory. This issue isn't present in unified IR, which uses
OMETHVALUE when the receiver type is statically known.
Updates #54343.
Change-Id: I2c4ffeb125a3cf338f949a93b0baac75fff6cd31
Reviewed-on: https://go-review.googlesource.com/c/go/+/422198
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
For interface method values, we nil check the receiver value at the
point of evaluating the method value. Currently this is inserted by
the backend during walk, but in some cases it's useful to emit them
upfront instead.
OITAB is essentially a field selection operation, like ODOT, OIDATA,
and OSPTR.
OCHECKNIL is a statement that simply evaluates its unary operand, and
discards the result (after testing for nil).
Change-Id: I583b5170539caa9a87aec661d5c293080fd87fbb
Reviewed-on: https://go-review.googlesource.com/c/go/+/422197
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
ir.ClosureExpr implements ir.InitNode, so ir.InitExpr can prepend init
statements to it. However, CalleeEffects wasn't aware of this and
could cause the init statements to get dropped when inlining a call to
a closure.
This isn't an issue today, because we don't create closures with init
statements. But I ran into this within unified IR.
Easy and robust solution: just take advantage that ir.TakeInit can
handle any node.
Change-Id: Ica05fbf6a8c5be4b11927daf84491a1140da5431
Reviewed-on: https://go-review.googlesource.com/c/go/+/422196
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
NewClosureVar should only be called to capture locally declared
variables in the enclosing function scope. This CL adds a check to
make sure it's used that way, in particular to make sure it's not
called to capture global variables.
This came up because for generic method values, we desugar the method
value into a function literal that captures the receiver value after
evaluating it. However, due to compiler backend limitations, for
package-scope generic method values we spill the receiver value into a
global variable rather than capturing it normally.
To prevent confusing backend issues when misusing NewClosureVar with
global variables, this CL adds an extra check.
Change-Id: I80f0f083dc80f70c7f0298020efe56dba00b67d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/422195
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
When debugging IR that uses OLINKSYMOFFSET, you really need to know
what linksym it actually refers to.
Change-Id: I7f4775d040b50e36262f9f8b52d0fb112b7ed350
Reviewed-on: https://go-review.googlesource.com/c/go/+/422194
Reviewed-by: 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: Than McIntosh <thanm@google.com>