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/Compact.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/Compact.c')
-rw-r--r-- | rts/sm/Compact.c | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/rts/sm/Compact.c b/rts/sm/Compact.c index 3731dd65e9..b07a886eab 100644 --- a/rts/sm/Compact.c +++ b/rts/sm/Compact.c @@ -248,6 +248,20 @@ thread_large_bitmap( StgPtr p, StgLargeBitmap *large_bitmap, StgWord size ) } STATIC_INLINE StgPtr +thread_small_bitmap (StgPtr p, StgWord size, StgWord bitmap) +{ + while (size > 0) { + if ((bitmap & 1) == 0) { + thread((StgClosure **)p); + } + p++; + bitmap = bitmap >> 1; + size--; + } + return p; +} + +STATIC_INLINE StgPtr thread_arg_block (StgFunInfoTable *fun_info, StgClosure **args) { StgPtr p; @@ -269,14 +283,7 @@ thread_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) { - thread((StgClosure **)p); - } - p++; - bitmap = bitmap >> 1; - size--; - } + p = thread_small_bitmap(p, size, bitmap); break; } return p; @@ -315,14 +322,7 @@ thread_stack(StgPtr p, StgPtr stack_end) p++; // NOTE: the payload starts immediately after the info-ptr, we // don't have an StgHeader in the same sense as a heap closure. - while (size > 0) { - if ((bitmap & 1) == 0) { - thread((StgClosure **)p); - } - p++; - bitmap = bitmap >> 1; - size--; - } + p = thread_small_bitmap(p, size, bitmap); continue; case RET_BCO: { @@ -394,14 +394,7 @@ thread_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) { - thread((StgClosure **)p); - } - p++; - bitmap = bitmap >> 1; - size--; - } + p = thread_small_bitmap(p, size, bitmap); break; } |