summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÖmer Sinan Ağacan <omer@well-typed.com>2019-02-05 11:46:25 -0500
committerBen Gamari <ben@smart-cactus.org>2019-10-20 21:15:37 -0400
commit04471c4f9037065c274736a3693cba116db7bcb9 (patch)
treed0f579fab8fb7cb2237d69c7f3d383ac31d1658d
parent4be5152a04fe8cdeac896a934c64fea0590aacb8 (diff)
downloadhaskell-04471c4f9037065c274736a3693cba116db7bcb9.tar.gz
rts/Scav: Expose scavenging functions
To keep the non-moving collector nicely separated from the moving collector its scavenging phase will live in another file, `NonMovingScav.c`. However, it will need to use these functions so let's expose them.
-rw-r--r--rts/sm/Scav.c28
-rw-r--r--rts/sm/Scav.h14
2 files changed, 31 insertions, 11 deletions
diff --git a/rts/sm/Scav.c b/rts/sm/Scav.c
index c486cd96c5..b50dff38fb 100644
--- a/rts/sm/Scav.c
+++ b/rts/sm/Scav.c
@@ -63,8 +63,6 @@
#include "sm/MarkWeak.h"
-static void scavenge_stack (StgPtr p, StgPtr stack_end);
-
static void scavenge_large_bitmap (StgPtr p,
StgLargeBitmap *large_bitmap,
StgWord size );
@@ -76,6 +74,14 @@ static void scavenge_large_bitmap (StgPtr p,
# define scavenge_block(a) scavenge_block1(a)
# define scavenge_mutable_list(bd,g) scavenge_mutable_list1(bd,g)
# define scavenge_capability_mut_lists(cap) scavenge_capability_mut_Lists1(cap)
+# define scavengeTSO(tso) scavengeTSO1(tso)
+# define scavenge_stack(p, stack_end) scavenge_stack1(p, stack_end)
+# define scavenge_fun_srt(info) scavenge_fun_srt1(info)
+# define scavenge_fun_srt(info) scavenge_fun_srt1(info)
+# define scavenge_thunk_srt(info) scavenge_thunk_srt1(info)
+# define scavenge_mut_arr_ptrs(info) scavenge_mut_arr_ptrs1(info)
+# define scavenge_PAP(pap) scavenge_PAP1(pap)
+# define scavenge_AP(ap) scavenge_AP1(ap)
#endif
static void do_evacuate(StgClosure **p, void *user STG_UNUSED)
@@ -87,7 +93,7 @@ static void do_evacuate(StgClosure **p, void *user STG_UNUSED)
Scavenge a TSO.
-------------------------------------------------------------------------- */
-static void
+void
scavengeTSO (StgTSO *tso)
{
bool saved_eager;
@@ -198,7 +204,7 @@ scavenge_compact(StgCompactNFData *str)
Mutable arrays of pointers
-------------------------------------------------------------------------- */
-static StgPtr scavenge_mut_arr_ptrs (StgMutArrPtrs *a)
+StgPtr scavenge_mut_arr_ptrs (StgMutArrPtrs *a)
{
W_ m;
bool any_failed;
@@ -348,14 +354,14 @@ scavenge_PAP_payload (StgClosure *fun, StgClosure **payload, StgWord size)
return p;
}
-STATIC_INLINE GNUC_ATTR_HOT StgPtr
+GNUC_ATTR_HOT StgPtr
scavenge_PAP (StgPAP *pap)
{
evacuate(&pap->fun);
return scavenge_PAP_payload (pap->fun, pap->payload, pap->n_args);
}
-STATIC_INLINE StgPtr
+StgPtr
scavenge_AP (StgAP *ap)
{
evacuate(&ap->fun);
@@ -366,7 +372,7 @@ scavenge_AP (StgAP *ap)
Scavenge SRTs
-------------------------------------------------------------------------- */
-STATIC_INLINE GNUC_ATTR_HOT void
+GNUC_ATTR_HOT void
scavenge_thunk_srt(const StgInfoTable *info)
{
StgThunkInfoTable *thunk_info;
@@ -380,7 +386,7 @@ scavenge_thunk_srt(const StgInfoTable *info)
}
}
-STATIC_INLINE GNUC_ATTR_HOT void
+GNUC_ATTR_HOT void
scavenge_fun_srt(const StgInfoTable *info)
{
StgFunInfoTable *fun_info;
@@ -1570,10 +1576,10 @@ static void
scavenge_mutable_list(bdescr *bd, generation *gen)
{
StgPtr p, q;
- uint32_t gen_no;
- gen_no = gen->no;
+ uint32_t gen_no = gen->no;
gct->evac_gen_no = gen_no;
+
for (; bd != NULL; bd = bd->link) {
for (q = bd->start; q < bd->free; q++) {
p = (StgPtr)*q;
@@ -1795,7 +1801,7 @@ scavenge_large_bitmap( StgPtr p, StgLargeBitmap *large_bitmap, StgWord size )
AP_STACK_UPDs, since these are just sections of copied stack.
-------------------------------------------------------------------------- */
-static void
+void
scavenge_stack(StgPtr p, StgPtr stack_end)
{
const StgRetInfoTable* info;
diff --git a/rts/sm/Scav.h b/rts/sm/Scav.h
index 21ca691bff..644aa32b8f 100644
--- a/rts/sm/Scav.h
+++ b/rts/sm/Scav.h
@@ -17,10 +17,24 @@
void scavenge_loop (void);
void scavenge_capability_mut_lists (Capability *cap);
+void scavengeTSO (StgTSO *tso);
+void scavenge_stack (StgPtr p, StgPtr stack_end);
+void scavenge_fun_srt (const StgInfoTable *info);
+void scavenge_thunk_srt (const StgInfoTable *info);
+StgPtr scavenge_mut_arr_ptrs (StgMutArrPtrs *a);
+StgPtr scavenge_PAP (StgPAP *pap);
+StgPtr scavenge_AP (StgAP *ap);
#if defined(THREADED_RTS)
void scavenge_loop1 (void);
void scavenge_capability_mut_Lists1 (Capability *cap);
+void scavengeTSO1 (StgTSO *tso);
+void scavenge_stack1 (StgPtr p, StgPtr stack_end);
+void scavenge_fun_srt1 (const StgInfoTable *info);
+void scavenge_thunk_srt1 (const StgInfoTable *info);
+StgPtr scavenge_mut_arr_ptrs1 (StgMutArrPtrs *a);
+StgPtr scavenge_PAP1 (StgPAP *pap);
+StgPtr scavenge_AP1 (StgAP *ap);
#endif
#include "EndPrivate.h"