X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FGCCompact.c;h=8f61d73b5a583da995e5569f051ea3379cbd6efb;hb=423d477bfecd490de1449c59325c8776f91d7aac;hp=eaefcb746279f1611d77c209e24f1f237af0fc69;hpb=b3f530814c15886a7a010ed871bb1f054a3918b3;p=ghc-hetmet.git diff --git a/ghc/rts/GCCompact.c b/ghc/rts/GCCompact.c index eaefcb7..8f61d73 100644 --- a/ghc/rts/GCCompact.c +++ b/ghc/rts/GCCompact.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: GCCompact.c,v 1.14 2003/03/24 14:46:54 simonmar Exp $ + * $Id: GCCompact.c,v 1.19 2004/08/13 13:09:56 simonmar Exp $ * * (c) The GHC Team 2001 * @@ -16,14 +16,12 @@ #include "MBlock.h" #include "GCCompact.h" #include "Schedule.h" -#include "StablePriv.h" #include "Apply.h" // Turn off inlining when debugging - it obfuscates things #ifdef DEBUG -#define INLINE -#else -#define INLINE inline +# undef STATIC_INLINE +# define STATIC_INLINE static #endif /* ----------------------------------------------------------------------------- @@ -48,7 +46,7 @@ except for the info pointer. -------------------------------------------------------------------------- */ -static INLINE void +STATIC_INLINE void thread( StgPtr p ) { StgPtr q = (StgPtr)*p; @@ -71,7 +69,7 @@ thread( StgPtr p ) } } -static INLINE void +STATIC_INLINE void unthread( StgPtr p, StgPtr free ) { StgPtr q = (StgPtr)*p, r; @@ -85,7 +83,7 @@ unthread( StgPtr p, StgPtr free ) *p = (StgWord)q; } -static INLINE StgInfoTable * +STATIC_INLINE StgInfoTable * get_threaded_info( StgPtr p ) { StgPtr q = (P_)GET_INFO((StgClosure *)p); @@ -100,7 +98,7 @@ get_threaded_info( StgPtr p ) // A word-aligned memmove will be faster for small objects than libc's or gcc's. // Remember, the two regions *might* overlap, but: to <= from. -static INLINE void +STATIC_INLINE void move(StgPtr to, StgPtr from, nat size) { for(; size > 0; --size) { @@ -108,7 +106,7 @@ move(StgPtr to, StgPtr from, nat size) } } -static INLINE nat +STATIC_INLINE nat obj_sizeW( StgClosure *p, StgInfoTable *info ) { switch (info->type) { @@ -184,7 +182,7 @@ thread_static( StgClosure* p ) } } -static INLINE void +STATIC_INLINE void thread_large_bitmap( StgPtr p, StgLargeBitmap *large_bitmap, nat size ) { nat i, b; @@ -207,7 +205,7 @@ thread_large_bitmap( StgPtr p, StgLargeBitmap *large_bitmap, nat size ) } } -static INLINE StgPtr +STATIC_INLINE StgPtr thread_arg_block (StgFunInfoTable *fun_info, StgClosure **args) { StgPtr p; @@ -215,19 +213,19 @@ thread_arg_block (StgFunInfoTable *fun_info, StgClosure **args) nat size; p = (StgPtr)args; - switch (fun_info->fun_type) { + switch (fun_info->f.fun_type) { case ARG_GEN: - bitmap = BITMAP_BITS(fun_info->bitmap); - size = BITMAP_SIZE(fun_info->bitmap); + bitmap = BITMAP_BITS(fun_info->f.bitmap); + size = BITMAP_SIZE(fun_info->f.bitmap); goto small_bitmap; case ARG_GEN_BIG: - size = ((StgLargeBitmap *)fun_info->bitmap)->size; - thread_large_bitmap(p, (StgLargeBitmap *)fun_info->bitmap, size); + size = ((StgLargeBitmap *)fun_info->f.bitmap)->size; + thread_large_bitmap(p, (StgLargeBitmap *)fun_info->f.bitmap, size); p += size; break; default: - bitmap = BITMAP_BITS(stg_arg_bitmaps[fun_info->fun_type]); - size = BITMAP_SIZE(stg_arg_bitmaps[fun_info->fun_type]); + 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) { @@ -268,9 +266,9 @@ thread_stack(StgPtr p, StgPtr stack_end) dyn = ((StgRetDyn *)p)->liveness; // traverse the bitmap first - bitmap = GET_LIVENESS(dyn); + bitmap = RET_DYN_LIVENESS(dyn); p = (P_)&((StgRetDyn *)p)->payload[0]; - size = RET_DYN_SIZE; + size = RET_DYN_BITMAP_SIZE; while (size > 0) { if ((bitmap & 1) == 0) { thread(p); @@ -281,10 +279,10 @@ thread_stack(StgPtr p, StgPtr stack_end) } // skip over the non-ptr words - p += GET_NONPTRS(dyn); + p += RET_DYN_NONPTRS(dyn) + RET_DYN_NONPTR_REGS_SIZE; // follow the ptr words - for (size = GET_PTRS(dyn); size > 0; size--) { + for (size = RET_DYN_PTRS(dyn); size > 0; size--) { thread(p); p++; } @@ -317,8 +315,8 @@ thread_stack(StgPtr p, StgPtr stack_end) nat size; p++; - thread(p); bco = (StgBCO *)*p; + thread(p); p++; size = BCO_BITMAP_SIZE(bco); thread_large_bitmap(p, BCO_BITMAP(bco), size); @@ -340,7 +338,8 @@ thread_stack(StgPtr p, StgPtr stack_end) StgRetFun *ret_fun = (StgRetFun *)p; StgFunInfoTable *fun_info; - fun_info = itbl_to_fun_itbl(get_threaded_info(ret_fun->fun)); + fun_info = itbl_to_fun_itbl( + get_threaded_info((StgPtr)ret_fun->fun)); // *before* threading it! thread((StgPtr)&ret_fun->fun); p = thread_arg_block(fun_info, ret_fun->payload); @@ -354,25 +353,25 @@ thread_stack(StgPtr p, StgPtr stack_end) } } -static INLINE StgPtr +STATIC_INLINE StgPtr thread_PAP (StgPAP *pap) { StgPtr p; StgWord bitmap, size; StgFunInfoTable *fun_info; - fun_info = itbl_to_fun_itbl(get_threaded_info(pap->fun)); + fun_info = itbl_to_fun_itbl(get_threaded_info((StgPtr)pap->fun)); ASSERT(fun_info->i.type != PAP); p = (StgPtr)pap->payload; size = pap->n_args; - switch (fun_info->fun_type) { + switch (fun_info->f.fun_type) { case ARG_GEN: - bitmap = BITMAP_BITS(fun_info->bitmap); + bitmap = BITMAP_BITS(fun_info->f.bitmap); goto small_bitmap; case ARG_GEN_BIG: - thread_large_bitmap(p, (StgLargeBitmap *)fun_info->bitmap, size); + thread_large_bitmap(p, (StgLargeBitmap *)fun_info->f.bitmap, size); p += size; break; case ARG_BCO: @@ -380,7 +379,7 @@ thread_PAP (StgPAP *pap) p += size; break; default: - bitmap = BITMAP_BITS(stg_arg_bitmaps[fun_info->fun_type]); + bitmap = BITMAP_BITS(stg_arg_bitmaps[fun_info->f.fun_type]); small_bitmap: size = pap->n_args; while (size > 0) { @@ -398,7 +397,7 @@ thread_PAP (StgPAP *pap) return p; } -static INLINE StgPtr +STATIC_INLINE StgPtr thread_AP_STACK (StgAP_STACK *ap) { thread((StgPtr)&ap->fun); @@ -479,7 +478,7 @@ update_fwd_large( bdescr *bd ) } } -static INLINE StgPtr +STATIC_INLINE StgPtr thread_obj (StgInfoTable *info, StgPtr p) { switch (info->type) { @@ -609,6 +608,7 @@ thread_obj (StgInfoTable *info, StgPtr p) default: barf("update_fwd: unknown/strange object %d", (int)(info->type)); + return NULL; } }