On Linux a signal sent using tgkill will have si_code == SI_TKILL,
not SI_USER. Treat the two cases the same. Add a Linux-specific test.
Change the test to use the C pause function rather than sleeping
for a second, as that achieves the same effect.
Change-Id: I2a36646aecabcab9ec42ed9a048b07c2ff0a3987
Reviewed-on: https://go-review.googlesource.com/c/go/+/431255
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Return errors instead of calling t.Fatalf for timing-sensitive failure
modes. Scale the Sleep call to the timeout (so that it isn't too short
for the longer durations).
Fixes#54891.
Change-Id: I574e85e121becdda9ab8ee6bfd37c18a549d366d
Reviewed-on: https://go-review.googlesource.com/c/go/+/430955
Reviewed-by: Joel Sing <joel@sing.id.au>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Fixes#51152
Change-Id: Ib366e733434b4bb60ac93e6e622d9ba50bfe4e26
GitHub-Last-Rev: e98220d62f
GitHub-Pull-Request: golang/go#54921
Reviewed-on: https://go-review.googlesource.com/c/go/+/428955
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Currently bgsweep attempts to be a low-priority background goroutine
that runs mainly when the application is mostly idle. To avoid
complicating the scheduler further, it achieves this with a simple
heuristic: call Gosched after each span swept. While this is somewhat
inefficient as there's scheduling overhead on each iteration, it's
mostly fine because it tends to just come out of idle time anyway. In a
busy system, the call to Gosched quickly puts bgsweep at the back of
scheduler queues.
However, what's problematic about this heuristic is the number of
tracing events it produces. Average span sweeping latencies have been
measured as low as 30 ns, so every 30 ns in the sweep phase, with
available idle time, there would be a few trace events emitted. This
could result in an overwhelming number, making traces much larger than
they need to be. It also pollutes other observability tools, like the
scheduling latencies runtime metric, because bgsweep stays runnable the
whole time.
This change fixes these problems with two modifications to the
heursitic:
1. Check if there are any idle Ps before yielding. If there are, don't
yield.
2. Sweep at least 10 spans before trying to yield.
(1) is doing most of the work here. This change assumes that the
presence of idle Ps means that there is available CPU time, so bgsweep
is already making use of idle time and there's no reason it should stop.
This will have the biggest impact on the aforementioned issues.
(2) is a mitigation for the case where GOMAXPROCS=1, because we won't
ever observe a zero idle P count. It does mean that bgsweep is a little
bit higher priority than before because it yields its time less often,
so it could interfere with goroutine scheduling latencies more. However,
by sweeping 10 spans before volunteering time, we directly reduce trace
event production by 90% in all cases. The impact on scheduling latencies
should be fairly minimal, as sweeping a span is already so fast, that
sweeping 10 is unlikely to make a dent in any meaningful end-to-end
latency. In fact, it may even improve application latencies overall by
freeing up spans and sweep work from goroutines allocating memory. It
may be worth considering pushing this number higher in the future.
Another reason to do (2) is to reduce contention on npidle, which will
be checked as part of (1), but this is a fairly minor concern. The main
reason is to capture the GOMAXPROCS=1 case.
Fixes#54767.
Change-Id: I4361400f17197b8ab84c01f56203f20575b29fc6
Reviewed-on: https://go-review.googlesource.com/c/go/+/429615
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
This change adds a metric to the runtime/metrics package which tracks
total mutex wait time for sync.Mutex and sync.RWMutex. The purpose of
this metric is to be able to quickly get an idea of the total mutex wait
time.
The implementation of this metric piggybacks off of the existing G
runnable tracking infrastructure, as well as the wait reason set on a G
when it goes into _Gwaiting.
Fixes#49881.
Change-Id: I4691abf64ac3574bec69b4d7d4428b1573130517
Reviewed-on: https://go-review.googlesource.com/c/go/+/427618
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Currently, wait reasons are set somewhat inconsistently. In a follow-up
CL, we're going to want to rely on the wait reason being there for
casgstatus, so the status quo isn't really going to work for that. Plus
this inconsistency means there are a whole bunch of cases where we could
be more specific about the G's status but aren't.
So, this change adds a new function, casGToWaiting which is like
casgstatus but also sets the wait reason. The goal is that by using this
API it'll be harder to forget to set a wait reason (or the lack thereof
will at least be explicit). This change then updates all casgstatus(gp,
..., _Gwaiting) calls to casGToWaiting(gp, ..., waitReasonX) instead.
For a number of these cases, we're missing a wait reason, and it
wouldn't hurt to add a wait reason for them, so this change also adds
those wait reasons.
For #49881.
Change-Id: Ia95e06ecb74ed17bb7bb94f1a362ebfe6bec1518
Reviewed-on: https://go-review.googlesource.com/c/go/+/427617
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This change adds 3 new waitReasons that correspond to sync.Mutex.Lock,
sync.RWMutex.RLock, and sync.RWMutex.Lock that are plumbed down into
semacquire1 by exporting new functions to the sync package from the
runtime.
Currently these three functions show up as "semacquire" in backtraces
which isn't very clear, though the stack trace itself should reveal
what's really going on. This represents a minor improvement to backtrace
readability, though blocking on an RWMutex.w.Lock will still show up as
blocking on a regular mutex (I suppose technically it is).
This is a step toward helping the runtime identify when a goroutine is
blocked on a mutex of some kind.
For #49881.
Change-Id: Ia409b4d27e117fe4bfdc25fa541e9c58d6d587b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/427616
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
This changes adds a breakdown for estimated CPU usage by time. These
estimates are not based on real on-CPU counters, so each metric has a
disclaimer explaining so. They can, however, be more reasonably
compared to a total CPU time metric that this change also adds.
Fixes#47216.
Change-Id: I125006526be9f8e0d609200e193da5a78d9935be
Reviewed-on: https://go-review.googlesource.com/c/go/+/404307
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Josh MacDonald <jmacd@lightstep.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
There are lots of useless buckets with too much precision. Introduce a
minimum level of precision with a minimum bucket bit. This cuts down on
the size of a time histogram dramatically (~3x). Also, pick a smaller
sub bucket count; we don't need 6% precision.
Also, rename super-buckets to buckets to more closely line up with HDR
histogram literature.
Change-Id: I199449650e4b34f2a6dca3cf1d8edb071c6655c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/427615
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Includes cases where the core type of the variadic parameter is
a slice or bytestring. Permits a client to create the signature
for various instantiations of append.
Fixes#55030.
Change-Id: I0f4983eb00c088cbe1d87954ee0b2df0ccc3bc49
Reviewed-on: https://go-review.googlesource.com/c/go/+/430455
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Apparently the new darwin linker starts to emit a warning about
-no_pie deprecation. Maybe we want to switch to PIE by default.
For now, suppress the warning. This also makes it easier for
backporting to previous releases.
For #54482.
Change-Id: I1a3b74c237a9d00ec3b030fc3a9940a31e5cd37e
Reviewed-on: https://go-review.googlesource.com/c/go/+/430937
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
When running on Go 1.19, we can further simplify some of the exec.Cmd
helpers due to API improvements. There's not much point in doing this
while the bootstrap is still 1.17, but this will queue up this
simplification in an obvious way for when we next upgrade the
bootstrap toolchain (#54265).
Updates #44505.
Change-Id: I2ebc3d5c584375ec862a1d48138ab134bd9b2366
Reviewed-on: https://go-review.googlesource.com/c/go/+/427958
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Now that the required Go bootstrap version is 1.17, we can simplify
some of the logic for working with exec.Cmd.Env as those APIs have
been simplified.
Updates #44505.
Change-Id: Ia62ab9830320c7daf65a15f2313471dfaba687b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/427957
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
function "ExampleFprint" will be rewritten to function "main"
when displayed on the godoc pages, so the online example is failed to
run:
Output:
panic: function not found
goroutine 1 [running]:
main.parseFunc({0x4f772e, 0xf}, {0x4f713f, 0xd})
/tmp/sandbox1264544227/prog.go:23 +0x13b
main.main()
/tmp/sandbox1264544227/prog.go:30 +0x45
See: https://pkg.go.dev/go/printer#example-Fprint
Add printSelf function to prevent the function not found when running in godoc
sandbox. Beside, deleting the dummy test function to make the example show
the entire file, as we want to show the newly added printSelf function.
Change-Id: Ia2b772937081b58a0fce9860838959c95f2d650c
GitHub-Last-Rev: bac1189173
GitHub-Pull-Request: golang/go#53141
Reviewed-on: https://go-review.googlesource.com/c/go/+/409314
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
The correct spelling is asyncpreemptoff=1,
but clearly this test doesn't need it.
Change-Id: Ic69cf5be04bf90d357a6e4d8ae3f9011f1779922
Reviewed-on: https://go-review.googlesource.com/c/go/+/430575
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
For proposal #41583, add a new 'go test -skip' flag to make it easy
to disable specific tests, benchmarks, examples, or fuzz targets.
Fixes#41583.
Change-Id: Id12a6575f505dafdce4a149aedc454a002e93afa
Reviewed-on: https://go-review.googlesource.com/c/go/+/421439
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
The object header string is meant to record the relevant toolchain
configuration, so that we don't import or link object files that are
incompatible with each other. One important part of compatibility
is the sub-architecture version (GOARM for GOARCH=arm, and so on).
Add the sub-architecture info to the object header line so that
binaries cannot be built that have inconsistent sub-architecture
configurations across the build.
This check is only important when the build system makes a mistake.
Builds using the go command don't make this kind of mistake anymore,
but we just debugged a difficult problem inside Google where a custom
build system had built part of a program with GOARM=5 and part of
a program with GOARM=7, resulting in corrupted execution when
signal-based preemption was attempted. Updating the check will avoid
this kind of problem in the future, in any custom build system, or if the
go command makes a mistake.
After this change:
% sed 3q pkg/darwin_amd64/runtime.a
!<arch>
__.PKGDEF 0 0 0 644 30525 `
go object darwin amd64 devel go1.20-102ebe10b7 Wed Aug 17 14:31:01 2022 -0400 GOAMD64=v1 X:regabiwrappers,regabiargs
%
Change-Id: I901e0758f1002dd2c58292dc65e2d06da86e4495
Reviewed-on: https://go-review.googlesource.com/c/go/+/427174
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
The concurrent model for delivering tokens was fine for pedagogy,
but has caused a few problems as the package has evolved (that is,
got more complicated). It's easy to eliminate it, simplifying or
removing some of the hacks used to work around these prolems.
The old lexer would deliver tokens over a channel to the parsing
goroutine, and continue running until EOF. In this rewrite, we
instead run the machine until a token is ready, and shut it down
until the next token is needed. The mechanism is just to return nil
as the state function, which requires a bit more threading of return
values through the state functions but is not difficult. The change
is modest.
A couple of error messages change, but otherwise the change has no
external effect. This is just an internal cleanup, long overdue.
benchmark old ns/op new ns/op delta
BenchmarkParseLarge-20 12222729 6769966 -44.61%
BenchmarkVariableString-20 73.5 73.4 -0.16%
BenchmarkListString-20 1827 1841 +0.77%
benchmark old allocs new allocs delta
BenchmarkVariableString-20 3 3 +0.00%
BenchmarkListString-20 31 31 +0.00%
benchmark old bytes new bytes delta
BenchmarkVariableString-20 72 72 +0.00%
BenchmarkListString-20 1473 1473 +0.00%
Fixes#53261
Change-Id: I4133bed2f8df16d398b707fb9509230325765c57
Reviewed-on: https://go-review.googlesource.com/c/go/+/421883
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Use ppc64map (from x/arch) to generate ISA 3.1 support for the
assembler. A new file asm9_gtables.go is added which contains
generated code to encode ISA 3.1 instructions, a function to assist
filling out the oprange structure, a lookup table for the fixed
bits of each instructions, and a slice of string name. Generated
functions are shared if their bitwise encoding match, and the
translation from an obj.Prog structure matches.
The generated file is entirely self-contained, and does not require
regenerating any other files for changes within it. If opcodes in
a.out.go are reordered or changed, anames.go must be updated in
the same way as before.
Future improvements could shrink the generated opcode table
to 32 bit entries as there is much less variation of the
encoding of the prefix word, but it is not always identical
for instructions which share a similar encoding of arguments
(e.g PLWA and PLWZ).
Updates #44549
Change-Id: Ie83fa02497c9ad2280678d68391043d3aae63175
Reviewed-on: https://go-review.googlesource.com/c/go/+/419535
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
This CL adds tests for some of the instructions that were
missing. A minor change was made to asm9.go to ensure EXTSWSLICC
test works.
Change-Id: I95cd096c85778fc93856d213aa4fb14c35228cec
Reviewed-on: https://go-review.googlesource.com/c/go/+/430376
Run-TryBot: Archana Ravindar <aravind5@in.ibm.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Paul Murphy <murp@ibm.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
This is the initial trivial implemenation. Further improvements can be
made for local calls.
A test is added, but the -fno-plt option is ignored by gcc if binutils
does not support inline plt relocations, so the test is effectively
skipped on such hosts.
Fixes#53345
Change-Id: Ibf31c26b1a8551c942b21019df8782c00b7a563e
Reviewed-on: https://go-review.googlesource.com/c/go/+/412714
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
The optimizations were added in CL 425197 and CL 421877.
Move this functionality to a separate file to keep format.go smaller
and to document the justification for why this optimization exists.
Change-Id: I1e4e1ace19f9d596d8c0cf49ab6062f63a87b5bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/430675
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Use fcntl(oldfd, F_DUP2FD_CLOEXEC, newfd) to duplicate the file
descriptor and mark is as close-on-exec instead of dup2 & fcntl.
DragonFly BSD implements dup3 like this in libc since version 5.4.
Change-Id: I80c765faa288add8ffb236284c9e8c4f8e6c6769
Reviewed-on: https://go-review.googlesource.com/c/go/+/430535
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Increase unit test coverage of strconv/itoa.go from 83.8% to 85%
Change-Id: I0abdfc70a3f06251106f229c12ffb105eeb43fc8
GitHub-Last-Rev: da9755368b
GitHub-Pull-Request: golang/go#55014
Reviewed-on: https://go-review.googlesource.com/c/go/+/430137
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
Merge the CRC32 Update and Write functions using an unexported function, to avoid duplication of code and make it more readable.
The only difference between them is the check of the initialization of the IEEE table, and a boolean value specifies that.
Throughout the crc32.go file, in the switches the default value is inserted inside the switch statement, this change uniforms the style of the MakeTable function, making it like the other pieces of code.
Change-Id: I3889f6c6671210c82f0d7250cea67907bccf3ce7
GitHub-Last-Rev: b8777ee213
GitHub-Pull-Request: golang/go#55044
Reviewed-on: https://go-review.googlesource.com/c/go/+/430456
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Use fcntl(oldfd, F_DUP2FD_CLOEXEC, newfd) to duplicate the file
descriptor and mark is as close-on-exec instead of dup2 & fcntl.
Note that the value for F_DUP2FD_CLOEXEC is different on Solaris and
Illumos and thus the definition is moved from zerrors_solaris_amd64.go
to solaris/illumos specific files.
Change-Id: I9a52801d1a01471ec3f065520575e3fafee92855
Reviewed-on: https://go-review.googlesource.com/c/go/+/428375
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
The text was mistakenly quoted with backquotes.
Change-Id: I77ed4adac8c78b719bea61c08f1c377ed4ac4c9d
GitHub-Last-Rev: 6f1430fe16
GitHub-Pull-Request: golang/go#55059
Reviewed-on: https://go-review.googlesource.com/c/go/+/430775
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
Go 1.19 introduce new append-like APIs in package encoding/binary, this
change teaches the inliner to treat calls to these methods as cheap, so
that code using them will be more inlineable.
Updates #42958
Change-Id: Ie3dd4906e285430f435bdedbf8a11fdffce9302d
Reviewed-on: https://go-review.googlesource.com/c/go/+/431015
Auto-Submit: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Keith Randall <khr@google.com>
These instructions already do sign extension on output, so we can get rid of it.
Note: (MOVWreg (MULW x y)) may araise from divisions by constant,
generic rules replace them with multiply and may produce (Rsh32x64 (Mul32 _ _) _).
Change-Id: I41bc9b519e38bc6027311de604dadb962cd0bbf4
Reviewed-on: https://go-review.googlesource.com/c/go/+/429757
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Calling close is no longer necessary.
It was was originally necessary to cleanup goroutines
spawned to decompress the stream.
This has not been the case since CL 4548079.
Update the documentation to mention how it handles trailing data
after the end of the DEFLATE stream.
Change-Id: Ieacba264230560713b7b8d604665223fd096f4ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/430377
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
We added -pagezero_size in CL 72730, where it was intented for iOS.
The current code passes it only on macOS/AMD64 instead. It is not
really necessary there. Also, the new darwin linker starts to emit
a warning about deprecation of the flag. Stop passing it.
For #54482.
Change-Id: If9db7a1645c37d4284e48f075856912df8d8c1a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/430936
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Allow us to select a race .syso file based on subarch values.
Note that this doesn't actually change the syso used. This CL
just moves things around in preparation for adding v3-specific
versions in future CLs.
Change-Id: I14e3c273a7c6f07b13b22193b7a851ea94c765cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/424034
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
CL 413374 added syscall.Mmap on solaris. Use it in cmd/compile and
cmd/link if the bootstrap toolchain is Go ≥ 1.20.
For #52875
For #54265
Change-Id: I9a0534bf97926eecf0c6f1f9218e855344ba158f
Reviewed-on: https://go-review.googlesource.com/c/go/+/430496
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Support for 1xx responses has recently been merged in
net/http (CL 269997).
As discussed in this CL
(https://go-review.googlesource.com/c/go/+/269997/comments/1ff70bef_c25a829a),
support for forwarding 1xx responses in ReverseProxy has been extracted
in this separate patch.
According to RFC 7231, "a proxy MUST forward 1xx responses unless the
proxy itself requested the generation of the 1xx response".
Consequently, all received 1xx responses are automatically forwarded as long as the
underlying transport supports ClientTrace.Got1xxResponse.
Fixes#26088Fixes#51914
Change-Id: I3a35ea023b798bfe56b7fb8696d5a49695229cfd
GitHub-Last-Rev: dab8a461fb
GitHub-Pull-Request: golang/go#53164
Reviewed-on: https://go-review.googlesource.com/c/go/+/409536
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Rhys Hiltner <rhys@justin.tv>
Run-TryBot: hopehook <hopehook@golangcn.org>
Noticed in a manual audit from a customer codebase that the pattern
w.WriteString(fmt.Sprint*(args...))
was less efficient and in most cases we can just invoke:
fmt.Fprint*(w, args...)
and from the simple benchmarks we can see quick wins in all dimensions:
$ benchstat before.txt after.txt
name old time/op new time/op delta
DetailString-8 5.48µs ±23% 4.40µs ±11% -19.79% (p=0.000 n=20+17)
name old alloc/op new alloc/op delta
DetailString-8 2.63kB ± 0% 2.11kB ± 0% -19.76% (p=0.000 n=20+20)
name old allocs/op new allocs/op delta
DetailString-8 63.0 ± 0% 50.0 ± 0% -20.63% (p=0.000 n=20+20)
Change-Id: I47a2827cd34d6b92644900b1bd5f4c0a3287bdb1
Reviewed-on: https://go-review.googlesource.com/c/go/+/429861
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: hopehook <hopehook@golangcn.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Remove an unnecessary 'an' from errorcodes.go.
Change-Id: Iabe8ce479077cbfff936d57c788a9b39d7e5b34e
Reviewed-on: https://go-review.googlesource.com/c/go/+/430495
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
The existing implementation allocates a new string even when the
count is 1, where we know the output is the same as the input.
While we wouldn't expect a count of 1 for hardcoded values of the
parameter, it is expected when the parameter is computed based on
a different value (e.g., the length of a input slice).
name old time/op new time/op delta
Repeat/5x0-10 2.03ns ± 0% 2.02ns ± 0% ~ (p=1.000 n=1+1)
Repeat/5x1-10 13.7ns ± 0% 2.0ns ± 0% ~ (p=1.000 n=1+1)
Repeat/5x2-10 18.2ns ± 0% 18.1ns ± 0% ~ (p=1.000 n=1+1)
Repeat/5x6-10 27.0ns ± 0% 27.0ns ± 0% ~ (p=1.000 n=1+1)
Repeat/10x0-10 2.02ns ± 0% 2.02ns ± 0% ~ (p=1.000 n=1+1)
Repeat/10x1-10 16.1ns ± 0% 2.0ns ± 0% ~ (p=1.000 n=1+1)
Repeat/10x2-10 20.8ns ± 0% 20.9ns ± 0% ~ (p=1.000 n=1+1)
Repeat/10x6-10 29.2ns ± 0% 29.4ns ± 0% ~ (p=1.000 n=1+1)
Change-Id: I48e08e08f8f6d6914d62b3d6a61d563d637bec59
GitHub-Last-Rev: 068f58e08b
GitHub-Pull-Request: golang/go#53321
Reviewed-on: https://go-review.googlesource.com/c/go/+/411477
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@google.com>
These variables never change, we don't need second copies of them.
Also rename bPlusBuild to plusBuild, since it is the only remaining
variable with a "b" prefix.
Change-Id: I97089b001d23e9b0f2096e19d9ceed7a9bbb377d
Reviewed-on: https://go-review.googlesource.com/c/go/+/429636
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
The issue referenced in work_prune.txt was fixed in CL 362754, but we
forgot to update the TODO or mark the issue as fixed in the commit
message.
Updates #48331.
Change-Id: Id2115e496aeaef275dd3c8d32c5c5564e6addb07
Reviewed-on: https://go-review.googlesource.com/c/go/+/425485
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>