[uim-commit] r2487 - branches/r5rs/sigscheme

yamaken at freedesktop.org yamaken at freedesktop.org
Fri Dec 9 05:04:59 PST 2005


Author: yamaken
Date: 2005-12-09 05:04:54 -0800 (Fri, 09 Dec 2005)
New Revision: 2487

Modified:
   branches/r5rs/sigscheme/storage-gc.c
Log:
* sigscheme/storage-gc.c
  - Simplify the description about the GC
  - (gc_mark):
    * Reorder mark functions for efficiency
    * Remove debug message


Modified: branches/r5rs/sigscheme/storage-gc.c
===================================================================
--- branches/r5rs/sigscheme/storage-gc.c	2005-12-09 12:29:25 UTC (rev 2486)
+++ branches/r5rs/sigscheme/storage-gc.c	2005-12-09 13:04:54 UTC (rev 2487)
@@ -33,24 +33,24 @@
 ===========================================================================*/
 
 /*
- * Description of the Garbage Collection
+ * The GC performs conservative mark-and-sweep.
  *
- * Our GC uses Mark-and-Sweep algorithm. So, we have MARK phase and SWEEP phase.
- *
  * [1] Mark phase : gc_mark()
  *   - gc_mark_locations()
- *       marking the Scheme object which are stored in the registers.
+ *       marks Scheme objects that held in the registers.
  *
+ *   - gc_mark_locations()
+ *       marks Scheme objects that located on the stack.
+ *
  *   - gc_mark_protected_var()
- *       marking the protected Scheme object which are being hold by C
- *       variables registered by SigScm_GC_Protect().
+ *       marks Scheme objects held in off-heap locations that registered by
+ *       SigScm_GC_Protect().
  *
- *   - gc_mark_locations()
- *       marking the Scheme object which are pushed to the stack, so we need to
- *       traverse the stack for marking the objects.
+ *   - gc_mark_definite_locations_n()
+ *       marks Scheme objects that held in the symbol table.
  *
  * [2] Sweep phase : gc_sweep()
- *   - scanning heaps and move non-marked object to the freelist.
+ *   - collects unmarked objects on heaps into the freelist.
  */
 
 /*=======================================
@@ -501,12 +501,12 @@
     ScmObj stack_end;
     void *save_regs_buf_end = (char *)save_regs_buf + sizeof(save_regs_buf);
 
-    CDBG((SCM_DBG_GC, "gc_mark()"));
-
     setjmp(save_regs_buf);
     gc_mark_locations((ScmObj *)save_regs_buf, (ScmObj *)save_regs_buf_end);
+    gc_mark_locations(stack_start_pointer, &stack_end);
+
+    /* performed after above two because of cache pollution */
     gc_mark_protected_var();
-    gc_mark_locations(stack_start_pointer, &stack_end);
     if (scm_symbol_hash)
         gc_mark_definite_locations_n(scm_symbol_hash, NAMEHASH_SIZE);
 }



More information about the uim-commit mailing list