cmd/compile/internal/gc: remove remaining Nod(OXXX, ...)
Remove almost all the remaining Nod(OXXX, ... ) uses. The performance
change is due entirely to the changes to func temp(*Type). The other
cleanups have no effect, as expected.
I'll address the remaining Nod(OXXX, ...) uses in a followup CL as they
are very sensitive to change.
lucky(~/go/src/cmd/compile) % benchstat /tmp/{old,new}.txt
name old time/op new time/op delta
Template 391ms ± 6% 385ms ± 6% ~ (p=0.127 n=19+20)
GoTypes 1.27s ± 2% 1.27s ± 2% ~ (p=0.172 n=19+19)
Compiler 6.17s ± 2% 6.15s ± 2% ~ (p=0.647 n=19+20)
name old alloc/op new alloc/op delta
Template 63.7MB ± 0% 63.4MB ± 0% -0.35% (p=0.000 n=16+20)
GoTypes 219MB ± 0% 218MB ± 0% -0.38% (p=0.000 n=20+20)
Compiler 980MB ± 0% 976MB ± 0% -0.38% (p=0.000 n=20+20)
name old allocs/op new allocs/op delta
Template 586k ± 0% 584k ± 0% -0.30% (p=0.000 n=20+20)
GoTypes 1.80M ± 0% 1.79M ± 0% -0.31% (p=0.000 n=20+20)
Compiler 7.74M ± 0% 7.71M ± 0% -0.34% (p=0.000 n=20+20)
Change-Id: Ie21a5443c33a23ce30f987bdddec9fe350365d35
Reviewed-on: https://go-review.googlesource.com/21017
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/src/cmd/compile/internal/gc/inl.go b/src/cmd/compile/internal/gc/inl.go
index ce0b6c3..ff0791c 100644
--- a/src/cmd/compile/internal/gc/inl.go
+++ b/src/cmd/compile/internal/gc/inl.go
@@ -249,8 +249,7 @@
return n
}
- m := Nod(OXXX, nil, nil)
- *m = *n
+ m := *n
if m.Func != nil {
m.Func.Inl.Set(nil)
}
@@ -261,7 +260,7 @@
m.Ninit.Set(inlcopylist(n.Ninit.Slice()))
m.Nbody.Set(inlcopylist(n.Nbody.Slice()))
- return m
+ return &m
}
// Inlcalls/nodelist/node walks fn's statements and expressions and substitutes any
@@ -968,24 +967,24 @@
m.Left = newname(Lookup(p))
return m
+ default:
+ m := Nod(OXXX, nil, nil)
+ *m = *n
+ m.Ninit.Set(nil)
+
+ if n.Op == OCLOSURE {
+ Fatalf("cannot inline function containing closure: %v", Nconv(n, FmtSign))
+ }
+
+ m.Left = subst.node(n.Left)
+ m.Right = subst.node(n.Right)
+ m.List.Set(subst.list(n.List))
+ m.Rlist.Set(subst.list(n.Rlist))
+ m.Ninit.Set(append(m.Ninit.Slice(), subst.list(n.Ninit)...))
+ m.Nbody.Set(subst.list(n.Nbody))
+
+ return m
}
-
- m := Nod(OXXX, nil, nil)
- *m = *n
- m.Ninit.Set(nil)
-
- if n.Op == OCLOSURE {
- Fatalf("cannot inline function containing closure: %v", Nconv(n, FmtSign))
- }
-
- m.Left = subst.node(n.Left)
- m.Right = subst.node(n.Right)
- m.List.Set(subst.list(n.List))
- m.Rlist.Set(subst.list(n.Rlist))
- m.Ninit.Set(append(m.Ninit.Slice(), subst.list(n.Ninit)...))
- m.Nbody.Set(subst.list(n.Nbody))
-
- return m
}
// Plaster over linenumbers