const (
// See abi_generic.go.
- // Currently these values are zero because whatever uses
- // them will expect the register ABI, which isn't ready
- // yet.
-
// RAX, RBX, RCX, RDI, RSI, R8, R9, R10, R11.
- IntArgRegs = 0 // 9
+ IntArgRegs = 9
// X0 -> X14.
- FloatArgRegs = 0 // 15
+ FloatArgRegs = 15
// We use SSE2 registers which support 64-bit float operations.
- EffectiveFloatRegSize = 0 // 8
+ EffectiveFloatRegSize = 8
)
"unsafe"
)
+// These variables are used by the register assignment
+// algorithm in this file.
+//
+// They should be modified with care (no other reflect code
+// may be executing) and are generally only modified
+// when testing this package.
+//
+// They should never be set higher than their internal/abi
+// constant counterparts, because the system relies on a
+// structure that is at least large enough to hold the
+// registers the system supports.
+//
+// Currently they're set to zero because using the actual
+// constants will break every part of the toolchain that
+// uses reflect to call functions (e.g. go test, or anything
+// that uses text/template). The values that are currently
+// 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)
+)
+
// abiStep represents an ABI "instruction." Each instruction
// describes one part of how to translate between a Go value
// in memory and a call frame.
if ptrMap != 0 && size != ptrSize {
panic("non-empty pointer map passed for non-pointer-size values")
}
- if a.iregs+n > abi.IntArgRegs {
+ if a.iregs+n > intArgRegs {
return false
}
for i := 0; i < n; i++ {
if n < 0 {
panic("invalid n")
}
- if a.fregs+n > abi.FloatArgRegs || abi.EffectiveFloatRegSize < size {
+ if a.fregs+n > floatArgRegs || floatRegSize < size {
return false
}
for i := 0; i < n; i++ {
MOVL $0, DX
JMP runtime·morestack(SB)
-// REFLECTCALL_USE_REGABI is not defined. It must be defined in conjunction with the
-// register constants in the internal/abi package.
-
-#ifdef REFLECTCALL_USE_REGABI
+#ifdef GOEXPERIMENT_REGABI
// spillArgs stores return values from registers to a *internal/abi.RegArgs in R12.
TEXT spillArgs<>(SB),NOSPLIT,$0-0
MOVQ AX, 0(R12)