1
0
mirror of https://github.com/golang/go synced 2024-11-26 13:58:48 -07:00

runtime: call nanotimeQPC from nanotime1 without a wrapper

This changes makes it so that nanotimeQPC calls nanotime1 without an ABI
wrapper by specifying the ABIInternal version directly. The reason why
this is necessary is because ABI wrappers typically require additional
stack space, and nanotimeQPC is used deep within nosplit contexts,
and with the ABI wrappers now enabled, this exhausts the stack guard
space held for nosplit functions. Rather than increase the stack guard,
we choose to do this.

For #40724.

Change-Id: Ia9173ca903335a9d6f380f57f4a45e49b58da6bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/303069
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
Michael Anthony Knyszek 2021-03-18 16:01:23 +00:00 committed by Michael Knyszek
parent e58fb90c75
commit 4deaa6a178

View File

@ -464,7 +464,13 @@ loop:
MOVQ CX, ret+0(FP)
RET
useQPC:
JMP runtime·nanotimeQPC(SB)
// Call with ABIInternal because we could be
// very deep in a nosplit context and the wrapper
// adds stack space.
// TODO(#40724): The result from nanotimeQPC will
// be passed in a register, so store that to the
// stack so we can return through a wrapper.
JMP runtime·nanotimeQPC<ABIInternal>(SB)
RET
TEXT time·now(SB),NOSPLIT,$0-24