]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: remove slices from rtype.funcType
authorDavid Crawshaw <crawshaw@golang.org>
Tue, 23 Feb 2016 16:31:13 +0000 (11:31 -0500)
committerDavid Crawshaw <crawshaw@golang.org>
Wed, 9 Mar 2016 01:25:18 +0000 (01:25 +0000)
commit8df733bd2210e086c179ffb898d4e960f8d62df7
treee9d7ec93cd4bf8fdb277e1128c1c687ae4543707
parentb050adeebddb269cfb57f2c84acef7430326b6d5
cmd/compile: remove slices from rtype.funcType

Alternative to golang.org/cl/19852. This memory layout doesn't have
an easy type representation, but it is noticeably smaller than the
current funcType, and saves significant extra space.

Some notes on the layout are in reflect/type.go:

// A *rtype for each in and out parameter is stored in an array that
// directly follows the funcType (and possibly its uncommonType). So
// a function type with one method, one input, and one output is:
//
// struct {
// funcType
// uncommonType
// [2]*rtype    // [0] is in, [1] is out
// uncommonTypeSliceContents
// }

There are three arbitrary limits introduced by this CL:

1. No more than 65535 function input parameters.
2. No more than 32767 function output parameters.
3. reflect.FuncOf is limited to 128 parameters.

I don't think these are limits in practice, but are worth noting.

Reduces godoc binary size by 2.4%, 330KB.

For #6853.

Change-Id: I225c0a0516ebdbe92d41dfdf43f716da42dfe347
Reviewed-on: https://go-review.googlesource.com/19916
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/compile/internal/gc/reflect.go
src/cmd/link/internal/ld/decodesym.go
src/cmd/link/internal/ld/dwarf.go
src/reflect/type.go
src/reflect/value.go
src/runtime/mfinal.go
src/runtime/syscall_windows.go
src/runtime/type.go