emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r109096: Cleanup basic allocation var


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109096: Cleanup basic allocation variables and functions.
Date: Sun, 15 Jul 2012 15:17:09 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109096
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Sun 2012-07-15 15:17:09 +0400
message:
  Cleanup basic allocation variables and functions.
  * alloc.c (ignore_warnings, init_intervals, init_float)
  (init_cons, init_symbol, init_marker): Remove.
  (interval_block_index): Initialize to INTERVAL_BLOCK_SIZE.
  (float_block_index): Initialize to FLOAT_BLOCK_SIZE.
  (cons_block_index): Initialize to CONS_BLOCK_SIZE.
  (symbol_block_size): Initialize to SYMBOL_BLOCK_SIZE.
  (marker_block_index): Initialize to MARKER_BLOCK_SIZE.
  (staticidx, init_alloc_once, init_strings, free_ablock):
  Remove redundant initialization.
  * fns.c (init_weak_hash_tables): Remove.
  * lisp.h (init_weak_hash_tables): Remove prototype.
modified:
  src/ChangeLog
  src/alloc.c
  src/fns.c
  src/lisp.h
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-07-15 07:57:54 +0000
+++ b/src/ChangeLog     2012-07-15 11:17:09 +0000
@@ -1,5 +1,20 @@
 2012-07-15  Dmitry Antipov  <address@hidden>
 
+       Cleanup basic allocation variables and functions.
+       * alloc.c (ignore_warnings, init_intervals, init_float)
+       (init_cons, init_symbol, init_marker): Remove.
+       (interval_block_index): Initialize to INTERVAL_BLOCK_SIZE.
+       (float_block_index): Initialize to FLOAT_BLOCK_SIZE.
+       (cons_block_index): Initialize to CONS_BLOCK_SIZE.
+       (symbol_block_size): Initialize to SYMBOL_BLOCK_SIZE.
+       (marker_block_index): Initialize to MARKER_BLOCK_SIZE.
+       (staticidx, init_alloc_once, init_strings, free_ablock):
+       Remove redundant initialization.
+       * fns.c (init_weak_hash_tables): Remove.
+       * lisp.h (init_weak_hash_tables): Remove prototype.
+
+2012-07-15  Dmitry Antipov  <address@hidden>
+
        Use zero_vector where appropriate.
        * alloc.c (zero_vector): Define as Lisp_Object.  Adjust users
        accordingly.

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2012-07-15 07:57:54 +0000
+++ b/src/alloc.c       2012-07-15 11:17:09 +0000
@@ -258,11 +258,6 @@
 static ptrdiff_t stack_copy_size;
 #endif
 
-/* Non-zero means ignore malloc warnings.  Set during initialization.
-   Currently not used.  */
-
-static int ignore_warnings;
-
 static Lisp_Object Qgc_cons_threshold;
 Lisp_Object Qchar_table_extra_slots;
 
@@ -435,7 +430,7 @@
 
 /* Index of next unused slot in staticvec.  */
 
-static int staticidx = 0;
+static int staticidx;
 
 static void *pure_alloc (size_t, int);
 
@@ -1481,7 +1476,7 @@
 /* Index in interval_block above of the next unused interval
    structure.  */
 
-static int interval_block_index;
+static int interval_block_index = INTERVAL_BLOCK_SIZE;
 
 /* Number of free and live intervals.  */
 
@@ -1491,18 +1486,6 @@
 
 static INTERVAL interval_free_list;
 
-
-/* Initialize interval allocation.  */
-
-static void
-init_intervals (void)
-{
-  interval_block = NULL;
-  interval_block_index = INTERVAL_BLOCK_SIZE;
-  interval_free_list = 0;
-}
-
-
 /* Return a new interval.  */
 
 INTERVAL
@@ -1803,10 +1786,6 @@
 static void
 init_strings (void)
 {
-  total_strings = total_free_strings = total_string_size = 0;
-  oldest_sblock = current_sblock = large_sblocks = NULL;
-  string_blocks = NULL;
-  string_free_list = NULL;
   empty_unibyte_string = make_pure_string ("", 0, 0, 0);
   empty_multibyte_string = make_pure_string ("", 0, 0, 1);
 }
@@ -2590,24 +2569,12 @@
 
 /* Index of first unused Lisp_Float in the current float_block.  */
 
-static int float_block_index;
+static int float_block_index = FLOAT_BLOCK_SIZE;
 
 /* Free-list of Lisp_Floats.  */
 
 static struct Lisp_Float *float_free_list;
 
-
-/* Initialize float allocation.  */
-
-static void
-init_float (void)
-{
-  float_block = NULL;
-  float_block_index = FLOAT_BLOCK_SIZE; /* Force alloc of new float_block.   */
-  float_free_list = 0;
-}
-
-
 /* Return a new float object with value FLOAT_VALUE.  */
 
 Lisp_Object
