cmd/internal/gc: more Node cleanups
More cleanups to gc.Node
- make Node.Local a boolean
- make Type.Local a boolean
- reduce the size of Node.Esc to a uint8
Reducing the size of Node.Esc shaves ~45mb off the RSS compiling cmd/internal/gc on amd64
before:
Maximum resident set size (kbytes): 659496
after:
Maximum resident set size (kbytes): 612196
- declare gc.Funcdepth as int32
- declare Node.Funcdepth as int32
In both cases, these were previously machine specific int types. This doesn't result in
any memory saving at the moment due to struct padding.
Change-Id: Iabef8da15e962fe8b79d7fd3d402fb26ce7ec31c
Reviewed-on: https://go-review.googlesource.com/7261
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/src/cmd/internal/gc/dcl.go b/src/cmd/internal/gc/dcl.go
index cccdbdd..7194c12 100644
--- a/src/cmd/internal/gc/dcl.go
+++ b/src/cmd/internal/gc/dcl.go
@@ -763,9 +763,9 @@
* is being declared to have uncompiled type t.
* return the ODCLTYPE node to use.
*/
-func typedcl1(n *Node, t *Node, local int) *Node {
+func typedcl1(n *Node, t *Node, local bool) *Node {
n.Ntype = t
- n.Local = uint8(local)
+ n.Local = local
return Nod(ODCLTYPE, n, nil)
}
@@ -1404,7 +1404,7 @@
}
}
- if local && pa.Local == 0 {
+ if local && !pa.Local {
// defining method on non-local type.
Yyerror("cannot define new methods on non-local type %v", Tconv(pa, 0))