Mercurial > projects > ldc
changeset 806:96b404ba7eb0
Move storage of final vtbl from BaseClass to IrInterface: BaseClass instances are shared!
Always use the target's irstruct interfaceMap when building the const initializer.
Tango helloworld works again.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sun, 30 Nov 2008 11:25:40 +0100 |
parents | 1b23aa1fb1b5 |
children | d92acb81a583 |
files | dmd/aggregate.h gen/classes.cpp ir/irstruct.h |
diffstat | 3 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/dmd/aggregate.h Sat Nov 29 23:39:04 2008 +0100 +++ b/dmd/aggregate.h Sun Nov 30 11:25:40 2008 +0100 @@ -154,6 +154,8 @@ UnionDeclaration *isUnionDeclaration() { return this; } }; +// warning: two classes with the same base class share the same +// BaseClass instance. struct BaseClass { Type *type; // (before semantic processing)
--- a/gen/classes.cpp Sat Nov 29 23:39:04 2008 +0100 +++ b/gen/classes.cpp Sun Nov 30 11:25:40 2008 +0100 @@ -66,7 +66,7 @@ } // build the interface vtable - b->fillVtbl(target, &b->vtbl, newinstance); + b->fillVtbl(target, &iri->vtblDecls, newinstance); // add the vtable type assert(inter->type->ir.type); @@ -493,8 +493,8 @@ lastsize = var->type->size(); } - // if it's a class, and it implements interfaces, add the vtables - IrStruct* irstruct = cd->ir.irStruct; + // if it's a class, and it implements interfaces, add the vtables - as found in the target class! + IrStruct* irstruct = target->ir.irStruct; size_t nvtbls = cd->vtblInterfaces->dim; for(size_t i=0; i<nvtbls; i++) @@ -592,7 +592,7 @@ Logger::println("interface %s", iri->decl->toChars()); // build vtable intializer for this interface implementation - Array& arr = iri->base->vtbl; + Array& arr = iri->vtblDecls; size_t narr = arr.dim; if (narr > 0)