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>
diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index bdf73e0..f2e7f70 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -3303,9 +3303,11 @@
 		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)
+			}
 		}
 	}