diff options
author | David Chase <drchase@google.com> | 2021-03-01 17:31:20 -0500 |
---|---|---|
committer | David Chase <drchase@google.com> | 2021-03-02 15:26:33 +0000 |
commit | 97b32a6724ebc3a6029e06b6c4b3acb9c980b15a (patch) | |
tree | 549d68c2c8282bd4be34e0d7f4120503d19aae87 /src/cmd/compile/internal/test | |
parent | 2b50ab2aee75d3c361fcd1eb39e830e2e73056b6 (diff) | |
download | go-97b32a6724ebc3a6029e06b6c4b3acb9c980b15a.tar.gz go-97b32a6724ebc3a6029e06b6c4b3acb9c980b15a.zip |
cmd/compile: better version of check frame offsets against abi
improved to run on more architectures.
this is in preparation for turning off calculation of frame offsets
in types.CalcSize.
Replaces https://go-review.googlesource.com/c/go/+/293392 .
Updates #44675.
For #40724.
Change-Id: I40ba496172447cf09b86bc646148859363c11ad9
Reviewed-on: https://go-review.googlesource.com/c/go/+/297637
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/compile/internal/test')
-rw-r--r-- | src/cmd/compile/internal/test/abiutils_test.go | 2 | ||||
-rw-r--r-- | src/cmd/compile/internal/test/abiutilsaux_test.go | 32 |
2 files changed, 1 insertions, 33 deletions
diff --git a/src/cmd/compile/internal/test/abiutils_test.go b/src/cmd/compile/internal/test/abiutils_test.go index a0a11671e1..9a7d6d138c 100644 --- a/src/cmd/compile/internal/test/abiutils_test.go +++ b/src/cmd/compile/internal/test/abiutils_test.go @@ -21,7 +21,7 @@ import ( // AMD64 registers available: // - integer: RAX, RBX, RCX, RDI, RSI, R8, R9, r10, R11 // - floating point: X0 - X14 -var configAMD64 = abi.NewABIConfig(9, 15) +var configAMD64 = abi.NewABIConfig(9, 15, 0) func TestMain(m *testing.M) { ssagen.Arch.LinkArch = &x86.Linkamd64 diff --git a/src/cmd/compile/internal/test/abiutilsaux_test.go b/src/cmd/compile/internal/test/abiutilsaux_test.go index bac0c7639d..7eb273273d 100644 --- a/src/cmd/compile/internal/test/abiutilsaux_test.go +++ b/src/cmd/compile/internal/test/abiutilsaux_test.go @@ -129,36 +129,4 @@ func abitest(t *testing.T, ft *types.Type, exp expectedDump) { strings.TrimSpace(exp.dump), regResString, reason) } - // Analyze again with empty register set. - empty := abi.NewABIConfig(0, 0) - emptyRes := empty.ABIAnalyze(ft) - emptyResString := emptyRes.String() - - // Walk the results and make sure the offsets assigned match - // up with those assiged by CalcSize. This checks to make sure that - // when we have no available registers the ABI assignment degenerates - // back to the original ABI0. - - // receiver - failed := 0 - rfsl := ft.Recvs().Fields().Slice() - poff := 0 - if len(rfsl) != 0 { - failed |= verifyParamResultOffset(t, rfsl[0], emptyRes.InParams()[0], "receiver", 0) - poff = 1 - } - // params - pfsl := ft.Params().Fields().Slice() - for k, f := range pfsl { - verifyParamResultOffset(t, f, emptyRes.InParams()[k+poff], "param", k) - } - // results - ofsl := ft.Results().Fields().Slice() - for k, f := range ofsl { - failed |= verifyParamResultOffset(t, f, emptyRes.OutParams()[k], "result", k) - } - - if failed != 0 { - t.Logf("emptyres:\n%s\n", emptyResString) - } } |