Reviewers: golang-dev_googlegroups.com,

Hello golang-dev@googlegroups.com,

I'd like you to review this change to

reflect: add ArrayOf, ChanOf, MapOf, SliceOf

In order to add these, we need to be able to find references
to such types that already exist in the binary. To do that, introduce
a new linker section holding a list of the types corresponding to
arrays, chans, maps, and slices.

To offset the storage cost of this list, and to simplify the code,
remove the interface{} header from the representation of a
runtime type. It was used in early versions of the code but was
made obsolete by the kind field: a switch on kind is more efficient
than a type switch.

In the godoc binary, removing the interface{} header cuts two
words from each of about 10,000 types. Adding back the list of pointers
to array, chan, map, and slice types reintroduces one word for
each of about 500 types. On a 64-bit machine, then, this CL *removes*
a net 156 kB of read-only data from the binary.

Fixes issue 2339.

Please review this at http://codereview.appspot.com/6572043/

Affected files:
M src/cmd/gc/go.h
M src/cmd/gc/lex.c
M src/cmd/gc/reflect.c
M src/cmd/ld/data.c
M src/cmd/ld/decodesym.c
M src/cmd/ld/go.c
M src/cmd/ld/lib.h
M src/cmd/ld/symtab.c
M src/pkg/reflect/all_test.go
M src/pkg/reflect/makefunc.go
M src/pkg/reflect/type.go
M src/pkg/reflect/value.go
M src/pkg/runtime/iface.c
M src/pkg/runtime/type.go
M src/pkg/runtime/type.h
M src/pkg/runtime/typekind.h

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
postedNov 7, '12 at 9:34p
activeNov 13, '12 at 6:06p



site design / logo © 2022 Grokbase