diff options
author | Arash Rouhani <rarash@student.chalmers.se> | 2014-02-06 09:10:03 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2014-04-29 20:34:08 +0100 |
commit | 05fcc3331622995015ccba17ae333b9a0fc9bb77 (patch) | |
tree | 4ec19e3f80db51a979019cc505db180f48e70972 /rts/sm/Scav.c | |
parent | 43b3bab38eafef8c02a09fb4ff1e757f5cba6073 (diff) | |
download | haskell-05fcc3331622995015ccba17ae333b9a0fc9bb77.tar.gz |
Rts: Reuse scavenge_small_bitmap (#8742)
The function was inlined at two places already. And the function is
having the STATIC_INLINE annotation, so the assembly output should.
be the same.
To convince myself, I did diff the output of the object files before
and after the patch and they matched on my 64-bit Ubuntu 13.10 machine,
running gcc 4.8.1-10ubuntu9.
Also, I had to move scavenge_small_bitmap up a bit since it's not in any
.h-file.
While I was at it, I also applied the analogous patch for Compact.c.
Though I had to write `thread_small_bitmap` instead of just moving it.
Diffstat (limited to 'rts/sm/Scav.c')
-rw-r--r-- | rts/sm/Scav.c | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/rts/sm/Scav.c b/rts/sm/Scav.c index 5cf4cfa27b..b9f8f1259b 100644 --- a/rts/sm/Scav.c +++ b/rts/sm/Scav.c @@ -168,6 +168,20 @@ static StgPtr scavenge_mut_arr_ptrs_marked (StgMutArrPtrs *a) return (StgPtr)a + mut_arr_ptrs_sizeW(a); } +STATIC_INLINE StgPtr +scavenge_small_bitmap (StgPtr p, StgWord size, StgWord bitmap) +{ + while (size > 0) { + if ((bitmap & 1) == 0) { + evacuate((StgClosure **)p); + } + p++; + bitmap = bitmap >> 1; + size--; + } + return p; +} + /* ----------------------------------------------------------------------------- Blocks of function args occur on the stack (at the top) and in PAPs. @@ -195,14 +209,7 @@ scavenge_arg_block (StgFunInfoTable *fun_info, StgClosure **args) bitmap = BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]); size = BITMAP_SIZE(stg_arg_bitmaps[fun_info->f.fun_type]); small_bitmap: - while (size > 0) { - if ((bitmap & 1) == 0) { - evacuate((StgClosure **)p); - } - p++; - bitmap = bitmap >> 1; - size--; - } + p = scavenge_small_bitmap(p, size, bitmap); break; } return p; @@ -234,14 +241,7 @@ scavenge_PAP_payload (StgClosure *fun, StgClosure **payload, StgWord size) default: bitmap = BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]); small_bitmap: - while (size > 0) { - if ((bitmap & 1) == 0) { - evacuate((StgClosure **)p); - } - p++; - bitmap = bitmap >> 1; - size--; - } + p = scavenge_small_bitmap(p, size, bitmap); break; } return p; @@ -1765,19 +1765,6 @@ scavenge_large_bitmap( StgPtr p, StgLargeBitmap *large_bitmap, StgWord size ) } } -STATIC_INLINE StgPtr -scavenge_small_bitmap (StgPtr p, StgWord size, StgWord bitmap) -{ - while (size > 0) { - if ((bitmap & 1) == 0) { - evacuate((StgClosure **)p); - } - p++; - bitmap = bitmap >> 1; - size--; - } - return p; -} /* ----------------------------------------------------------------------------- scavenge_stack walks over a section of stack and evacuates all the |