Author: yamakenz
Date: Mon Aug 6 09:21:10 2007
New Revision: 4794
Modified:
sigscheme-trunk/src/storage-compact.h
sigscheme-trunk/src/storage-gc.c
Log:
* src/storage-compact.h
- (SCM_ISAL_CELL_RECLAIM_CELL): Remove fablicated-ScmObj acception
* src/storage-gc.c
- (add_heap): Optimize
Modified: sigscheme-trunk/src/storage-compact.h
==============================================================================
--- sigscheme-trunk/src/storage-compact.h (original)
+++ sigscheme-trunk/src/storage-compact.h Mon Aug 6 09:21:10 2007
@@ -916,7 +916,7 @@
#define SCM_ISAL_CELL_FREECELLP(c) \
(SCM_Y(c) == SCM_MTAG_FREECELL)
#define SCM_ISAL_CELL_RECLAIM_CELL(c, next) \
- (SCM_SET_X((c), (SCM_NULLP(next) ? (next) : ((next) | SCM_PTAG_MISC))), \
+ (SCM_SET_X((c), (next)), \
SCM_SET_Y((c), SCM_MTAG_FREECELL), \
((ScmObj)(c) | SCM_PTAG_MISC))
Modified: sigscheme-trunk/src/storage-gc.c
==============================================================================
--- sigscheme-trunk/src/storage-gc.c (original)
+++ sigscheme-trunk/src/storage-gc.c Mon Aug 6 09:21:10 2007
@@ -405,6 +405,7 @@
{
ScmObjHeap heap;
ScmCell *cell;
+ ScmObj next;
SCM_BEGIN_GC_SUBCONTEXT();
@@ -421,12 +422,11 @@
if (&heap[0] < l_heaps_lowest)
l_heaps_lowest = &heap[0];
- /* link in order */
- for (cell = &heap[0]; cell < &heap[l_heap_size - 1]; cell++)
- SCM_CELL_RECLAIM_CELL(cell, (ScmObj)(cell + 1));
- SCM_CELL_RECLAIM_CELL(cell, l_freelist);
- /* FIXME: assumes that (ScmCell *) can be being ScmObj */
- l_freelist = (ScmObj)heap;
+ /* link as address-increasing order */
+ next = l_freelist;
+ for (cell = &heap[l_heap_size - 1]; cell >= &heap[0]; cell--)
+ next = SCM_CELL_RECLAIM_CELL(cell, next);
+ l_freelist = next;
SCM_END_GC_SUBCONTEXT();
}