From: Dmitry Antipov Date: Sun, 15 Jul 2012 11:17:09 +0000 (+0400) Subject: Cleanup basic allocation variables and functions. X-Git-Tag: emacs-24.2.90~1192 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fff62aa9aea4f6c2aadcef4cdc203cdf60ba224c;p=emacs.git 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. --- diff --git a/src/ChangeLog b/src/ChangeLog index 2a6f2ebb42b..f094e5d6f75 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,18 @@ +2012-07-15 Dmitry Antipov + + 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 Use zero_vector where appropriate. diff --git a/src/alloc.c b/src/alloc.c index 1df775a093b..39c360a67e7 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -258,11 +258,6 @@ static char *stack_copy; 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 @@ static Lisp_Object *staticvec[NSTATICS] = {&Vpurify_flag}; /* 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 @@ static struct interval_block *interval_block; /* 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 EMACS_INT total_free_intervals, total_intervals; 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 char const string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] = 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 @@ static struct float_block *float_block; /* 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 @@ static struct cons_block *cons_block; /* 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 @@ struct symbol_block 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 @@ struct marker_block }; 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 @@ init_alloc_once (void) /* 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 @@ init_alloc_once (void) #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 diff --git a/src/fns.c b/src/fns.c index a42a1530906..0132dcd2cf5 100644 --- a/src/fns.c +++ b/src/fns.c @@ -3945,12 +3945,6 @@ hash_clear (struct Lisp_Hash_Table *h) 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 diff --git a/src/lisp.h b/src/lisp.h index 0bfe3c78118..9a277f0d2d3 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2437,7 +2437,6 @@ Lisp_Object make_hash_table (Lisp_Object, Lisp_Object, Lisp_Object, 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,