summaryrefslogtreecommitdiff
path: root/rts/sm/MarkWeak.c
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2016-11-29 16:51:30 -0500
committerBen Gamari <ben@smart-cactus.org>2016-11-29 16:51:30 -0500
commit428e152be6bb0fd3867e41cee82a6d5968a11a26 (patch)
treee43d217c10c052704f872cd7e1df4d335c12d376 /rts/sm/MarkWeak.c
parent56d74515396c8b6360ba7898cbc4b68f0f1fb2ea (diff)
downloadhaskell-428e152be6bb0fd3867e41cee82a6d5968a11a26.tar.gz
Use C99's bool
Test Plan: Validate on lots of platforms Reviewers: erikd, simonmar, austin Reviewed By: erikd, simonmar Subscribers: michalt, thomie Differential Revision: https://phabricator.haskell.org/D2699
Diffstat (limited to 'rts/sm/MarkWeak.c')
-rw-r--r--rts/sm/MarkWeak.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/rts/sm/MarkWeak.c b/rts/sm/MarkWeak.c
index 7e3e1d5818..e7dfd6e57c 100644
--- a/rts/sm/MarkWeak.c
+++ b/rts/sm/MarkWeak.c
@@ -84,8 +84,8 @@ StgWeak *dead_weak_ptr_list;
StgTSO *resurrected_threads;
static void collectDeadWeakPtrs (generation *gen);
-static rtsBool tidyWeakList (generation *gen);
-static rtsBool resurrectUnreachableThreads (generation *gen);
+static bool tidyWeakList (generation *gen);
+static bool resurrectUnreachableThreads (generation *gen);
static void tidyThreadList (generation *gen);
void
@@ -104,15 +104,15 @@ initWeakForGC(void)
resurrected_threads = END_TSO_QUEUE;
}
-rtsBool
+bool
traverseWeakPtrList(void)
{
- rtsBool flag = rtsFalse;
+ bool flag = false;
switch (weak_stage) {
case WeakDone:
- return rtsFalse;
+ return false;
case WeakThreads:
/* Now deal with the gen->threads lists, which behave somewhat like
@@ -130,18 +130,18 @@ traverseWeakPtrList(void)
// key is reachable):
for (g = 0; g <= N; g++) {
if (tidyWeakList(&generations[g])) {
- flag = rtsTrue;
+ flag = true;
}
}
// if we evacuated anything new, we must scavenge thoroughly
// before we can determine which threads are unreachable.
- if (flag) return rtsTrue;
+ if (flag) return true;
// Resurrect any threads which were unreachable
for (g = 0; g <= N; g++) {
if (resurrectUnreachableThreads(&generations[g])) {
- flag = rtsTrue;
+ flag = true;
}
}
@@ -151,7 +151,7 @@ traverseWeakPtrList(void)
// if we evacuated anything new, we must scavenge thoroughly
// before entering the WeakPtrs stage.
- if (flag) return rtsTrue;
+ if (flag) return true;
// otherwise, fall through...
}
@@ -164,7 +164,7 @@ traverseWeakPtrList(void)
// alive, so traverse those lists again:
for (g = 0; g <= N; g++) {
if (tidyWeakList(&generations[g])) {
- flag = rtsTrue;
+ flag = true;
}
}
@@ -172,7 +172,7 @@ traverseWeakPtrList(void)
* the dead weak pointers. The dead_weak_ptr list is used as a list
* of pending finalizers later on.
*/
- if (flag == rtsFalse) {
+ if (flag == false) {
for (g = 0; g <= N; g++) {
collectDeadWeakPtrs(&generations[g]);
}
@@ -180,12 +180,12 @@ traverseWeakPtrList(void)
weak_stage = WeakDone; // *now* we're done,
}
- return rtsTrue; // but one more round of scavenging, please
+ return true; // but one more round of scavenging, please
}
default:
barf("traverse_weak_ptr_list");
- return rtsTrue;
+ return true;
}
}
@@ -205,10 +205,10 @@ static void collectDeadWeakPtrs (generation *gen)
}
}
-static rtsBool resurrectUnreachableThreads (generation *gen)
+static bool resurrectUnreachableThreads (generation *gen)
{
StgTSO *t, *tmp, *next;
- rtsBool flag = rtsFalse;
+ bool flag = false;
for (t = gen->old_threads; t != END_TSO_QUEUE; t = next) {
next = t->global_link;
@@ -226,18 +226,18 @@ static rtsBool resurrectUnreachableThreads (generation *gen)
evacuate((StgClosure **)&tmp);
tmp->global_link = resurrected_threads;
resurrected_threads = tmp;
- flag = rtsTrue;
+ flag = true;
}
}
return flag;
}
-static rtsBool tidyWeakList(generation *gen)
+static bool tidyWeakList(generation *gen)
{
StgWeak *w, **last_w, *next_w;
const StgInfoTable *info;
StgClosure *new;
- rtsBool flag = rtsFalse;
+ bool flag = false;
last_w = &gen->old_weak_ptr_list;
for (w = gen->old_weak_ptr_list; w != NULL; w = next_w) {
@@ -267,7 +267,7 @@ static rtsBool tidyWeakList(generation *gen)
new_gen = Bdescr((P_)w)->gen;
gct->evac_gen_no = new_gen->no;
- gct->failed_to_evac = rtsFalse;
+ gct->failed_to_evac = false;
// evacuate the fields of the weak ptr
scavengeLiveWeak(w);
@@ -276,7 +276,7 @@ static rtsBool tidyWeakList(generation *gen)
debugTrace(DEBUG_weak,
"putting weak pointer %p into mutable list",
w);
- gct->failed_to_evac = rtsFalse;
+ gct->failed_to_evac = false;
recordMutableGen_GC((StgClosure *)w, new_gen->no);
}
@@ -287,7 +287,7 @@ static rtsBool tidyWeakList(generation *gen)
// and put it on the correct weak ptr list.
w->link = new_gen->weak_ptr_list;
new_gen->weak_ptr_list = w;
- flag = rtsTrue;
+ flag = true;
if (gen->no != new_gen->no) {
debugTrace(DEBUG_weak,