]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: compute second method type at runtime
authorDavid Crawshaw <crawshaw@golang.org>
Tue, 15 Mar 2016 01:30:43 +0000 (21:30 -0400)
committerDavid Crawshaw <crawshaw@golang.org>
Tue, 15 Mar 2016 19:57:40 +0000 (19:57 +0000)
commitf2772a49353e09e4e00121ca4e538a3b3302a1de
tree244e520d9ceb1fec43c6af6ead045b71b0703c8d
parent1b9f168f73c44b2743338a16e8122a13203e8e9b
cmd/compile: compute second method type at runtime

The type information for a method includes two variants: a func
without the receiver, and a func with the receiver as the first
parameter. The former is used as part of the dynamic interface
checks, but the latter is only returned as a type in the
reflect.Method struct.

Instead of computing it at compile time, construct it at run time
with reflect.FuncOf.

Using cl/20701 as a baseline,

cmd/go: -480KB, (4.4%)
jujud:  -5.6MB, (7.8%)

For #6853.

Change-Id: I1b8c73f3ab894735f53d00cb9c0b506d84d54e92
Reviewed-on: https://go-review.googlesource.com/20709
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/compile/internal/gc/reflect.go
src/cmd/link/internal/ld/deadcode.go
src/cmd/link/internal/ld/decodesym.go
src/reflect/type.go
src/runtime/type.go