Changeset 812:6c2ff06c4201
- 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
| r809 |
r812 |
|
| 436 | 436 | } |
|---|
| 437 | 437 | |
|---|
| 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); |
|---|
| 439 | 439 | LOG_SCOPE; |
|---|
| 440 | 440 | |
|---|
| … | … | |
| 465 | 465 | else |
|---|
| 466 | 466 | { |
|---|
| 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); |
|---|
| 468 | 468 | } |
|---|
| 469 | 469 | } |
|---|
| … | … | |
| 520 | 520 | inits.push_back(getNullPtr(getVoidPtrType())); |
|---|
| 521 | 521 | |
|---|
| 522 | | lastoffset += PTRSIZE; |
|---|
| | 522 | lastoffset += lastsize; |
|---|
| 523 | 523 | lastsize = PTRSIZE; |
|---|
| 524 | 524 | } |
|---|
| … | … | |
| 750 | 750 | |
|---|
| 751 | 751 | // build constant from inits |
|---|
| | 752 | assert(!irstruct->constInit); |
|---|
| 752 | 753 | irstruct->constInit = LLConstantStruct::get(inits); // classes are never packed |
|---|
| 753 | 754 | |
|---|
| … | … | |
| 1438 | 1439 | |
|---|
| 1439 | 1440 | TypeClass* cdty = (TypeClass*)cd->type; |
|---|
| 1440 | | if (!cd->isInterfaceDeclaration() && !cd->isAbstract()) |
|---|
| | 1441 | if (!cd->isInterfaceDeclaration()) |
|---|
| 1441 | 1442 | { |
|---|
| 1442 | 1443 | assert(ir->init); |
|---|
| … | … | |
| 1451 | 1452 | ClassDeclaration* cinfo = ClassDeclaration::classinfo; |
|---|
| 1452 | 1453 | DtoForceConstInitDsymbol(cinfo); |
|---|
| 1453 | | assert(cinfo->ir.irStruct->constInit); |
|---|
| 1454 | 1454 | |
|---|
| 1455 | 1455 | LLConstant* c; |
|---|
| … | … | |
| 1474 | 1474 | c = DtoBitCast(ir->init, voidPtr); |
|---|
| 1475 | 1475 | //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)); |
|---|
| 1477 | 1477 | c = DtoConstSlice(DtoConstSize_t(initsz), c); |
|---|
| 1478 | 1478 | } |
|---|
| r803 |
r812 |
|
| 1006 | 1006 | llvm::cast<LLOpaqueType>(glob->type.get())->refineAbstractTypeTo(initVal->getType()); |
|---|
| 1007 | 1007 | |
|---|
| | 1008 | assert(!glob->constInit); |
|---|
| 1008 | 1009 | glob->constInit = initVal; |
|---|
| 1009 | 1010 | |
|---|
| r809 |
r812 |
|
| 468 | 468 | |
|---|
| 469 | 469 | // always generate the constant initalizer |
|---|
| | 470 | assert(!irstruct->constInit); |
|---|
| 470 | 471 | if (sd->zeroInit) |
|---|
| 471 | 472 | { |
|---|