Changeset 2139

Show
Ignore:
Timestamp:
11/08/10 21:09:52 (2 years ago)
Author:
walter
Message:

bugzilla 690 ABI not fully documented

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/docsrc/abi.dd

    r2132 r2139  
    9292 
    9393$(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)) 
    9696$(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)) 
    98100) 
    99101 
     
    101103 
    102104$(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    ) 
    107133 
    108134    $(P The class definition:) 
     
    182208    $(P Associative arrays consist of a pointer to an opaque, implementation 
    183209    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).) 
    185214    ) 
    186215) 
  • trunk/docsrc/doc.ddoc

    r2073 r2139  
    158158    $(TOCENTRY interface.html, Interfaces) 
    159159    $(TOCENTRY enum.html, Enums) 
    160     $(TOCENTRY const3.html, Const and Immutable
     160    $(TOCENTRY const3.html, Const and Invariant
    161161    $(TOCENTRY function.html, Functions) 
    162162    $(TOCENTRY operatoroverloading.html, Operator Overloading) 
     
    384384DUMPOBJ=$(LINK2 http://www.digitalmars.com/ctg/dumpobj.html, dumpobj) 
    385385SHELL=$(LINK2 http://www.digitalmars.com/ctg/shell.html, shell) 
     386PHOBOSSRC=$(LINK2 http://www.dsource.org/projects/phobos/browser/trunk/phobos/$0, $0) 
     387DRUNTIMESRC=$(LINK2 http://www.dsource.org/projects/druntime/browser/trunk/src/$0, $0) 
    386388DOLLAR=$ 
    387389