guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, master, updated. release_1-9-2-354-gdb


From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-2-354-gdb72398
Date: Tue, 15 Sep 2009 22:09:16 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=db723980a4b1e4d4d4d665283d1bc0b792c751bf

The branch, master has been updated
       via  db723980a4b1e4d4d4d665283d1bc0b792c751bf (commit)
       via  dddacb233ba4559dcfc4355b33706a32f77e5b64 (commit)
       via  238f9a4f72a1537d8be9a21c1140a368a118f85b (commit)
       via  a0faf7ddf9e260916aa1e64cc2ec48ac6925b2d6 (commit)
       via  aef9e3bd012fdf7b8fe126d89c48eb22019f0ec8 (commit)
       via  0a9a6d142269d54b572d19fb958309be2b5b8818 (commit)
      from  4c0fc0070257cff52d14b340b94d7d05c0ef7260 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit db723980a4b1e4d4d4d665283d1bc0b792c751bf
Author: Ludovic Courtès <address@hidden>
Date:   Tue Sep 15 23:54:09 2009 +0200

    Bump version number for 1.9.3.
    
    * GUILE-VERSION (GUILE_MICRO_VERSION): Increment.

commit dddacb233ba4559dcfc4355b33706a32f77e5b64
Author: Ludovic Courtès <address@hidden>
Date:   Tue Sep 15 23:48:01 2009 +0200

    Use fixnums for int32 when the native word size of greater than 4 bytes.
    
    This should also fix "condition is always true" warnings.
    
    * libguile/vm-i-scheme.c (bv_u32_native_ref, bv_s32_native_ref,
      bv_u32_native_set, bv_s32_native_set): Conditionalize use of
      `BV_FIXABLE_INT_REF' vs. `BV_INT_REF' based on `SIZEOF_VOID_P'.

commit 238f9a4f72a1537d8be9a21c1140a368a118f85b
Author: Ludovic Courtès <address@hidden>
Date:   Tue Sep 15 23:12:39 2009 +0200

    Keep the weak pair API internal.
    
    * libguile/weaks.h (scm_weak_car_pair, scm_weak_cdr_pair,
      scm_doubly_weak_pair): Make them internal.

