mirror of
https://github.com/golang/go
synced 2024-09-29 16:14:28 -06:00
[dev.regabi] cmd/compile: remove unneeded indirection
Thanks to package reorganizing, we can remove types.TypeLinkSym by simply having its only callers use reflectdata.TypeLinksym directly. Passes toolstash -cmp. Change-Id: I5bc5dbb6bf0664af43ae5130cfe1f19bd23b2bfe Reviewed-on: https://go-review.googlesource.com/c/go/+/280644 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
This commit is contained in:
parent
171fc6f223
commit
6f30c95048
@ -7,7 +7,6 @@ package gc
|
|||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"cmd/compile/internal/base"
|
"cmd/compile/internal/base"
|
||||||
"cmd/compile/internal/reflectdata"
|
|
||||||
"cmd/compile/internal/ssagen"
|
"cmd/compile/internal/ssagen"
|
||||||
"cmd/compile/internal/typecheck"
|
"cmd/compile/internal/typecheck"
|
||||||
"cmd/compile/internal/types"
|
"cmd/compile/internal/types"
|
||||||
@ -39,12 +38,6 @@ func TestMain(m *testing.M) {
|
|||||||
base.Ctxt.Bso = bufio.NewWriter(os.Stdout)
|
base.Ctxt.Bso = bufio.NewWriter(os.Stdout)
|
||||||
types.PtrSize = ssagen.Arch.LinkArch.PtrSize
|
types.PtrSize = ssagen.Arch.LinkArch.PtrSize
|
||||||
types.RegSize = ssagen.Arch.LinkArch.RegSize
|
types.RegSize = ssagen.Arch.LinkArch.RegSize
|
||||||
types.TypeLinkSym = func(t *types.Type) *obj.LSym {
|
|
||||||
return reflectdata.TypeLinksym(t)
|
|
||||||
}
|
|
||||||
types.TypeLinkSym = func(t *types.Type) *obj.LSym {
|
|
||||||
return reflectdata.TypeLinksym(t)
|
|
||||||
}
|
|
||||||
typecheck.Init()
|
typecheck.Init()
|
||||||
os.Exit(m.Run())
|
os.Exit(m.Run())
|
||||||
}
|
}
|
||||||
|
@ -190,9 +190,6 @@ func Main(archInit func(*ssagen.ArchInfo)) {
|
|||||||
types.PtrSize = ssagen.Arch.LinkArch.PtrSize
|
types.PtrSize = ssagen.Arch.LinkArch.PtrSize
|
||||||
types.RegSize = ssagen.Arch.LinkArch.RegSize
|
types.RegSize = ssagen.Arch.LinkArch.RegSize
|
||||||
types.MaxWidth = ssagen.Arch.MAXWIDTH
|
types.MaxWidth = ssagen.Arch.MAXWIDTH
|
||||||
types.TypeLinkSym = func(t *types.Type) *obj.LSym {
|
|
||||||
return reflectdata.TypeLinksym(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
typecheck.Target = new(ir.Package)
|
typecheck.Target = new(ir.Package)
|
||||||
|
|
||||||
@ -202,9 +199,6 @@ func Main(archInit func(*ssagen.ArchInfo)) {
|
|||||||
|
|
||||||
base.AutogeneratedPos = makePos(src.NewFileBase("<autogenerated>", "<autogenerated>"), 1, 0)
|
base.AutogeneratedPos = makePos(src.NewFileBase("<autogenerated>", "<autogenerated>"), 1, 0)
|
||||||
|
|
||||||
types.TypeLinkSym = func(t *types.Type) *obj.LSym {
|
|
||||||
return reflectdata.TypeLinksym(t)
|
|
||||||
}
|
|
||||||
typecheck.Init()
|
typecheck.Init()
|
||||||
|
|
||||||
// Parse input.
|
// Parse input.
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
package ssa
|
package ssa
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"cmd/compile/internal/reflectdata"
|
||||||
"cmd/compile/internal/types"
|
"cmd/compile/internal/types"
|
||||||
"cmd/internal/obj"
|
"cmd/internal/obj"
|
||||||
"cmd/internal/objabi"
|
"cmd/internal/objabi"
|
||||||
@ -270,11 +271,11 @@ func writebarrier(f *Func) {
|
|||||||
case OpMoveWB:
|
case OpMoveWB:
|
||||||
fn = typedmemmove
|
fn = typedmemmove
|
||||||
val = w.Args[1]
|
val = w.Args[1]
|
||||||
typ = w.Aux.(*types.Type).Symbol()
|
typ = reflectdata.TypeLinksym(w.Aux.(*types.Type))
|
||||||
nWBops--
|
nWBops--
|
||||||
case OpZeroWB:
|
case OpZeroWB:
|
||||||
fn = typedmemclr
|
fn = typedmemclr
|
||||||
typ = w.Aux.(*types.Type).Symbol()
|
typ = reflectdata.TypeLinksym(w.Aux.(*types.Type))
|
||||||
nWBops--
|
nWBops--
|
||||||
case OpVarDef, OpVarLive, OpVarKill:
|
case OpVarDef, OpVarLive, OpVarKill:
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ package types
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"cmd/compile/internal/base"
|
"cmd/compile/internal/base"
|
||||||
"cmd/internal/obj"
|
|
||||||
"cmd/internal/src"
|
"cmd/internal/src"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
@ -1532,10 +1531,6 @@ func (t *Type) HasPointers() bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Type) Symbol() *obj.LSym {
|
|
||||||
return TypeLinkSym(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tie returns 'T' if t is a concrete type,
|
// Tie returns 'T' if t is a concrete type,
|
||||||
// 'I' if t is an interface type, and 'E' if t is an empty interface type.
|
// 'I' if t is an interface type, and 'E' if t is an empty interface type.
|
||||||
// It is used to build calls to the conv* and assert* runtime routines.
|
// It is used to build calls to the conv* and assert* runtime routines.
|
||||||
|
@ -4,19 +4,8 @@
|
|||||||
|
|
||||||
package types
|
package types
|
||||||
|
|
||||||
import (
|
|
||||||
"cmd/internal/obj"
|
|
||||||
)
|
|
||||||
|
|
||||||
const BADWIDTH = -1000000000
|
const BADWIDTH = -1000000000
|
||||||
|
|
||||||
// The following variables must be initialized early by the frontend.
|
|
||||||
// They are here to break import cycles.
|
|
||||||
// TODO(gri) eliminate these dependencies.
|
|
||||||
var (
|
|
||||||
TypeLinkSym func(*Type) *obj.LSym
|
|
||||||
)
|
|
||||||
|
|
||||||
type bitset8 uint8
|
type bitset8 uint8
|
||||||
|
|
||||||
func (f *bitset8) set(mask uint8, b bool) {
|
func (f *bitset8) set(mask uint8, b bool) {
|
||||||
|
Loading…
Reference in New Issue
Block a user