Changes between Version 13 and Version 14 of Commentary/ResourceLimits


Ignore:
Timestamp:
Sep 2, 2013 3:27:33 AM (8 months ago)
Author:
ezyang
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/ResourceLimits

    v13 v14  
    11= Resource Limits = 
    22 
    3 This page describes a proposed resource limits capabilities for GHC. The idea is to give users the ability to create and utilize cost-centres inside programs (so that cost-centres do not necessarily have to be tied to source code locations), and then provide in-program access to heap census and other information. The end result is the ability to impose resource limits on space usage, as well as a side-effect of more precise profiling. 
     3This page describes a proposed resource limits capabilities for GHC. The idea is to give users the ability to create and utilize resource containers inside programs, and then provide in-program access to heap census and other information. The semantics of resource containers are quite similar to cost centers used in profiling, except that they do not have "stack" semantics (more on this later). The end result is the ability to impose resource limits on space usage. 
     4 
     5== Code generation changes == 
     6 
     7Resource limits is a new way (similar to profiled and dynamic). Here are the relevant changes: 
     8 
     9=== Dynamic closure allocation === 
     10 
     11[[GhcFile(compiler/codeGen/StgCmmHeap.hs)]]:allocDynClosureCmm (via StgCmmCon, also handles StgCmmBind:mkRhsClosure/cgRhsStdThunk. link_caf needs special treatment.) 
     12 
     13{{{ 
     14// profDynAlloc rep use_cc 
     15// use_cc == CurCCS 
     16         I64[CCCS + 72] = I64[CCCS + 72] + %MO_UU_Conv_W64_W64(4 - 2); 
     17// ALLOCATE THE OBJECT 
     18// emitSetDynHdr base info_ptr use_cc 
     19         I64[Hp - 24] = Data.Maybe.Just_con_info; // info_ptr 
     20         I64[Hp - 16] = CCCS;                     // use_cc 
     21         I64[Hp - 8] = (%MO_UU_Conv_W32_W64(I32[era]) << 30) | 0; // dynLdvInit 
     22// let (cmm_args, offsets) = unzip amodes_w_offsets 
     23// hpStore base cmm_args offsets 
     24         I64[Hp + 0] = I64[R1 + 32]; 
     25}}} 
     26 
     27Changes to: 
     28 
     29{{{ 
     30// invariant: Hp points to nursery of current resource container 
     31         I64[Hp - 8] = Data.Maybe.Just_con_info; // info_ptr 
     32         I64[Hp + 0] = I64[R1 + 32]; 
     33}}} 
     34 
     35=== CAF Allocation === 
     36 
     37[[GhcFile(compiler/codeGen/StgCmmBind.hs)]]:link_caf 
     38 
     39 
     40**Warning:** The rest of this document describes an old iteration of the system, which directly used  
    441 
    542== Front-end changes ==