Ticket #8590: tmp.diff

File tmp.diff, 8.1 KB (added by parcs, 18 months ago)
  • compiler/cmm/CLabel.hs

    diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs
    index 1b86f3d..a9c28d9 100644
    a b module CLabel ( 
    6060        mkTopTickyCtrLabel, 
    6161        mkCAFBlackHoleInfoTableLabel, 
    6262        mkCAFBlackHoleEntryLabel, 
     63        mkCAFInfoTableLabel, 
    6364        mkRtsPrimOpLabel, 
    6465        mkRtsSlowFastTickyCtrLabel, 
    6566 
    mkDirty_MUT_VAR_Label, mkSplitMarkerLabel, mkUpdInfoLabel, 
    402403    mkBHUpdInfoLabel, mkIndStaticInfoLabel, mkMainCapabilityLabel, 
    403404    mkMAP_FROZEN_infoLabel, mkMAP_DIRTY_infoLabel, 
    404405    mkEMPTY_MVAR_infoLabel, mkTopTickyCtrLabel, 
    405     mkCAFBlackHoleInfoTableLabel, mkCAFBlackHoleEntryLabel :: CLabel 
     406    mkCAFBlackHoleInfoTableLabel, mkCAFBlackHoleEntryLabel, 
     407    mkCAFInfoTableLabel :: CLabel 
    406408mkDirty_MUT_VAR_Label           = mkForeignLabel (fsLit "dirty_MUT_VAR") Nothing ForeignLabelInExternalPackage IsFunction 
    407409mkSplitMarkerLabel              = CmmLabel rtsPackageId (fsLit "__stg_split_marker")    CmmCode 
    408410mkUpdInfoLabel                  = CmmLabel rtsPackageId (fsLit "stg_upd_frame")         CmmInfo 
    mkEMPTY_MVAR_infoLabel = CmmLabel rtsPackageId (fsLit "stg_EMPTY_MVAR") 
    415417mkTopTickyCtrLabel              = CmmLabel rtsPackageId (fsLit "top_ct")                CmmData 
    416418mkCAFBlackHoleInfoTableLabel    = CmmLabel rtsPackageId (fsLit "stg_CAF_BLACKHOLE")     CmmInfo 
    417419mkCAFBlackHoleEntryLabel        = CmmLabel rtsPackageId (fsLit "stg_CAF_BLACKHOLE")     CmmEntry 
     420mkCAFInfoTableLabel             = CmmLabel rtsPackageId (fsLit "stg_CAF")               CmmInfo 
    418421 
    419422----- 
    420423mkCmmInfoLabel,   mkCmmEntryLabel, mkCmmRetInfoLabel, mkCmmRetLabel, 
  • compiler/cmm/SMRep.lhs

    diff --git a/compiler/cmm/SMRep.lhs b/compiler/cmm/SMRep.lhs
    index 0185aba..01e03ec 100644
    a b module SMRep ( 
    2424 
    2525        -- ** Construction 
    2626        mkHeapRep, blackHoleRep, indStaticRep, mkStackRep, mkRTSRep, 
     27        cafRep, 
    2728 
    2829        -- ** Predicates 
    2930        isStaticRep, isConRep, isThunkRep, isFunRep, isStaticNoCafCon, 
    blackHoleRep = HeapRep False 0 0 BlackHole 
    221222indStaticRep :: SMRep 
    222223indStaticRep = HeapRep True 1 0 IndStatic 
    223224 
     225cafRep :: SMRep 
     226cafRep = HeapRep True 0 0 Thunk 
     227 
    224228----------------------------------------------------------------------------- 
    225229-- Predicates 
    226230 
  • compiler/codeGen/StgCmmBind.hs

    diff --git a/compiler/codeGen/StgCmmBind.hs b/compiler/codeGen/StgCmmBind.hs
    index 2336792..d088a5b 100644
    a b cgTopRhsClosure dflags rec id ccs _ upd_flag args body = 
    9292         let closure_rep   = mkStaticClosureFields dflags 
    9393                                    indStaticInfoTable ccs MayHaveCafRefs 
    9494                                    [unLit (idInfoToAmode cg_info)] 
     95                                    [] 
    9596         emitDataLits closure_label closure_rep 
    9697         return () 
    9798 
    cgTopRhsClosure dflags rec id ccs _ upd_flag args body = 
    104105 
    105106              caffy         = idCafInfo id 
    106107              info_tbl      = mkCmmInfo closure_info -- XXX short-cut 
    107               closure_rep   = mkStaticClosureFields dflags info_tbl ccs caffy [] 
     108              fun_rep       = mkStaticClosureFields dflags info_tbl ccs caffy [] [] 
     109              thunk_rep     = mkStaticClosureFields dflags 
     110                                    cafInfoTable ccs caffy 
     111                                    [] 
     112                                    [CmmLabel (cit_lbl info_tbl)] 
    108113 
    109114                 -- BUILD THE OBJECT, AND GENERATE INFO TABLE (IF NECESSARY) 
    110         ; emitDataLits closure_label closure_rep 
     115        ; emitDataLits closure_label (if null args then thunk_rep else fun_rep) 
    111116        ; let fv_details :: [(NonVoid Id, VirtualHpOffset)] 
    112117              (_, _, fv_details) = mkVirtHeapOffsets dflags (isLFThunk lf_info) 
    113118                                               (addIdReps []) 
    closureCodeBody :: Bool -- whether this is a top-level binding 
    451456  There info if Node points to closure is available. -- HWL -} 
    452457 
    453458closureCodeBody top_lvl bndr cl_info cc _args arity body fv_details 
    454   | arity == 0 -- No args i.e. thunk 
     459  -- no need for specialized thunk code anymore - only the 
     460  -- info table differs 
     461  | False, arity == 0 -- No args i.e. thunk 
    455462  = withNewTickyCounterThunk (isStaticClosure cl_info) (closureName cl_info) $ 
    456463    emitClosureProcAndInfoTable top_lvl bndr lf_info info_tbl [] $ 
    457464      \(_, node, _) -> thunkCode cl_info fv_details cc node arity body 
  • compiler/codeGen/StgCmmClosure.hs

    diff --git a/compiler/codeGen/StgCmmClosure.hs b/compiler/codeGen/StgCmmClosure.hs
    index af9c7b8..0de9538 100644
    a b module StgCmmClosure ( 
    5656        mkDataConInfoTable, 
    5757        cafBlackHoleInfoTable, 
    5858        indStaticInfoTable, 
     59        cafInfoTable, 
    5960        staticClosureNeedsLink, 
    6061    ) where 
    6162 
    indStaticInfoTable 
    946947                 , cit_prof = NoProfilingInfo 
    947948                 , cit_srt  = NoC_SRT } 
    948949 
     950cafInfoTable :: CmmInfoTable 
     951cafInfoTable 
     952  = CmmInfoTable { cit_lbl  = mkCAFInfoTableLabel 
     953                 , cit_rep  = cafRep 
     954                 , cit_prof = NoProfilingInfo 
     955                 , cit_srt  = NoC_SRT } 
     956 
    949957staticClosureNeedsLink :: Bool -> CmmInfoTable -> Bool 
    950958-- A static closure needs a link field to aid the GC when traversing 
    951959-- the static closure graph.  But it only needs such a field if either 
  • compiler/codeGen/StgCmmCon.hs

    diff --git a/compiler/codeGen/StgCmmCon.hs b/compiler/codeGen/StgCmmCon.hs
    index eb00bbf..92e06ac 100644
    a b cgTopRhsCon dflags id con args = 
    9696                             dontCareCCS                -- Because it's static data 
    9797                             caffy                      -- Has CAF refs 
    9898                             payload 
     99                             [] 
    99100 
    100101                -- BUILD THE OBJECT 
    101102        ; emitDataLits closure_label closure_rep 
  • compiler/codeGen/StgCmmHeap.hs

    diff --git a/compiler/codeGen/StgCmmHeap.hs b/compiler/codeGen/StgCmmHeap.hs
    index 55ddfd4..ba4ddbb 100644
    a b mkStaticClosureFields 
    158158        -> CostCentreStack 
    159159        -> CafInfo 
    160160        -> [CmmLit]             -- Payload 
     161        -> [CmmLit] 
    161162        -> [CmmLit]             -- The full closure 
    162 mkStaticClosureFields dflags info_tbl ccs caf_refs payload 
     163mkStaticClosureFields dflags info_tbl ccs caf_refs payload saved_info 
    163164  = mkStaticClosure dflags info_lbl ccs payload padding 
    164165        static_link_field saved_info_field 
    165166  where 
    mkStaticClosureFields dflags info_tbl ccs caf_refs payload 
    190191        = [] 
    191192 
    192193    saved_info_field 
    193         | is_caf     = [mkIntCLit dflags 0] 
    194         | otherwise  = [] 
     194        | is_caf && null saved_info = [mkIntCLit dflags 0] 
     195        | otherwise = saved_info 
    195196 
    196197        -- For a static constructor which has NoCafRefs, we set the 
    197198        -- static link field to a non-zero value so the garbage 
  • rts/StgMiscClosures.cmm

    diff --git a/rts/StgMiscClosures.cmm b/rts/StgMiscClosures.cmm
    index 450b2d9..2c3df41 100644
    a b INFO_TABLE(stg_IND_PERM,1,0,IND_PERM,"IND_PERM","IND_PERM") 
    294294    jump %GET_ENTRY(R1) [R1]; 
    295295} 
    296296 
     297INFO_TABLE(stg_CAF, 0, 0, THUNK_STATIC, "CAF", "CAF") 
     298    (P_ node) 
     299{ 
     300    P_ bh; 
     301    W_ info; 
     302 
     303    STK_CHK_GEN(); 
     304 
     305    info = StgIndStatic_saved_info(node); 
     306 
     307    ("ptr" bh) = ccall newCAF(BaseReg "ptr", node "ptr"); 
     308    if (bh == 0) { 
     309        jump %GET_ENTRY(node) (); 
     310    } else { 
     311        push (stg_bh_upd_frame_info, bh) { 
     312            jump (%ENTRY_CODE(info)) (); 
     313        } 
     314    } 
     315} 
     316 
     317 
    297318/* ---------------------------------------------------------------------------- 
    298319   Black holes. 
    299320 
  • utils/deriveConstants/DeriveConstants.hs

    diff --git a/utils/deriveConstants/DeriveConstants.hs b/utils/deriveConstants/DeriveConstants.hs
    index 10df61c..2b88179 100644
    a b wanteds = concat 
    443443 
    444444          ,closureFieldGcptr C "StgInd" "indirectee" 
    445445 
     446          ,closureField C "StgIndStatic" "saved_info" 
     447 
    446448          ,closureSize  C "StgMutVar" 
    447449          ,closureField C "StgMutVar" "var" 
    448450