aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2020-12-29 01:22:50 -0800
committerMatthew Dempsky <mdempsky@google.com>2020-12-29 09:57:31 +0000
commit6f30c9504861d68d13113989a3cf063832d47002 (patch)
tree195a6f09ffe9aad50d4fb213959a328a5b50bdc8 /src
parent171fc6f22388cc8628b5590f42d46a7c57277428 (diff)
downloadgo-6f30c9504861d68d13113989a3cf063832d47002.tar.gz
go-6f30c9504861d68d13113989a3cf063832d47002.zip
[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>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/compile/internal/gc/abiutils_test.go7
-rw-r--r--src/cmd/compile/internal/gc/main.go6
-rw-r--r--src/cmd/compile/internal/ssa/writebarrier.go5
-rw-r--r--src/cmd/compile/internal/types/type.go5
-rw-r--r--src/cmd/compile/internal/types/utils.go11
5 files changed, 3 insertions, 31 deletions
diff --git a/src/cmd/compile/internal/gc/abiutils_test.go b/src/cmd/compile/internal/gc/abiutils_test.go
index 656eab18cb..d535a6a34b 100644
--- a/src/cmd/compile/internal/gc/abiutils_test.go
+++ b/src/cmd/compile/internal/gc/abiutils_test.go
@@ -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())
}
diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go
index a4613f04fb..45219801f0 100644
--- a/src/cmd/compile/internal/gc/main.go
+++ b/src/cmd/compile/internal/gc/main.go
@@ -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.
diff --git a/src/cmd/compile/internal/ssa/writebarrier.go b/src/cmd/compile/internal/ssa/writebarrier.go
index 849c9e8967..4378f2d627 100644
--- a/src/cmd/compile/internal/ssa/writebarrier.go
+++ b/src/cmd/compile/internal/ssa/writebarrier.go
@@ -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:
}
diff --git a/src/cmd/compile/internal/types/type.go b/src/cmd/compile/internal/types/type.go
index 6feedbfabc..5176b96c02 100644
--- a/src/cmd/compile/internal/types/type.go
+++ b/src/cmd/compile/internal/types/type.go
@@ -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.
diff --git a/src/cmd/compile/internal/types/utils.go b/src/cmd/compile/internal/types/utils.go
index 2477f1da66..f9f629ca3e 100644
--- a/src/cmd/compile/internal/types/utils.go
+++ b/src/cmd/compile/internal/types/utils.go
@@ -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) {