Mercurial > projects > ldc
comparison gen/classes.cpp @ 1463:a5526b7a5ae6
D2:
Applied function type from D1 frontend that got removed in D2, it's critical for member function type to be correct.
Fixed a bunch of type discrepancies in druntime object.di vs. genobj.d .
Disabled (#if 0) some potentally very large type dumps for -vv .
Updated classinfo and typeinfo generation for D2, almost complete now.
Added finer grained checks for vtbl type mismatching, aids debugging.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail com> |
---|---|
date | Wed, 03 Jun 2009 02:28:48 +0200 |
parents | 89e38fbfef1f |
children | d9c5f5a43403 |
comparison
equal
deleted
inserted
replaced
1462:f0423003caa6 | 1463:a5526b7a5ae6 |
---|---|
484 const LLType* st = DtoType(cd->type); | 484 const LLType* st = DtoType(cd->type); |
485 // cast to the struct type | 485 // cast to the struct type |
486 src = DtoBitCast(src, st); | 486 src = DtoBitCast(src, st); |
487 | 487 |
488 // gep to the index | 488 // gep to the index |
489 #if 0 | |
489 if (Logger::enabled()) | 490 if (Logger::enabled()) |
490 { | 491 { |
491 Logger::cout() << "src2: " << *src << '\n'; | 492 Logger::cout() << "src2: " << *src << '\n'; |
492 Logger::cout() << "index: " << field->index << '\n'; | 493 Logger::cout() << "index: " << field->index << '\n'; |
493 Logger::cout() << "srctype: " << *src->getType() << '\n'; | 494 Logger::cout() << "srctype: " << *src->getType() << '\n'; |
494 } | 495 } |
496 #endif | |
495 LLValue* val = DtoGEPi(src, 0, field->index); | 497 LLValue* val = DtoGEPi(src, 0, field->index); |
496 | 498 |
497 // do we need to offset further? (union area) | 499 // do we need to offset further? (union area) |
498 if (field->unionOffset) | 500 if (field->unionOffset) |
499 { | 501 { |
676 // void *[] vtbl; | 678 // void *[] vtbl; |
677 // Interface[] interfaces; | 679 // Interface[] interfaces; |
678 // ClassInfo *base; // base class | 680 // ClassInfo *base; // base class |
679 // void *destructor; | 681 // void *destructor; |
680 // void *invariant; // class invariant | 682 // void *invariant; // class invariant |
681 // version(D_Version2) | |
682 // void *xgetMembers; | |
683 // uint flags; | 683 // uint flags; |
684 // void *deallocator; | 684 // void *deallocator; |
685 // OffsetTypeInfo[] offTi; | 685 // OffsetTypeInfo[] offTi; |
686 // void *defaultConstructor; | 686 // void *defaultConstructor; |
687 // version(D_Version2) | |
688 // const(MemberInfo[]) function(string) xgetMembers; | |
687 // TypeInfo typeinfo; // since dmd 1.045 | 689 // TypeInfo typeinfo; // since dmd 1.045 |
688 // } | 690 // } |
689 | 691 |
690 Logger::println("DtoDefineClassInfo(%s)", cd->toChars()); | 692 Logger::println("DtoDefineClassInfo(%s)", cd->toChars()); |
691 LOG_SCOPE; | 693 LOG_SCOPE; |
796 #endif // GENERATE_OFFTI | 798 #endif // GENERATE_OFFTI |
797 | 799 |
798 // default constructor | 800 // default constructor |
799 b.push_funcptr(cd->defaultCtor, Type::tvoid->pointerTo()); | 801 b.push_funcptr(cd->defaultCtor, Type::tvoid->pointerTo()); |
800 | 802 |
803 #if DMDV2 | |
804 | |
805 // xgetMembers | |
806 VarDeclaration* xgetVar = (VarDeclaration*)cinfo->fields.data[11]; | |
807 | |
808 // FIXME: fill it out! | |
809 b.push_null(xgetVar->type); | |
810 | |
811 #endif | |
812 | |
801 // typeinfo - since 1.045 | 813 // typeinfo - since 1.045 |
802 b.push_typeinfo(cd->type); | 814 b.push_typeinfo(cd->type); |
803 | |
804 #if DMDV2 | |
805 | |
806 // xgetMembers | |
807 VarDeclaration* xgetVar = (VarDeclaration*)cinfo->fields.data[11]; | |
808 | |
809 // FIXME: fill it out! | |
810 b.push_null(xgetVar->type); | |
811 | |
812 #endif | |
813 | 815 |
814 /*size_t n = inits.size(); | 816 /*size_t n = inits.size(); |
815 for (size_t i=0; i<n; ++i) | 817 for (size_t i=0; i<n; ++i) |
816 { | 818 { |
817 Logger::cout() << "inits[" << i << "]: " << *inits[i] << '\n'; | 819 Logger::cout() << "inits[" << i << "]: " << *inits[i] << '\n'; |