]> Cypherpunks repositories - gostls13.git/commitdiff
reflect,runtime: assume register ABI with GOEXPERIMENT=regabiargs
authorMichael Anthony Knyszek <mknyszek@google.com>
Thu, 1 Apr 2021 15:02:11 +0000 (15:02 +0000)
committerMichael Knyszek <mknyszek@google.com>
Thu, 1 Apr 2021 22:35:25 +0000 (22:35 +0000)
This change causes finalizers, reflect calls, and Windows syscall
callbacks to assume the register ABI when GOEXPERIMENT=regabiargs is
set. That is, when all Go functions are using the new ABI by default,
these features should assume the new ABI too.

For #40724.

Change-Id: Ie4ee66b8085b692e1ff675f01134c9a4703ae1b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/306571
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

src/reflect/abi.go
src/reflect/regabiargs_off.go [new file with mode: 0644]
src/reflect/regabiargs_on.go [new file with mode: 0644]
src/runtime/regabiargs_off.go [new file with mode: 0644]
src/runtime/regabiargs_on.go [new file with mode: 0644]
src/runtime/stubs.go

index 002e4598b95596f029eca07f7349ad9156f960ed..ab19695edc52bdf401481a478975f78979d46dbc 100644 (file)
@@ -28,9 +28,9 @@ import (
 // commented out there should be the actual values once
 // we're ready to use the register ABI everywhere.
 var (
-       intArgRegs   = 0          // abi.IntArgRegs
-       floatArgRegs = 0          // abi.FloatArgRegs
-       floatRegSize = uintptr(0) // uintptr(abi.EffectiveFloatRegSize)
+       intArgRegs   = abi.IntArgRegs * experimentRegabiArgs
+       floatArgRegs = abi.FloatArgRegs * experimentRegabiArgs
+       floatRegSize = uintptr(abi.EffectiveFloatRegSize * experimentRegabiArgs)
 )
 
 // abiStep represents an ABI "instruction." Each instruction
diff --git a/src/reflect/regabiargs_off.go b/src/reflect/regabiargs_off.go
new file mode 100644 (file)
index 0000000..655e955
--- /dev/null
@@ -0,0 +1,10 @@
+// Copyright 2021 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build !goexperiment.regabiargs
+// +build !goexperiment.regabiargs
+
+package reflect
+
+const experimentRegabiArgs = 0
diff --git a/src/reflect/regabiargs_on.go b/src/reflect/regabiargs_on.go
new file mode 100644 (file)
index 0000000..0f33b22
--- /dev/null
@@ -0,0 +1,10 @@
+// Copyright 2021 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build goexperiment.regabiargs
+// +build goexperiment.regabiargs
+
+package reflect
+
+const experimentRegabiArgs = 1
diff --git a/src/runtime/regabiargs_off.go b/src/runtime/regabiargs_off.go
new file mode 100644 (file)
index 0000000..49d7bcc
--- /dev/null
@@ -0,0 +1,10 @@
+// Copyright 2021 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build !goexperiment.regabiargs
+// +build !goexperiment.regabiargs
+
+package runtime
+
+const experimentRegabiArgs = 0
diff --git a/src/runtime/regabiargs_on.go b/src/runtime/regabiargs_on.go
new file mode 100644 (file)
index 0000000..935d3ec
--- /dev/null
@@ -0,0 +1,10 @@
+// Copyright 2021 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build goexperiment.regabiargs
+// +build goexperiment.regabiargs
+
+package runtime
+
+const experimentRegabiArgs = 1
index a2e04a64a5564b61ae36de661f0c49feac84513b..e2d4f0da3b679288fd1d2d2a99beef48dacbd58f 100644 (file)
@@ -423,4 +423,4 @@ func sigpanic0()
 // everywhere.
 //
 // Protected by finlock.
-var intArgRegs = 0 // abi.IntArgRegs
+var intArgRegs = abi.IntArgRegs * experimentRegabiArgs