Changeset 2139
- Timestamp:
- 11/08/10 21:09:52 (2 years ago)
- Files:
-
- trunk/docsrc/abi.dd (modified) (3 diffs)
- trunk/docsrc/doc.ddoc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/docsrc/abi.dd
r2132 r2139 92 92 93 93 $(TABLE2 Class Object Layout, 94 $(TR $(TH offset) $(TH property) $(TH contents))95 $(TR $(TD 0) $(TD $(CODE .__vptr)) $(TD pointer to vtable))94 $(TR $(TH size) $(TH property) $(TH contents)) 95 $(TR $(TD $(I ptrsize)) $(TD $(CODE .__vptr)) $(TD pointer to vtable)) 96 96 $(TR $(TD $(I ptrsize)) $(TD $(CODE .__monitor)) $(TD monitor)) 97 $(TR $(TD $(I ptrsize*2)...) $(TD named members ) $(TD non-static members)) 97 $(TR $(TD ...) $(TD ...) $(TD super's non-static fields and super's interface vptrs, from least to most derived)) 98 $(TR $(TD ...) $(TD named fields) $(TD non-static fields)) 99 $(TR $(TD $(I ptrsize)...) $(TD ) $(TD vptr's for any interfaces implemented by this class in left to right, most to least derived, order)) 98 100 ) 99 101 … … 101 103 102 104 $(TABLE2 Virtual Function Pointer Table Layout, 103 $(TR $(TH offset) $(TH contents)) 104 $(TR $(TD 0) $(TD pointer to instance of ClassInfo)) 105 $(TR $(TD $(I ptrsize)...) $(TD pointers to virtual member functions)) 106 ) 105 $(TR $(TH size) $(TH contents)) 106 $(TR $(TD $(I ptrsize)) $(TD pointer to instance of $(V1 ClassInfo)$(V2 TypeInfo))) 107 $(TR $(TD $(I ptrsize)...) $(TD pointers to virtual member functions)) 108 ) 109 110 $(P Casting a class object to an interface consists of adding the offset of 111 the interface's corresponding vptr to the address of the base of the object. 112 Casting an interface ptr back to the class type it came from involves getting 113 the correct offset to subtract from it from the object.Interface entry at vtbl[0]. 114 Adjustor thunks are created and pointers to them stored in the method entries in the vtbl[] 115 in order to set the this pointer to the start of the object instance corresponding 116 to the implementing method. 117 ) 118 119 $(P An adjustor thunk looks like:) 120 121 $(CCODE 122 ADD EAX,offset 123 JMP method 124 ) 125 126 $(P The leftmost side of the inheritance graph of the interfaces all share 127 their vptrs, this is the single inheritance model. 128 Every time the inheritance graph forks (for multiple inheritance) a new vptr is created 129 and stored in the class' instance. 130 Every time a virtual method is overridden, a new vtbl[] must be created with 131 the updated method pointers in it. 132 ) 107 133 108 134 $(P The class definition:) … … 182 208 $(P Associative arrays consist of a pointer to an opaque, implementation 183 209 defined type. 184 The current implementation is contained in phobos/internal/aaA.d. 210 $(V1 The current implementation is contained in and defined by 211 $(PHOBOSSRC internal/aaA.d).) 212 $(V2 The current implementation is contained in and defined by 213 $(DRUNTIMESRC rt/aaA.d).) 185 214 ) 186 215 ) trunk/docsrc/doc.ddoc
r2073 r2139 158 158 $(TOCENTRY interface.html, Interfaces) 159 159 $(TOCENTRY enum.html, Enums) 160 $(TOCENTRY const3.html, Const and I mmutable)160 $(TOCENTRY const3.html, Const and Invariant) 161 161 $(TOCENTRY function.html, Functions) 162 162 $(TOCENTRY operatoroverloading.html, Operator Overloading) … … 384 384 DUMPOBJ=$(LINK2 http://www.digitalmars.com/ctg/dumpobj.html, dumpobj) 385 385 SHELL=$(LINK2 http://www.digitalmars.com/ctg/shell.html, shell) 386 PHOBOSSRC=$(LINK2 http://www.dsource.org/projects/phobos/browser/trunk/phobos/$0, $0) 387 DRUNTIMESRC=$(LINK2 http://www.dsource.org/projects/druntime/browser/trunk/src/$0, $0) 386 388 DOLLAR=$ 387 389