commit a0faf7ddf9e260916aa1e64cc2ec48ac6925b2d6
Author: Ludovic Courtès <address@hidden>
Date:   Tue Sep 15 22:46:55 2009 +0200

    Fix bug #27450 ("Fat mutexes not GC'd until their owner dies").
    
    * libguile/threads.c (do_thread_exit): Deal with `t->mutexes' being a
      weak list.
      (fat_mutex_lock): Use weak-car pairs when building up `t->mutexes'.
    
    * test-suite/tests/threads.test ("mutex-ownership")["mutex with owner
      not retained (bug #27450)"]: New test.

commit aef9e3bd012fdf7b8fe126d89c48eb22019f0ec8
Author: Ludovic Courtès <address@hidden>
Date:   Tue Sep 15 22:33:03 2009 +0200

    Fix the (currently unused) weak pair accessors.
    
    * libguile/weaks.h (SCM_WEAK_PAIR_WORD): Fixed; changed to return
      `SCM_UNDEFINED' when the word has been nullified.

commit 0a9a6d142269d54b572d19fb958309be2b5b8818
Author: Ludovic Courtès <address@hidden>
Date:   Tue Sep 15 22:31:45 2009 +0200

    "Document" the `set-module-eval-closure!' weak hash table glitch.
    
    * module/ice-9/boot-9.scm (set-module-eval-closure!): Add link to an
      explanation.
    
    * test-suite/tests/gc.test ("gc")["Unused modules are removed"]:
      Increase the `cleanup' loop.

-----------------------------------------------------------------------

Summary of changes:
 GUILE-VERSION                 |    2 +-
 libguile/threads.c            |   26 +++++++++++++++++++-------
 libguile/vm-i-scheme.c        |   18 ++++++++++++++++--
 libguile/weaks.h              |   16 +++++++++-------
 module/ice-9/boot-9.scm       |    1 +
 test-suite/tests/gc.test      |    4 ++--
 test-suite/tests/threads.test |   18 ++++++++++++++++--
 7 files changed, 64 insertions(+), 21 deletions(-)

diff --git a/GUILE-VERSION b/GUILE-VERSION
index 80e2916..b47c620 100644
--- a/GUILE-VERSION
+++ b/GUILE-VERSION
@@ -2,7 +2,7 @@
 
 GUILE_MAJOR_VERSION=1
 GUILE_MINOR_VERSION=9
-GUILE_MICRO_VERSION=2
+GUILE_MICRO_VERSION=3
 
 GUILE_EFFECTIVE_VERSION=${GUILE_MAJOR_VERSION}.${GUILE_MINOR_VERSION}
 GUILE_VERSION=${GUILE_EFFECTIVE_VERSION}.${GUILE_MICRO_VERSION}
diff --git a/libguile/threads.c b/libguile/threads.c
index 174562f..8dce604 100644
--- a/libguile/threads.c
+++ b/libguile/threads.c
@@ -53,6 +53,7 @@
 #include "libguile/init.h"
 #include "libguile/scmsigs.h"
 #include "libguile/strings.h"
+#include "libguile/weaks.h"
 
 #ifdef __MINGW32__
 #ifndef ETIMEDOUT
@@ -440,14 +441,18 @@ do_thread_exit (void *v)
 
   while (!scm_is_null (t->mutexes))
     {
-      SCM mutex = SCM_CAR (t->mutexes);
-      fat_mutex *m  = SCM_MUTEX_DATA (mutex);
-      scm_i_pthread_mutex_lock (&m->lock);
+      SCM mutex = SCM_WEAK_PAIR_CAR (t->mutexes);
 
-      unblock_from_queue (m->waiting);
+      if (!SCM_UNBNDP (mutex))
+       {
+         fat_mutex *m  = SCM_MUTEX_DATA (mutex);
 
-      scm_i_pthread_mutex_unlock (&m->lock);
-      t->mutexes = SCM_CDR (t->mutexes);
+         scm_i_pthread_mutex_lock (&m->lock);
+         unblock_from_queue (m->waiting);
+         scm_i_pthread_mutex_unlock (&m->lock);
+       }
+
+      t->mutexes = SCM_WEAK_PAIR_CDR (t->mutexes);
     }
 
   scm_i_pthread_mutex_unlock (&t->admin_mutex);
@@ -1196,7 +1201,14 @@ fat_mutex_lock (SCM mutex, scm_t_timespec *timeout, SCM 
owner, int *ret)
            {
              scm_i_thread *t = SCM_I_THREAD_DATA (new_owner);
              scm_i_pthread_mutex_lock (&t->admin_mutex);
-             t->mutexes = scm_cons (mutex, t->mutexes);
+
+             /* Only keep a weak reference to MUTEX so that it's not
+                retained when not referenced elsewhere (bug #27450).  Note
+                that the weak pair itself it still retained, but it's better
+                than retaining MUTEX and the threads referred to by its
+                associated queue.  */
+             t->mutexes = scm_weak_car_pair (mutex, t->mutexes);
+
              scm_i_pthread_mutex_unlock (&t->admin_mutex);
            }
          *ret = 1;
diff --git a/libguile/vm-i-scheme.c b/libguile/vm-i-scheme.c
index 0cace14..b4aadf9 100644
--- a/libguile/vm-i-scheme.c
+++ b/libguile/vm-i-scheme.c
@@ -433,10 +433,17 @@ BV_FIXABLE_INT_REF (u16, u16_native, uint16, 2)
 VM_DEFINE_FUNCTION (142, bv_s16_native_ref, "bv-s16-native-ref", 2)
 BV_FIXABLE_INT_REF (s16, s16_native, int16, 2)
 VM_DEFINE_FUNCTION (143, bv_u32_native_ref, "bv-u32-native-ref", 2)
-/* FIXME: u32 is always a fixnum on 64-bit builds */
+#if SIZEOF_VOID_P > 4
+BV_FIXABLE_INT_REF (u32, u32_native, uint32, 4)
+#else
 BV_INT_REF (u32, uint32, 4)
+#endif
 VM_DEFINE_FUNCTION (144, bv_s32_native_ref, "bv-s32-native-ref", 2)
+#if SIZEOF_VOID_P > 4
+BV_FIXABLE_INT_REF (s32, s32_native, int32, 4)
+#else
 BV_INT_REF (s32, int32, 4)
+#endif
 VM_DEFINE_FUNCTION (145, bv_u64_native_ref, "bv-u64-native-ref", 2)
 BV_INT_REF (u64, uint64, 8)
 VM_DEFINE_FUNCTION (146, bv_s64_native_ref, "bv-s64-native-ref", 2)
@@ -541,10 +548,17 @@ BV_FIXABLE_INT_SET (u16, u16_native, uint16, 0, 
SCM_T_UINT16_MAX, 2)
 VM_DEFINE_INSTRUCTION (160, bv_s16_native_set, "bv-s16-native-set", 0, 3, 0)
 BV_FIXABLE_INT_SET (s16, s16_native, int16, SCM_T_INT16_MIN, SCM_T_INT16_MAX, 
2)
 VM_DEFINE_INSTRUCTION (161, bv_u32_native_set, "bv-u32-native-set", 0, 3, 0)
-/* FIXME: u32 is always a fixnum on 64-bit builds */
+#if SIZEOF_VOID_P > 4
+BV_FIXABLE_INT_SET (u32, u32_native, uint32, 0, SCM_T_UINT32_MAX, 4)
+#else
 BV_INT_SET (u32, uint32, 4)
+#endif
 VM_DEFINE_INSTRUCTION (162, bv_s32_native_set, "bv-s32-native-set", 0, 3, 0)
+#if SIZEOF_VOID_P > 4
+BV_FIXABLE_INT_SET (s32, s32_native, int32, SCM_T_INT32_MIN, SCM_T_INT32_MAX, 
4)
+#else
 BV_INT_SET (s32, int32, 4)
+#endif
 VM_DEFINE_INSTRUCTION (163, bv_u64_native_set, "bv-u64-native-set", 0, 3, 0)
 BV_INT_SET (u64, uint64, 8)
 VM_DEFINE_INSTRUCTION (164, bv_s64_native_set, "bv-s64-native-set", 0, 3, 0)
diff --git a/libguile/weaks.h b/libguile/weaks.h
index 908e276..eecc618 100644
--- a/libguile/weaks.h
+++ b/libguile/weaks.h
@@ -3,7 +3,7 @@
 #ifndef SCM_WEAKS_H
 #define SCM_WEAKS_H
 
-/* Copyright (C) 1995,1996,2000,2001, 2003, 2006, 2008 Free Software 
Foundation, Inc.
+/* Copyright (C) 1995,1996,2000,2001, 2003, 2006, 2008, 2009 Free Software 
Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -55,9 +55,9 @@
 
 /* Weak pairs.  */
 
-SCM_API SCM scm_weak_car_pair (SCM car, SCM cdr);
-SCM_API SCM scm_weak_cdr_pair (SCM car, SCM cdr);
-SCM_API SCM scm_doubly_weak_pair (SCM car, SCM cdr);
+SCM_INTERNAL SCM scm_weak_car_pair (SCM car, SCM cdr);
+SCM_INTERNAL SCM scm_weak_cdr_pair (SCM car, SCM cdr);
+SCM_INTERNAL SCM scm_doubly_weak_pair (SCM car, SCM cdr);
 
 /* Testing the weak component(s) of a cell for reachability.  */
 #define SCM_WEAK_PAIR_WORD_DELETED_P(_cell, _word)             \
@@ -71,10 +71,12 @@ SCM_API SCM scm_doubly_weak_pair (SCM car, SCM cdr);
   ((SCM_WEAK_PAIR_CAR_DELETED_P (_cell))       \
    || (SCM_WEAK_PAIR_CDR_DELETED_P (_cell)))
 
-/* Accessing the components of a weak cell.  */
+/* Accessing the components of a weak cell.  These return `SCM_UNDEFINED' if
+   the car/cdr has been collected.  */
 #define SCM_WEAK_PAIR_WORD(_cell, _word)               \
-  ((SCM_WEAK_PAIR_WORD_DELETED_P ((_cell), (_word)))   \
-   ? SCM_BOOL_F : SCM_CAR (pair))
+  (SCM_WEAK_PAIR_WORD_DELETED_P ((_cell), (_word))     \
+   ? SCM_UNDEFINED                                     \
+   : SCM_CELL_OBJECT ((_cell), (_word)))
 #define SCM_WEAK_PAIR_CAR(_cell)  (SCM_WEAK_PAIR_WORD ((_cell), 0))
 #define SCM_WEAK_PAIR_CDR(_cell)  (SCM_WEAK_PAIR_WORD ((_cell), 1))
 
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index e6824b9..b1bc3c9 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -1422,6 +1422,7 @@
       ;; XXX: The following line introduces a circular reference that
       ;; precludes garbage collection of modules with the current weak hash
       ;; table semantics (see
+      ;; http://lists.gnu.org/archive/html/guile-devel/2009-01/msg00102.html 
and
       ;; 
http://thread.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/2465
       ;; for details).  Since it doesn't appear to be used (only in
       ;; `scm_lookup_closure_module ()', which has 1 caller), we just comment
diff --git a/test-suite/tests/gc.test b/test-suite/tests/gc.test
index 063dad6..cf252ce 100644
--- a/test-suite/tests/gc.test
+++ b/test-suite/tests/gc.test
@@ -1,5 +1,5 @@
 ;;;; gc.test --- test guile's garbage collection    -*- scheme -*-
-;;;; Copyright (C) 2000, 2001, 2004, 2006, 2007, 2008 Free Software 
Foundation, Inc.
+;;;; Copyright (C) 2000, 2001, 2004, 2006, 2007, 2008, 2009 Free Software 
Foundation, Inc.
 ;;;;
 ;;;; This library is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU Lesser General Public
@@ -68,7 +68,7 @@
             ;; don't leave a reference to one of the modules we created.  It
             ;; proved to be useful on SPARC:
             ;; 
http://lists.gnu.org/archive/html/guile-devel/2008-02/msg00006.html .
-             (let cleanup ((i 10))
+             (let cleanup ((i 20))
                (and (> i 0)
                     (begin (cleanup (1- i)) i)))
 
diff --git a/test-suite/tests/threads.test b/test-suite/tests/threads.test
index 26efe85..58a2eba 100644
--- a/test-suite/tests/threads.test
+++ b/test-suite/tests/threads.test
@@ -1,6 +1,6 @@
 ;;;; threads.test --- Tests for Guile threading.    -*- scheme -*-
 ;;;;
-;;;; Copyright 2003, 2006, 2007 Free Software Foundation, Inc.
+;;;; Copyright 2003, 2006, 2007, 2009 Free Software Foundation, Inc.
 ;;;;
 ;;;; This library is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU Lesser General Public
@@ -363,7 +363,21 @@
         (pass-if "locking mutex with no owner"
          (let ((m (make-mutex)))
            (lock-mutex m #f #f)
-           (not (mutex-owner m)))))
+           (not (mutex-owner m))))
+
+        (pass-if "mutex with owner not retained (bug #27450)"
+          (let ((g (make-guardian)))
+            (g (let ((m (make-mutex))) (lock-mutex m) m))
+
+            ;; Avoid false references to M on the stack.
+            (let cleanup ((i 20))
+              (and (> i 0)
+                   (begin (cleanup (1- i)) i)))
+
+            (gc) (gc)
+            (let ((m (g)))
+              (and (mutex? m)
+                   (eq? (mutex-owner m) (current-thread)))))))
 
       ;;
       ;; mutex lock levels


hooks/post-receive
-- 
GNU Guile




reply via email to

[Prev in Thread] Current Thread [Next in Thread]