]> Cypherpunks repositories - gostls13.git/commit
[dev.link] cmd/link: add internal packages at the end
authorCherry Zhang <cherryyz@google.com>
Thu, 31 Oct 2019 01:24:22 +0000 (21:24 -0400)
committerCherry Zhang <cherryyz@google.com>
Sat, 2 Nov 2019 19:21:37 +0000 (19:21 +0000)
commit24ea07d5925af3528c44e85655a35e17e2de57de
treef3a6cc6a9faf24c4da43d6402943cc64b9b88572
parent5597e3d38968beb41f78971d523aef0a49605410
[dev.link] cmd/link: add internal packages at the end

Currently in the linker we load internal packges first, then the
main package, and then load imported packages following the
dependency graph. As a result, packages are loaded mostly in the
dependency order, except the internal packages. The global symbol
indices are assigned the same way.

By loading the internal packages at the end, the packages are
loaded in the dependency order, so are the global indices. This
way, a relocation edge is mostly either within a packge or a
forward edge from a smaller index to a larger one. This allows
us to use a min-heap work queue in the deadcode pass, to achieve
better spatial locality (in the next CL).

Change-Id: I01fa9b3cf0c9e9e66006040f6378a51fd78f0f39
Reviewed-on: https://go-review.googlesource.com/c/go/+/204437
Reviewed-by: Jeremy Faller <jeremy@golang.org>
src/cmd/link/internal/ld/lib.go