Commit 14064836 authored by's avatar
Browse files

Fix copyArray# bug in old code generator

parent a94144b8
......@@ -994,11 +994,12 @@ emitCopyArray copy src0 src_off0 dst0 dst_off0 n0 live = do
dflags <- getDynFlags
-- Assign the arguments to temporaries so the code generator can
-- calculate liveness for us.
n <- assignTemp_ n0
emitIf (cmmNeWord dflags n (CmmLit (mkIntCLit dflags 0))) $ do
src <- assignTemp_ src0
src_off <- assignTemp_ src_off0
dst <- assignTemp_ dst0
dst_off <- assignTemp_ dst_off0
n <- assignTemp_ n0
-- Set the dirty bit in the header.
stmtC (setInfo dst (CmmLit (CmmLabel mkMAP_DIRTY_infoLabel)))
......@@ -1065,14 +1066,16 @@ emitCloneArray info_p res_r src0 src_off0 n0 live = do
-- | Takes and offset in the destination array, the base address of
-- the card table, and the number of elements affected (*not* the
-- number of cards). Marks the relevant cards as dirty.
-- number of cards). The number of elements may not be zero.
-- Marks the relevant cards as dirty.
emitSetCards :: CmmExpr -> CmmExpr -> CmmExpr -> StgLiveVars -> Code
emitSetCards dst_start dst_cards_start n live = do
dflags <- getDynFlags
start_card <- assignTemp $ card dflags dst_start
let end_card = card dflags (cmmAddWord dflags dst_start n)
emitMemsetCall (cmmAddWord dflags dst_cards_start start_card)
(CmmLit (mkIntCLit dflags 1))
(cardRoundUp dflags n)
(cmmAddWord dflags (cmmSubWord dflags end_card start_card) (CmmLit (mkIntCLit dflags 1)))
(CmmLit (mkIntCLit dflags 1)) -- no alignment (1 byte)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment