Skip to content

[pull] master from golang:master#45

Merged
pull[bot] merged 23 commits into
trailofbits:masterfrom
golang:master
May 20, 2026
Merged

[pull] master from golang:master#45
pull[bot] merged 23 commits into
trailofbits:masterfrom
golang:master

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented May 20, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

rhysh and others added 23 commits May 20, 2026 05:57
While the primary purpose of gp.m.locks may be to count the number of
mutex values held by the M, several other parts of the runtime use it as
a general-purpose mechanism to disable preemption, independent of the
mutex implementation.

Adding a sample to the mutex contention profile includes acquiring a
mutex, and the easiest way to know that's safe to do is by waiting until
the M has released its final mutex. But when calls to lock/unlock are
interspersed with acquirem/releasem (or other changes to gp.m.locks),
it's hard to tell when the mutex count will reach zero.

This can cause TestRuntimeLockMetricsAndProfile to drop samples,
attributing more than necessary to _LostContendedRuntimeLock rather than
more specific call stacks. Consider the case where an M experiences
contention on sched.lock in startm and captures the call stack in its
local buffer. The call to unlock is nested within an acquirem/releasem
pair, which makes it look like it's not safe to acquire the mutex that
protects the contention profile buckets. So the M doesn't flush its
local buffer during the unlock call. Then releasem reduces gp.m.locks to
0, but doesn't include any code related to flushing the local contention
sample. Later, the same M experiences contention on another mutex. Since
it already has a sample in its buffer, it needs to choose which one to
keep (adding the other's value to _LostContendedRuntimeLock). This leads
to the profile missing known contention events (such as in #70602).

Change lock/unlock to use a larger delta. Leave gp.m.locks as an int32,
shifting the mutex count by 4 bits (steps of 16), for 2^27-1 before
overflow. Leave acquirem (and other ad-hoc gp.m.locks manipulation) with
a delta of 1, allowing 15 levels of nesting before interfering with
mutex profile sampling.

For #70602
For #79409

Change-Id: I7935d9e9f5b221001285fea1131c4d5ed31f0ce2
Reviewed-on: https://go-review.googlesource.com/c/go/+/779160
Auto-Submit: Rhys Hiltner <rhys.hiltner@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
The mutex contention profile tests have to create contention between OS
threads. Previously, the first thread to obtain the mutex under test
would busy-loop until it observed the other thread register its interest
in acquiring the mutex.

Slow builders (such as gotip-linux-arm and gotip-linux-amd64-noopt) are
timing out on this test. Have the leading thread yield to the OS when it
hasn't yet seen the contention, to give the other thread a better chance
to run.

For #70602
For #79409

Change-Id: I3f97e0739fd9cb06b939bfc7c1768ca5e027bd0c
Reviewed-on: https://go-review.googlesource.com/c/go/+/779241
Auto-Submit: Rhys Hiltner <rhys.hiltner@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Bypass: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
While not recognized by cmd/go, this helps with
bug reports around the tooling ecosystem.

Fixes #75930

Change-Id: I23018d0bb9fcb13df7060d5bf6e11abd6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/778600
Reviewed-by: qiu laidongfeng <2645477756@qq.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
p.ip is a value type and cannot ever by nil.

Change-Id: I28d54ff1f70d0965fe42cb9f02a7359efd9c9740
Reviewed-on: https://go-review.googlesource.com/c/go/+/779641
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Test TestReadUniqueDirectoryEntries requires symbolic links, which
are not supported on all platforms. Use testenv.MustHaveSymlink to
skip the test on those platforms.

Fixes #79516

Change-Id: Iea650022c985c396af6653e3391173cb17bcee20
Reviewed-on: https://go-review.googlesource.com/c/go/+/779642
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
v1 is implemented in terms of v2, and as such inherits support for
MarshalerTo. This is important to ensure that types implementing
MarshalerTo are usable by all clients, not just v2 clients.

Update the v1 Marshal docs to add MarshalerTo to the precedence rules.
I've reused the nice bulleted formatting used in v2.

For #71497.

Change-Id: Ifc0e89ce7203aa51016c1056ebaf69ac6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/775180
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Change-Id: I8a6772cbf6b347d1bd80c5978423046a63a6b743
Reviewed-on: https://go-review.googlesource.com/c/go/+/780320
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This allows us to properly generate the ops and merge/load rules for
various SIMD instructions that can use memory operands.

Fixes #78159

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-simd,gotip-linux-amd64_avx512-simd

Change-Id: Idec450c931c41bb903d4cc5b9b9ee8f610ee8796
Reviewed-on: https://go-review.googlesource.com/c/go/+/779521
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
As flagged by the modernize linter.

Change-Id: Iba6ea62d617f7e3622773c76a47655f1ad8be0e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/779661
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Update to a newer version of golang.org/x/arch, in order to bring in
changes to the riscv64 disassembler:

  go get golang.org/x/arch@master
  go mod vendor
  go mod tidy

Change-Id: I6e3ece09e72e36d50bae8341832d5b8f7e330e72
Reviewed-on: https://go-review.googlesource.com/c/go/+/778961
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Joel Sing <joel@sing.id.au>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Change floating-point parsing and printing to use fast unrounded scaling,
as presented in “Floating-Point Printing and Parsing Can Be Simple And Fast”,
https://research.swtch.com/fp

This CL deletes almost 900 lines of code while making printing much faster.
Parsing is simpler but about the same speed.

benchmark \ host                       local  linux-arm64       s7  linux-amd64  s7:GOARCH=386  linux-386
                                     vs base      vs base  vs base      vs base        vs base    vs base
Atof64Decimal                              ~       -0.47%   +1.67%       -2.70%         +1.21%     +2.70%
Atof64Float                                ~       +2.48%        ~            ~              ~          ~
Atof64FloatExp                             ~       +1.15%        ~            ~         +1.83%     +3.87%
Atof64Big                                  ~       +4.74%        ~            ~         +4.17%     +7.30%
Atof64RandomBits                     -27.95%            ~  -10.11%      -10.54%              ~          ~
Atof64RandomFloats                         ~       +0.75%        ~            ~              ~          ~
Atof64RandomLongFloats                -6.24%       -4.17%   -9.60%       -8.55%         -2.62%     -4.52%
Atof32Decimal                              ~       +3.24%   +3.76%       +3.89%              ~          ~
Atof32Float                                ~       +2.77%        ~            ~              ~          ~
Atof32FloatExp                             ~       +4.02%        ~            ~         +2.56%     +6.55%
Atof32Random                         -11.97%      -10.38%  -14.53%      -12.41%         -5.65%     -3.64%
Atof32RandomLong                     -22.77%      -22.45%  -20.00%      -26.52%        -13.36%    -13.84%
AppendFloat/Decimal                  +10.82%       +2.66%   -3.00%            ~              ~          ~
AppendFloat/Float                    -14.26%       -2.49%  -21.84%      -10.52%         -4.70%     -4.84%
AppendFloat/Exp                       +7.69%       +6.01%   -4.15%            ~         -1.04%          ~
AppendFloat/NegExp                    +8.95%       +5.75%   -4.73%            ~              ~          ~
AppendFloat/LongExp                  -33.48%      -29.01%  -31.61%      -34.75%        -23.30%    -21.21%
AppendFloat/Big                      -16.91%      -27.85%  -32.91%      -30.01%        -18.67%     -8.51%
AppendFloat/BinaryExp                -19.88%       -8.47%   -9.40%      -18.08%         -9.40%     -9.33%
AppendFloat/32Integer                +29.68%      -11.91%  -12.31%      -15.43%         +5.49%    +14.83%
AppendFloat/32ExactFraction          -14.62%       -7.34%  -14.28%      -13.78%         +6.46%    +15.68%
AppendFloat/32Point                        ~      -16.51%  -30.84%      -22.16%              ~    +11.04%
AppendFloat/32Exp                     -7.44%       -7.72%   -8.47%      -12.78%         +6.13%    +18.65%
AppendFloat/32NegExp                  -6.36%       -7.58%  -10.05%      -13.23%         +7.69%    +18.18%
AppendFloat/32Shortest               -17.45%      -18.23%  -18.03%      -19.29%         +2.68%    +11.41%
AppendFloat/32Fixed8Hard             -13.57%      -14.52%  -14.91%      -16.55%        -20.28%    -23.51%
AppendFloat/32Fixed9Hard             -16.06%      -16.69%  -11.75%      -19.42%         -5.12%          ~
AppendFloat/64Fixed1                  -3.25%       -9.70%   -8.67%      -14.11%        -13.08%    -14.23%
AppendFloat/64Fixed2                  -1.77%       -9.77%   -9.40%      -12.25%        -12.69%    -13.32%
AppendFloat/64Fixed2.5                -3.46%       -6.21%  -12.38%      -10.86%        -10.47%    -11.31%
AppendFloat/64Fixed3                       ~       -9.39%  -11.13%      -14.39%        -14.50%    -11.16%
AppendFloat/64Fixed4                       ~      -11.91%  -20.62%      -13.40%        -19.78%    -22.41%
AppendFloat/64Fixed5Hard              -6.45%       -7.36%  -13.88%      -12.42%        -12.31%    -12.92%
AppendFloat/64Fixed12                -26.39%      -23.15%  -29.45%      -28.11%        -24.63%    -27.61%
AppendFloat/64Fixed16                      ~      -15.85%  -21.24%      -19.76%        -24.24%    -26.14%
AppendFloat/64Fixed12Hard            -16.25%      -12.77%  -18.74%      -19.20%        -17.08%    -18.95%
AppendFloat/64Fixed17Hard            -16.81%       -9.80%  -12.77%      -17.19%         -2.75%     +6.06%
AppendFloat/64Fixed18Hard                  ~       -0.76%        ~            ~              ~    -26.49%
AppendFloat/64FixedF1                +16.15%      -12.93%  -18.60%      -18.24%         +1.57%          ~
AppendFloat/64FixedF2                -16.83%       -9.77%  -12.09%      -18.43%        -13.44%    -15.23%
AppendFloat/64FixedF3                      ~       -5.68%   -9.65%      -15.14%         -8.87%    -11.83%
AppendFloat/Slowpath64               -33.56%      -28.32%  -32.45%      -33.42%        -22.77%    -18.76%
AppendFloat/SlowpathDenormal64       -31.53%      -25.45%  -32.60%      -25.27%        -13.36%     -6.95%
AppendFloat/ShorterIntervalCase32    -19.52%      -14.41%  -13.89%      -17.03%              ~    +12.21%
AppendFloat/ShorterIntervalCase64    +14.00%      +14.94%   +4.06%            ~         +9.43%     +8.07%
AppendUint                           -33.66%      -13.19%  -11.52%      -13.39%        -13.68%     -9.04%
AppendUintVarlen/digits=1                  ~       -4.96%        ~            ~              ~    +13.97%
AppendUintVarlen/digits=2            +10.01%       +2.45%        ~            ~              ~    +11.23%
AppendUintVarlen/digits=3             -5.10%       +0.53%   +2.32%       +3.74%        +18.05%    +61.14%
AppendUintVarlen/digits=4                  ~      +14.32%        ~       +6.86%        +22.09%    +61.28%
AppendUintVarlen/digits=5            -18.17%       +0.62%   +1.13%            ~        +13.94%    +48.42%
AppendUintVarlen/digits=6             -8.74%       +7.58%   +2.47%       +7.86%        +17.45%    +50.58%
AppendUintVarlen/digits=7            -27.30%       -2.17%   -1.61%            ~         +8.31%    +37.41%
AppendUintVarlen/digits=8            -19.80%      +13.49%        ~            ~        +19.81%    +55.28%
AppendUintVarlen/digits=9            -28.86%       +3.29%        ~       -7.81%        +10.42%    +39.20%
AppendUintVarlen/digits=10           -33.46%       -8.00%  -12.57%      -19.07%         -8.59%     +7.48%
AppendUintVarlen/digits=11           -37.91%       -8.32%  -11.85%      -16.89%        -10.14%          ~
AppendUintVarlen/digits=12           -28.93%       -7.26%  -14.27%      -23.26%        -12.07%          ~
AppendUintVarlen/digits=13           -33.20%       -8.87%  -13.43%      -21.56%         -8.39%          ~
AppendUintVarlen/digits=14           -33.20%       -9.49%  -13.50%      -21.92%        -10.43%          ~
AppendUintVarlen/digits=15           -36.90%       -9.16%   -8.48%      -16.95%        -10.62%          ~
AppendUintVarlen/digits=16           -36.20%       -8.06%  -13.58%      -20.92%         -6.67%     +3.52%
AppendUintVarlen/digits=17           -36.15%       -7.47%  -14.12%      -21.53%         -6.00%     +3.88%
AppendUintVarlen/digits=18           -35.85%       -7.56%  -14.12%      -19.66%         -9.16%          ~
AppendUintVarlen/digits=19           -43.45%      -17.14%  -20.38%      -28.29%        -25.25%    -16.47%
AppendUintVarlen/digits=20           -40.70%      -13.60%  -18.66%      -24.18%        -24.69%    -17.33%

Change-Id: I4eed57cfbf398b5d5327efd749e13610e17153e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/743860
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Neal Patel <neal@golang.org>
Reviewed-by: Neal Patel <nealpatel@google.com>
Add the testdata binaries and the reproducers for #30250 and #30253 to
the seed corpus.

Change-Id: I12e4f48a9a4bb91f00f1703cd7b2776eb2bf2e5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/780360
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Generalize FuncSingleAssignment to FuncAssignments, tracking all
non-zero assignments to func-typed variables. When multiple
callees are known, escape analysis merges their parameter escape
behaviors via teeHole.

compilebench results (this CL vs parent):

                         │  parent.txt  │             commit.txt             │
                         │    sec/op    │    sec/op     vs base              │
Template                   150.8m ± 12%   149.6m ± 12%       ~ (p=0.589 n=6)
Unicode                    120.2m ± 11%   117.2m ±  5%       ~ (p=0.699 n=6)
GoTypes                    890.6m ±  3%   884.8m ±  2%       ~ (p=0.310 n=6)
Compiler                   161.2m ± 13%   154.4m ±  4%       ~ (p=0.180 n=6)
SSA                         7.023 ±  1%    7.021 ±  1%       ~ (p=0.485 n=6)
Flate                      162.6m ±  6%   162.0m ±  6%       ~ (p=0.699 n=6)
GoParser                   176.9m ±  7%   178.0m ±  6%       ~ (p=0.699 n=6)
Reflect                    393.2m ±  4%   389.5m ±  5%       ~ (p=0.699 n=6)
Tar                        171.5m ± 14%   172.9m ±  5%       ~ (p=0.937 n=6)
XML                        197.1m ±  6%   197.7m ±  2%       ~ (p=0.818 n=6)
LinkCompiler               650.5m ±  4%   637.0m ±  2%       ~ (p=0.394 n=6)
ExternalLinkCompiler        2.196 ±  1%    2.206 ±  1%       ~ (p=0.240 n=6)
LinkWithoutDebugCompiler   421.2m ±  6%   423.4m ±  7%       ~ (p=0.699 n=6)
StdCmd                      29.21 ±  2%    29.27 ±  1%       ~ (p=0.937 n=6)
geomean                    525.6m         522.3m        -0.63%

                         │  parent.txt  │             commit.txt             │
                         │ user-sec/op  │ user-sec/op   vs base              │
Template                   728.1m ±  5%   686.9m ± 11%       ~ (p=0.180 n=6)
Unicode                    158.9m ± 12%   160.9m ±  8%       ~ (p=0.937 n=6)
GoTypes                     4.921 ±  4%    4.919 ±  2%       ~ (p=0.937 n=6)
Compiler                   502.4m ±  9%   505.3m ± 10%       ~ (p=0.818 n=6)
SSA                         37.77 ±  2%    37.06 ±  4%       ~ (p=0.699 n=6)
Flate                      751.3m ± 11%   759.7m ±  8%       ~ (p=0.937 n=6)
GoParser                   677.4m ±  5%   674.4m ±  8%       ~ (p=0.394 n=6)
Reflect                     1.888 ±  2%    1.901 ±  3%       ~ (p=0.589 n=6)
Tar                        772.1m ± 14%   789.7m ±  5%       ~ (p=0.937 n=6)
XML                        911.8m ±  9%   916.0m ± 12%       ~ (p=0.937 n=6)
LinkCompiler                1.077 ±  4%    1.059 ±  5%       ~ (p=0.310 n=6)
ExternalLinkCompiler        2.539 ±  2%    2.531 ±  3%       ~ (p=1.000 n=6)
LinkWithoutDebugCompiler   489.7m ±  4%   485.3m ±  5%       ~ (p=1.000 n=6)
geomean                     1.192          1.187        -0.36%

          │  parent.txt  │              commit.txt              │
          │  text-bytes  │  text-bytes   vs base                │
HelloSize   1.110Mi ± 0%   1.110Mi ± 0%       ~ (p=1.000 n=6) ¹
CmdGoSize   14.14Mi ± 0%   14.14Mi ± 0%       ~ (p=1.000 n=6) ¹
geomean     3.961Mi        3.961Mi       +0.00%
¹ all samples are equal

          │  parent.txt  │              commit.txt              │
          │  data-bytes  │  data-bytes   vs base                │
HelloSize   27.54Ki ± 0%   27.54Ki ± 0%       ~ (p=1.000 n=6) ¹
CmdGoSize   431.4Ki ± 0%   431.4Ki ± 0%       ~ (p=1.000 n=6) ¹
geomean     109.0Ki        109.0Ki       +0.00%
¹ all samples are equal

          │  parent.txt  │              commit.txt              │
          │  bss-bytes   │  bss-bytes    vs base                │
HelloSize   213.9Ki ± 0%   213.9Ki ± 0%       ~ (p=1.000 n=6) ¹
CmdGoSize   32.27Mi ± 0%   32.27Mi ± 0%       ~ (p=1.000 n=6) ¹
geomean     2.597Mi        2.597Mi       +0.00%
¹ all samples are equal

          │  parent.txt  │              commit.txt              │
          │  exe-bytes   │  exe-bytes    vs base                │
HelloSize   1.782Mi ± 0%   1.782Mi ± 0%       ~ (p=1.000 n=6) ¹
CmdGoSize   21.29Mi ± 0%   21.29Mi ± 0%       ~ (p=1.000 n=6) ¹
geomean     6.158Mi        6.158Mi       +0.00%
¹ all samples are equal

Fixes #73132

Change-Id: Ice3ed672db28dbfd4bdc788019111d5d3092c5bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/771500
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
The standalone ir.FuncAssignments walked the entire enclosing
function on every call. Move it into ReassignOracle, which collects
the same information in a single walk during Init alongside the
existing singleDef analysis.

compilebench results (this CL vs parent):

                         │  parent.txt  │             commit.txt             │
                         │    sec/op    │    sec/op     vs base              │
Template                   153.1m ± 16%   149.5m ±  7%       ~ (p=0.699 n=6)
Unicode                    115.0m ± 15%   116.1m ±  8%       ~ (p=0.310 n=6)
GoTypes                    876.2m ±  2%   872.1m ±  2%       ~ (p=0.699 n=6)
Compiler                   156.4m ±  9%   158.2m ±  8%       ~ (p=0.818 n=6)
SSA                         7.044 ±  1%    7.044 ±  1%       ~ (p=0.937 n=6)
Flate                      172.5m ±  4%   165.7m ± 11%       ~ (p=0.132 n=6)
GoParser                   168.0m ±  3%   169.5m ± 13%       ~ (p=0.937 n=6)
Reflect                    394.2m ±  3%   391.3m ±  4%       ~ (p=0.937 n=6)
Tar                        167.1m ± 13%   167.9m ± 15%       ~ (p=0.589 n=6)
XML                        200.0m ±  7%   197.5m ± 15%       ~ (p=1.000 n=6)
LinkCompiler               638.3m ±  3%   631.2m ±  5%       ~ (p=0.699 n=6)
ExternalLinkCompiler        2.197 ±  2%    2.192 ±  1%       ~ (p=0.699 n=6)
LinkWithoutDebugCompiler   422.2m ±  4%   425.8m ±  3%       ~ (p=0.093 n=6)
StdCmd                      29.01 ±  2%    28.73 ±  1%       ~ (p=0.394 n=6)
geomean                    522.0m         519.4m        -0.50%

                         │  parent.txt  │             commit.txt             │
                         │ user-sec/op  │ user-sec/op   vs base              │
Template                   727.0m ± 15%   692.6m ±  8%       ~ (p=1.000 n=6)
Unicode                    159.7m ±  6%   161.9m ±  6%       ~ (p=0.589 n=6)
GoTypes                     4.884 ±  1%    4.907 ±  1%       ~ (p=0.937 n=6)
Compiler                   470.5m ±  9%   476.9m ± 11%       ~ (p=0.699 n=6)
SSA                         37.17 ±  2%    37.40 ±  2%       ~ (p=0.132 n=6)
Flate                      776.9m ±  9%   749.1m ± 16%       ~ (p=0.699 n=6)
GoParser                   688.5m ±  5%   676.7m ±  6%       ~ (p=0.937 n=6)
Reflect                     1.861 ±  2%    1.910 ±  3%       ~ (p=0.065 n=6)
Tar                        750.6m ± 11%   762.4m ± 23%       ~ (p=0.937 n=6)
XML                        947.8m ± 13%   926.4m ± 12%       ~ (p=0.485 n=6)
LinkCompiler                1.035 ±  6%    1.037 ±  5%       ~ (p=0.818 n=6)
ExternalLinkCompiler        2.505 ±  2%    2.506 ±  2%       ~ (p=0.699 n=6)
LinkWithoutDebugCompiler   479.0m ±  6%   490.4m ±  3%       ~ (p=0.394 n=6)
geomean                     1.181          1.180        -0.15%

          │  parent.txt  │              commit.txt              │
          │  text-bytes  │  text-bytes   vs base                │
HelloSize   1.110Mi ± 0%   1.110Mi ± 0%       ~ (p=1.000 n=6) ¹
CmdGoSize   14.14Mi ± 0%   14.14Mi ± 0%       ~ (p=1.000 n=6) ¹
geomean     3.961Mi        3.961Mi       +0.00%
¹ all samples are equal

          │  parent.txt  │              commit.txt              │
          │  data-bytes  │  data-bytes   vs base                │
HelloSize   27.54Ki ± 0%   27.54Ki ± 0%       ~ (p=1.000 n=6) ¹
CmdGoSize   431.4Ki ± 0%   431.4Ki ± 0%       ~ (p=1.000 n=6) ¹
geomean     109.0Ki        109.0Ki       +0.00%
¹ all samples are equal

          │  parent.txt  │              commit.txt              │
          │  bss-bytes   │  bss-bytes    vs base                │
HelloSize   213.9Ki ± 0%   213.9Ki ± 0%       ~ (p=1.000 n=6) ¹
CmdGoSize   32.27Mi ± 0%   32.27Mi ± 0%       ~ (p=1.000 n=6) ¹
geomean     2.597Mi        2.597Mi       +0.00%
¹ all samples are equal

          │  parent.txt  │              commit.txt              │
          │  exe-bytes   │  exe-bytes    vs base                │
HelloSize   1.782Mi ± 0%   1.782Mi ± 0%       ~ (p=1.000 n=6) ¹
CmdGoSize   21.29Mi ± 0%   21.29Mi ± 0%       ~ (p=1.000 n=6) ¹
geomean     6.158Mi        6.158Mi       +0.00%
¹ all samples are equal

Change-Id: Iba7c593a31946fb17450106d1ee0ba9e28eedba3
Reviewed-on: https://go-review.googlesource.com/c/go/+/771161
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
…ysis

Split out of CL 771163; this solves the TODO and saves a double-walk,
without requiring extra fixes needed to use it more broadly.

compilebench results (this CL vs parent):

                         │  parent.txt  │             commit.txt             │
                         │    sec/op    │    sec/op     vs base              │
Template                   153.9m ±  9%   157.1m ±  5%       ~ (p=0.818 n=6)
Unicode                    116.7m ±  7%   115.8m ± 10%       ~ (p=0.699 n=6)
GoTypes                    879.9m ±  3%   876.5m ±  2%       ~ (p=0.937 n=6)
Compiler                   165.3m ±  8%   160.5m ±  8%       ~ (p=0.699 n=6)
SSA                         6.998 ±  0%    7.097 ±  1%  +1.42% (p=0.002 n=6)
Flate                      166.1m ± 10%   163.3m ±  6%       ~ (p=0.310 n=6)
GoParser                   170.3m ±  6%   169.3m ±  5%       ~ (p=0.937 n=6)
Reflect                    388.3m ±  5%   390.2m ±  2%       ~ (p=0.937 n=6)
Tar                        173.7m ±  3%   173.6m ±  5%       ~ (p=0.818 n=6)
XML                        197.6m ±  9%   194.6m ±  8%       ~ (p=0.485 n=6)
LinkCompiler               651.5m ±  7%   637.9m ±  3%       ~ (p=0.394 n=6)
ExternalLinkCompiler        2.194 ±  1%    2.193 ±  2%       ~ (p=0.937 n=6)
LinkWithoutDebugCompiler   419.0m ±  6%   412.4m ±  3%       ~ (p=0.589 n=6)
StdCmd                      29.02 ±  2%    29.36 ±  4%       ~ (p=0.937 n=6)
geomean                    524.6m         522.2m        -0.47%

                         │  parent.txt  │             commit.txt             │
                         │ user-sec/op  │ user-sec/op   vs base              │
Template                   727.8m ± 12%   736.0m ±  8%       ~ (p=0.589 n=6)
Unicode                    156.5m ±  8%   162.3m ±  8%       ~ (p=0.310 n=6)
GoTypes                     4.889 ±  2%    4.898 ±  2%       ~ (p=0.937 n=6)
Compiler                   505.5m ±  6%   491.1m ±  4%       ~ (p=0.394 n=6)
SSA                         36.98 ±  1%    37.35 ±  3%       ~ (p=0.093 n=6)
Flate                      797.3m ±  8%   761.3m ± 13%       ~ (p=0.180 n=6)
GoParser                   677.9m ±  5%   695.3m ±  7%       ~ (p=0.394 n=6)
Reflect                     1.871 ±  8%    1.875 ±  2%       ~ (p=1.000 n=6)
Tar                        763.1m ± 10%   825.0m ± 15%       ~ (p=0.485 n=6)
XML                        915.9m ± 15%   877.2m ± 14%       ~ (p=0.065 n=6)
LinkCompiler                1.035 ±  5%    1.059 ±  5%       ~ (p=0.394 n=6)
ExternalLinkCompiler        2.488 ±  3%    2.509 ±  3%       ~ (p=0.485 n=6)
LinkWithoutDebugCompiler   477.8m ±  2%   478.1m ±  6%       ~ (p=0.937 n=6)
geomean                     1.185          1.192        +0.60%

          │  parent.txt  │              commit.txt              │
          │  text-bytes  │  text-bytes   vs base                │
HelloSize   1.110Mi ± 0%   1.110Mi ± 0%       ~ (p=1.000 n=6) ¹
CmdGoSize   14.14Mi ± 0%   14.14Mi ± 0%       ~ (p=1.000 n=6) ¹
geomean     3.961Mi        3.961Mi       +0.00%
¹ all samples are equal

          │  parent.txt  │              commit.txt              │
          │  data-bytes  │  data-bytes   vs base                │
HelloSize   27.54Ki ± 0%   27.54Ki ± 0%       ~ (p=1.000 n=6) ¹
CmdGoSize   431.4Ki ± 0%   431.4Ki ± 0%       ~ (p=1.000 n=6) ¹
geomean     109.0Ki        109.0Ki       +0.00%
¹ all samples are equal

          │  parent.txt  │              commit.txt              │
          │  bss-bytes   │  bss-bytes    vs base                │
HelloSize   213.9Ki ± 0%   213.9Ki ± 0%       ~ (p=1.000 n=6) ¹
CmdGoSize   32.27Mi ± 0%   32.27Mi ± 0%       ~ (p=1.000 n=6) ¹
geomean     2.597Mi        2.597Mi       +0.00%
¹ all samples are equal

          │  parent.txt  │              commit.txt              │
          │  exe-bytes   │  exe-bytes    vs base                │
HelloSize   1.782Mi ± 0%   1.782Mi ± 0%       ~ (p=1.000 n=6) ¹
CmdGoSize   21.29Mi ± 0%   21.29Mi ± 0%       ~ (p=1.000 n=6) ¹
geomean     6.158Mi        6.158Mi       +0.00%
¹ all samples are equal

Change-Id: If4d51835045e27e5f67bac901f9edd1dc4da9b97
Reviewed-on: https://go-review.googlesource.com/c/go/+/778300
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Teach ReassignOracle.StaticValue to peel OPAREN nodes, matching the
package-level ir.StaticValue helper.

This is a small parity step needed before more callers can switch from
ir.StaticValue to ReassignOracle.StaticValue.

Passes toolstash -cmp.

compilebench results (this CL vs parent):

                         │  parent.txt  │             commit.txt             │
                         │    sec/op    │    sec/op     vs base              │
Template                   154.2m ±  5%   153.6m ±  5%       ~ (p=0.485 n=6)
Unicode                    114.7m ±  2%   117.2m ±  4%       ~ (p=0.310 n=6)
GoTypes                    897.8m ±  2%   878.8m ±  5%       ~ (p=0.310 n=6)
Compiler                   160.2m ± 22%   159.0m ±  6%       ~ (p=0.310 n=6)
SSA                         7.171 ±  4%    7.136 ±  1%       ~ (p=0.485 n=6)
Flate                      171.2m ± 11%   161.8m ±  5%       ~ (p=0.065 n=6)
GoParser                   172.5m ±  6%   172.9m ± 18%       ~ (p=0.589 n=6)
Reflect                    398.9m ± 11%   391.8m ± 13%       ~ (p=0.394 n=6)
Tar                        173.2m ±  4%   168.8m ±  3%       ~ (p=0.093 n=6)
XML                        201.6m ± 23%   194.2m ±  3%       ~ (p=0.240 n=6)
LinkCompiler               639.2m ±  3%   646.7m ±  4%       ~ (p=0.937 n=6)
ExternalLinkCompiler        2.204 ±  2%    2.196 ±  2%       ~ (p=0.699 n=6)
LinkWithoutDebugCompiler   423.5m ±  4%   415.7m ± 13%       ~ (p=0.937 n=6)
StdCmd                      29.73 ±  3%    29.41 ±  2%       ~ (p=0.589 n=6)
geomean                    528.6m         522.2m        -1.22%

                         │  parent.txt  │             commit.txt             │
                         │ user-sec/op  │ user-sec/op   vs base              │
Template                   685.3m ±  8%   746.5m ± 16%       ~ (p=0.132 n=6)
Unicode                    158.6m ±  5%   156.5m ±  9%       ~ (p=0.589 n=6)
GoTypes                     5.001 ±  2%    4.900 ±  1%  -2.01% (p=0.009 n=6)
Compiler                   511.1m ±  4%   500.2m ±  9%       ~ (p=0.699 n=6)
SSA                         37.50 ±  3%    37.34 ±  1%       ~ (p=0.394 n=6)
Flate                      793.4m ± 10%   735.2m ±  8%       ~ (p=0.180 n=6)
GoParser                   698.0m ±  4%   696.3m ±  8%       ~ (p=0.818 n=6)
Reflect                     1.895 ±  5%    1.897 ±  2%       ~ (p=0.937 n=6)
Tar                        794.7m ± 13%   764.9m ± 10%       ~ (p=0.394 n=6)
XML                        936.5m ± 19%   865.7m ±  5%  -7.57% (p=0.009 n=6)
LinkCompiler                1.054 ±  7%    1.077 ±  8%       ~ (p=0.485 n=6)
ExternalLinkCompiler        2.498 ±  2%    2.515 ±  3%       ~ (p=0.937 n=6)
LinkWithoutDebugCompiler   485.8m ±  5%   482.1m ± 14%       ~ (p=1.000 n=6)
geomean                     1.197          1.184        -1.13%

          │  parent.txt  │              commit.txt              │
          │  text-bytes  │  text-bytes   vs base                │
HelloSize   1.110Mi ± 0%   1.110Mi ± 0%       ~ (p=1.000 n=6) ¹
CmdGoSize   14.14Mi ± 0%   14.14Mi ± 0%       ~ (p=1.000 n=6) ¹
geomean     3.961Mi        3.961Mi       +0.00%
¹ all samples are equal

          │  parent.txt  │              commit.txt              │
          │  data-bytes  │  data-bytes   vs base                │
HelloSize   27.49Ki ± 0%   27.49Ki ± 0%       ~ (p=1.000 n=6) ¹
CmdGoSize   431.4Ki ± 0%   431.4Ki ± 0%       ~ (p=1.000 n=6) ¹
geomean     108.9Ki        108.9Ki       +0.00%
¹ all samples are equal

          │  parent.txt  │              commit.txt              │
          │  bss-bytes   │  bss-bytes    vs base                │
HelloSize   213.9Ki ± 0%   213.9Ki ± 0%       ~ (p=1.000 n=6) ¹
CmdGoSize   32.27Mi ± 0%   32.27Mi ± 0%       ~ (p=1.000 n=6) ¹
geomean     2.597Mi        2.597Mi       +0.00%
¹ all samples are equal

          │  parent.txt  │              commit.txt              │
          │  exe-bytes   │  exe-bytes    vs base                │
HelloSize   1.777Mi ± 0%   1.777Mi ± 0%       ~ (p=1.000 n=6) ¹
CmdGoSize   21.29Mi ± 0%   21.29Mi ± 0%       ~ (p=1.000 n=6) ¹
geomean     6.150Mi        6.150Mi       +0.00%
¹ all samples are equal

Change-Id: I31c77871939a057415d2b99b051b28624f88e9d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/778800
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
In the no scan reuse path, goto the postMallocgc call in the end rather
than duplicating it. This only has an effect in the no scan slow path
function, but adds some noise to the generated files: we put
nextFree/nextFreeFast into a block so that there are no new variables we
jump over. Also the label has a goto before it so the compiler doesn't
complain if we don't use the label, and a nop statement after it so that
the call to postMallocgc doesn't appear in a labeledstatement, but is
instead in a block, where mkmalloc expects it.

goos: linux
goarch: amd64
pkg: runtime
cpu: Intel(R) Xeon(R) Platinum 8481C CPU @ 2.70GHz
                                               │   baseline   │             experiment             │
                                               │    sec/op    │   sec/op     vs base               │
Mallocgc/scan=noscan/size=1/kind=new-88           4.701n ± 0%   4.695n ± 0%  -0.14% (p=0.049 n=10)
Mallocgc/scan=noscan/size=1/kind=mallocgc-88      6.976n ± 0%   6.953n ± 0%  -0.33% (p=0.000 n=10)
Mallocgc/scan=noscan/size=2/kind=new-88           5.113n ± 0%   5.074n ± 0%  -0.75% (p=0.000 n=10)
Mallocgc/scan=noscan/size=2/kind=mallocgc-88      6.646n ± 0%   6.611n ± 0%  -0.54% (p=0.000 n=10)
Mallocgc/scan=noscan/size=3/kind=new-88           6.304n ± 8%   6.271n ± 1%  -0.53% (p=0.000 n=10)
Mallocgc/scan=noscan/size=3/kind=mallocgc-88      7.528n ± 0%   7.479n ± 0%  -0.65% (p=0.000 n=10)
Mallocgc/scan=noscan/size=4/kind=new-88           6.556n ± 0%   6.496n ± 0%  -0.92% (p=0.000 n=10)
Mallocgc/scan=noscan/size=4/kind=mallocgc-88      7.901n ± 0%   7.841n ± 0%  -0.76% (p=0.000 n=10)
Mallocgc/scan=noscan/size=5/kind=new-88           7.778n ± 1%   7.707n ± 1%  -0.92% (p=0.008 n=10)
Mallocgc/scan=noscan/size=5/kind=mallocgc-88      9.588n ± 2%   9.046n ± 0%  -5.65% (p=0.000 n=10)
Mallocgc/scan=noscan/size=6/kind=new-88           9.366n ± 0%   9.280n ± 0%  -0.91% (p=0.000 n=10)
Mallocgc/scan=noscan/size=6/kind=mallocgc-88      10.80n ± 0%   10.70n ± 0%  -0.97% (p=0.000 n=10)
Mallocgc/scan=noscan/size=7/kind=new-88           9.737n ± 0%   9.642n ± 0%  -0.98% (p=0.000 n=10)
Mallocgc/scan=noscan/size=7/kind=mallocgc-88      11.01n ± 0%   10.92n ± 0%  -0.82% (p=0.000 n=10)
Mallocgc/scan=noscan/size=8/kind=new-88           9.149n ± 0%   9.081n ± 0%  -0.74% (p=0.000 n=10)
Mallocgc/scan=noscan/size=8/kind=mallocgc-88      10.51n ± 0%   10.45n ± 1%  -0.57% (p=0.000 n=10)
Mallocgc/scan=noscan/size=9/kind=new-88           15.12n ± 1%   14.38n ± 1%  -4.89% (p=0.000 n=10)
Mallocgc/scan=noscan/size=9/kind=mallocgc-88      16.14n ± 4%   15.90n ± 0%  -1.52% (p=0.000 n=10)
Mallocgc/scan=noscan/size=10/kind=new-88          14.34n ± 1%   14.13n ± 1%  -1.46% (p=0.000 n=10)
Mallocgc/scan=noscan/size=10/kind=mallocgc-88     15.56n ± 1%   15.38n ± 0%  -1.16% (p=0.000 n=10)
Mallocgc/scan=noscan/size=11/kind=new-88          14.53n ± 0%   14.29n ± 0%  -1.62% (p=0.000 n=10)
Mallocgc/scan=noscan/size=11/kind=mallocgc-88     15.97n ± 0%   15.84n ± 0%  -0.81% (p=0.000 n=10)
Mallocgc/scan=noscan/size=12/kind=new-88          14.31n ± 1%   14.05n ± 1%  -1.82% (p=0.000 n=10)
Mallocgc/scan=noscan/size=12/kind=mallocgc-88     15.55n ± 0%   15.32n ± 0%  -1.51% (p=0.000 n=10)
Mallocgc/scan=noscan/size=13/kind=new-88          14.59n ± 0%   14.33n ± 0%  -1.78% (p=0.000 n=10)
Mallocgc/scan=noscan/size=13/kind=mallocgc-88     16.09n ± 0%   15.80n ± 1%  -1.83% (p=0.000 n=10)
Mallocgc/scan=noscan/size=14/kind=new-88          14.59n ± 0%   14.11n ± 1%  -3.26% (p=0.000 n=10)
Mallocgc/scan=noscan/size=14/kind=mallocgc-88     15.74n ± 1%   15.30n ± 1%  -2.86% (p=0.000 n=10)
Mallocgc/scan=noscan/size=15/kind=new-88          14.59n ± 1%   14.44n ± 1%  -0.99% (p=0.000 n=10)
Mallocgc/scan=noscan/size=15/kind=mallocgc-88     16.03n ± 1%   15.85n ± 0%  -1.12% (p=0.000 n=10)
Mallocgc/scan=noscan/size=16/kind=new-88          13.35n ± 0%   13.15n ± 0%  -1.50% (p=0.000 n=10)
Mallocgc/scan=noscan/size=16/kind=mallocgc-88     14.52n ± 0%   14.28n ± 0%  -1.62% (p=0.000 n=10)
Mallocgc/scan=noscan/size=24/kind=new-88          16.06n ± 0%   15.86n ± 1%  -1.25% (p=0.000 n=10)
Mallocgc/scan=noscan/size=24/kind=mallocgc-88     17.36n ± 1%   17.11n ± 1%  -1.41% (p=0.000 n=10)
Mallocgc/scan=noscan/size=32/kind=new-88          18.87n ± 1%   18.38n ± 1%  -2.60% (p=0.000 n=10)
Mallocgc/scan=noscan/size=32/kind=mallocgc-88     20.04n ± 0%   19.76n ± 1%  -1.40% (p=0.000 n=10)
Mallocgc/scan=noscan/size=48/kind=new-88          24.79n ± 1%   24.33n ± 1%  -1.86% (p=0.000 n=10)
Mallocgc/scan=noscan/size=48/kind=mallocgc-88     25.49n ± 1%   25.07n ± 1%  -1.61% (p=0.000 n=10)
Mallocgc/scan=noscan/size=64/kind=new-88          31.02n ± 1%   30.30n ± 1%  -2.34% (p=0.000 n=10)
Mallocgc/scan=noscan/size=64/kind=mallocgc-88     31.75n ± 1%   31.09n ± 1%  -2.09% (p=0.000 n=10)
Mallocgc/scan=noscan/size=80/kind=new-88          37.26n ± 1%   36.43n ± 0%  -2.23% (p=0.000 n=10)
Mallocgc/scan=noscan/size=80/kind=mallocgc-88     37.57n ± 1%   36.49n ± 1%  -2.87% (p=0.000 n=10)
Mallocgc/scan=noscan/size=96/kind=new-88          43.11n ± 1%   42.17n ± 1%  -2.18% (p=0.000 n=10)
Mallocgc/scan=noscan/size=96/kind=mallocgc-88     44.12n ± 1%   42.95n ± 1%  -2.65% (p=0.000 n=10)
Mallocgc/scan=noscan/size=112/kind=new-88         50.54n ± 1%   48.53n ± 1%  -3.99% (p=0.000 n=10)
Mallocgc/scan=noscan/size=112/kind=mallocgc-88    50.53n ± 2%   48.51n ± 1%  -4.01% (p=0.000 n=10)
Mallocgc/scan=noscan/size=128/kind=new-88         56.10n ± 1%   54.55n ± 1%  -2.76% (p=0.000 n=10)
Mallocgc/scan=noscan/size=128/kind=mallocgc-88    56.66n ± 1%   54.72n ± 1%  -3.42% (p=0.000 n=10)
Mallocgc/scan=noscan/size=144/kind=new-88         64.96n ± 1%   63.57n ± 1%  -2.15% (p=0.000 n=10)
Mallocgc/scan=noscan/size=144/kind=mallocgc-88    64.61n ± 1%   63.43n ± 1%  -1.83% (p=0.000 n=10)
Mallocgc/scan=noscan/size=160/kind=new-88         71.78n ± 1%   70.39n ± 1%  -1.94% (p=0.000 n=10)
Mallocgc/scan=noscan/size=160/kind=mallocgc-88    71.64n ± 1%   69.60n ± 1%  -2.85% (p=0.000 n=10)
Mallocgc/scan=noscan/size=176/kind=new-88         79.03n ± 1%   77.52n ± 1%  -1.92% (p=0.000 n=10)
Mallocgc/scan=noscan/size=176/kind=mallocgc-88    78.59n ± 1%   77.16n ± 1%  -1.83% (p=0.000 n=10)
Mallocgc/scan=noscan/size=192/kind=new-88         83.71n ± 1%   82.55n ± 1%  -1.39% (p=0.005 n=10)
Mallocgc/scan=noscan/size=192/kind=mallocgc-88    83.21n ± 1%   82.48n ± 1%  -0.88% (p=0.002 n=10)
Mallocgc/scan=noscan/size=208/kind=new-88         92.03n ± 1%   90.84n ± 1%  -1.29% (p=0.002 n=10)
Mallocgc/scan=noscan/size=208/kind=mallocgc-88    91.67n ± 1%   90.78n ± 2%  -0.97% (p=0.015 n=10)
Mallocgc/scan=noscan/size=224/kind=new-88         96.05n ± 1%   96.22n ± 1%       ~ (p=0.529 n=10)
Mallocgc/scan=noscan/size=224/kind=mallocgc-88    96.02n ± 1%   94.05n ± 2%  -2.05% (p=0.001 n=10)
Mallocgc/scan=noscan/size=240/kind=new-88         103.9n ± 1%   102.9n ± 2%       ~ (p=0.060 n=10)
Mallocgc/scan=noscan/size=240/kind=mallocgc-88    104.0n ± 0%   102.9n ± 1%  -1.15% (p=0.000 n=10)
Mallocgc/scan=noscan/size=256/kind=new-88         111.2n ± 1%   109.0n ± 1%  -1.98% (p=0.000 n=10)
Mallocgc/scan=noscan/size=256/kind=mallocgc-88    110.2n ± 1%   109.1n ± 1%  -1.00% (p=0.002 n=10)
Mallocgc/scan=noscan/size=288/kind=new-88         122.2n ± 1%   120.7n ± 2%  -1.19% (p=0.000 n=10)
Mallocgc/scan=noscan/size=288/kind=mallocgc-88    121.0n ± 1%   119.4n ± 1%  -1.40% (p=0.001 n=10)
Mallocgc/scan=noscan/size=320/kind=new-88         135.2n ± 1%   132.8n ± 1%  -1.74% (p=0.000 n=10)
Mallocgc/scan=noscan/size=320/kind=mallocgc-88    133.8n ± 1%   132.9n ± 1%  -0.64% (p=0.011 n=10)
Mallocgc/scan=noscan/size=352/kind=new-88         151.9n ± 1%   151.1n ± 1%  -0.56% (p=0.008 n=10)
Mallocgc/scan=noscan/size=352/kind=mallocgc-88    151.1n ± 1%   151.3n ± 1%       ~ (p=0.424 n=10)
Mallocgc/scan=noscan/size=384/kind=new-88         159.4n ± 1%   157.5n ± 1%  -1.22% (p=0.000 n=10)
Mallocgc/scan=noscan/size=384/kind=mallocgc-88    158.3n ± 1%   157.8n ± 2%       ~ (p=0.148 n=10)
Mallocgc/scan=noscan/size=416/kind=new-88         174.0n ± 1%   172.2n ± 2%       ~ (p=0.305 n=10)
Mallocgc/scan=noscan/size=416/kind=mallocgc-88    174.7n ± 1%   173.3n ± 1%  -0.80% (p=0.022 n=10)
Mallocgc/scan=noscan/size=448/kind=new-88         183.0n ± 1%   182.3n ± 1%       ~ (p=0.110 n=10)
Mallocgc/scan=noscan/size=448/kind=mallocgc-88    182.7n ± 1%   180.4n ± 1%  -1.23% (p=0.007 n=10)
Mallocgc/scan=noscan/size=480/kind=new-88         205.5n ± 1%   204.6n ± 1%       ~ (p=0.101 n=10)
Mallocgc/scan=noscan/size=480/kind=mallocgc-88    204.4n ± 1%   205.0n ± 1%       ~ (p=0.077 n=10)
Mallocgc/scan=noscan/size=512/kind=new-88         218.4n ± 1%   217.6n ± 1%       ~ (p=0.643 n=10)
Mallocgc/scan=noscan/size=512/kind=mallocgc-88    217.6n ± 1%   215.5n ± 1%  -0.97% (p=0.004 n=10)
Mallocgc/scan=scan/size=8/kind=new-88             10.93n ± 0%   10.88n ± 0%  -0.41% (p=0.006 n=10)
Mallocgc/scan=scan/size=8/kind=mallocgc-88        11.94n ± 0%   11.85n ± 0%  -0.75% (p=0.000 n=10)
Mallocgc/scan=scan/size=16/kind=new-88            14.81n ± 1%   15.03n ± 1%  +1.49% (p=0.000 n=10)
Mallocgc/scan=scan/size=16/kind=mallocgc-88       16.12n ± 0%   16.05n ± 1%  -0.37% (p=0.003 n=10)
Mallocgc/scan=scan/size=24/kind=new-88            18.23n ± 1%   18.23n ± 1%       ~ (p=0.954 n=10)
Mallocgc/scan=scan/size=24/kind=mallocgc-88       19.46n ± 0%   19.30n ± 1%  -0.80% (p=0.014 n=10)
Mallocgc/scan=scan/size=32/kind=new-88            20.48n ± 0%   20.22n ± 0%  -1.25% (p=0.000 n=10)
Mallocgc/scan=scan/size=32/kind=mallocgc-88       21.72n ± 1%   21.47n ± 1%  -1.13% (p=0.000 n=10)
Mallocgc/scan=scan/size=48/kind=new-88            26.56n ± 1%   26.03n ± 0%  -2.01% (p=0.000 n=10)
Mallocgc/scan=scan/size=48/kind=mallocgc-88       27.96n ± 1%   27.61n ± 1%  -1.25% (p=0.000 n=10)
Mallocgc/scan=scan/size=64/kind=new-88            31.95n ± 1%   31.37n ± 1%  -1.83% (p=0.001 n=10)
Mallocgc/scan=scan/size=64/kind=mallocgc-88       32.48n ± 2%   32.16n ± 1%  -1.00% (p=0.005 n=10)
Mallocgc/scan=scan/size=80/kind=new-88            39.54n ± 2%   38.49n ± 1%  -2.64% (p=0.000 n=10)
Mallocgc/scan=scan/size=80/kind=mallocgc-88       40.04n ± 2%   39.25n ± 1%  -1.99% (p=0.000 n=10)
Mallocgc/scan=scan/size=96/kind=new-88            44.99n ± 1%   44.51n ± 1%  -1.07% (p=0.025 n=10)
Mallocgc/scan=scan/size=96/kind=mallocgc-88       45.75n ± 1%   45.28n ± 2%  -1.05% (p=0.003 n=10)
Mallocgc/scan=scan/size=112/kind=new-88           52.31n ± 2%   50.68n ± 1%  -3.12% (p=0.000 n=10)
Mallocgc/scan=scan/size=112/kind=mallocgc-88      51.62n ± 1%   50.62n ± 1%  -1.93% (p=0.000 n=10)
Mallocgc/scan=scan/size=128/kind=new-88           56.66n ± 1%   56.33n ± 1%       ~ (p=0.052 n=10)
Mallocgc/scan=scan/size=128/kind=mallocgc-88      57.20n ± 1%   56.30n ± 1%  -1.57% (p=0.000 n=10)
Mallocgc/scan=scan/size=144/kind=new-88           68.48n ± 2%   67.41n ± 2%  -1.57% (p=0.003 n=10)
Mallocgc/scan=scan/size=144/kind=mallocgc-88      67.55n ± 1%   66.06n ± 1%  -2.21% (p=0.000 n=10)
Mallocgc/scan=scan/size=160/kind=new-88           75.42n ± 1%   73.86n ± 2%  -2.07% (p=0.000 n=10)
Mallocgc/scan=scan/size=160/kind=mallocgc-88      74.39n ± 1%   73.36n ± 1%  -1.38% (p=0.003 n=10)
Mallocgc/scan=scan/size=176/kind=new-88           80.22n ± 1%   79.15n ± 1%  -1.34% (p=0.008 n=10)
Mallocgc/scan=scan/size=176/kind=mallocgc-88      79.47n ± 1%   79.03n ± 2%       ~ (p=0.110 n=10)
Mallocgc/scan=scan/size=192/kind=new-88           86.95n ± 1%   85.90n ± 1%  -1.21% (p=0.034 n=10)
Mallocgc/scan=scan/size=192/kind=mallocgc-88      85.85n ± 1%   85.34n ± 1%  -0.59% (p=0.004 n=10)
Mallocgc/scan=scan/size=208/kind=new-88           92.53n ± 1%   92.22n ± 1%       ~ (p=0.105 n=10)
Mallocgc/scan=scan/size=208/kind=mallocgc-88      92.27n ± 1%   92.41n ± 2%       ~ (p=0.912 n=10)
Mallocgc/scan=scan/size=224/kind=new-88           101.0n ± 1%   102.4n ± 1%  +1.34% (p=0.006 n=10)
Mallocgc/scan=scan/size=224/kind=mallocgc-88      99.61n ± 1%   99.37n ± 1%       ~ (p=0.393 n=10)
Mallocgc/scan=scan/size=240/kind=new-88           104.7n ± 1%   105.5n ± 1%       ~ (p=0.100 n=10)
Mallocgc/scan=scan/size=240/kind=mallocgc-88      104.4n ± 1%   105.0n ± 1%       ~ (p=0.403 n=10)
Mallocgc/scan=scan/size=256/kind=new-88           110.2n ± 1%   110.6n ± 1%       ~ (p=0.362 n=10)
Mallocgc/scan=scan/size=256/kind=mallocgc-88      110.2n ± 1%   110.5n ± 1%       ~ (p=0.592 n=10)
Mallocgc/scan=scan/size=288/kind=new-88           127.4n ± 2%   127.0n ± 1%       ~ (p=0.492 n=10)
Mallocgc/scan=scan/size=288/kind=mallocgc-88      126.4n ± 1%   126.3n ± 1%       ~ (p=0.755 n=10)
Mallocgc/scan=scan/size=320/kind=new-88           140.4n ± 1%   139.8n ± 1%       ~ (p=0.361 n=10)
Mallocgc/scan=scan/size=320/kind=mallocgc-88      141.1n ± 1%   140.9n ± 1%       ~ (p=0.927 n=10)
Mallocgc/scan=scan/size=352/kind=new-88           152.6n ± 1%   152.6n ± 1%       ~ (p=0.927 n=10)
Mallocgc/scan=scan/size=352/kind=mallocgc-88      152.9n ± 1%   151.8n ± 1%       ~ (p=0.066 n=10)
Mallocgc/scan=scan/size=384/kind=new-88           168.2n ± 1%   165.6n ± 1%  -1.58% (p=0.002 n=10)
Mallocgc/scan=scan/size=384/kind=mallocgc-88      166.8n ± 1%   165.3n ± 1%  -0.93% (p=0.018 n=10)
Mallocgc/scan=scan/size=416/kind=new-88           174.6n ± 1%   173.8n ± 1%       ~ (p=0.101 n=10)
Mallocgc/scan=scan/size=416/kind=mallocgc-88      174.4n ± 1%   173.7n ± 1%       ~ (p=0.424 n=10)
Mallocgc/scan=scan/size=448/kind=new-88           194.5n ± 1%   195.7n ± 1%  +0.59% (p=0.012 n=10)
Mallocgc/scan=scan/size=448/kind=mallocgc-88      194.0n ± 1%   194.6n ± 1%       ~ (p=0.286 n=10)
Mallocgc/scan=scan/size=480/kind=new-88           204.3n ± 1%   204.0n ± 1%       ~ (p=0.810 n=10)
Mallocgc/scan=scan/size=480/kind=mallocgc-88      204.1n ± 1%   203.8n ± 0%       ~ (p=0.616 n=10)
Mallocgc/scan=scan/size=512/kind=new-88           217.8n ± 1%   217.0n ± 1%       ~ (p=0.210 n=10)
Mallocgc/scan=scan/size=512/kind=mallocgc-88      218.7n ± 1%   215.4n ± 1%  -1.51% (p=0.000 n=10)
Mallocgc/scan=scanslice/size=8-88                 13.33n ± 0%   13.20n ± 0%  -0.98% (p=0.000 n=10)
Mallocgc/scan=scanslice/size=16-88                22.67n ± 0%   22.55n ± 0%  -0.53% (p=0.000 n=10)
Mallocgc/scan=scanslice/size=24-88                25.52n ± 0%   25.37n ± 0%  -0.61% (p=0.000 n=10)
Mallocgc/scan=scanslice/size=32-88                27.77n ± 0%   27.83n ± 1%       ~ (p=0.382 n=10)
Mallocgc/scan=scanslice/size=48-88                33.97n ± 0%   33.80n ± 1%       ~ (p=0.085 n=10)
Mallocgc/scan=scanslice/size=64-88                38.23n ± 1%   37.95n ± 1%  -0.73% (p=0.050 n=10)
Mallocgc/scan=scanslice/size=80-88                45.38n ± 0%   45.17n ± 1%  -0.47% (p=0.004 n=10)
Mallocgc/scan=scanslice/size=96-88                50.79n ± 0%   50.56n ± 0%       ~ (p=0.063 n=10)
Mallocgc/scan=scanslice/size=112-88               55.70n ± 1%   55.92n ± 1%       ~ (p=0.424 n=10)
Mallocgc/scan=scanslice/size=128-88               60.19n ± 1%   59.73n ± 1%       ~ (p=0.060 n=10)
Mallocgc/scan=scanslice/size=144-88               69.30n ± 1%   67.95n ± 1%  -1.94% (p=0.000 n=10)
Mallocgc/scan=scanslice/size=160-88               74.91n ± 1%   74.58n ± 1%       ~ (p=0.052 n=10)
Mallocgc/scan=scanslice/size=176-88               80.61n ± 1%   79.55n ± 1%  -1.31% (p=0.004 n=10)
Mallocgc/scan=scanslice/size=192-88               87.58n ± 1%   86.90n ± 1%       ~ (p=0.105 n=10)
Mallocgc/scan=scanslice/size=208-88               93.00n ± 1%   92.48n ± 1%  -0.55% (p=0.022 n=10)
Mallocgc/scan=scanslice/size=224-88              101.15n ± 1%   99.08n ± 1%  -2.05% (p=0.001 n=10)
Mallocgc/scan=scanslice/size=240-88               105.3n ± 1%   104.0n ± 1%  -1.19% (p=0.002 n=10)
Mallocgc/scan=scanslice/size=256-88               110.2n ± 1%   110.2n ± 1%       ~ (p=0.810 n=10)
Mallocgc/scan=scanslice/size=288-88               127.4n ± 1%   127.0n ± 1%       ~ (p=0.446 n=10)
Mallocgc/scan=scanslice/size=320-88               142.6n ± 2%   141.2n ± 2%       ~ (p=0.072 n=10)
Mallocgc/scan=scanslice/size=352-88               153.8n ± 1%   152.3n ± 1%  -0.98% (p=0.005 n=10)
Mallocgc/scan=scanslice/size=384-88               168.0n ± 1%   166.4n ± 1%       ~ (p=0.060 n=10)
Mallocgc/scan=scanslice/size=416-88               175.1n ± 2%   174.3n ± 1%       ~ (p=0.127 n=10)
Mallocgc/scan=scanslice/size=448-88               196.5n ± 1%   196.4n ± 1%       ~ (p=0.754 n=10)
Mallocgc/scan=scanslice/size=480-88               204.0n ± 2%   204.3n ± 1%       ~ (p=0.446 n=10)
Mallocgc/scan=scanslice/size=512-88               218.2n ± 1%   217.4n ± 1%       ~ (p=0.423 n=10)
geomean                                           50.01n        49.45n       -1.11%

For #79286

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64_c2s16-perf_vs_parent,gotip-linux-amd64_c3h88-perf_vs_parent,gotip-linux-arm64_c4ah72-perf_vs_parent,gotip-linux-arm64_c4as16-perf_vs_parent
Change-Id: Ie5fe8007733ae94556792146d1cd7c666a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/779220
Reviewed-by: Michael Matloob <matloob@google.com>
TryBot-Bypass: Michael Matloob <matloob@google.com>
Commit-Queue: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Profile.Write defers gzip.Writer.Close without checking its return
value. Close flushes buffered data and writes the gzip footer (CRC32
checksum and size). If the flush or footer write fails, the caller
receives a nil error despite the output being truncated or corrupt.

This is called by runtime/pprof and net/http/pprof to serialize
profiles. A write error during gzip finalization (e.g., broken pipe,
full disk) produces corrupt output reported as success.

Remove the defer and call Close explicitly after Write, returning
its error. On Write failure, Close is still called to release
resources, but the Write error is returned.

Fixes #79423

Change-Id: I1d93c20158010f45c72d57caf5d5b25b72ca7511
GitHub-Last-Rev: cd79f2a
GitHub-Pull-Request: #79424
Reviewed-on: https://go-review.googlesource.com/c/go/+/778280
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
The 0xffff directorySize was a typo, and File.zip64 was unused.

The ErrFormat was intentional, but it's actually possible to have a
valid zip file with compressed size 2³²-1, for example by storing
uncompressed a file of size 2³²-1 using Info-ZIP. The following CL
introduces a couple such files (infozip-store-4g-minus-1 and
infozip-offset-eq-4g).

Fixes #31692
Fixes #56249
Updates #14185
Updates #13367
Updates #13166

Change-Id: I503805cace50316a665633d43dcc7fa46a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/779180
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Change-Id: I98c8eb513131942c885457912a2101316a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/768460
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Print only the removals that would actually happen,
and print them for all removals.

Fixes #33573

Change-Id: Ic73e5e73329dd5dcc111696e9732e7e36a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/768461
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
…rce directory

The behaviour of the compiler and go/scanner is unified:
Relative //line directives are now relative to the directory of
the scanned file.

Fixes #70478

Change-Id: I804edbb5f9540d386e0fb1a4e64b10b717125d1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/706795
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
I ran into this because the broken Writer caused mysterious and very
hard to debug failures uploading archive/zip-generated files to the
Internet Archive. (Only zip files bigger than 4GiB *and* smaller than
around 6.5GiB failed. I still don't have an explanation for the latter
part, maybe the parser has different logic for when the count of records
crosses 65535 and the Zip64 EOCD is used.)

Reproducing testdata/zip64/*.zsparse:

Inputs (sparse zero files via `truncate -s N NAME`, sizes in bytes):
  big5g.bin     5<<30                   big4g.bin     4<<30
  big4g-1.bin   (4<<30) - 1             big4g-2.bin   (4<<30) - 2
  under4g.bin   (4<<30) - 59            first         (4<<30) - 36
  small.bin     42  (use `dd` for the non-sparse 42-byte file)

Cases (case → entries, M=0 Store, M=9 Deflate):
  store-5g             big5g.bin/0
  deflate-zeros-5g     big5g.bin/9
  store-4g-minus-1     big4g-1.bin/0
  store-4g-minus-2     big4g-2.bin/0
  store-just-under-4g  under4g.bin/0
  store-exact-4g       big4g.bin/0
  offset-past-4g       big5g.bin/0, small.bin/0
  offset-eq-4g         first/0,     small.bin/0

Producers:
  infozip-*    Info-ZIP 3.0:
                 zip -q -X -M OUT.zip <entries>
  libarchive-* bsdtar (libarchive):
                 bsdtar -cf OUT.zip --format zip \
                   --options zip:compression={store|deflate} <entries>
  go126-*      archive/zip from Go 1.26. Build with GOTOOLCHAIN=go1.26.0
                 from a tempdir whose go.mod declares `go 1.26.0`.
                 For each entry:
                 zip.FileHeader{Name, Method: zip.Store|zip.Deflate},
                 CreateHeader, io.CopyN(fw, zeros, size), w.Close().

Convert each OUT.zip to ${producer}-${case}.zsparse using the format
defined in archive/zip/zip64_sparse_test.go (scanSparse / readSparse):
walk the zip in 4 KiB chunks, drop chunks that are entirely zero,
coalesce adjacent non-zero chunks into spans, and serialize the result
as gzip of:

  uint64 LE  totalSize
  uint32 LE  numSpans
  numSpans times:
    uint64 LE  offset
    uint32 LE  dataLen
    dataLen bytes

Updates #22520
Fixes #23572
Fixes #33116
Fixes #69415

Change-Id: I6e24e7170094346af494da153c63e6b56a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/725161
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
SLSA-Policy-Verified: SLSA Policy Verification Service <devtools-gerritcodereview-exitgate@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
@pull pull Bot locked and limited conversation to collaborators May 20, 2026
@pull pull Bot added the ⤵️ pull label May 20, 2026
@pull pull Bot merged commit 51a2fe1 into trailofbits:master May 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.