Skip to content

Instantly share code, notes, and snippets.

@Tarrasch
Created February 13, 2014 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tarrasch/8976269 to your computer and use it in GitHub Desktop.
Save Tarrasch/8976269 to your computer and use it in GitHub Desktop.
diff --git a/rts/sm/Compact.c b/rts/sm/Compact.c
index e9973d3..cdb487b 100644
--- a/rts/sm/Compact.c
+++ b/rts/sm/Compact.c
@@ -248,6 +248,20 @@ thread_large_bitmap( StgPtr p, StgLargeBitmap *large_bitmap, W_ size )
}
STATIC_INLINE StgPtr
+thread_small_bitmap (StgPtr p, nat 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,6 +283,9 @@ 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:
+#if defined(use_function_yay)
+ p = thread_small_bitmap(p, size, bitmap);
+#elif defined(explicit_yay)
while (size > 0) {
if ((bitmap & 1) == 0) {
thread((StgClosure **)p);
@@ -277,6 +294,9 @@ thread_arg_block (StgFunInfoTable *fun_info, StgClosure **args)
bitmap = bitmap >> 1;
size--;
}
+#else
+#error("Please define one of these symbols! :) ")
+#endif
break;
}
return p;
@@ -315,6 +335,9 @@ 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.
+#if defined(use_function_yay)
+ p = thread_small_bitmap(p, size, bitmap);
+#elif defined(explicit_yay)
while (size > 0) {
if ((bitmap & 1) == 0) {
thread((StgClosure **)p);
@@ -323,6 +346,9 @@ thread_stack(StgPtr p, StgPtr stack_end)
bitmap = bitmap >> 1;
size--;
}
+#else
+#error("Please define one of these symbols! :) ")
+#endif
continue;
case RET_BCO: {
@@ -395,6 +421,9 @@ thread_PAP_payload (StgClosure *fun, StgClosure **payload, StgWord size)
default:
bitmap = BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]);
small_bitmap:
+#if defined(use_function_yay)
+ p = thread_small_bitmap(p, size, bitmap);
+#elif defined(explicit_yay)
while (size > 0) {
if ((bitmap & 1) == 0) {
thread((StgClosure **)p);
@@ -403,6 +432,9 @@ thread_PAP_payload (StgClosure *fun, StgClosure **payload, StgWord size)
bitmap = bitmap >> 1;
size--;
}
+#else
+#error("Please define one of these symbols! :) ")
+#endif
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment