diff options
author | Inada Naoki <songofacandy@gmail.com> | 2018-12-27 00:47:20 +0900 |
---|---|---|
committer | Katie Hockman <katie@golang.org> | 2019-01-04 20:47:36 +0000 |
commit | c36b5322a7bcb268fa7a4b5ef67ce807745745a9 (patch) | |
tree | ab5484337998368997132e1cfac9e8f305efeee6 | |
parent | b2c472f91e9ad8e8a302ad9fc963d4875bdfbae0 (diff) | |
download | go-c36b5322a7bcb268fa7a4b5ef67ce807745745a9.tar.gz go-c36b5322a7bcb268fa7a4b5ef67ce807745745a9.zip |
[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 5372257e600989ab4cf742b35e3fa649cad3f45c)
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>
-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 e8495d1a10..e309c505b4 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -3371,9 +3371,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) + } } } |