projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[project @ 2004-08-06 11:33:06 by simonmar]
[ghc-hetmet.git]
/
ghc
/
rts
/
GCCompact.c
diff --git
a/ghc/rts/GCCompact.c
b/ghc/rts/GCCompact.c
index
16b8fb1
..
860c531
100644
(file)
--- a/
ghc/rts/GCCompact.c
+++ b/
ghc/rts/GCCompact.c
@@
-1,5
+1,5
@@
/* -----------------------------------------------------------------------------
/* -----------------------------------------------------------------------------
- * $Id: GCCompact.c,v 1.13 2002/12/11 15:36:42 simonmar Exp $
+ * $Id: GCCompact.c,v 1.18 2003/11/12 17:49:07 sof Exp $
*
* (c) The GHC Team 2001
*
*
* (c) The GHC Team 2001
*
@@
-19,6
+19,12
@@
#include "StablePriv.h"
#include "Apply.h"
#include "StablePriv.h"
#include "Apply.h"
+// Turn off inlining when debugging - it obfuscates things
+#ifdef DEBUG
+# undef STATIC_INLINE
+# define STATIC_INLINE static
+#endif
+
/* -----------------------------------------------------------------------------
Threading / unthreading pointers.
/* -----------------------------------------------------------------------------
Threading / unthreading pointers.
@@
-41,7
+47,7
@@
except for the info pointer.
-------------------------------------------------------------------------- */
except for the info pointer.
-------------------------------------------------------------------------- */
-static inline void
+STATIC_INLINE void
thread( StgPtr p )
{
StgPtr q = (StgPtr)*p;
thread( StgPtr p )
{
StgPtr q = (StgPtr)*p;
@@
-64,7
+70,7
@@
thread( StgPtr p )
}
}
}
}
-static inline void
+STATIC_INLINE void
unthread( StgPtr p, StgPtr free )
{
StgPtr q = (StgPtr)*p, r;
unthread( StgPtr p, StgPtr free )
{
StgPtr q = (StgPtr)*p, r;
@@
-78,7
+84,7
@@
unthread( StgPtr p, StgPtr free )
*p = (StgWord)q;
}
*p = (StgWord)q;
}
-static inline StgInfoTable *
+STATIC_INLINE StgInfoTable *
get_threaded_info( StgPtr p )
{
StgPtr q = (P_)GET_INFO((StgClosure *)p);
get_threaded_info( StgPtr p )
{
StgPtr q = (P_)GET_INFO((StgClosure *)p);
@@
-93,7
+99,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.
// 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) {
move(StgPtr to, StgPtr from, nat size)
{
for(; size > 0; --size) {
@@
-101,7
+107,7
@@
move(StgPtr to, StgPtr from, nat size)
}
}
}
}
-static inline nat
+STATIC_INLINE nat
obj_sizeW( StgClosure *p, StgInfoTable *info )
{
switch (info->type) {
obj_sizeW( StgClosure *p, StgInfoTable *info )
{
switch (info->type) {
@@
-136,6
+142,8
@@
obj_sizeW( StgClosure *p, StgInfoTable *info )
return mut_arr_ptrs_sizeW((StgMutArrPtrs*)p);
case TSO:
return tso_sizeW((StgTSO *)p);
return mut_arr_ptrs_sizeW((StgMutArrPtrs*)p);
case TSO:
return tso_sizeW((StgTSO *)p);
+ case BCO:
+ return bco_sizeW((StgBCO *)p);
default:
return sizeW_fromITBL(info);
}
default:
return sizeW_fromITBL(info);
}
@@
-175,7
+183,7
@@
thread_static( StgClosure* p )
}
}
}
}
-static inline void
+STATIC_INLINE void
thread_large_bitmap( StgPtr p, StgLargeBitmap *large_bitmap, nat size )
{
nat i, b;
thread_large_bitmap( StgPtr p, StgLargeBitmap *large_bitmap, nat size )
{
nat i, b;
@@
-198,7
+206,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;
thread_arg_block (StgFunInfoTable *fun_info, StgClosure **args)
{
StgPtr p;
@@
-261,7
+269,7
@@
thread_stack(StgPtr p, StgPtr stack_end)
// traverse the bitmap first
bitmap = GET_LIVENESS(dyn);
p = (P_)&((StgRetDyn *)p)->payload[0];
// traverse the bitmap first
bitmap = GET_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);
while (size > 0) {
if ((bitmap & 1) == 0) {
thread(p);
@@
-272,7
+280,7
@@
thread_stack(StgPtr p, StgPtr stack_end)
}
// skip over the non-ptr words
}
// skip over the non-ptr words
- p += GET_NONPTRS(dyn);
+ p += GET_NONPTRS(dyn) + RET_DYN_NONPTR_REGS_SIZE;
// follow the ptr words
for (size = GET_PTRS(dyn); size > 0; size--) {
// follow the ptr words
for (size = GET_PTRS(dyn); size > 0; size--) {
@@
-308,8
+316,8
@@
thread_stack(StgPtr p, StgPtr stack_end)
nat size;
p++;
nat size;
p++;
- thread(p);
bco = (StgBCO *)*p;
bco = (StgBCO *)*p;
+ thread(p);
p++;
size = BCO_BITMAP_SIZE(bco);
thread_large_bitmap(p, BCO_BITMAP(bco), size);
p++;
size = BCO_BITMAP_SIZE(bco);
thread_large_bitmap(p, BCO_BITMAP(bco), size);
@@
-331,7
+339,9
@@
thread_stack(StgPtr p, StgPtr stack_end)
StgRetFun *ret_fun = (StgRetFun *)p;
StgFunInfoTable *fun_info;
StgRetFun *ret_fun = (StgRetFun *)p;
StgFunInfoTable *fun_info;
- fun_info = get_fun_itbl(ret_fun->fun); // *before* threading it!
+ 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);
continue;
thread((StgPtr)&ret_fun->fun);
p = thread_arg_block(fun_info, ret_fun->payload);
continue;
@@
-344,15
+354,14
@@
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;
thread_PAP (StgPAP *pap)
{
StgPtr p;
StgWord bitmap, size;
StgFunInfoTable *fun_info;
- thread((StgPtr)&pap->fun);
- fun_info = get_fun_itbl(pap->fun);
+ fun_info = itbl_to_fun_itbl(get_threaded_info((StgPtr)pap->fun));
ASSERT(fun_info->i.type != PAP);
p = (StgPtr)pap->payload;
ASSERT(fun_info->i.type != PAP);
p = (StgPtr)pap->payload;
@@
-384,10
+393,12
@@
thread_PAP (StgPAP *pap)
}
break;
}
}
break;
}
+
+ thread((StgPtr)&pap->fun);
return p;
}
return p;
}
-static inline StgPtr
+STATIC_INLINE StgPtr
thread_AP_STACK (StgAP_STACK *ap)
{
thread((StgPtr)&ap->fun);
thread_AP_STACK (StgAP_STACK *ap)
{
thread((StgPtr)&ap->fun);
@@
-468,7
+479,7
@@
update_fwd_large( bdescr *bd )
}
}
}
}
-static inline StgPtr
+STATIC_INLINE StgPtr
thread_obj (StgInfoTable *info, StgPtr p)
{
switch (info->type) {
thread_obj (StgInfoTable *info, StgPtr p)
{
switch (info->type) {
@@
-504,12
+515,20
@@
thread_obj (StgInfoTable *info, StgPtr p)
thread((StgPtr)&((StgClosure *)p)->payload[1]);
return p + sizeofW(StgHeader) + 2;
thread((StgPtr)&((StgClosure *)p)->payload[1]);
return p + sizeofW(StgHeader) + 2;
+ case BCO: {
+ StgBCO *bco = (StgBCO *)p;
+ thread((StgPtr)&bco->instrs);
+ thread((StgPtr)&bco->literals);
+ thread((StgPtr)&bco->ptrs);
+ thread((StgPtr)&bco->itbls);
+ return p + bco_sizeW(bco);
+ }
+
case FUN:
case THUNK:
case CONSTR:
case FOREIGN:
case STABLE_NAME:
case FUN:
case THUNK:
case CONSTR:
case FOREIGN:
case STABLE_NAME:
- case BCO:
case IND_PERM:
case MUT_VAR:
case MUT_CONS:
case IND_PERM:
case MUT_VAR:
case MUT_CONS:
@@
-590,6
+609,7
@@
thread_obj (StgInfoTable *info, StgPtr p)
default:
barf("update_fwd: unknown/strange object %d", (int)(info->type));
default:
barf("update_fwd: unknown/strange object %d", (int)(info->type));
+ return NULL;
}
}
}
}