* Make SCM_DEBUG_CELL_ACCESSES=1 work with GUILE_DEBUG_FREELIST.
authorDirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Tue, 15 May 2001 09:45:10 +0000 (09:45 +0000)
committerDirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Tue, 15 May 2001 09:45:10 +0000 (09:45 +0000)
libguile/ChangeLog
libguile/eval.c
libguile/gc.c
libguile/gc.h
libguile/init.c
libguile/load.c
libguile/strings.c
libguile/vectors.c

index e52e956..ea0440f 100644 (file)
@@ -1,3 +1,30 @@
+2001-05-15  Dirk Herrmann  <D.Herrmann@tu-bs.de>
+
+       * eval.c (scm_init_eval):  Initialize scm_undefineds and
+       scm_listofnull. 
+
+       * gc.c (scm_debug_newcell, scm_debug_newcell2):  Fixed to behave
+       like the SCM_NEWCELL macro counterparts.
+
+       (scm_init_storage, scm_init_gc):  Moved initialization of
+       scm_tc16_allocated from scm_init_gc to scm_init_storage.
+
+       (scm_init_storage):  Moved initialization of scm_undefineds and
+       scm_listofnull to eval.c, initializion of scm_nullstr to
+       strings.c, initializion of scm_nullvect to vectors.c.
+
+       * gc.h (SCM_NEWCELL, SCM_NEWCELL2):  Prefer SCM_NULLP over
+       SCM_IMP, as in scm_debug_newcell and scm_debug_newcell2.
+
+       * init.c (scm_init_guile_1):  Reordered some initializations and
+       added dependcy information comments.
+
+       * load.c (scm_init_load):  Use scm_nullstr.
+
+       * strings.c (scm_init_strings):  Initialize scm_nullstr.
+
+       * vectors.c (scm_init_vectors):  Initialize scm_nullvect.
+
 2001-05-15  Marius Vollmer  <mvo@zagadka.ping.de>
 
        * values.c (print_values): Print as a unreadable object, not as
index 24f2749..a4fea7d 100644 (file)
@@ -4083,6 +4083,11 @@ scm_init_eval ()
   scm_set_smob_mark (scm_tc16_promise, scm_markcdr);
   scm_set_smob_print (scm_tc16_promise, promise_print);
 
+  /* Dirk:Fixme:: make scm_undefineds local to eval.c: it's only used here. */
+  scm_undefineds = scm_cons (SCM_UNDEFINED, SCM_EOL);
+  SCM_SETCDR (scm_undefineds, scm_undefineds);
+  scm_listofnull = scm_cons (SCM_EOL, SCM_EOL);
+
   scm_f_apply = scm_make_subr ("apply", scm_tc7_lsubr_2, scm_apply);
 
   scm_lisp_nil = scm_sysintern ("nil", SCM_UNDEFINED);
@@ -4092,9 +4097,6 @@ scm_init_eval ()
   SCM_SETCDR (scm_lisp_t, SCM_CAR (scm_lisp_t));
   scm_lisp_t = SCM_CAR (scm_lisp_t);
   
-  /* acros */
-  /* end of acros */
-
 #if SCM_DEBUG_DEPRECATED == 0
   scm_top_level_lookup_closure_var =
     scm_sysintern ("*top-level-lookup-closure*", scm_make_fluid ());
index b92549f..ddfbbec 100644 (file)
@@ -672,11 +672,15 @@ scm_debug_newcell (void)
   /* The rest of this is supposed to be identical to the SCM_NEWCELL
      macro.  */
   if (SCM_NULLP (scm_freelist))
-    new = scm_gc_for_newcell (&scm_master_freelist, &scm_freelist);
+    {
+      new = scm_gc_for_newcell (&scm_master_freelist, &scm_freelist);
+      SCM_GC_SET_ALLOCATED (new);
+    }
   else
     {
       new = scm_freelist;
       scm_freelist = SCM_FREE_CELL_CDR (scm_freelist);
+      SCM_GC_SET_ALLOCATED (new);
     }
 
   return new;
@@ -697,11 +701,15 @@ scm_debug_newcell2 (void)
   /* The rest of this is supposed to be identical to the SCM_NEWCELL
      macro.  */
   if (SCM_NULLP (scm_freelist2))
-    new = scm_gc_for_newcell (&scm_master_freelist2, &scm_freelist2);
+    {
+      new = scm_gc_for_newcell (&scm_master_freelist2, &scm_freelist2);
+      SCM_GC_SET_ALLOCATED (new);
+    }
   else
     {
       new = scm_freelist2;
       scm_freelist2 = SCM_FREE_CELL_CDR (scm_freelist2);
+      SCM_GC_SET_ALLOCATED (new);
     }
 
   return new;
@@ -2589,6 +2597,10 @@ scm_init_storage ()
   scm_sizet init_heap_size_2;
   scm_sizet j;
 
+#if (SCM_DEBUG_CELL_ACCESSES == 1)
+  scm_tc16_allocated = scm_make_smob_type ("allocated cell", 0);
+#endif  /* SCM_DEBUG_CELL_ACCESSES == 1 */
+
   j = SCM_NUM_PROTECTS;
   while (j)
     scm_sys_protects[--j] = SCM_BOOL_F;