@@ -2696,24 +2663,12 @@
 
 /* Index of first unused Lisp_Cons in the current block.  */
 
-static int cons_block_index;
+static int cons_block_index = CONS_BLOCK_SIZE;
 
 /* Free-list of Lisp_Cons structures.  */
 
 static struct Lisp_Cons *cons_free_list;
 
-
-/* Initialize cons allocation.  */
-
-static void
-init_cons (void)
-{
-  cons_block = NULL;
-  cons_block_index = CONS_BLOCK_SIZE; /* Force alloc of new cons_block.  */
-  cons_free_list = 0;
-}
-
-
 /* Explicitly free a cons cell by putting it on the free-list.  */
 
 void
@@ -3453,24 +3408,12 @@
    structure in it.  */
 
 static struct symbol_block *symbol_block;
-static int symbol_block_index;
+static int symbol_block_index = SYMBOL_BLOCK_SIZE;
 
 /* List of free symbols.  */
 
 static struct Lisp_Symbol *symbol_free_list;
 
-
-/* Initialize symbol allocation.  */
-
-static void
-init_symbol (void)
-{
-  symbol_block = NULL;
-  symbol_block_index = SYMBOL_BLOCK_SIZE;
-  symbol_free_list = 0;
-}
-
-
 DEFUN ("make-symbol", Fmake_symbol, Smake_symbol, 1, 1, 0,
        doc: /* Return a newly allocated uninterned symbol whose name is NAME.
 Its value and function definition are void, and its property list is nil.  */)
@@ -3554,18 +3497,10 @@
 };
 
 static struct marker_block *marker_block;
-static int marker_block_index;
+static int marker_block_index = MARKER_BLOCK_SIZE;
 
 static union Lisp_Misc *marker_free_list;
 
-static void
-init_marker (void)
-{
-  marker_block = NULL;
-  marker_block_index = MARKER_BLOCK_SIZE;
-  marker_free_list = 0;
-}
-
 /* Return a newly allocated Lisp_Misc object, with no substructure.  */
 
 Lisp_Object
@@ -6713,32 +6648,19 @@
   /* Used to do Vpurify_flag = Qt here, but Qt isn't set up yet!  */
   purebeg = PUREBEG;
   pure_size = PURESIZE;
-  pure_bytes_used = 0;
-  pure_bytes_used_lisp = pure_bytes_used_non_lisp = 0;
-  pure_bytes_used_before_overflow = 0;
-
-  /* Initialize the list of free aligned blocks.  */
-  free_ablock = NULL;
 
 #if GC_MARK_STACK || defined GC_MALLOC_CHECK
   mem_init ();
   Vdead = make_pure_string ("DEAD", 4, 4, 0);
 #endif
 
-  ignore_warnings = 1;
 #ifdef DOUG_LEA_MALLOC
   mallopt (M_TRIM_THRESHOLD, 128*1024); /* trim threshold */
   mallopt (M_MMAP_THRESHOLD, 64*1024); /* mmap threshold */
   mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); /* max. number of mmap'ed areas */
 #endif
   init_strings ();
-  init_cons ();
-  init_symbol ();
-  init_marker ();
-  init_float ();
-  init_intervals ();
   init_vectors ();
-  init_weak_hash_tables ();
 
 #ifdef REL_ALLOC
   malloc_hysteresis = 32;
@@ -6747,14 +6669,7 @@
 #endif
 
   refill_memory_reserve ();
-
-  ignore_warnings = 0;
-  gcprolist = 0;
-  byte_stack_list = 0;
-  staticidx = 0;
-  consing_since_gc = 0;
   gc_cons_threshold = 100000 * sizeof (Lisp_Object);
-  gc_relative_threshold = 0;
 }
 
 void

=== modified file 'src/fns.c'
--- a/src/fns.c 2012-07-10 23:24:36 +0000
+++ b/src/fns.c 2012-07-15 11:17:09 +0000
@@ -3945,12 +3945,6 @@
                           Weak Hash Tables
  ************************************************************************/
 
-void
-init_weak_hash_tables (void)
-{
-  weak_hash_tables = NULL;
-}
-
 /* Sweep weak hash table H.  REMOVE_ENTRIES_P non-zero means remove
    entries from the table that don't survive the current GC.
    REMOVE_ENTRIES_P zero means mark entries that are in use.  Value is

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2012-07-15 07:57:54 +0000
+++ b/src/lisp.h        2012-07-15 11:17:09 +0000
@@ -2437,7 +2437,6 @@
 ptrdiff_t hash_lookup (struct Lisp_Hash_Table *, Lisp_Object, EMACS_UINT *);
 ptrdiff_t hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object,
                    EMACS_UINT);
-void init_weak_hash_tables (void);
 extern void init_fns (void) ATTRIBUTE_CONST;
 
 extern Lisp_Object substring_both (Lisp_Object, ptrdiff_t, ptrdiff_t,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]