[uim-commit] r2588 - branches/r5rs/sigscheme
yamaken at freedesktop.org
yamaken at freedesktop.org
Thu Dec 15 10:51:46 PST 2005
Author: yamaken
Date: 2005-12-15 10:51:42 -0800 (Thu, 15 Dec 2005)
New Revision: 2588
Modified:
branches/r5rs/sigscheme/sigschemeinternal.h
branches/r5rs/sigscheme/storage-fatty.h
branches/r5rs/sigscheme/storage-gc.c
Log:
* sigscheme/sigschemeinternal.h
- (SCM_FREECELL_CAR, SCM_FREECELL_CDR, SCM_FREECELL_SET_CAR,
SCM_FREECELL_SET_CDR): Removed
- (SCM_FREECELL_NEXT, SCM_FREECELL_FREESLOT, SCM_FREECELL_SET_NEXT,
SCM_FREECELL_SET_FREESLOT, SCM_FREECELL_CLEAR_FREESLOT,
SCM_RECLAIM_CELL): New macro
* sigscheme/storage-fatty.h
- (SCM_SAL_FREECELL_CAR, SCM_SAL_FREECELL_CDR,
SCM_SAL_FREECELL_SET_CAR, SCM_SAL_FREECELL_SET_CDR): Removed
- (SCM_SAL_FREECELL_NEXT, SCM_SAL_FREECELL_FREESLOT,
SCM_SAL_FREECELL_SET_NEXT, SCM_SAL_FREECELL_SET_FREESLOT,
SCM_SAL_FREECELL_CLEAR_FREESLOT, SCM_SAL_RECLAIM_CELL): New macro
* sigscheme/storage-gc.c
- (SigScm_NewObjFromHeap, add_heap, gc_sweep): Follow the API changes
Modified: branches/r5rs/sigscheme/sigschemeinternal.h
===================================================================
--- branches/r5rs/sigscheme/sigschemeinternal.h 2005-12-15 11:01:14 UTC (rev 2587)
+++ branches/r5rs/sigscheme/sigschemeinternal.h 2005-12-15 18:51:42 UTC (rev 2588)
@@ -120,11 +120,16 @@
#define SCM_AS_FREECELL(o) (SCM_SAL_AS_FREECELL(o))
#define SCM_FREECELLP(o) (SCM_SAL_FREECELLP(o))
-#define SCM_FREECELL_CAR(o) (SCM_SAL_FREECELL_CAR(o))
-#define SCM_FREECELL_CDR(o) (SCM_SAL_FREECELL_CDR(o))
-#define SCM_FREECELL_SET_CAR(o, kar) (SCM_SAL_FREECELL_SET_CAR((o), (kar)))
-#define SCM_FREECELL_SET_CDR(o, kdr) (SCM_SAL_FREECELL_SET_CDR((o), (kdr)))
+#define SCM_FREECELL_NEXT(o) SCM_SAL_FREECELL_NEXT(o)
+#define SCM_FREECELL_FREESLOT(o) SCM_SAL_FREECELL_FREESLOT(o)
+#define SCM_FREECELL_SET_NEXT(o, next) SCM_SAL_FREECELL_SET_NEXT((o), (next))
+#define SCM_FREECELL_SET_FREESLOT(o, v) SCM_SAL_FREECELL_SET_FREESLOT((o), (v))
+#define SCM_FREECELL_CLEAR_FREESLOT(o) SCM_SAL_FREECELL_CLEAR_FREESLOT((o))
+/* For optimized operation: Cleanup a destructed ScmCell *cell to a freecell
+ * and chain it into freelist. */
+#define SCM_RECLAIM_CELL(cell, next) SCM_SAL_RECLAIM_CELL((cell), (next))
+
/* FIXME: rename appropriately */
#define SCM_IS_MARKED(o) (SCM_SAL_IS_MARKED(o))
#define SCM_IS_UNMARKED(o) (SCM_SAL_IS_UNMARKED(o))
Modified: branches/r5rs/sigscheme/storage-fatty.h
===================================================================
--- branches/r5rs/sigscheme/storage-fatty.h 2005-12-15 11:01:14 UTC (rev 2587)
+++ branches/r5rs/sigscheme/storage-fatty.h 2005-12-15 18:51:42 UTC (rev 2588)
@@ -304,12 +304,22 @@
============================================================================*/
#define SCM_SAL_FREECELLP(a) (SCM_TYPE(a) == ScmFreeCell)
#define SCM_SAL_AS_FREECELL(a) (SCM_ASSERT_TYPE(SCM_FREECELLP(a), (a)))
-#define SCM_SAL_FREECELL_CAR(a) (SCM_AS_FREECELL(a)->obj.cons.car)
-#define SCM_SAL_FREECELL_CDR(a) (SCM_AS_FREECELL(a)->obj.cons.cdr)
+#define SCM_SAL_FREECELL_NEXT(a) (SCM_AS_FREECELL(a)->obj.cons.car)
+#define SCM_SAL_FREECELL_FREESLOT(a) (SCM_AS_FREECELL(a)->obj.cons.cdr)
#define SCM_SAL_ENTYPE_FREECELL(a) (SCM_ENTYPE((a), ScmFreeCell))
-#define SCM_SAL_FREECELL_SET_CAR(a, car) (SCM_FREECELL_CAR(a) = (car))
-#define SCM_SAL_FREECELL_SET_CDR(a, cdr) (SCM_FREECELL_CDR(a) = (cdr))
+#define SCM_SAL_FREECELL_SET_NEXT(a, next) (SCM_FREECELL_NEXT(a) = (next))
+#define SCM_SAL_FREECELL_SET_FREESLOT(a, v) (SCM_FREECELL_FREESLOT(a) = (v))
+#define SCM_SAL_FREECELL_CLEAR_FREESLOT(o) \
+ SCM_SAL_FREECELL_SET_FREESLOT((o), SCM_FALSE)
+#define SCM_SAL_RECLAIM_CELL(cell, next) \
+ do { \
+ SCM_ENTYPE_FREECELL(cell); \
+ SCM_DO_UNMARK(cell); \
+ SCM_FREECELL_SET_NEXT((cell), (next)); \
+ SCM_FREECELL_CLEAR_FREESLOT(cell); \
+ } while (/* CONSTCOND */ 0)
+
#define SCM_UNMARKER 0
#define SCM_MARKER (SCM_UNMARKER + 1)
#define SCM_SAL_IS_MARKED(o) (SCM_MARK(o) == SCM_MARKER)
Modified: branches/r5rs/sigscheme/storage-gc.c
===================================================================
--- branches/r5rs/sigscheme/storage-gc.c 2005-12-15 11:01:14 UTC (rev 2587)
+++ branches/r5rs/sigscheme/storage-gc.c 2005-12-15 18:51:42 UTC (rev 2588)
@@ -166,7 +166,7 @@
gc_mark_and_sweep();
ret = freelist;
- freelist = SCM_FREECELL_CDR(freelist);
+ freelist = SCM_FREECELL_NEXT(freelist);
return ret;
}
@@ -301,13 +301,9 @@
heaps_lowest = &heap[0];
/* link in order */
- for (cell = &heap[0]; cell < &heap[heap_size]; cell++) {
- SCM_ENTYPE_FREECELL(cell);
- SCM_DO_UNMARK(cell);
- SCM_FREECELL_SET_CDR(cell, cell + 1);
- }
-
- SCM_FREECELL_SET_CDR(cell - 1, freelist);
+ for (cell = &heap[0]; cell < &heap[heap_size - 1]; cell++)
+ SCM_RECLAIM_CELL(cell, cell + 1);
+ SCM_RECLAIM_CELL(cell, freelist);
freelist = heap;
}
@@ -608,10 +604,7 @@
SCM_DO_UNMARK(obj);
} else {
free_cell(cell);
-
- SCM_ENTYPE_FREECELL(obj);
- SCM_FREECELL_SET_CAR(obj, SCM_NULL);
- SCM_FREECELL_SET_CDR(obj, new_freelist);
+ SCM_RECLAIM_CELL(cell, new_freelist);
new_freelist = obj;
n_collected++;
}
More information about the uim-commit
mailing list