mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: statically initialize some interface values
When possible, emit static data rather than init functions for interface values. This: * cuts 32k off cmd/go * removes several error values from runtime init * cuts the size of the image/color/palette compiled package from 103k to 34k * reduces the time to build the package in #15520 from 8s to 1.5s Fixes #6289 Fixes #15528 Change-Id: I317112da17aadb180c958ea328ab380f83e640b4 Reviewed-on: https://go-review.googlesource.com/26668 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
b8eb5b53ea
commit
dfc56a4cd3
3 changed files with 208 additions and 5 deletions
|
|
@ -978,8 +978,8 @@ func typename(t *Type) *Node {
|
|||
}
|
||||
|
||||
func itabname(t, itype *Type) *Node {
|
||||
if t == nil || (t.IsPtr() && t.Elem() == nil) || t.IsUntyped() {
|
||||
Fatalf("itabname %v", t)
|
||||
if t == nil || (t.IsPtr() && t.Elem() == nil) || t.IsUntyped() || !itype.IsInterface() || itype.IsEmptyInterface() {
|
||||
Fatalf("itabname(%v, %v)", t, itype)
|
||||
}
|
||||
s := Pkglookup(fmt.Sprintf("%-v,%-v", t, itype), itabpkg)
|
||||
if s.Def == nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue