• Josh Bleecher Snyder's avatar
    cmd/internal/obj: add LookupInit · 735fe51a
    Josh Bleecher Snyder authored
    There are some LSyms that are lazily initialized,
    and which cannot be made eagerly initialized,
    such as elements of a constant pool.
    
    To avoid needing a mutex to protect the internals of
    those LSyms, this CL introduces LookupInit,
    which allows an LSym to be initialized only once.
    
    By itself this is not fully concurrency-safe,
    but Ctxt.Hash will need mutex protection anyway,
    and that will be enough to support one-time LSym initialization.
    
    Passes toolstash-check -all.
    
    Updates #15756
    
    Change-Id: Id7248dfdc4dfbdfe425fa31d0c0045018eeea1fa
    Reviewed-on: https://go-review.googlesource.com/39990
    Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
    735fe51a
obj6.go 32.4 KB