diff options
author | Inada Naoki <songofacandy@gmail.com> | 2018-12-27 00:47:20 +0900 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2019-01-03 18:48:52 +0000 |
commit | 5372257e600989ab4cf742b35e3fa649cad3f45c (patch) | |
tree | e8720c97da3e1e5f80e0e8d9853217f0a7d35013 | |
parent | 30c0a0d33faee0355db2cb91e8599d6fd85fae76 (diff) | |
download | go-5372257e600989ab4cf742b35e3fa649cad3f45c.tar.gz go-5372257e600989ab4cf742b35e3fa649cad3f45c.zip |
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 <khr@golang.org>
-rw-r--r-- | src/runtime/proc.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/runtime/proc.go b/src/runtime/proc.go index bdf73e0412..f2e7f707ed 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -3303,9 +3303,11 @@ func newproc1(fn *funcval, argp *uint8, narg int32, callergp *g, callerpc uintpt if writeBarrier.needed && !_g_.m.curg.gcscandone { f := findfunc(fn.fn) stkmap := (*stackmap)(funcdata(f, _FUNCDATA_ArgsPointerMaps)) - // We're in the prologue, so it's always stack map index 0. - bv := stackmapdata(stkmap, 0) - bulkBarrierBitmap(spArg, spArg, uintptr(narg), 0, bv.bytedata) + if stkmap.nbit > 0 { + // We're in the prologue, so it's always stack map index 0. + bv := stackmapdata(stkmap, 0) + bulkBarrierBitmap(spArg, spArg, uintptr(narg), 0, bv.bytedata) + } } } |