diff options
| author | Russ Cox <rsc@golang.org> | 2011-04-09 09:44:20 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2011-04-09 09:44:20 -0400 |
| commit | 1bc84b7e18ae704483ab028bb2030970bbc0b2f3 (patch) | |
| tree | b3cc18d44af119730dd6e8a3a28abd3c5aa24d7b /src/cmd/ld/symtab.c | |
| parent | ebaf01f0526f349dd207798dc5771219e9d8a8ca (diff) | |
| download | go-1bc84b7e18ae704483ab028bb2030970bbc0b2f3.tar.xz | |
ld: 25% faster
The ld time was dominated by symbol table processing, so
* increase hash table size
* emit fewer symbols in gc (just 1 per string, 1 per type)
* add read-only lookup to avoid creating spurious symbols
* add linked list to speed whole-table traversals
Breaks dwarf generator (no idea why), so disable dwarf.
Reduces time for 6l to link godoc by 25%.
R=ken2
CC=golang-dev
https://golang.org/cl/4383047
Diffstat (limited to 'src/cmd/ld/symtab.c')
| -rw-r--r-- | src/cmd/ld/symtab.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/src/cmd/ld/symtab.c b/src/cmd/ld/symtab.c index f1d44058e0..aefe0b1af0 100644 --- a/src/cmd/ld/symtab.c +++ b/src/cmd/ld/symtab.c @@ -340,7 +340,6 @@ putsymb(Sym *s, char *name, int t, vlong v, vlong size, int ver, Sym *typ) void symtab(void) { - int32 h; Sym *s; // Define these so that they'll get put into the symbol table. @@ -361,11 +360,6 @@ symtab(void) s->size = 0; s->reachable = 1; - s = lookup("string.*", 0); - s->type = SSTRING; - s->size = 0; - s->reachable = 1; - s = lookup("go.string.*", 0); s->type = SGOSTRING; s->size = 0; @@ -380,22 +374,16 @@ symtab(void) // within a type they sort by size, so the .* symbols // just defined above will be first. // hide the specific symbols. - for(h=0; h<NHASH; h++) { - for(s=hash[h]; s!=S; s=s->hash){ - if(!s->reachable || s->special || s->type != SRODATA) - continue; - if(strncmp(s->name, "type.", 5) == 0) { - s->type = STYPE; - s->hide = 1; - } - if(strncmp(s->name, "string.", 7) == 0) { - s->type = SSTRING; - s->hide = 1; - } - if(strncmp(s->name, "go.string.", 10) == 0) { - s->type = SGOSTRING; - s->hide = 1; - } + for(s = allsym; s != S; s = s->allsym) { + if(!s->reachable || s->special || s->type != SRODATA) + continue; + if(strncmp(s->name, "type.", 5) == 0) { + s->type = STYPE; + s->hide = 1; + } + if(strncmp(s->name, "go.string.", 10) == 0) { + s->type = SGOSTRING; + s->hide = 1; } } |
