]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/gc: replace hash tables with Go maps
authorRuss Cox <rsc@golang.org>
Mon, 2 Mar 2015 21:21:15 +0000 (16:21 -0500)
committerRuss Cox <rsc@golang.org>
Tue, 3 Mar 2015 20:33:11 +0000 (20:33 +0000)
commitd0b59deb71b69c1a07b3e734b6f5ff66b3a4e2c8
treed575dd1497eda7347e30f7f37de172ef2a811399
parentbed1f90d080da467d6abd416f76681ef58c9f79e
cmd/internal/gc: replace hash tables with Go maps

The C version of the compiler had just one hash table,
indexed by a (name string, pkg *Pkg) pair.
Because we always know the pkg during a lookup,
replace the one table with a per-Pkg map[string]*Sym.
This also lets us do non-allocating []byte key lookups.

This CL *does* change the generated object files.
In the old code, export data and init calls were emitted
in "hash table order". Now they are emitted in the order
in which they were added to the table.

Change-Id: I5a48d5c9add996dc43ad04a905641d901522de0b
Reviewed-on: https://go-review.googlesource.com/6600
Reviewed-by: Rob Pike <r@golang.org>
src/cmd/internal/gc/export.go
src/cmd/internal/gc/fmt.go
src/cmd/internal/gc/go.go
src/cmd/internal/gc/go.y
src/cmd/internal/gc/init.go
src/cmd/internal/gc/lex.go
src/cmd/internal/gc/reflect.go
src/cmd/internal/gc/subr.go
src/cmd/internal/gc/typecheck.go
src/cmd/internal/gc/y.go