~ chicken-core (chicken-5) 74561c9598d0acb97c328f9719827a2989607079


commit 74561c9598d0acb97c328f9719827a2989607079
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Fri Feb 12 10:10:36 2010 +0100
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Fri Feb 12 10:10:36 2010 +0100

    gc symbols in weak mode only if the plist is empty

diff --git a/c-backend.scm b/c-backend.scm
index 17c15e3e..edbd6438 100644
--- a/c-backend.scm
+++ b/c-backend.scm
@@ -853,6 +853,8 @@
 			 (unless direct (gen #t "C_word *a;"))
 			 (when looping (gen #t "loop:")) 
 			 (when (and direct (not unsafe) (not disable-stack-overflow-checking))
+			   ;;XXX this can be lifted out of the loop, if the procedure
+			   ;;    does not allocate (suggested by Benedikt Rosenau):
 			   (gen #t "C_stack_check;") ) ] )
 		  (when (and external (not unsafe) (not no-argc-checks) (not customizable))
 		    ;; (not customizable) implies empty-closure
diff --git a/runtime.c b/runtime.c
index 39f31da7..b225e15f 100644
--- a/runtime.c
+++ b/runtime.c
@@ -2810,7 +2810,7 @@ C_regparm void C_fcall C_reclaim(void *trampoline, void *proc)
 
     if(C_enable_gcweak) {
       /* Check entries in weak item table and recover items ref'd only
-      * once and which are unbound symbols: */
+      * once, which are unbound symbols and have an empty property-lists: */
       weakn = 0;
       wep = weak_item_table;
 
@@ -2820,7 +2820,9 @@ C_regparm void C_fcall C_reclaim(void *trampoline, void *proc)
 	    item = fptr_to_ptr(item);
 	    container = wep->container & ~WEAK_COUNTER_MASK;
 
-	    if(C_header_bits(item) == C_SYMBOL_TYPE && C_u_i_car(item) == C_SCHEME_UNBOUND) {
+	    if(C_header_bits(item) == C_SYMBOL_TYPE && 
+	       C_block_item(item, 0) == C_SCHEME_UNBOUND &&
+	       C_block_item(item, 2) == C_SCHEME_END_OF_LIST) {
 	      ++weakn;
 #ifdef PARANOIA
 	      item = C_u_i_cdr(item);
Trap