*** empty log message ***
authorHan-Wen Nienhuys <hanwen@lilypond.org>
Sat, 11 Jun 2005 01:48:19 +0000 (01:48 +0000)
committerHan-Wen Nienhuys <hanwen@lilypond.org>
Sat, 11 Jun 2005 01:48:19 +0000 (01:48 +0000)
INSTALL
ice-9/ChangeLog
ice-9/boot-9.scm
libguile/ChangeLog
libguile/gc.c
libguile/modules.c
libguile/modules.h
test-suite/ChangeLog
test-suite/tests/gc.test
test-suite/tests/hash.test

diff --git a/INSTALL b/INSTALL
index 095b1eb..56b077d 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -1,7 +1,7 @@
 Installation Instructions
 *************************
 
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004 Free
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
 Software Foundation, Inc.
 
 This file is free documentation; the Free Software Foundation gives
@@ -189,8 +189,13 @@ them in the `configure' command line, using `VAR=value'.  For example:
 
      ./configure CC=/usr/local2/bin/gcc
 
-will cause the specified gcc to be used as the C compiler (unless it is
-overridden in the site shell script).
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).  Here is a another example:
+
+     /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
+configuration-related scripts to be executed by `/bin/bash'.
 
 `configure' Invocation
 ======================
index 111dd02..a4b6a41 100644 (file)
@@ -1,3 +1,9 @@
+2005-06-10  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * boot-9.scm (set-module-eval-closure!): remove
+       set-procedure-property! closure 'module. Setting this property
+       causes un-gc-able modules.
+
 2005-06-05  Marius Vollmer  <mvo@zagadka.de>
 
        * boot-9.scm (substring-fill!): New, for compatability.
index 5314d7d..7a91485 100644 (file)
 
 (define (environment-module env)
   (let ((closure (and (pair? env) (car (last-pair env)))))
-    (and closure (procedure-property closure 'module))))
+    (and closure (eval-closure-module closure))))
 
 \f
 
   (let ((setter (record-modifier module-type 'eval-closure)))
     (lambda (module closure)
       (setter module closure)
-      ;; Make it possible to lookup the module from the environment.
-      ;; This implementation is correct since an eval closure can belong
-      ;; to maximally one module.
-      (set-procedure-property! closure 'module module))))
+      
+      ;; do not set procedure properties on closures.
+      ;; since procedure properties are weak-hashes, they cannot
+      ;; have cyclical data, otherwise the data cannot be GC-ed.
+      )))
 
 \f
 
               (exports '())
               (re-exports '())
               (replacements '()))
+
       (if (null? kws)
          (call-with-deferred-observers
           (lambda ()
index 62a70f0..d637cba 100644 (file)
@@ -1,3 +1,12 @@
+2005-06-10  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * modules.c (s_scm_eval_closure_module): new function. Return the
+       module inside an eval-closure.
+
+       * gc.c (scm_init_storage): make scm_stand_in_procs a weak_key hash
+       table. This means that procedure properties are GC'd if the
+       procedure dies.
+
 2005-06-11  Kevin Ryde  <user42@zip.com.au>
 
        * srfi-13.c (scm_string_filter, scm_string_delete): For char and
index 039ae8e..b926911 100644 (file)
@@ -935,7 +935,7 @@ scm_init_storage ()
 
 #endif
 
-  scm_stand_in_procs = scm_c_make_hash_table (257);
+  scm_stand_in_procs = scm_make_weak_key_hash_table (scm_from_int (257));
   scm_permobjs = SCM_EOL;
   scm_protects = scm_c_make_hash_table (31);
   scm_gc_registered_roots = scm_c_make_hash_table (31);
index 557b33a..d2d1d44 100644 (file)
@@ -346,6 +346,19 @@ SCM_DEFINE (scm_standard_eval_closure, "standard-eval-closure", 1, 0, 0,
 }
 #undef FUNC_NAME
 
+
+SCM_DEFINE (scm_eval_closure_module, "eval-closure-module", 1, 0, 0,
+           (SCM closure),
+           "Return the module for @var{closure}.")
+#define FUNC_NAME s_scm_eval_closure_module
+{
+  SCM_ASSERT_TYPE(SCM_EVAL_CLOSURE_P (closure), closure, SCM_ARG1, FUNC_NAME, "eval-closure");
+  return SCM_PACK (SCM_CELL_WORD_1(closure));
+}
+#undef FUNC_NAME
+
+
 SCM_DEFINE (scm_standard_interface_eval_closure,
            "standard-interface-eval-closure", 1, 0, 0,
            (SCM module),
index abfe697..7b3d114 100644 (file)
@@ -98,6 +98,7 @@ SCM_API SCM scm_current_module_lookup_closure (void);
 SCM_API SCM scm_current_module_transformer (void);
 SCM_API SCM scm_eval_closure_lookup (SCM eclo, SCM sym, SCM definep);
 SCM_API SCM scm_standard_eval_closure (SCM module);
+SCM_API SCM scm_eval_closure_module (SCM closure);
 SCM_API SCM scm_standard_interface_eval_closure (SCM module);
 SCM_API SCM scm_get_pre_modules_obarray (void);
 SCM_API SCM scm_lookup_closure_module (SCM proc);
index 7bdd98e..c4a468a 100644 (file)
@@ -1,3 +1,8 @@
+2005-06-10  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * tests/gc.test ("gc"): add a test to verify that modules are
+       garbage collected.
+
 2005-06-11  Kevin Ryde  <user42@zip.com.au>
 
        * tests/srfi-13.test (string-filter): A few more tests.
index 59c7f7c..c425e2d 100644 (file)
       (gc)
       (remove-hook! after-gc-hook thunk)
       foo)))
+
+
+(with-test-prefix "gc"
+  (pass-if "Unused modules are removed"
+          (let*
+              ((dummy (gc))
+               (last-count (cdr (assoc
+                                 "eval-closure" (gc-live-object-stats)))))
+              
+            (for-each (lambda (x) (make-module)) (iota 1000))
+            (gc)
+            (gc) ;; twice: have to kill the weak vectors.
+            (= last-count (cdr (assoc "eval-closure" (gc-live-object-stats)))))
+          ))
index 5846974..2c589a0 100644 (file)
@@ -65,7 +65,6 @@
 ;;;
 ;;; hashx-remove!
 ;;;
-
 (with-test-prefix "hashx-remove!"
   (pass-if (->bool (object-documentation hashx-remove!)))