@@ -2641,13 +2653,6 @@ scm_init_storage ()
 #endif
 #endif
 
-  scm_undefineds = scm_cons (SCM_UNDEFINED, SCM_EOL);
-  SCM_SETCDR (scm_undefineds, scm_undefineds);
-
-  scm_listofnull = scm_cons (SCM_EOL, SCM_EOL);
-  scm_nullstr = scm_allocate_string (0);
-  scm_nullvect = scm_c_make_vector (0, SCM_UNDEFINED);
-
 #define DEFAULT_SYMHASH_SIZE 277
   scm_symhash = scm_c_make_hash_table (DEFAULT_SYMHASH_SIZE);
   scm_symhash_vars = scm_c_make_hash_table (DEFAULT_SYMHASH_SIZE);
@@ -2695,10 +2700,6 @@ scm_init_gc ()
 {
   SCM after_gc_thunk;
 
-#if (SCM_DEBUG_CELL_ACCESSES == 1)
-  scm_tc16_allocated = scm_make_smob_type ("allocated cell", 0);
-#endif  /* SCM_DEBUG_CELL_ACCESSES == 1 */
-
   /* Dirk:FIXME:: scm_create_hook is strange. */
   scm_after_gc_hook = scm_create_hook ("after-gc-hook", 0);
 
index 150074f..0fe4d51 100644 (file)
@@ -261,7 +261,7 @@ typedef unsigned long scm_c_bvec_limb_t;
    a freelist of its own.  */
 #define SCM_NEWCELL(_into) \
         do { \
-          if (SCM_IMP (scm_freelist)) \
+          if (SCM_NULLP (scm_freelist)) \
             { \
              _into = scm_gc_for_newcell (&scm_master_freelist, \
                                          &scm_freelist); \
@@ -276,7 +276,7 @@ typedef unsigned long scm_c_bvec_limb_t;
         } while(0)
 #define SCM_NEWCELL2(_into) \
         do { \
-          if (SCM_IMP (scm_freelist2)) \
+          if (SCM_NULLP (scm_freelist2)) \
             { \
              _into = scm_gc_for_newcell (&scm_master_freelist2, \
                                          &scm_freelist2); \
index c53d1a4..dacd1ee 100644 (file)
@@ -471,7 +471,7 @@ scm_init_guile_1 (SCM_STACKITEM *base)
 #ifdef GUILE_DEBUG_MALLOC
   scm_debug_malloc_prehistory ();
 #endif
-  scm_init_storage ();
+  scm_init_storage ();           /* requires smob_prehistory */
   scm_struct_prehistory ();      /* requires storage */
   scm_symbols_prehistory ();      /* requires storage */
   scm_weaks_prehistory ();       /* requires storage */
@@ -541,17 +541,17 @@ scm_init_guile_1 (SCM_STACKITEM *base)
   scm_init_srcprop ();
 #endif
   scm_init_stackchk ();
-  scm_init_struct ();
-  scm_init_stacks ();   /* Requires struct */
+  scm_init_strings ();
+  scm_init_struct ();   /* Requires strings */
+  scm_init_stacks ();   /* Requires strings, struct */
   scm_init_symbols ();
   scm_init_tag ();
   scm_init_values ();   /* Requires struct */
-  scm_init_load ();
+  scm_init_load ();     /* Requires strings */
   scm_init_objects (); /* Requires struct */
-  scm_init_print ();   /* Requires struct */
+  scm_init_print ();   /* Requires strings, struct */
   scm_init_read ();
   scm_init_stime ();
-  scm_init_strings ();
   scm_init_strorder ();
   scm_init_strop ();
   scm_init_throw ();
index d6612b1..98158e6 100644 (file)
@@ -513,7 +513,7 @@ scm_init_load ()
   scm_loc_load_extensions
     = SCM_CDRLOC (scm_sysintern ("%load-extensions",
                                 SCM_LIST2 (scm_makfrom0str (".scm"),
-                                           scm_makfrom0str (""))));
+                                           scm_nullstr)));
   scm_loc_load_hook = SCM_CDRLOC (scm_sysintern ("%load-hook", SCM_BOOL_F));
 
   init_build_info ();
index c4843eb..792b0f8 100644 (file)
@@ -48,7 +48,7 @@
 
 #include "libguile/_scm.h"
 #include "libguile/chars.h"
-
+#include "libguile/root.h"
 #include "libguile/strings.h"
 #include "libguile/validate.h"
 \f
@@ -437,6 +437,8 @@ SCM_DEFINE (scm_make_shared_substring, "make-shared-substring", 1, 2, 0,
 void
 scm_init_strings ()
 {
+  scm_nullstr = scm_allocate_string (0);
+
 #ifndef SCM_MAGIC_SNARFER
 #include "libguile/strings.x"
 #endif
index e21c5b0..5958338 100644 (file)
@@ -413,6 +413,8 @@ SCM_DEFINE (scm_vector_move_right_x, "vector-move-right!", 5, 0, 0,
 void
 scm_init_vectors ()
 {
+  scm_nullvect = scm_c_make_vector (0, SCM_UNDEFINED);
+
 #ifndef SCM_MAGIC_SNARFER
 #include "libguile/vectors.x"
 #endif