diff options
| author | Keith Randall <khr@golang.org> | 2026-03-17 13:28:51 -0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2026-03-17 14:02:21 -0700 |
| commit | adf9c27874d8b59b9632a23d9148db4faef36d98 (patch) | |
| tree | 26c3d52645a35df6813c7fc2cb95f74e00f0c8f1 /src/cmd | |
| parent | cd2fa3b48dc059203aa724474e19096928b3f71f (diff) | |
| download | go-adf9c27874d8b59b9632a23d9148db4faef36d98.tar.xz | |
cmd/compile: don't call memclrNoHeapPointersPreemptible from nosplit functions
That function will allow preemption, which could subsequently allow
for a stack copy (from shrinking). We can't let that happen inside
a nosplit function.
Update #78081
Change-Id: I12e77b50bbdcdd1e08e505a863b13cd9e1f814ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/756123
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd')
| -rw-r--r-- | src/cmd/compile/internal/walk/assign.go | 2 | ||||
| -rw-r--r-- | src/cmd/compile/internal/walk/range.go | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/walk/assign.go b/src/cmd/compile/internal/walk/assign.go index fe51a19cfc..a2a652e9d8 100644 --- a/src/cmd/compile/internal/walk/assign.go +++ b/src/cmd/compile/internal/walk/assign.go @@ -723,6 +723,8 @@ func extendSlice(n *ir.CallExpr, init *ir.Nodes) ir.Node { if hasPointers { clrname = "memclrHasPointers" ir.CurFunc.SetWBPos(n.Pos()) + } else if ir.CurFunc.Pragma&ir.Nosplit != 0 { + clrname = "memclrNoHeapPointers" } var clr ir.Nodes diff --git a/src/cmd/compile/internal/walk/range.go b/src/cmd/compile/internal/walk/range.go index 10546f0849..b8e7a2c9eb 100644 --- a/src/cmd/compile/internal/walk/range.go +++ b/src/cmd/compile/internal/walk/range.go @@ -588,6 +588,8 @@ func arrayClear(wbPos src.XPos, a ir.Node, nrange *ir.RangeStmt) ir.Node { // memclrHasPointers(hp, hn) ir.CurFunc.SetWBPos(wbPos) fn = mkcallstmt("memclrHasPointers", hp, hn) + } else if ir.CurFunc.Pragma&ir.Nosplit != 0 { + fn = mkcallstmt("memclrNoHeapPointers", hp, hn) } else { // memclrNoHeapPointersPreemptible(hp, hn) fn = mkcallstmt("memclrNoHeapPointersPreemptible", hp, hn) |
