diff options
| author | Matthew Dempsky <mdempsky@google.com> | 2021-08-26 12:11:14 -0700 |
|---|---|---|
| committer | Matthew Dempsky <mdempsky@google.com> | 2021-08-27 20:43:31 +0000 |
| commit | 72c003ef82ba7c997f49e187e953872bfcbf5263 (patch) | |
| tree | 8dff1fb85bc1988630948fa972b849a15b95cf58 /src/cmd/compile/internal/reflectdata/alg.go | |
| parent | 94f2a03951ed1534ebd6b13392b87d8b8b807e20 (diff) | |
| download | go-72c003ef82ba7c997f49e187e953872bfcbf5263.tar.xz | |
cmd/compile: unexport Type.Width and Type.Align [generated]
[git-generate]
cd src/cmd/compile/internal
: Workaround rf issue with types2 tests.
rm types2/*_test.go
: Rewrite uses. First a type-safe rewrite,
: then a second pass to fix unnecessary conversions.
rf '
ex ./abi ./escape ./gc ./liveness ./noder ./reflectdata ./ssa ./ssagen ./staticinit ./typebits ./typecheck ./walk {
import "cmd/compile/internal/types"
var t *types.Type
t.Width -> t.Size()
t.Align -> uint8(t.Alignment())
}
ex ./abi ./escape ./gc ./liveness ./noder ./reflectdata ./ssa ./ssagen ./staticinit ./typebits ./typecheck ./walk {
import "cmd/compile/internal/types"
var t *types.Type
int64(uint8(t.Alignment())) -> t.Alignment()
}
'
: Rename fields to lower case.
(
cd types
rf '
mv Type.Width Type.width
mv Type.Align Type.align
'
)
: Revert types2 changes.
git checkout HEAD^ types2
Change-Id: I42091faece104c4ef619d9d4d50514fd48c8f029
Reviewed-on: https://go-review.googlesource.com/c/go/+/345480
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/reflectdata/alg.go')
| -rw-r--r-- | src/cmd/compile/internal/reflectdata/alg.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cmd/compile/internal/reflectdata/alg.go b/src/cmd/compile/internal/reflectdata/alg.go index 36ad389647..d000618bd6 100644 --- a/src/cmd/compile/internal/reflectdata/alg.go +++ b/src/cmd/compile/internal/reflectdata/alg.go @@ -48,12 +48,12 @@ func eqCanPanic(t *types.Type) bool { func AlgType(t *types.Type) types.AlgKind { a, _ := types.AlgType(t) if a == types.AMEM { - if t.Alignment() < int64(base.Ctxt.Arch.Alignment) && t.Alignment() < t.Width { + if t.Alignment() < int64(base.Ctxt.Arch.Alignment) && t.Alignment() < t.Size() { // For example, we can't treat [2]int16 as an int32 if int32s require // 4-byte alignment. See issue 46283. return a } - switch t.Width { + switch t.Size() { case 0: return types.AMEM0 case 1: @@ -110,7 +110,7 @@ func genhash(t *types.Type) *obj.LSym { // For other sizes of plain memory, we build a closure // that calls memhash_varlen. The size of the memory is // encoded in the first slot of the closure. - closure := TypeLinksymLookup(fmt.Sprintf(".hashfunc%d", t.Width)) + closure := TypeLinksymLookup(fmt.Sprintf(".hashfunc%d", t.Size())) if len(closure.P) > 0 { // already generated return closure } @@ -119,7 +119,7 @@ func genhash(t *types.Type) *obj.LSym { } ot := 0 ot = objw.SymPtr(closure, ot, memhashvarlen, 0) - ot = objw.Uintptr(closure, ot, uint64(t.Width)) // size encoded in closure + ot = objw.Uintptr(closure, ot, uint64(t.Size())) // size encoded in closure objw.Global(closure, int32(ot), obj.DUPOK|obj.RODATA) return closure case types.ASPECIAL: @@ -354,7 +354,7 @@ func geneq(t *types.Type) *obj.LSym { case types.AMEM: // make equality closure. The size of the type // is encoded in the closure. - closure := TypeLinksymLookup(fmt.Sprintf(".eqfunc%d", t.Width)) + closure := TypeLinksymLookup(fmt.Sprintf(".eqfunc%d", t.Size())) if len(closure.P) != 0 { return closure } @@ -363,7 +363,7 @@ func geneq(t *types.Type) *obj.LSym { } ot := 0 ot = objw.SymPtr(closure, ot, memequalvarlen, 0) - ot = objw.Uintptr(closure, ot, uint64(t.Width)) + ot = objw.Uintptr(closure, ot, uint64(t.Size())) objw.Global(closure, int32(ot), obj.DUPOK|obj.RODATA) return closure case types.ASPECIAL: |
