diff options
| author | Cherry Zhang <cherryyz@google.com> | 2021-04-08 14:41:44 -0400 |
|---|---|---|
| committer | Cherry Zhang <cherryyz@google.com> | 2021-04-08 21:02:58 +0000 |
| commit | 6c98ecda100c2e3f8325d0b958f53aeaeb92c101 (patch) | |
| tree | cb862a873f441de647cd1cd79477ee047996d457 /src | |
| parent | a9e475a15a7211c356157d1d0e5dc7cef7dd970e (diff) | |
| download | go-6c98ecda100c2e3f8325d0b958f53aeaeb92c101.tar.xz | |
cmd/compile: don't use fast32/64 map functions for aggregates
Under register ABI, aggregates like [2]uint32 is passed
differently than a uint64. For now, don't use the fast version
of the map functions for non-trivial aggregates.
GOEXPERIMENT=regabi,regabiargs can now pass make.bash, modulo
staleness checks.
TODO: maybe find some way to use the fast functions. Maybe
unsafe-cast to uint32/64 then call the map function. But need to
make the type checker happy.
Change-Id: If42717280dde12636fb970798cf1ca8fb29a3d06
Reviewed-on: https://go-review.googlesource.com/c/go/+/308650
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/compile/internal/walk/walk.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/walk/walk.go b/src/cmd/compile/internal/walk/walk.go index d889786c72..1f0b777263 100644 --- a/src/cmd/compile/internal/walk/walk.go +++ b/src/cmd/compile/internal/walk/walk.go @@ -14,6 +14,7 @@ import ( "cmd/compile/internal/ssagen" "cmd/compile/internal/typecheck" "cmd/compile/internal/types" + "cmd/internal/objabi" "cmd/internal/src" ) @@ -203,6 +204,13 @@ func mapfast(t *types.Type) int { } switch reflectdata.AlgType(t.Key()) { case types.AMEM32: + if objabi.Experiment.RegabiArgs && t.Key().NumComponents(types.CountBlankFields) != 1 { + // If key has multiple components, under register ABI it will + // be passed differently than uint32. + // TODO: maybe unsafe-case to uint32. But needs to make the type + // checker happy. + return mapslow + } if !t.Key().HasPointers() { return mapfast32 } @@ -211,6 +219,10 @@ func mapfast(t *types.Type) int { } base.Fatalf("small pointer %v", t.Key()) case types.AMEM64: + if objabi.Experiment.RegabiArgs && t.Key().NumComponents(types.CountBlankFields) != 1 { + // See above. + return mapslow + } if !t.Key().HasPointers() { return mapfast64 } |
