From 6639bb894d8770290f1860a4cad8f8726079b870 Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Wed, 21 Apr 2021 20:45:44 +0000 Subject: [PATCH] runtime: call nanotimeQPC from nanotime1 normally 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 Reviewed-by: Michael Pratt Reviewed-by: Cherry Zhang Run-TryBot: Michael Knyszek TryBot-Result: Go Bot --- src/runtime/sys_windows_amd64.s | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/runtime/sys_windows_amd64.s b/src/runtime/sys_windows_amd64.s index a9a7dfdd49..72ced3cd1c 100644 --- a/src/runtime/sys_windows_amd64.s +++ b/src/runtime/sys_windows_amd64.s @@ -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(SB) + JMP runtime·nanotimeQPC(SB) RET TEXT time·now(SB),NOSPLIT,$0-24 -- 2.50.0