1
0
mirror of https://github.com/golang/go synced 2024-10-05 07:11:22 -06:00
go/src/reflect
David Crawshaw 8df733bd22 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>
2016-03-09 01:25:18 +00:00
..
all_test.go reflect: recognize unnamed directional channels 2016-03-04 20:34:30 +00:00
asm_386.s all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
asm_amd64.s all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
asm_amd64p32.s all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
asm_arm64.s all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
asm_arm.s all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
asm_mips64x.s all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
asm_ppc64x.s all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
deepequal.go all: single space after period. 2016-03-02 00:13:47 +00:00
example_test.go all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
export_test.go all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
makefunc.go all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
set_test.go reflect: recognize unnamed directional channels 2016-03-04 20:34:30 +00:00
tostring_test.go
type.go cmd/compile: remove slices from rtype.funcType 2016-03-09 01:25:18 +00:00
value.go cmd/compile: remove slices from rtype.funcType 2016-03-09 01:25:18 +00:00