aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2017-04-23 17:35:12 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2017-04-24 00:58:15 +0000
commit976a5ce1a86bfb3772f1301a77eb41c17fe9178a (patch)
tree5fe94088ba14577bd1731a4e6a0dcbfdb75a36e2 /src
parent07d09003f1f3360ae870b9960b6a96079e319b3b (diff)
downloadgo-976a5ce1a86bfb3772f1301a77eb41c17fe9178a.tar.xz
cmd/compile: break apart dumptypestructs
dumptypestructs did several different jobs. Split them into separate functions and call them in turn. Hand dumptypestructs a list of dcls, rather than reading the global. Rename dumpptabs for (marginal) clarity. This is groundwork for compiling autogenerated functions concurrently. Passes toolstash-check. Change-Id: I627a1dffc70a7e4b7b4436ab19af1406267f01dc Reviewed-on: https://go-review.googlesource.com/41501 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/compile/internal/gc/obj.go9
-rw-r--r--src/cmd/compile/internal/gc/reflect.go14
2 files changed, 16 insertions, 7 deletions
diff --git a/src/cmd/compile/internal/gc/obj.go b/src/cmd/compile/internal/gc/obj.go
index 5067330e52..e9d94607ec 100644
--- a/src/cmd/compile/internal/gc/obj.go
+++ b/src/cmd/compile/internal/gc/obj.go
@@ -136,8 +136,11 @@ func dumpobj1(outfile string, mode int) {
externs := len(externdcl)
dumpglobls()
- dumpptabs()
- dumptypestructs()
+ addptabs()
+ dumptypestructs(externdcl)
+ dumptabs()
+ dumpimportstrings()
+ dumpbasictypes()
// Dump extra globals.
tmp := externdcl
@@ -171,7 +174,7 @@ func dumpobj1(outfile string, mode int) {
bout.Close()
}
-func dumpptabs() {
+func addptabs() {
if !Ctxt.Flag_dynlink || localpkg.Name != "main" {
return
}
diff --git a/src/cmd/compile/internal/gc/reflect.go b/src/cmd/compile/internal/gc/reflect.go
index 08ca0f13e6..5bbeb954c6 100644
--- a/src/cmd/compile/internal/gc/reflect.go
+++ b/src/cmd/compile/internal/gc/reflect.go
@@ -1394,9 +1394,9 @@ func addsignat(t *types.Type) {
signatlist[formalType(t)] = true
}
-func dumptypestructs() {
- // copy types from externdcl list to signatlist
- for _, n := range externdcl {
+func dumptypestructs(dcls []*Node) {
+ // copy types from dcl list to signatlist
+ for _, n := range dcls {
if n.Op == OTYPE {
addsignat(n.Type)
}
@@ -1421,7 +1421,9 @@ func dumptypestructs() {
}
}
}
+}
+func dumptabs() {
// process itabs
for _, i := range itabs {
// dump empty itab symbol into i.sym
@@ -1474,18 +1476,22 @@ func dumptypestructs() {
}
ggloblsym(s, int32(ot), int16(obj.RODATA))
}
+}
+func dumpimportstrings() {
// generate import strings for imported packages
for _, p := range types.ImportedPkgList() {
dimportpath(p)
}
+}
+func dumpbasictypes() {
// do basic types if compiling package runtime.
// they have to be in at least one package,
// and runtime is always loaded implicitly,
// so this is as good as any.
// another possible choice would be package main,
- // but using runtime means fewer copies in .6 files.
+ // but using runtime means fewer copies in object files.
if myimportpath == "runtime" {
for i := types.EType(1); i <= TBOOL; i++ {
dtypesym(types.NewPtr(types.Types[i]))