• David Crawshaw's avatar
    cmd/compile: remove slices from rtype.funcType · 8df733bd
    David Crawshaw authored
    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/19916Reviewed-by: default avatarRuss Cox <rsc@golang.org>
    Run-TryBot: David Crawshaw <crawshaw@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    8df733bd
value.go 72.2 KB