]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/obj: add LookupInit
authorJosh Bleecher Snyder <josharian@gmail.com>
Thu, 6 Apr 2017 18:47:33 +0000 (11:47 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Fri, 7 Apr 2017 20:30:45 +0000 (20:30 +0000)
commit735fe51a4b3b2b333b209f803f80ffc61cd7948e
tree79db59d8c85549b0c8a69e2a5c353bb4da1178d7
parentdc243f257bc5b9aff59782abae35a2868d593947
cmd/internal/obj: add LookupInit

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: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/internal/obj/sym.go
src/cmd/internal/obj/x86/obj6.go