changeset 1643:763f577d57b0

[xemacs-hg @ 2003-08-25 20:53:58 by crestani] 2003-08-25 Marcus Crestani <crestani@informatik.uni-tuebingen.de> * alloc.c (kkcc_gc_stack_init): (kkcc_gc_stack_free): (kkcc_gc_stack_realloc): (kkcc_gc_stack_full): (kkcc_gc_stack_empty): (kkcc_gc_stack_push): (kkcc_gc_stack_pop): Remove kkcc_gc_stack_count. (mark_object_maybe_checking_free): Push on stack instead of marking. (garbage_collect_1): Invoke kkcc_marking after finish_marking_*.
author crestani
date Mon, 25 Aug 2003 20:53:59 +0000
parents 793259f54fc4
children 14a7222dba6d
files src/ChangeLog src/alloc.c
diffstat 2 files changed, 26 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sun Aug 24 21:52:37 2003 +0000
+++ b/src/ChangeLog	Mon Aug 25 20:53:59 2003 +0000
@@ -1,3 +1,15 @@
+2003-08-25  Marcus Crestani  <crestani@informatik.uni-tuebingen.de>
+
+	* alloc.c (kkcc_gc_stack_init):
+	(kkcc_gc_stack_free):
+	(kkcc_gc_stack_realloc):
+	(kkcc_gc_stack_full):
+	(kkcc_gc_stack_empty):
+	(kkcc_gc_stack_push):
+	(kkcc_gc_stack_pop): Remove kkcc_gc_stack_count.
+	(mark_object_maybe_checking_free): Push on stack instead of marking.
+	(garbage_collect_1): Invoke kkcc_marking after finish_marking_*.
+	
 2003-08-21  Jerry James  <james@xemacs.org>
 
 	* lrecord.h (DECLARE_MODULE_API_LRECORD): Also define when not
--- a/src/alloc.c	Sun Aug 24 21:52:37 2003 +0000
+++ b/src/alloc.c	Mon Aug 25 20:53:59 2003 +0000
@@ -2962,8 +2962,8 @@
 
 static kkcc_gc_stack_entry *kkcc_gc_stack_ptr;
 static kkcc_gc_stack_entry *kkcc_gc_stack_top;
+static kkcc_gc_stack_entry *kkcc_gc_stack_last_entry;
 static int kkcc_gc_stack_size;
-static int kkcc_gc_stack_count;
 
 static void
 kkcc_gc_stack_init (void)
@@ -2977,7 +2977,7 @@
       exit(23);
     }
   kkcc_gc_stack_top = kkcc_gc_stack_ptr - 1;
-  kkcc_gc_stack_count = 0;
+  kkcc_gc_stack_last_entry = kkcc_gc_stack_ptr + kkcc_gc_stack_size - 1;
 }
 
 static void
@@ -2992,6 +2992,7 @@
 static void
 kkcc_gc_stack_realloc (void)
 {
+  int current_offset = (int)(kkcc_gc_stack_top - kkcc_gc_stack_ptr);
   kkcc_gc_stack_size *= 2;
   kkcc_gc_stack_ptr = (kkcc_gc_stack_entry *)
     realloc (kkcc_gc_stack_ptr, 
@@ -3001,13 +3002,14 @@
       stderr_out ("stack realloc failed for size %d\n", kkcc_gc_stack_size);
       exit(23);
     }
-  kkcc_gc_stack_top = kkcc_gc_stack_ptr + kkcc_gc_stack_count - 1;
+  kkcc_gc_stack_top = kkcc_gc_stack_ptr + current_offset;
+  kkcc_gc_stack_last_entry = kkcc_gc_stack_ptr + kkcc_gc_stack_size - 1;
 }
 
 static int
 kkcc_gc_stack_full (void)
 {
-  if (kkcc_gc_stack_count > (kkcc_gc_stack_size - 1))
+  if (kkcc_gc_stack_top >= kkcc_gc_stack_last_entry)
     return 1;
   return 0;
 }
@@ -3015,7 +3017,7 @@
 static int
 kkcc_gc_stack_empty (void)
 {
-  if (kkcc_gc_stack_count == 0)
+  if (kkcc_gc_stack_top < kkcc_gc_stack_ptr)
     return 1;
   return 0;
 }
@@ -3025,9 +3027,7 @@
 {
   if (kkcc_gc_stack_full ())
       kkcc_gc_stack_realloc();
-
   kkcc_gc_stack_top++;
-  kkcc_gc_stack_count++;
   kkcc_gc_stack_top->data = data;
   kkcc_gc_stack_top->desc = desc;
 }
@@ -3037,10 +3037,7 @@
 {
   if (kkcc_gc_stack_empty ())
     return 0;
-
   kkcc_gc_stack_top--;
-  kkcc_gc_stack_count--;
-
   return kkcc_gc_stack_top + 1;
 }
 
@@ -3329,7 +3326,8 @@
 #endif /* NOT USE_KKCC */
 }
 #else
-#define mark_object_maybe_checking_free(obj, allow_free) mark_object (obj)
+#define mark_object_maybe_checking_free(obj, allow_free) 	\
+      kkcc_gc_stack_push_lisp_object (obj)
 #endif /* ERROR_CHECK_GC */
 
 
@@ -4706,7 +4704,6 @@
 
 #ifdef USE_KKCC
   kkcc_marking ();
-  kkcc_gc_stack_free ();
 #endif /* USE_KKCC */
 
   /* At this point, we know which objects need to be finalized: we
@@ -4717,6 +4714,11 @@
 	 finish_marking_weak_hash_tables () > 0)
     ;
 
+#ifdef USE_KKCC
+  kkcc_marking ();
+  kkcc_gc_stack_free ();
+#endif /* USE_KKCC */
+
   /* And prune (this needs to be called after everything else has been
      marked and before we do any sweeping). */
   /* #### this is somewhat ad-hoc and should probably be an object