Skip to content

Commit 5372257

Browse files
methanerandall77
authored andcommitted
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. Fixes #29362 Change-Id: Icfa42b8759ce8ad9267dcb3859c626feb6fda381 Reviewed-on: https://go-review.googlesource.com/c/155779 Reviewed-by: Keith Randall <[email protected]>
1 parent 30c0a0d commit 5372257

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
@@ -3303,9 +3303,11 @@ func newproc1(fn *funcval, argp *uint8, narg int32, callergp *g, callerpc uintpt
33033303
if writeBarrier.needed && !_g_.m.curg.gcscandone {
33043304
f := findfunc(fn.fn)
33053305
stkmap := (*stackmap)(funcdata(f, _FUNCDATA_ArgsPointerMaps))
3306-
// We're in the prologue, so it's always stack map index 0.
3307-
bv := stackmapdata(stkmap, 0)
3308-
bulkBarrierBitmap(spArg, spArg, uintptr(narg), 0, bv.bytedata)
3306+
if stkmap.nbit > 0 {
3307+
// We're in the prologue, so it's always stack map index 0.
3308+
bv := stackmapdata(stkmap, 0)
3309+
bulkBarrierBitmap(spArg, spArg, uintptr(narg), 0, bv.bytedata)
3310+
}
33093311
}
33103312
}
33113313

0 commit comments

Comments
 (0)