Commit message:
runtime: add a test for issue 78081
Contrive to have a bunch of stack shrinking going on during
memclrNoHeapPointersPreemptible calls.
Fails at tip with this patch:
--- a/src/runtime/malloc.go
+++ b/src/runtime/malloc.go
@@ -2184,6 +2184,7 @@ func reusableSize(size uintptr) bool {
// Use this with care; if the data being cleared is tagged to contain
// pointers, this allows the GC to run before it is all cleared.
func memclrNoHeapPointersChunked(size uintptr, x unsafe.Pointer) {
+ y := uintptr(x)
if getg().preempt {
// TODO: no need for this, except to test that
// the preemption point is ok for small zeroings.
@@ -2193,6 +2194,7 @@ func memclrNoHeapPointersChunked(size uintptr, x unsafe.Pointer) {
// may hold locks, e.g., profiling
goschedguarded()
}
+ x = unsafe.Pointer(y)
// got this from benchmarking. 128k is too small, 512k is too large.
const chunkBytes = 256 * 1024
for size > chunkBytes {
Update #78081