]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: call nanotimeQPC from nanotime1 normally
authorMichael Anthony Knyszek <mknyszek@google.com>
Wed, 21 Apr 2021 20:45:44 +0000 (20:45 +0000)
committerMichael Knyszek <mknyszek@google.com>
Wed, 21 Apr 2021 23:01:42 +0000 (23:01 +0000)
Currently we call runtimeQPC as ABIInternal because it shaves off 24
bytes by not having an extra wrapper, and at the time we were exceeding
the nosplit stack limit in some cases.

However, this code was written before we had the regabiargs GOEXPERIMENT
flag, and wasn't properly flagged. Naturally, with regabiargs enabled,
it leads to garbage being returned, because it needs to store
runtimeQPC's result to the stack.

We didn't notice this because today runtimeQPC is only used in Wine, not
on any native Windows platform.

Back when I wrote this code, it appeared to be necessary on even native
Windows, but it turns out that's not true anymore. Turn it back into a
native call through a wrapper.

For #40724.

Change-Id: Ia2e5901965ef46c5f299daccef49952026854fe6
Reviewed-on: https://go-review.googlesource.com/c/go/+/312429
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

src/runtime/sys_windows_amd64.s

index a9a7dfdd494bb90dbfe9af9e25e37128285bcaec..72ced3cd1c1afcd8b4867c9e054c8a3de35f639f 100644 (file)
@@ -367,13 +367,7 @@ loop:
        MOVQ    CX, ret+0(FP)
        RET
 useQPC:
-       // 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)
+       JMP     runtime·nanotimeQPC(SB)
        RET
 
 TEXT time·now(SB),NOSPLIT,$0-24