1
0
mirror of https://github.com/golang/go synced 2024-09-29 14:24:32 -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:
Matthew Dempsky 2020-12-29 01:22:50 -08:00
parent 171fc6f223
commit 6f30c95048
5 changed files with 3 additions and 31 deletions

View File

@ -7,7 +7,6 @@ package gc
import (
"bufio"
"cmd/compile/internal/base"
"cmd/compile/internal/reflectdata"
"cmd/compile/internal/ssagen"
"cmd/compile/internal/typecheck"
"cmd/compile/internal/types"
@ -39,12 +38,6 @@ func TestMain(m *testing.M) {
base.Ctxt.Bso = bufio.NewWriter(os.Stdout)
types.PtrSize = ssagen.Arch.LinkArch.PtrSize
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()
os.Exit(m.Run())
}

View File

@ -190,9 +190,6 @@ func Main(archInit func(*ssagen.ArchInfo)) {
types.PtrSize = ssagen.Arch.LinkArch.PtrSize
types.RegSize = ssagen.Arch.LinkArch.RegSize
types.MaxWidth = ssagen.Arch.MAXWIDTH
types.TypeLinkSym = func(t *types.Type) *obj.LSym {
return reflectdata.TypeLinksym(t)
}
typecheck.Target = new(ir.Package)
@ -202,9 +199,6 @@ func Main(archInit func(*ssagen.ArchInfo)) {
base.AutogeneratedPos = makePos(src.NewFileBase("<autogenerated>", "<autogenerated>"), 1, 0)
types.TypeLinkSym = func(t *types.Type) *obj.LSym {
return reflectdata.TypeLinksym(t)
}
typecheck.Init()
// Parse input.

View File

@ -5,6 +5,7 @@
package ssa
import (
"cmd/compile/internal/reflectdata"
"cmd/compile/internal/types"
"cmd/internal/obj"
"cmd/internal/objabi"
@ -270,11 +271,11 @@ func writebarrier(f *Func) {
case OpMoveWB:
fn = typedmemmove
val = w.Args[1]
typ = w.Aux.(*types.Type).Symbol()
typ = reflectdata.TypeLinksym(w.Aux.(*types.Type))
nWBops--
case OpZeroWB:
fn = typedmemclr
typ = w.Aux.(*types.Type).Symbol()
typ = reflectdata.TypeLinksym(w.Aux.(*types.Type))
nWBops--
case OpVarDef, OpVarLive, OpVarKill:
}

View File

@ -6,7 +6,6 @@ package types
import (
"cmd/compile/internal/base"
"cmd/internal/obj"
"cmd/internal/src"
"fmt"
"sync"
@ -1532,10 +1531,6 @@ func (t *Type) HasPointers() bool {
return true
}
func (t *Type) Symbol() *obj.LSym {
return TypeLinkSym(t)
}
// 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.
// It is used to build calls to the conv* and assert* runtime routines.

View File

@ -4,19 +4,8 @@
package types
import (
"cmd/internal/obj"
)
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
func (f *bitset8) set(mask uint8, b bool) {