comparison druntime/src/compiler/ldc/genobj.d @ 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 e0b2d67cfe7c
children
comparison
equal deleted inserted replaced
1462:f0423003caa6 1463:a5526b7a5ae6
149 string name; /// class name 149 string name; /// class name
150 void*[] vtbl; /// virtual function pointer table 150 void*[] vtbl; /// virtual function pointer table
151 Interface[] interfaces; /// interfaces this class implements 151 Interface[] interfaces; /// interfaces this class implements
152 ClassInfo base; /// base class 152 ClassInfo base; /// base class
153 void* destructor; 153 void* destructor;
154 void* classInvariant; 154 void(*classInvariant)(Object);
155 uint flags; 155 uint flags;
156 // 1: // is IUnknown or is derived from IUnknown 156 // 1: // is IUnknown or is derived from IUnknown
157 // 2: // has no possible pointers into GC memory 157 // 2: // has no possible pointers into GC memory
158 // 4: // has offTi[] member 158 // 4: // has offTi[] member
159 // 8: // has constructors 159 // 8: // has constructors
160 // 16: // has xgetMembers member 160 // 16: // has xgetMembers member
161 // 32: // has typeinfo member 161 // 32: // has typeinfo member
162 void* deallocator; 162 void* deallocator;
163 OffsetTypeInfo[] offTi; 163 OffsetTypeInfo[] offTi;
164 void* defaultConstructor; // default Constructor 164 void* defaultConstructor; // default Constructor
165 const(MemberInfo[]) function(in char[]) xgetMembers; 165 const(MemberInfo[]) function(string) xgetMembers;
166 TypeInfo typeinfo; 166 TypeInfo typeinfo;
167 167
168 /** 168 /**
169 * Search all modules for ClassInfo corresponding to classname. 169 * Search all modules for ClassInfo corresponding to classname.
170 * Returns: null if not found 170 * Returns: null if not found
205 205
206 /** 206 /**
207 * Search for all members with the name 'name'. 207 * Search for all members with the name 'name'.
208 * If name[] is null, return all members. 208 * If name[] is null, return all members.
209 */ 209 */
210 const(MemberInfo[]) getMembers(in char[] name) 210 const(MemberInfo[]) getMembers(string name)
211 { 211 {
212 if (flags & 16 && xgetMembers) 212 if (flags & 16 && xgetMembers)
213 return xgetMembers(name); 213 return xgetMembers(name);
214 return null; 214 return null;
215 } 215 }
228 /** 228 /**
229 * Runtime type information about a type. 229 * Runtime type information about a type.
230 * Can be retrieved for any type using a 230 * Can be retrieved for any type using a
231 * <a href="../expression.html#typeidexpression">TypeidExpression</a>. 231 * <a href="../expression.html#typeidexpression">TypeidExpression</a>.
232 */ 232 */
233 class TypeInfo 233 class TypeInfo : Object
234 { 234 {
235 override hash_t toHash() 235 override hash_t toHash()
236 { 236 {
237 hash_t hash; 237 hash_t hash;
238 238
879 void[] m_init; // initializer; init.ptr == null if 0 initialize 879 void[] m_init; // initializer; init.ptr == null if 0 initialize
880 880
881 hash_t function(in void*) xtoHash; 881 hash_t function(in void*) xtoHash;
882 equals_t function(in void*, in void*) xopEquals; 882 equals_t function(in void*, in void*) xopEquals;
883 int function(in void*, in void*) xopCmp; 883 int function(in void*, in void*) xopCmp;
884 char[] function(in void*) xtoString; 884 string function(in void*) xtoString;
885 885
886 uint m_flags; 886 uint m_flags;
887 887
888 const(MemberInfo[]) function(in char[]) xgetMembers; 888 const(MemberInfo[]) function(in char[]) xgetMembers;
889 void function(void*) xdtor; 889 void function(void*) xdtor;