Some *mem ops are loads, some are stores, some are modifications.
Replace mem->load for the loads.
Replace mem->store for the stores.
Replace mem->modify for the load-modify-stores.
The only semantic change in this CL is to mark
ADD(Q|L)constmodify (which used to be ADD(Q|L)constmem) as
both a read and a write, instead of just a write. This is arguably
a bug fix, but the bug isn't triggerable at the moment, see CL 112157.
Change-Id: Iccb45aea817b606adb2d712ff99b10ee28e4616a
Reviewed-on: https://go-review.googlesource.com/112159
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Missing rule to fold out Convert ops on 32-bit architectures.
This comes up with expressions like
unsafe.Pointer(uintptr(p) + x)
Change-Id: I429e968e5d1a3e13a386ddd29a08ebb6d7dd938a
Reviewed-on: https://go-review.googlesource.com/112158
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: David Chase <drchase@google.com>
If the modify ops operate on a variable, we should tell the liveness
pass that the variable is still live before the instruction.
This looks like a bug, but I don't think there's any way to trigger
it at the moment. It only matters for pointer-containing values, and
the modify ops don't normally work on pointers. Even when I reach for
unsafe.Pointer tricks, I can't get ADDLmodify to work on pointers, as
there's always a Convert or VarDef preventing the coalescing.
TL;DR I can't figure out a test for this. But we should probably
fix it anyway.
Change-Id: I971c62616dec51a33788b7634e6478e1bfcd6260
Reviewed-on: https://go-review.googlesource.com/112157
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Currently go list -test runtime/cgo fails with an index out of range
error. This appears to be because the updating of import paths that
happens as part of -test doesn't take into account the fact that the
Internal.Imports of a package do not contain "C", whereas the public
Imports do.
Therefore we skip the public Import of "C" if it exists and continue.
Change-Id: I5cdc8968890fa7e5da3e375718606037d3282754
Reviewed-on: https://go-review.googlesource.com/111175
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
pkg-config errors were missing a space between pkg-config flags and packages
e.g. pkg-config --cflags --staticsdl2
Fixes#25260
Change-Id: Iacecb697c5782c4822db9eefa1a2e4c4daf91a69
GitHub-Last-Rev: 2adf8576be
GitHub-Pull-Request: golang/go#25261
Reviewed-on: https://go-review.googlesource.com/111638
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Avoid using values that do not dominate the block the Zero op is in.
Should fix the SSA check builder.
The additional OffPtr ops inserted by these rules should always be
optimized away when the Load is replaced with a const zero.
Fixes#25288.
Change-Id: I4163b58e60364f77c8a206ba084073a58ca6320a
Reviewed-on: https://go-review.googlesource.com/112136
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Use conditional moves instead of subtractions with borrow to handle
saturation cases. This allows us to delete the SUBE/SUBEW ops and
associated rules from the SSA backend. Using conditional moves also
means we can detect when shift values are masked so I've added some
new rules to constant fold the relevant comparisons and masking ops.
Also use the new shiftIsBounded() function to avoid generating code
to handle saturation cases where possible.
Updates #25167 for s390x.
Change-Id: Ief9991c91267c9151ce4c5ec07642abb4dcc1c0d
Reviewed-on: https://go-review.googlesource.com/110070
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Now that the iOS exec wrapper uninstalls any existing test app before
installing a new, looking up the device app path might fail. Before,
the lookup always succeeded (even though the path reported might be
stale).
For the iOS builder.
Change-Id: I5667b6fae15f88745bdee796db219a429a26e203
Reviewed-on: https://go-review.googlesource.com/112075
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
To avoid allocation between entersyscall and exitsyscall in Plan 9,
syscall error strings retrieved from the OS were being stored in
a shared buffer for each M, leading to overwriting of error strings
by subsequent syscalls, and potential confusion if exitsyscall
switched to a different M. Instead, the error string is now
retrieved to the G stack and then copied to a new allocated array
after exitsyscall.
A new test TestPlan9Syserr is provided to confirm the correction.
Fixes#13770Fixes#24921
Change-Id: I013c4a42baae80d03a5b61d828396527189f5551
Reviewed-on: https://go-review.googlesource.com/111195
Reviewed-by: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: David du Colombier <0intro@gmail.com>
Provide a complete list of EM_* and ELFOSABI_* constants.
Compiled from the tables at
http://www.sco.com/developers/gabi/latest/ch4.eheader.html
and llvm/BinaryFormat/ELF.h from LLVM.
Change-Id: Ice1e1476076fafdb8bb8af848caec6d80a82c452
Reviewed-on: https://go-review.googlesource.com/112115
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
intDataSize should return length of bool slice, so functions
Read and Write can use the fast path to process bool slice.
Change-Id: I8cd275e3ffea82024850662d86caca64bd91bf70
Reviewed-on: https://go-review.googlesource.com/112135
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
This commit adds the wasm architecture to the math package.
Updates #18892
Change-Id: I5cc38552a31b193d35fb81ae87600a76b8b9e9b5
Reviewed-on: https://go-review.googlesource.com/106996
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit adds the wasm architecture to the internal/bytealg package.
Some parts of the assembly code have been extracted from WebAssembly
bytecode generated with Emscripten (which uses musl libc).
Updates #18892
Change-Id: Iba7f7158356b816c9ad03ca9223903a41a024da6
Reviewed-on: https://go-review.googlesource.com/103915
Reviewed-by: Keith Randall <khr@golang.org>
We were spending more time in duffcopy than in the String method.
Avoid creating a copy of test struct to make benchmark measure performance of
String() itself.
IPString/IPv4-8 113ns ± 0% 57ns ± 1% -49.83% (p=0.000 n=8+10)
IPString/IPv6-8 972ns ± 1% 915ns ± 1% -5.88% (p=0.000 n=9+10)
Change-Id: I5ceff2caa1b8288c43f0cf6c6b3809ca523af1fa
Reviewed-on: https://go-review.googlesource.com/111881
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Currently isSystemGoroutine has a hard-coded list of known entry
points into system goroutines. This list is annoying to maintain. For
example, it's missing the ensureSigM goroutine.
Replace it with a check that simply looks for any goroutine with
runtime function as its entry point, with a few exceptions. This also
matches the definition recently added to the trace viewer (CL 81315).
Change-Id: Iaed723d4a6e8c2ffb7c0c48fbac1688b00b30f01
Reviewed-on: https://go-review.googlesource.com/81655
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
This comment needs updating after moving the "bounded" mark from
Aux to AuxInt.
Change-Id: I924fb22a81fffcd6944b93f0e3357c3aa2c4c49e
Reviewed-on: https://go-review.googlesource.com/111880
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Changed the example to convey the intent of the Unquote function
in a more succint way.
Fixes#23693
Change-Id: I49465641d730e70b5af0d47057335af39882bcec
Reviewed-on: https://go-review.googlesource.com/92015
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Tests can fail because there is leftover data from a previous run.
For example:
--- FAIL: TestRemoveAll (0.00s)
path_test.go:96: RemoveAll "/private/var/mobile/Containers/Data/Application/66247524-5ED7-45A4-82AA-6BF15D6078B2/tmp//_TestRemoveAll_" (first): open /private/var/mobile/Containers/Data/Application/66247524-5ED7-45A4-82AA-6BF15D6078B2/tmp//_TestRemoveAll_/dir: permission denied
FAIL
FAIL os 31.275s
There seem to be no way to simply clear the app data for an app
short of uninstalling it, so do that.
This change in effect undoes CL 106676, which means that running iOS
is a little slower again, and that another app from the same
apple developer account must be present on the device for our app
install to succeed.
Change-Id: Iacc3a6f95c93568f4418db45e1098c7c7fdb88e0
Reviewed-on: https://go-review.googlesource.com/111795
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
\f triggers a flush.
This is used (by gofmt, among others) to indicate that
the current aligned segment has ended.
When flushed, it is unlikely that the previous line is
in fact a good predictor of the upcoming line,
so stop treating it as such.
No performance impact on the existing benchmarks,
which do not perform any flushes.
Change-Id: Ifdf3e6d4600713c90db7b51a10e429d9260dc08c
Reviewed-on: https://go-review.googlesource.com/111644
Reviewed-by: Robert Griesemer <gri@golang.org>
In hasSideEffects, vet has to be taught whether or not a CallExpr is an
actual function call, or just a type conversion.
The previous code knew how to differentiate fn(arg) from int(arg), but
it incorrectly saw (func(T))(fn) as a func call. This edge case is
slightly tricky, since the CallExpr.Fun has a func signature type, just
like in func calls.
However, the difference is that in this case the Fun is a type, not a
value. This information is in types.TypeAndValue, so use it.
Change-Id: I18bb8b23abbe7decc558b726ff2dc31fae2f13d6
Reviewed-on: https://go-review.googlesource.com/111416
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Current assmbler accepts MUL* related instructions with 4 operands,
such as instruction "MUL R1, R2, R3, R4", which is illegal.
The fix adds an actual field informantion to Optab, which has value
of C_NONE, C_REG, etc, so assembler can use p.From3Type for checking
in oplook.
Add test cases.
Fixes#25059
Change-Id: I0656319383c460696b392197bf5960b987f8fc97
Reviewed-on: https://go-review.googlesource.com/109295
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
The hmap field in the maptype is only used by the runtime to check the sizes of
the hmap structure created by the compiler and runtime agree.
Comments are already present about the hmap structure definitions in the
compiler and runtime needing to be in sync.
Add a test that checks the runtimes hmap size is as expected to detect
when the compilers and runtimes hmap sizes diverge instead of checking
this at runtime when a map is created.
Change-Id: I974945ebfdb66883a896386a17bbcae62a18cf2a
Reviewed-on: https://go-review.googlesource.com/91796
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Ensure all error prefixes in the "database/sql" package start with
"sql: ". Do not prefix errors for type conversions because they
are always embedded in another error message with a specific
context.
Fixes#25251
Change-Id: I349d9804f3bfda4eeb755b32b508ec5992c28e07
Reviewed-on: https://go-review.googlesource.com/111637
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
When building for gccgo cmd/go uses symlinks for import maps.
In some cases, such as TestVendorTest, it generates the same symlink
multiple times. Don't give an error when this happens.
Change-Id: Iecc154ea1ac53d7c5427b36795881909c5cac7e3
Reviewed-on: https://go-review.googlesource.com/111636
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
A gccgo command line can contain parentheses, for -( and -).
Quote them when outputting a command line, so that `go build -x`
output is suitable for use as shell input.
Change-Id: I43194b87bf048e583c222b19ca4bcdcb1deca97a
Reviewed-on: https://go-review.googlesource.com/111635
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Some warnings were being missed, because vet's regex that finds
formatting directives was missing the 'T' verb.
Fixes#24646.
Change-Id: I2f6f9ed19e7daf9a07175199f428a62e94799ea9
Reviewed-on: https://go-review.googlesource.com/111357
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
The Go runtime registers a handler for every signal. This prevents Go
binaries from working on QEMU in user-emulation mode, since the hacky
way QEMU implements signals on Linux assumes that no-one uses signal
64 (SIGRTMAX).
In the past, we had a workaround in the runtime to prevent crashes on
start-up when running on QEMU:
golang.org/cl/124900043
golang.org/cl/16853
but it went lost during the 1.11 dev cycle. More precisely, the test
for SIGRTMAX was dropped in CL 18150 when we stopped testing the
result of sigaction in the Linux implementation of setsig. That change
was made to avoid a stack split overflow because code started calling
setsig from nosplit functions. Then in CL 99077 we started testing the
result of sigaction again, this time using systemstack to avoid to
stack split overflow. When this test was added back, we did not bring
back the test of SIGRTMAX.
As a result, Go1.10 binaries work on QEMU, while 1.11 binaries
immediately crash on startup.
This change restores the QEMU workaround.
Updates #24656
Change-Id: I46380b1e1b4bf47db7bc7b3d313f00c4e4c11ea3
Reviewed-on: https://go-review.googlesource.com/111176
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This is a followup to CL 110296. That change added a new behavior
to Redirect, where the short HTML body is not written if the
Content-Type header is already set. It was implemented by doing
an early return. That unintentionally prevented the correct status
code from being written, so it would always default to 200.
Existing tests didn't catch this because they don't check status code.
This change fixes that issue by removing the early return and
moving the code to write a short HTML body behind an if statement.
It adds written status code checks to Redirect tests.
It also tries to improve the documentation wording and code style
in TestRedirect_contentTypeAndBody.
Updates #25166.
Change-Id: Idce004baa88e278d098661c03c9523426c5eb898
Reviewed-on: https://go-review.googlesource.com/111517
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>