diff options
| author | Michael Anthony Knyszek <mknyszek@google.com> | 2022-06-02 21:10:26 +0000 |
|---|---|---|
| committer | Michael Knyszek <mknyszek@google.com> | 2022-06-03 20:16:21 +0000 |
| commit | 73587b71a62f7c7a27664a207781dedae223774b (patch) | |
| tree | c5e338dff44acff9152540bfaa69c87b42e6e1b6 /src/runtime/debuglog.go | |
| parent | d7941030c94ea14e9f32a4777424387b7f505cef (diff) | |
| download | go-73587b71a62f7c7a27664a207781dedae223774b.tar.xz | |
runtime: avoid string allocation in printDebuglog
Either due to a new nowritebarrierrec annotation or a change in escape
analysis, printDebuglog can't be called from sighandler anymore.
Fix this by avoiding a string allocation that's the primary culprit.
Change-Id: Ic84873a453f45852b0443a46597ed3ab8c9443fd
Reviewed-on: https://go-review.googlesource.com/c/go/+/410121
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/runtime/debuglog.go')
| -rw-r--r-- | src/runtime/debuglog.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/runtime/debuglog.go b/src/runtime/debuglog.go index 7f92a6baf8..ca1a791c93 100644 --- a/src/runtime/debuglog.go +++ b/src/runtime/debuglog.go @@ -777,7 +777,8 @@ func printDebugLog() { // Logged before runtimeInitTime was set. pnano = 0 } - print(string(itoaDiv(tmpbuf[:], uint64(pnano), 9))) + pnanoBytes := itoaDiv(tmpbuf[:], uint64(pnano), 9) + print(slicebytetostringtmp((*byte)(noescape(unsafe.Pointer(&pnanoBytes[0]))), len(pnanoBytes))) print(" P ", p, "] ") for i := 0; s.begin < s.end; i++ { |
