Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

Changeset 812:6c2ff06c4201

Show
Ignore:
Timestamp:
11/30/08 22:37:54 (1 month ago)
Author:
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
branch:
default
Message:

Fixed a nasty bug with how interface vtables for class initializers were output, causing some class fields to be skipped.
Fixed a problem in definition of ClassInfos? where an invalid constant was potentially used. This needs to be looked into proper as it might happen again in the future.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gen/classes.cpp

    r809 r812  
    436436    } 
    437437 
    438     Logger::println("adding data of %s to %s", cd->toChars(), target->toChars()); 
     438    Logger::println("adding data of %s to %s starting at %lu", cd->toChars(), target->toChars(), offsetbegin); 
    439439    LOG_SCOPE; 
    440440 
     
    465465        else 
    466466        { 
    467             Logger::println("  skipped %s", var->toChars()); 
     467            Logger::println("  skipped %s at offset %u, current pos is %lu", var->toChars(), var->offset, lastoffset+lastsize); 
    468468        } 
    469469    } 
     
    520520            inits.push_back(getNullPtr(getVoidPtrType())); 
    521521 
    522         lastoffset += PTRSIZE
     522        lastoffset += lastsize
    523523        lastsize = PTRSIZE; 
    524524    } 
     
    750750 
    751751    // build constant from inits 
     752    assert(!irstruct->constInit); 
    752753    irstruct->constInit = LLConstantStruct::get(inits); // classes are never packed 
    753754 
     
    14381439 
    14391440    TypeClass* cdty = (TypeClass*)cd->type; 
    1440     if (!cd->isInterfaceDeclaration() && !cd->isAbstract()
     1441    if (!cd->isInterfaceDeclaration()
    14411442    { 
    14421443        assert(ir->init); 
     
    14511452    ClassDeclaration* cinfo = ClassDeclaration::classinfo; 
    14521453    DtoForceConstInitDsymbol(cinfo); 
    1453     assert(cinfo->ir.irStruct->constInit); 
    14541454 
    14551455    LLConstant* c; 
     
    14741474        c = DtoBitCast(ir->init, voidPtr); 
    14751475        //Logger::cout() << *ir->constInit->getType() << std::endl; 
    1476         size_t initsz = getABITypeSize(ir->constInit->getType()); 
     1476        size_t initsz = getABITypeSize(ir->init->getType()->getContainedType(0)); 
    14771477        c = DtoConstSlice(DtoConstSize_t(initsz), c); 
    14781478    } 
  • gen/llvmhelpers.cpp

    r803 r812  
    10061006    llvm::cast<LLOpaqueType>(glob->type.get())->refineAbstractTypeTo(initVal->getType()); 
    10071007 
     1008    assert(!glob->constInit); 
    10081009    glob->constInit = initVal; 
    10091010 
  • gen/structs.cpp

    r809 r812  
    468468 
    469469    // always generate the constant initalizer 
     470    assert(!irstruct->constInit); 
    470471    if (sd->zeroInit) 
    471472    { 
Copyright © 2008, LDC Development Team.