Changes between Version 20 and Version 21 of Commentary/Rts/Storage/HeapObjects


Ignore:
Timestamp:
Mar 8, 2013 4:13:41 AM (2 years ago)
Author:
ezyang
Comment:

link up

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Rts/Storage/HeapObjects

    v20 v21  
    435435There are quite a lot of files to touch if you add a heap object. Here is an (incomplete!) list: 
    436436 
    437  * [source:includes/rts/storage/ClosureTypes.h]: Add the new closure type 
    438  * [source:rts/ClosureFlags.c]: Update the closure flags (see [source:includes/rts/storage/InfoTables.h] for info on what the flags mean "Closure flags") 
    439  * [source:includes/rts/storage/Closures.h]: Define a struct for the closure, including the ''header'' as well as your payloads 
    440  * [source:includes/rts/storage/ClosureMacros.h]: Add a case to ''closure_sizeW'' 
    441  * [source:includes/stg/MiscClosures.h]: Add an ''RTS_ENTRY'' for all your new types. 
    442  * [source:rts/Linker.c]: if you have any "RTS internal" info tables, for example, a DIRTY header 
    443  * [source:rts/Printer.c]: print out a description of the closure 
    444  * [source:rts/StgMiscClosures.cmm]: actually define the info tables for your objects, also, provide entry points if they represent runnable code 
    445  * [source:rts/sm/Sanity.c]: update sanity checks for your closure 
    446  * [source:rts/sm/Scav.c], [source:rts/sm/Evac.c], [source:rts/sm/Compact.c]: teach the garbage collector how to follow live pointers from your object 
    447  * [source:rts/LdvProfile.c], [source:rts/RetainerProfile.c], [source:rts/ProfHeap.c]: teach the profiler how to recognize your closure 
    448  * If you add any nullary closures (e.g. END_TSO_QUEUE), you need to register these too: 
    449    * [source:includes/stg/MiscClosures.h]: Add an ''RTS_CLOSURE'' for the closure 
    450    * [source:includes/Cmm.h]: so you can refer to it from C-- code 
     437 * [[GhcFile(includes/rts/storage/ClosureTypes.h)]]: Add the new closure type 
     438 * [[GhcFile(includes/rts/storage/Closures.h)]]: Define a struct for the closure, including the ''header'' as well as your payloads. Sometimes, you will have more than one info table per struct, e.g. if you have {{{DIRTY}}} and {{{CLEAN}}} variants. 
     439 * [[GhcFile(includes/rts/storage/ClosureMacros.h)]]: Add a case to {{{closure_sizeW}}} for your struct. However, if your structure is really simple (i.e. can be completely described by the info table, an entry here is not necessary. 
     440 * [[GhcFile(includes/stg/MiscClosures.h)]]: Define your info tables with {{{RTS_ENTRY}}}. 
     441 * [[GhcFile(rts/ClosureFlags.c)]]: Update the closure flags (see [[GhcFile(includes/rts/storage/InfoTables.h)]] for info on what the flags mean "Closure flags") and the sanity check at the bottom of the file 
     442 * [[GhcFile(rts/Linker.c)]]: Add your info tables so they are linked correctly 
     443 * [[GhcFile(rts/Printer.c)]]: Print out a description of the closure. You need to handle all of the info tables you defined. 
     444 * [[GhcFile(rts/StgMiscClosures.cmm)]]: Actually define the info tables for your objects, also, provide entry points if they represent runnable code 
     445 * [[GhcFile(rts/sm/Sanity.c)]]: Update sanity checks so they know about your new closure type 
     446 * [[GhcFile(rts/sm/Scav.c)]], [[GhcFile(rts/sm/Evac.c)]], [[GhcFile(rts/sm/Compact.c)]]: teach the garbage collector how to follow live pointers from your object. 
     447 * [[GhcFile(rts/LdvProfile.c)]], [[GhcFile(rts/RetainerProfile.c)]], [[GhcFile(rts/ProfHeap.c)]]: teach the profiler how to recognize your closure 
     448 * If you add any nullary closures (e.g. {{{END_TSO_QUEUE}}}), you need to register these too: 
     449   * [[GhcFile(includes/stg/MiscClosures.h)]]: Add an ''RTS_CLOSURE'' for the closure 
     450   * [[GhcFile(includes/Cmm.h)]]: so you can refer to it from C-- code 
    451451 
    452452When in doubt, look at how an existing heap object similar to the one you are implementing is implemented. (Of course, if they're identical, why are you defining a new heap object...)