When using faketime, only run the scavenger for one loop.
It tries to run for 1 ms, but with faketime that calculation fails.
Prohibit write barriers in the faketime write function, in case
the GC wants to print something (e.g., with GODEBUG=gctrace=1).
Fixes #49614
Change-Id: Iab5097fe78b6e0032ea8b493088264dfb25013c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/364757
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
crit += float64(end - start)
}
released += r
+
+ // When using fake time just do one loop.
+ if faketime != 0 {
+ break
+ }
}
if released == 0 {
return faketime / 1e9, int32(faketime % 1e9), faketime
}
+// write is like the Unix write system call.
+// We have to avoid write barriers to avoid potential deadlock
+// on write calls.
+//go:nowritebarrierrec
func write(fd uintptr, p unsafe.Pointer, n int32) int32 {
if !(fd == 1 || fd == 2) {
// Do an ordinary write.