]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: reorganize init functions
authorKeith Randall <khr@google.com>
Wed, 6 Feb 2019 00:22:38 +0000 (16:22 -0800)
committerKeith Randall <khr@golang.org>
Mon, 18 Mar 2019 20:10:55 +0000 (20:10 +0000)
commitd949d0b9252be1fffeadd65183a6bab3acf3de7a
tree842d96e7575d306fafd07322dbd7771ba56929ea
parent991c85a750574a608daf70330e26070f8cd97bb4
cmd/compile: reorganize init functions

Instead of writing an init function per package that does the same
thing for every package, just write that implementation once in the
runtime. Change the compiler to generate a data structure that encodes
the required initialization operations.

Reduces cmd/go binary size by 0.3%+.  Most of the init code is gone,
including all the corresponding stack map info. The .inittask
structures that replace them are quite a bit smaller.

Most usefully to me, there is no longer an init function in every -S output.
(There is an .inittask global there, but it's much less distracting.)

After this CL we could change the name of the "init.ializers" function
back to just "init".

Update #6853

R=go1.13

Change-Id: Iec82b205cc52fe3ade4d36406933c97dbc9c01b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/161337
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
src/cmd/compile/internal/gc/init.go
src/cmd/link/internal/ld/data.go
src/cmd/link/internal/ld/deadcode.go
src/plugin/plugin_dlopen.go
src/runtime/panic.go
src/runtime/proc.go
test/fixedbugs/issue29919.dir/a.go
test/init.go