diff options
author | Simon Marlow <marlowsd@gmail.com> | 2013-11-29 10:32:26 +0000 |
---|---|---|
committer | Johan Tibell <johan.tibell@gmail.com> | 2014-03-11 20:01:54 +0100 |
commit | a70e7b4762c75812254f7781bcd48139c4ec40dd (patch) | |
tree | 0a1641c4edf3b78277f86cee225333d211b1f4af /compiler/codeGen/StgCmmBind.hs | |
parent | 22f010e08e58ba40b0ab59ec7a7c02cce0938cce (diff) | |
download | haskell-a70e7b4762c75812254f7781bcd48139c4ec40dd.tar.gz |
Represent offsets into heap objects with byte, not word, offsets
I'd like to be able to pack together non-pointer fields that are less
than a word in size, and this is a necessary prerequisite.
Diffstat (limited to 'compiler/codeGen/StgCmmBind.hs')
-rw-r--r-- | compiler/codeGen/StgCmmBind.hs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/compiler/codeGen/StgCmmBind.hs b/compiler/codeGen/StgCmmBind.hs index 4531903228..c29f47c7f4 100644 --- a/compiler/codeGen/StgCmmBind.hs +++ b/compiler/codeGen/StgCmmBind.hs @@ -286,7 +286,8 @@ mkRhsClosure dflags bndr _cc _bi -- Just want the layout maybe_offset = assocMaybe params_w_offsets (NonVoid selectee) Just the_offset = maybe_offset - offset_into_int = the_offset - fixedHdrSize dflags + offset_into_int = bytesToWordsRoundUp dflags the_offset + - fixedHdrSize dflags ---------- Note [Ap thunks] ------------------ mkRhsClosure dflags bndr _cc _bi @@ -341,7 +342,7 @@ mkRhsClosure dflags bndr cc _ fvs upd_flag args body ; dflags <- getDynFlags ; let name = idName bndr descr = closureDescription dflags mod_name name - fv_details :: [(NonVoid Id, VirtualHpOffset)] + fv_details :: [(NonVoid Id, ByteOff)] (tot_wds, ptr_wds, fv_details) = mkVirtHeapOffsets dflags (isLFThunk lf_info) (addIdReps (map unsafe_stripNV reduced_fvs)) @@ -434,7 +435,7 @@ closureCodeBody :: Bool -- whether this is a top-level binding -> [NonVoid Id] -- incoming args to the closure -> Int -- arity, including void args -> StgExpr - -> [(NonVoid Id, VirtualHpOffset)] -- the closure's free vars + -> [(NonVoid Id, ByteOff)] -- the closure's free vars -> FCode () {- There are two main cases for the code for closures. @@ -514,10 +515,10 @@ closureCodeBody top_lvl bndr cl_info cc args arity body fv_details -- A function closure pointer may be tagged, so we -- must take it into account when accessing the free variables. -bind_fv :: (NonVoid Id, VirtualHpOffset) -> FCode (LocalReg, WordOff) +bind_fv :: (NonVoid Id, ByteOff) -> FCode (LocalReg, ByteOff) bind_fv (id, off) = do { reg <- rebindToReg id; return (reg, off) } -load_fvs :: LocalReg -> LambdaFormInfo -> [(LocalReg, WordOff)] -> FCode () +load_fvs :: LocalReg -> LambdaFormInfo -> [(LocalReg, ByteOff)] -> FCode () load_fvs node lf_info = mapM_ (\ (reg, off) -> do dflags <- getDynFlags let tag = lfDynTag dflags lf_info @@ -551,7 +552,7 @@ mkSlowEntryCode bndr cl_info arg_regs -- function closure is already in `Node' | otherwise = return () ----------------------------------------- -thunkCode :: ClosureInfo -> [(NonVoid Id, VirtualHpOffset)] -> CostCentreStack +thunkCode :: ClosureInfo -> [(NonVoid Id, ByteOff)] -> CostCentreStack -> LocalReg -> Int -> StgExpr -> FCode () thunkCode cl_info fv_details _cc node arity body = do { dflags <- getDynFlags |