home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Moscow ML 1.42 / src / !runtime / roots.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-18  |  542 b   |  29 lines  |  [TEXT/R*ch]

  1. /* To walk the memory roots for garbage collection */
  2.  
  3. #include "debugger.h"
  4. #include "memory.h"
  5. #include "misc.h"
  6. #include "mlvalues.h"
  7. #include "stacks.h"
  8.  
  9. void local_roots (copy_fn)
  10.      void (*copy_fn) ();
  11. {
  12.   register value *sp;
  13.   
  14.   /* stack */
  15.   for (sp = extern_sp; sp < stack_high; sp++) {
  16.     copy_fn (sp, *sp);
  17.   }
  18.  
  19.   /* C roots */
  20.   {
  21.     value *block;
  22.     for (block = c_roots_head; block != NULL; block = (value *) block [1]){
  23.       for (sp = block - (long) block [0]; sp < block; sp++){
  24.     copy_fn (sp, *sp);
  25.       }
  26.     }
  27.   }
  28. }
  29.