I just updated to current master.

First notice: with the modified allocation scheme for the m-stack
I observe a larger memory footprint.

The attached diff does roughly half the time the chicken executable
needs compiling it's own source.

IMHO it would be an interesting idea to convert C_mutate to
a macro, which would avoid any procedure call by lifting the check

 if(!C_immediatep(val) && C_i_in_stackp(val)) {

from the current C_mutate procedure into the TDB C_mutate macro
and call the TDB C_do_mutate procedure only in case.

/Jörg

--- /home/jfw/build/Scheme/chicken-core/runtime.c	2011-10-26 18:49:46.000000000 +0200
+++ runtime.c	2011-10-26 21:05:11.363641790 +0200
@@ -1792,7 +1792,7 @@
 
 void C_fcall C_callback_adjust_stack(C_word *a, int size)
 {
-  if(!chicken_is_running && !C_in_stackp((C_word)a)) {
+  if(!chicken_is_running && !C_i_in_stackp((C_word)a)) {
     if(debug_mode)
       C_dbg(C_text("debug"), 
 	    C_text("callback invoked in lower stack region - adjusting limits:\n"
@@ -1966,11 +1966,8 @@
 
   key = hash_string(len, str, stable->size);
 
-  if(C_truep(s = lookup(key, len, str, stable))) {
-    if(C_in_stackp(s)) C_mutate(slot, s);
-    
-    return s;
-  }
+  if(C_truep(s = lookup(key, len, str, stable)))
+    return C_mutate(slot, s);
 
   s = C_static_string(C_heaptop, len, str);
   return add_symbol(C_heaptop, key, s, stable);
@@ -2109,7 +2106,7 @@
 }
 
 
-C_regparm int C_in_stackp(C_word x)
+C_inline C_regparm int C_i_in_stackp(C_word x)
 {
   C_word *ptr = (C_word *)(C_uword)x;
 
@@ -2120,6 +2117,10 @@
 #endif
 }
 
+C_regparm int C_in_stackp(C_word x)
+{
+  return C_i_in_stackp(x);
+}
 
 C_regparm int C_fcall C_in_heapp(C_word x)
 {
@@ -2539,7 +2540,7 @@
 {
   unsigned int mssize, newmssize, bytes;
 
-  if(!C_immediatep(val)) {
+  if(!C_immediatep(val) && C_i_in_stackp(val)) {
 #ifdef C_GC_HOOKS
     if(C_gc_mutation_hook != NULL && C_gc_mutation_hook(slot, val)) return val;
 #endif
@@ -3362,7 +3363,7 @@
         if(is_fptr(h))		/* forwarded? update l-table entry */
           loc = locative_table[ i ] = fptr_to_ptr(h);
         /* otherwise it must have been GC'd (since this is a minor one) */
-        else if(C_in_stackp(loc)) {
+        else if(C_i_in_stackp(loc)) {
           locative_table[ i ] = C_SCHEME_UNDEFINED;
           C_set_block_item(loc, 0, 0);
 	  ++invalidated;
@@ -3379,7 +3380,7 @@
           C_set_block_item(loc, 0, (C_uword)fptr_to_ptr(h) + offset);
 	  hi = i + 1;
 	}
-        else if(C_in_stackp(obj)) { /* pointed-at object GC'd, locative is invalid */
+        else if(C_i_in_stackp(obj)) { /* pointed-at object GC'd, locative is invalid */
           locative_table[ i ] = C_SCHEME_UNDEFINED;
           C_set_block_item(loc, 0, 0);
         }
@@ -7985,10 +7986,10 @@
   flist->next = finalizer_list;
   finalizer_list = flist;
 
-  if(C_in_stackp(x)) C_mutate(&flist->item, x);
+  if(C_i_in_stackp(x)) C_mutate(&flist->item, x);
   else flist->item = x;
 
-  if(C_in_stackp(proc)) C_mutate(&flist->finalizer, proc);
+  if(C_i_in_stackp(proc)) C_mutate(&flist->finalizer, proc);
   else flist->finalizer = proc;
 
   ++live_finalizer_count;
_______________________________________________
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to