]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: call nanotimeQPC from nanotime1 without a wrapper
authorMichael Anthony Knyszek <mknyszek@google.com>
Thu, 18 Mar 2021 16:01:23 +0000 (16:01 +0000)
committerMichael Knyszek <mknyszek@google.com>
Fri, 19 Mar 2021 17:07:35 +0000 (17:07 +0000)
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>
src/runtime/sys_windows_amd64.s

index aba2811e5978078b7af2ebe27aa8a225bb9571a7..a7c519ae190bcb9bb26ab7d9318560ac0d07b7e7 100644 (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