golang.org/cl/102697 attempted to fix the span presentation by utilizing
the position of the span in the span slices of a task. But it is
not complete either.
First, id=0 is omitted in json encoding and the trace viewer silently
drops entries with the missing id field, so we must avoid zero-value id.
Second, it is possible that a goroutine handles multiple tasks. Then,
id collisions will happen.
This takes a simpler approach - have a counter that increments for every
emitSpan call, and use the value as the id value.
Change-Id: Idaa9505634acf6d327c6f00af32d8260955b85e1
Reviewed-on: https://go-review.googlesource.com/106755
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
The current assembler will report error when the negative offset is in
the range of [-256, 0) and is not the multiples of 4/8.
The fix introduces C_NSAUTO_8, C_NSAUTO_4 and C_NAUTO4K. C_NPAUTO
includes C_NSAUTO_8 instead of C_NSAUTO, C_NAUTO4K includes C_NSAUTO_8,
C_NSAUTO_4 and C_NSAUTO. So that assembler will encode the negative offset
that is greater than -4095 and is not the multiples of 4/8 as two instructions.
Add the test cases.
Fixed#24471
Change-Id: I42f34e3b8a9fc52c9e8b41504294271aafade639
Reviewed-on: https://go-review.googlesource.com/102635
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
The escape analysis models "loop depth". If the address of an
expression is assigned to something defined at a lower (outer)
loop depth, the escape analysis decides it escapes. However, it
uses the loop depth of the address operator instead of where
the RHS is defined. This causes an unnecessary escape if there is
an assignment inside a loop but the RHS is defined outside the
loop. This CL propagates the loop depth.
Fixes#24730.
Change-Id: I5ff1530688bdfd90561a7b39c8be9bfc009a9dae
Reviewed-on: https://go-review.googlesource.com/105257
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
This is more or less implied by the spec language on initialization,
but restate it for clarity.
Fixes#23112
Change-Id: Ibe5385acafe4eac38823de98a025cd37f7a77d3b
Reviewed-on: https://go-review.googlesource.com/103399
Reviewed-by: Austin Clements <austin@google.com>
If there are no certs, return an empty pool, not nil.
Fixes#21405
Change-Id: Ib4ac9d5c4a8cef83dd53565b0707a63b73ba0a8b
Reviewed-on: https://go-review.googlesource.com/103596
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
As an example of why this might happen,
consider this code from cmd/internal/objfile:
// Expand literal "$GOROOT" rewritten by obj.AbsFile()
filename = filepath.Clean(os.ExpandEnv(filename))
In this case, filename might not contain "$GOROOT",
in which case we can skip the buffer entirely.
name old time/op new time/op delta
Expand/noop-8 46.7ns ± 1% 12.9ns ± 1% -72.47% (p=0.000 n=9+9)
Expand/multiple-8 139ns ± 1% 137ns ± 1% -1.36% (p=0.001 n=10+10)
The Expand/multiple improvement is probably noise.
This speeds up cmd/objdump detectably, if not much.
Using "benchcmd ObjdumpCompile go tool objdump `go tool -n compile`":
name old time/op new time/op delta
ObjdumpCompile 9.35s ± 2% 9.07s ± 3% -3.00% (p=0.000 n=18+18)
Updates #24725
Change-Id: Id31ec6a9b8dfb3c0f1db58fe1f958e11c39e656c
Reviewed-on: https://go-review.googlesource.com/106697
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Fixes#24580
Change-Id: I7536aca1e90717283bd6a3bb4b1bab059b0cf720
Reviewed-on: https://go-review.googlesource.com/104677
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Users of TempFile need to be able to supply the suffix, especially
when using operating systems that give semantic meaning to the
filename extension such as Windows. Renaming the file to include
an extension after the fact is insufficient as it could lead to
race conditions.
If the string given to TempFile includes a "*", the random string
replaces the "*". For example "myname.*.bat" will result in a random
filename such as "myname.123456.bat". If no "*' is included the
old behavior is retained, and the random digits are appended to the
end.
If multiple "*" are included, the final one is replaced, thus
permitting a pathological programmer to create filenames such as
"foo*.123456.bat" but not "foo.123456.*.bat"
Fixes#4896
Change-Id: Iae7f0980b4de6d7d31b87c8c3c3d40767b283c1f
Reviewed-on: https://go-review.googlesource.com/105675
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
"MOVD $0xaaaaaaaa, R2"
"MOVD $-0x55555555, R3"
For the above instructions, 64-bit constants 0x00000000 aaaaaaaa
and 0xffffffff aaaaaaab are stored in the constant pool.
This CL optimizes them to
"MOVWU $0xaaaaaaaa, R2"
"MOVW $-0x05555555, R3"
and 32-bit constants 0xaaaaaaaa and 0xaaaaaaab are stored in the
constant pool.
There is a little size reduction (about total 5KB) in both the go
executable and the library files.
Change-Id: I7c4bfa6cd9c07da99c69a8f9c15010a0cce3b735
Reviewed-on: https://go-review.googlesource.com/105775
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
First, take the exclusive lock that ensures only one running binary
later: after assembling the gotest.app directory and signing it.
Second, don't pass -r to ios-deploy. The -r flag uninstalls the
app before installing it. It seems unnecessary, takes extra time
and if there was only the one developer app on the phone, it
will drop the developer permission on uninstall.
Change-Id: Ia222d3e5c2e1e2285f53074eb952941fd45fadd9
Reviewed-on: https://go-review.googlesource.com/106676
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
This commit includes efficiency improvements in two places in the
database/sql package where an "if err != nil" was redundant and
the error can be returned as-is (most of the code in the standard
library and even in the file I changed does it my suggested way).
Change-Id: Ib9dac69ed01ee846e570a776164cb87c2caee6ca
Reviewed-on: https://go-review.googlesource.com/106555
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Move the test skip to use testenv.SkipFlaky and link to the Go issue.
Update #24826
Change-Id: I7a0ea3325ffcaa790b25f8cdc429fb52e96a41c7
Reviewed-on: https://go-review.googlesource.com/106636
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
As the comment above the code I'm changing says, when building with
-buildmode=exe, the default compiler flags produce code incompatible with PIE.
But when -linkshared is passed, the default compiler flags are not used so this
does not apply. And now I've found a system (linux/arm64 with glibc 2.27) where
this combination of flags causes a problem, albeit for reasons I don't really
understand, so stop passing -no-pie when -linkshared is passed.
Change-Id: I412ec7941dc0cb89e6d1b171fc29288aadcb9f20
Reviewed-on: https://go-review.googlesource.com/104815
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
I was wrong. There was a need to loop here.
Fixes#24761
Change-Id: If13b3ab72febde930bdaebdddd1c05e0d0446020
Reviewed-on: https://go-review.googlesource.com/105615
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
The standard library has plenty of polished encoder/decoder
implementations. No need for another ad-hoc one.
I considered using encoding/gob instead, but these strings go into the
package data part of the object file, so it's important they don't
contain "\n$$\n". Package json escapes newlines in strings, so it's
safe to use here.
Change-Id: I998655524ccee7365c2c8e9a843e6975e95a3e62
Reviewed-on: https://go-review.googlesource.com/106463
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
And fix the nacl implementation.
Fixes#24710
Change-Id: I31ffeea03a72dac5021ffb183fde31e9ffd060ad
Reviewed-on: https://go-review.googlesource.com/106464
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
CL 106096 changed the iOS exec wrapper to directly run the binary
without waiting for a SIGINT signal, but did so in a way that
expects a "(lldb)" response from lldb in 2 seconds. Lldb might
not out output anything until the program finishes, so change the
exec wrapper to just fire and forget the the run command and go
straight to waiting for exit, successfully or otherwise.
Change-Id: I6a2dc63f9b29fe44edb3591afb048b9a8e2e0822
Reviewed-on: https://go-review.googlesource.com/106176
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
A raw string containing newlines breaks whatever columns structure
has been established so far. Recognize the situation and force a
new section of alignment with the first line break seen after the
the raw string.
Applied gofmt to src and misc.
Fixes#9064.
Change-Id: I961e94b529b1fd421908311f366b113e2ec9b7f0
Reviewed-on: https://go-review.googlesource.com/105040
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
The file ordering.go referred to in the comment was removed
with commit dd44895. There's no duplicate use of the deps
field anymore.
Change-Id: Ia6490e9f0839d4f755e8063758819e29b3d3b248
Reviewed-on: https://go-review.googlesource.com/106459
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Presumably each line in the descriptor should match the corresponding operation.
Change-Id: I7726befcd62147324764d15c26e737357122be51
GitHub-Last-Rev: 85e610e304
GitHub-Pull-Request: golang/go#24807
Reviewed-on: https://go-review.googlesource.com/106355
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
The previous implementation would return "sql: Rows are closed" for any
context errors, which can be confusing for context timeouts or
cancelations.
Fixes#24431
Change-Id: I884904ec43204c43f4e94e2335b2802aab77a888
Reviewed-on: https://go-review.googlesource.com/104276
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
It wasn't clear for existing docs if DB.Close forcefully closed
connections or waited for them to finish.
Fixes#23753
Change-Id: Id7df31224c93181c8d01bab7b0b23da25b42a288
Reviewed-on: https://go-review.googlesource.com/103397
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
The process reading the output of the binary may read stderr and
stdout separately, and may interleave reads from the two streams
arbitrarily. Because we explicitly serialize writes on the writer
side, we can reuse a timestamp within a single stream without losing
information; however, if we use the same timestamp for write on both
streams, the reader can't tell how to interleave them.
This change ensures that every time we change between the two fds, we
also bump the timestamp. That way, writes within a stream continue to
show the same timestamp, but a sorted merge of the contents of the two
streams always interleaves them in the correct order.
This still requires a corresponding change to the Playground parser to
actually reconstruct the correct interleaving. It currently merges the
two streams without reordering them; it should instead buffer them
separately and perform a sorted merge. (See
https://golang.org/cl/105496.)
Updates golang/go#24615.
Updates golang/go#24659.
Change-Id: Id789dfcc02eb4247906c9ddad38dac50cf829979
Reviewed-on: https://go-review.googlesource.com/105235
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Yury Smolsky <yury@smolsky.by>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Mac otool and llvm-objdump distinguishes a Mach-O section is
text or data by looking at S_ATTR_PURE_INSTRUCTIONS bit. Without
this bit it thinks our function symbols are data, not functions.
Set this bit for text section to make otool/objdump happy.
Fixes#24706.
Change-Id: I5236482cb9a72474c23fbea0f35d5b5cc8491ea4
Reviewed-on: https://go-review.googlesource.com/105256
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
If NewFile is called with a file descriptor that is already set to
non-blocking mode, it tries to return a pollable file (one for which
SetDeadline methods work) by adding the filedes to the poll/netpoll
mechanism. If called with a filedes in blocking mode, it returns a
non-pollable file, as it always did.
Fixes#22939
Updates #24331
Change-Id: Id54c8be1b83e6d35e14e76d7df0e57a9fd64e176
Reviewed-on: https://go-review.googlesource.com/100077
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
When a neither of a conditional block's successors follows,
the block must end with a conditional branch followed by a
an unconditional branch. If the (conditional) branch is
"unlikely", invert it and swap successors to make it
likely instead.
This doesn't matter to most benchmarks on amd64, but in one
instance on amd64 it caused a 30% improvement, and it is
otherwise harmless. The problematic loop is
for i := 0; i < w; i++ {
if pw[i] != 0 {
return true
}
}
compiled under GOEXPERIMENT=preemptibleloops
This the very worst-case benchmark for that experiment.
Also in this CL is a commoning up of heavily-repeated
boilerplate, which made it much easier to see that the
changes were applied correctly. In the future this should
allow un-exporting of SSAGenState.Branches once the
boilerplate-replacement is done everywhere.
Change-Id: I0e5ded6eeb3ab1e3e0138e12d54c7e056bd99335
Reviewed-on: https://go-review.googlesource.com/104977
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TestServerDuplicateBackgroundRead has been causing crashes on the
netbsd-arm-bsiegert builder, with the system becoming completely
unresponsive (probably deadlocked). Skip this test while the crash
is under investigation.
Upstream bug report is http://gnats.netbsd.org/53173.
Change-Id: Ib48f19005cf2cbba8a27e75e689c2acb025d8870
Reviewed-on: https://go-review.googlesource.com/106295
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
And delete them from asm_test.
Also delete an arm64 cmov test has been already ported to the new test
harness.
Change-Id: I4458721e1f512bc9ecbbe1c22a2c9c7109ad68fe
Reviewed-on: https://go-review.googlesource.com/106335
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Giovanni Bajo <rasky@develer.com>
SWPD/SWPW/SWPH/SWPB were introduced in ARMv8.1. They swap content
of register and memory atomically. And their difference is
SWPD: 64-bit double word data
SWPW: 32-bit word data (zero extended to 64-bit)
SWPH: 16-bit half word data (zero extended to 64-bit)
SWPB: 8-bit byte data (zero extended to 64-bit)
This CL implements them in the arm64 assembler.
Change-Id: I2d9fb2310674bd92693531210e187143e7eed602
Reviewed-on: https://go-review.googlesource.com/101516
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
In #17528 it was discussed (off-topic to the actual issue) to reserve
GOARCH names for the RISC-V architecture. With the first RISC-V
Linux-capable development boards released (e.g. HiFive Unleashed),
Linux distributions being ported to RISC-V (e.g. Debian, Fedora) and
RISC-V support being added to gccgo (CL 96377), it becomes more likely
that Go software (and maybe Go itself) will be ported as well.
Add riscv and riscv64 (which is already used by gccgo), so Go 1.11 will
already recognize "*_riscv{,64}.go" as reserved files.
Change-Id: I042aab19c68751d82ea513e40f7b1d7e1ad924ea
Reviewed-on: https://go-review.googlesource.com/106256
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
The patch adds support for arm64 instructions LDRB, LDRH, LDRSB,
LDRSH, LDRSW, STR, STRB and STRH with register offset.
Test cases are also added.
Change-Id: I8d17fddd2963c0bc366e12b00bac49b93f3f0957
Reviewed-on: https://go-review.googlesource.com/91575
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
After CL 104636 cpu.X86.HasAVX is set early enough that it can be used
to determine useAVXmemmove. Use it and remove support_avx.
Change-Id: Ib7a627bede2bf96c92362507e742bd833cb42a74
Reviewed-on: https://go-review.googlesource.com/106235
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Also, make the variables list sorted.
Fixes#24794
Change-Id: I55f77004b00391875d26df8e55e54d79cef168dc
Reviewed-on: https://go-review.googlesource.com/106255
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Point out that one can just run the commands now; it's not necessary
to log out first.
Change-Id: I48d0cc0273d97ba54ce59b3a3bbcae0b5af9aaef
Reviewed-on: https://go-review.googlesource.com/106195
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Fixes#23617
Note that this CL does not affect darwin/arm and darwin/arm64,
still TBD what, if anything, needs to be done for those.
This is a fix of CL 105975 which was reverted in CL 106155.
Needed to use movl instead of movq for 386.
Change-Id: I0db7f8087173869e60cc22c6c3124fa0a0739b46
Reviewed-on: https://go-review.googlesource.com/106156
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>