From 361d631fb7353c575b0ca05f26fec21eb91a8679 Mon Sep 17 00:00:00 2001 From: Mikael Djurfeldt Date: Thu, 23 Jan 2003 20:31:38 +0000 Subject: [PATCH] * futures.c (mark_futures): Don't need to mark data of recycled futures. (scan_futures, cleanup_undead): Be smarter about marking futures---avoid unnecessary passes through future lists. --- libguile/ChangeLog | 5 +++++ libguile/futures.c | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index c1c982a8a..851215dd9 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,5 +1,10 @@ 2003-01-23 Mikael Djurfeldt + * futures.c (mark_futures): Don't need to mark data of recycled + futures. + (scan_futures, cleanup_undead): Be smarter about marking + futures---avoid unnecessary passes through future lists. + * futures.h, futures.c: New files; Introduced recycling of futures. For fine-grained threading this lifts performance to another level. We can now use parallelization in inner loops of diff --git a/libguile/futures.c b/libguile/futures.c index fefd93121..826eacd3b 100644 --- a/libguile/futures.c +++ b/libguile/futures.c @@ -290,6 +290,7 @@ cleanup_undead () scm_cond_signal (SCM_FUTURE_COND (next)); scm_mutex_unlock (SCM_FUTURE_MUTEX (next)); next: + SCM_SET_GC_MARK (next); nextloc = SCM_FUTURE_NEXTLOC (next); next = *nextloc; } @@ -309,7 +310,6 @@ mark_futures (SCM futures) { while (!SCM_NULLP (futures)) { - scm_gc_mark (SCM_FUTURE_DATA (futures)); SCM_SET_GC_MARK (futures); futures = SCM_FUTURE_NEXT (futures); } @@ -329,6 +329,8 @@ scan_futures (void *dummy1, void *dummy2, void *dummy3) young = SCM_EOL; last_switch = now; } + else + mark_futures (young); next = futures; nextloc = &futures; @@ -352,15 +354,14 @@ scan_futures (void *dummy1, void *dummy2, void *dummy3) { SCM future; UNLINK (next, future); + SCM_SET_GC_MARK (future); LINK (young, future); } } *nextloc = SCM_EOL; exit: cleanup_undead (); - mark_futures (young); mark_futures (old); - mark_futures (undead); return 0; } -- 2.20.1