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


Ignore:
Timestamp:
Jan 26, 2013 10:09:09 AM (3 years ago)
Author:
ezyang
Comment:

--

Legend:

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

    v19 v20  
    430430
    431431{{{BLOCKED_FETCH}}}, {{{FETCH_ME}}}, {{{FETCH_ME_BQ}}}, {{{RBH}}}, {{{REMOTE_REF}}}
     432
     433== How to add new heap objects ==
     434
     435There are quite a lot of files to touch if you add a heap object. Here is an (incomplete!) list:
     436
     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
     451
     452When 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...)