~ chicken-core (chicken-5) ef5fdefb8068d558bd1308d0a43804c55677238f


commit ef5fdefb8068d558bd1308d0a43804c55677238f
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Fri Jul 30 13:45:52 2010 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Fri Jul 30 13:45:52 2010 +0200

    manually inlined mark/remark

diff --git a/runtime.c b/runtime.c
index eefdf51c..cc43cff7 100644
--- a/runtime.c
+++ b/runtime.c
@@ -470,7 +470,7 @@ static void horror(C_char *msg) C_noret;
 static void C_fcall initial_trampoline(void *proc) C_regparm C_noret;
 static C_ccall void termination_continuation(C_word c, C_word self, C_word result) C_noret;
 static void C_fcall mark_system_globals(void) C_regparm;
-static void C_fcall mark(C_word *x) C_regparm;
+static void C_fcall really_mark(C_word *x) C_regparm;
 static WEAK_TABLE_ENTRY *C_fcall lookup_weak_table_entry(C_word item, C_word container) C_regparm;
 static C_ccall void values_continuation(C_word c, C_word closure, C_word dummy, ...) C_noret;
 static C_word add_symbol(C_word **ptr, C_word key, C_word string, C_SYMBOL_TABLE *stable);
@@ -481,7 +481,7 @@ static C_word C_fcall convert_string_to_number(C_char *str, int radix, C_word *f
 static long C_fcall milliseconds(void);
 static long C_fcall cpu_milliseconds(void);
 static void C_fcall remark_system_globals(void) C_regparm;
-static void C_fcall remark(C_word *x) C_regparm;
+static void C_fcall really_remark(C_word *x) C_regparm;
 static C_word C_fcall intern0(C_char *name) C_regparm;
 static void C_fcall update_locative_table(int mode) C_regparm;
 static LF_LIST *find_module_handle(C_char *name);
@@ -2608,6 +2608,13 @@ void C_save_and_reclaim(void *trampoline, void *proc, int n, ...)
 }
 
 
+#define mark(x)					\
+  C_cblock \
+    C_word *_x = (x), _val = *_x;			\
+    if(!C_immediatep(_val)) really_mark(_x);	\
+  C_cblockend
+
+
 C_regparm void C_fcall C_reclaim(void *trampoline, void *proc)
 {
   int i, j, n, fcount, weakn;
@@ -2933,7 +2940,7 @@ C_regparm void C_fcall mark_system_globals(void)
 }
 
 
-C_regparm void C_fcall mark(C_word *x)
+C_regparm void C_fcall really_mark(C_word *x)
 {
   C_word val, item;
   C_uword n, bytes;
@@ -2943,8 +2950,6 @@ C_regparm void C_fcall mark(C_word *x)
 
   val = *x;
 
-  if(C_immediatep(val)) return;
-
   p = (C_SCHEME_BLOCK *)val;
   
   /* not in stack and not in heap? */
@@ -3066,6 +3071,13 @@ C_regparm void C_fcall mark(C_word *x)
 }
 
 
+#define remark(x)     \
+  C_cblock \
+    C_word *_x = (x), _val = *_x; \
+    if(!C_immediatep(_val)) really_remark(_x); \
+  C_cblockend
+
+
 /* Do a major GC into a freshly allocated heap: */
 
 C_regparm void C_fcall C_rereclaim2(C_uword size, int double_plus)
@@ -3240,7 +3252,7 @@ C_regparm void C_fcall remark_system_globals(void)
 }
 
 
-C_regparm void C_fcall remark(C_word *x)
+C_regparm void C_fcall really_remark(C_word *x)
 {
   C_word val, item;
   C_uword n, bytes;
@@ -3250,8 +3262,6 @@ C_regparm void C_fcall remark(C_word *x)
 
   val = *x;
 
-  if(C_immediatep(val)) return;
-
   p = (C_SCHEME_BLOCK *)val;
   
   /* not in stack and not in heap? */
@@ -7388,7 +7398,7 @@ void C_ccall C_number_to_string(C_word c, C_word closure, C_word k, C_word num,
 #endif
 
 #ifdef HAVE_GCVT
-    C_gcvt(f, flonum_print_precision, buffer);
+    p = C_gcvt(f, flonum_print_precision, buffer); /* p unused, but we want to avoid stupid warnings */
 #else
     C_sprintf(buffer, C_text("%.*g"), flonum_print_precision, f);
 #endif
Trap