mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
94f2a03951
commit
72c003ef82
30 changed files with 191 additions and 191 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue