• Keith Randall's avatar
    cmd/compile: reorganize init functions · d949d0b9
    Keith Randall authored
    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: default avatarJosh Bleecher Snyder <josharian@gmail.com>
    d949d0b9
init.go 3.28 KB