diff options
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/src/alloc.c b/src/alloc.c index 833176d4e90..7a0611dd3e2 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -420,14 +420,11 @@ enum mem_type | |||
| 420 | MEM_TYPE_SPARE | 420 | MEM_TYPE_SPARE |
| 421 | }; | 421 | }; |
| 422 | 422 | ||
| 423 | /* A unique object in pure space used to make some Lisp objects | 423 | static bool |
| 424 | on free lists recognizable in O(1). */ | 424 | deadp (Lisp_Object x) |
| 425 | 425 | { | |
| 426 | #ifndef ENABLE_CHECKING | 426 | return EQ (x, dead_object ()); |
| 427 | static | 427 | } |
| 428 | #endif | ||
| 429 | Lisp_Object Vdead; | ||
| 430 | #define DEADP(x) EQ (x, Vdead) | ||
| 431 | 428 | ||
| 432 | #ifdef GC_MALLOC_CHECK | 429 | #ifdef GC_MALLOC_CHECK |
| 433 | 430 | ||
| @@ -499,10 +496,6 @@ static void mem_delete (struct mem_node *); | |||
| 499 | static void mem_delete_fixup (struct mem_node *); | 496 | static void mem_delete_fixup (struct mem_node *); |
| 500 | static struct mem_node *mem_find (void *); | 497 | static struct mem_node *mem_find (void *); |
| 501 | 498 | ||
| 502 | #ifndef DEADP | ||
| 503 | # define DEADP(x) 0 | ||
| 504 | #endif | ||
| 505 | |||
| 506 | /* Addresses of staticpro'd variables. Initialize it to a nonzero | 499 | /* Addresses of staticpro'd variables. Initialize it to a nonzero |
| 507 | value if we might unexec; otherwise some compilers put it into | 500 | value if we might unexec; otherwise some compilers put it into |
| 508 | BSS. */ | 501 | BSS. */ |
| @@ -2548,7 +2541,7 @@ void | |||
| 2548 | free_cons (struct Lisp_Cons *ptr) | 2541 | free_cons (struct Lisp_Cons *ptr) |
| 2549 | { | 2542 | { |
| 2550 | ptr->u.s.u.chain = cons_free_list; | 2543 | ptr->u.s.u.chain = cons_free_list; |
| 2551 | ptr->u.s.car = Vdead; | 2544 | ptr->u.s.car = dead_object (); |
| 2552 | cons_free_list = ptr; | 2545 | cons_free_list = ptr; |
| 2553 | consing_since_gc -= sizeof *ptr; | 2546 | consing_since_gc -= sizeof *ptr; |
| 2554 | gcstat.total_free_conses++; | 2547 | gcstat.total_free_conses++; |
| @@ -4374,7 +4367,7 @@ live_cons_holding (struct mem_node *m, void *p) | |||
| 4374 | { | 4367 | { |
| 4375 | cp = ptr_bounds_copy (cp, b); | 4368 | cp = ptr_bounds_copy (cp, b); |
| 4376 | struct Lisp_Cons *s = p = cp -= offset % sizeof b->conses[0]; | 4369 | struct Lisp_Cons *s = p = cp -= offset % sizeof b->conses[0]; |
| 4377 | if (!EQ (s->u.s.car, Vdead)) | 4370 | if (!deadp (s->u.s.car)) |
| 4378 | return make_lisp_ptr (s, Lisp_Cons); | 4371 | return make_lisp_ptr (s, Lisp_Cons); |
| 4379 | } | 4372 | } |
| 4380 | } | 4373 | } |
| @@ -4410,7 +4403,7 @@ live_symbol_holding (struct mem_node *m, void *p) | |||
| 4410 | { | 4403 | { |
| 4411 | cp = ptr_bounds_copy (cp, b); | 4404 | cp = ptr_bounds_copy (cp, b); |
| 4412 | struct Lisp_Symbol *s = p = cp -= offset % sizeof b->symbols[0]; | 4405 | struct Lisp_Symbol *s = p = cp -= offset % sizeof b->symbols[0]; |
| 4413 | if (!EQ (s->u.s.function, Vdead)) | 4406 | if (!deadp (s->u.s.function)) |
| 4414 | return make_lisp_symbol (s); | 4407 | return make_lisp_symbol (s); |
| 4415 | } | 4408 | } |
| 4416 | } | 4409 | } |
| @@ -6717,7 +6710,7 @@ sweep_conses (void) | |||
| 6717 | this_free++; | 6710 | this_free++; |
| 6718 | cblk->conses[pos].u.s.u.chain = cons_free_list; | 6711 | cblk->conses[pos].u.s.u.chain = cons_free_list; |
| 6719 | cons_free_list = &cblk->conses[pos]; | 6712 | cons_free_list = &cblk->conses[pos]; |
| 6720 | cons_free_list->u.s.car = Vdead; | 6713 | cons_free_list->u.s.car = dead_object (); |
| 6721 | } | 6714 | } |
| 6722 | else | 6715 | else |
| 6723 | { | 6716 | { |
| @@ -6883,7 +6876,7 @@ sweep_symbols (void) | |||
| 6883 | } | 6876 | } |
| 6884 | sym->u.s.next = symbol_free_list; | 6877 | sym->u.s.next = symbol_free_list; |
| 6885 | symbol_free_list = sym; | 6878 | symbol_free_list = sym; |
| 6886 | symbol_free_list->u.s.function = Vdead; | 6879 | symbol_free_list->u.s.function = dead_object (); |
| 6887 | ++this_free; | 6880 | ++this_free; |
| 6888 | } | 6881 | } |
| 6889 | else | 6882 | else |
| @@ -7072,7 +7065,7 @@ which_symbols (Lisp_Object obj, EMACS_INT find_max) | |||
| 7072 | ptrdiff_t gc_count = inhibit_garbage_collection (); | 7065 | ptrdiff_t gc_count = inhibit_garbage_collection (); |
| 7073 | Lisp_Object found = Qnil; | 7066 | Lisp_Object found = Qnil; |
| 7074 | 7067 | ||
| 7075 | if (! DEADP (obj)) | 7068 | if (! deadp (obj)) |
| 7076 | { | 7069 | { |
| 7077 | for (int i = 0; i < ARRAYELTS (lispsym); i++) | 7070 | for (int i = 0; i < ARRAYELTS (lispsym); i++) |
| 7078 | { | 7071 | { |
| @@ -7251,7 +7244,6 @@ init_alloc_once_for_pdumper (void) | |||
| 7251 | purebeg = PUREBEG; | 7244 | purebeg = PUREBEG; |
| 7252 | pure_size = PURESIZE; | 7245 | pure_size = PURESIZE; |
| 7253 | mem_init (); | 7246 | mem_init (); |
| 7254 | Vdead = make_pure_string ("DEAD", 4, 4, 0); | ||
| 7255 | 7247 | ||
| 7256 | #ifdef DOUG_LEA_MALLOC | 7248 | #ifdef DOUG_LEA_MALLOC |
| 7257 | mallopt (M_TRIM_THRESHOLD, 128 * 1024); /* Trim threshold. */ | 7249 | mallopt (M_TRIM_THRESHOLD, 128 * 1024); /* Trim threshold. */ |