]> Cypherpunks repositories - gostls13.git/commit
change representation of interface values.
authorRuss Cox <rsc@golang.org>
Wed, 20 May 2009 21:57:55 +0000 (14:57 -0700)
committerRuss Cox <rsc@golang.org>
Wed, 20 May 2009 21:57:55 +0000 (14:57 -0700)
commit2da5022bcf578545207ecc0ed0a8c7669e7f708f
tree262689682751a1adebce9c4281e1ab77eb480cb4
parent47e5152790e6dab326237259e4898da22917342a
change representation of interface values.

this is not a user-visible change.

before, all interface values were

struct Itype {
Sigt *type;
Sigi *inter;
void *method[n];
}

struct Iface {
void *addr;
Itype *itype;
}

the itype is basically a vtable, but it's unnecessary
if the static type is interface{ }.
for interface values with static type empty, the
new representation is

struct Eface {
void *addr;
Sigt *type;
}

this complicates the code somewhat, but
it reduces the number of Itypes that
have to be computed and cached,
it opens up opportunities to avoid function
calls in a few common cases,
and it will make it possible to lay out
interface{} values at compile time,
which i think i'll need for the new reflection.

R=ken
OCL=28701
CL=29121
src/cmd/gc/builtin.c.boot
src/cmd/gc/go.h
src/cmd/gc/subr.c
src/cmd/gc/swt.c
src/cmd/gc/sys.go
src/cmd/gc/walk.c
src/runtime/iface.c
src/runtime/runtime.c
src/runtime/runtime.h
test/golden.out