Skip to content

Commit c36b532

Browse files
methanekatiehockman
authored andcommitted
[release-branch.go1.11] runtime: skip stack barrier copy when there are no pointers
After CL 31455, "go fun(n)" may put "n" to write barrier buffer when there are no pointers in fun's arguments. Updates #29565 Change-Id: Icfa42b8759ce8ad9267dcb3859c626feb6fda381 Reviewed-on: https://go-review.googlesource.com/c/155779 Reviewed-by: Keith Randall <khr@golang.org> (cherry picked from commit 5372257) Reviewed-on: https://go-review.googlesource.com/c/156357 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
1 parent b2c472f commit c36b532

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/runtime/proc.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3371,9 +3371,11 @@ func newproc1(fn *funcval, argp *uint8, narg int32, callergp *g, callerpc uintpt
33713371
if writeBarrier.needed && !_g_.m.curg.gcscandone {
33723372
f := findfunc(fn.fn)
33733373
stkmap := (*stackmap)(funcdata(f, _FUNCDATA_ArgsPointerMaps))
3374-
// We're in the prologue, so it's always stack map index 0.
3375-
bv := stackmapdata(stkmap, 0)
3376-
bulkBarrierBitmap(spArg, spArg, uintptr(narg), 0, bv.bytedata)
3374+
if stkmap.nbit > 0 {
3375+
// We're in the prologue, so it's always stack map index 0.
3376+
bv := stackmapdata(stkmap, 0)
3377+
bulkBarrierBitmap(spArg, spArg, uintptr(narg), 0, bv.bytedata)
3378+
}
33773379
}
33783380
}
33793381

0 commit comments

Comments
 (0)