aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorStefan Monnier2007-10-02 21:24:47 +0000
committerStefan Monnier2007-10-02 21:24:47 +0000
commit878f97ffedc5b4fc785beac809c3d4392f531eca (patch)
tree862d3533e412791972f9fd44fa4072d8173ff357 /src/alloc.c
parent5b2f56dfa64ff88188ece5093589a52542163e46 (diff)
downloademacs-878f97ffedc5b4fc785beac809c3d4392f531eca.tar.gz
emacs-878f97ffedc5b4fc785beac809c3d4392f531eca.zip
* lisp.h (struct Lisp_Hash_Table): Move non-traced elements at the end.
Turn `count' into an integer. * fns.c (make_hash_table, hash_put, hash_remove, hash_clear) (sweep_weak_table, sweep_weak_hash_tables, Fhash_table_count): * print.c (print_object) <HASH_TABLE_P>: `count' is an int. * alloc.c (allocate_hash_table): Use ALLOCATE_PSEUDOVECTOR. (mark_object) <HASH_TABLE_P>: Use mark_vectorlike.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c45
1 files changed, 7 insertions, 38 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 72e910f8faa..a3c9ec40f05 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -2986,20 +2986,12 @@ allocate_pseudovector (memlen, lisplen, tag)
2986 (VECSIZE (typ), PSEUDOVECSIZE (typ, field), tag)) 2986 (VECSIZE (typ), PSEUDOVECSIZE (typ, field), tag))
2987 2987
2988struct Lisp_Hash_Table * 2988struct Lisp_Hash_Table *
2989allocate_hash_table () 2989allocate_hash_table (void)
2990{ 2990{
2991 EMACS_INT len = VECSIZE (struct Lisp_Hash_Table); 2991 return ALLOCATE_PSEUDOVECTOR (struct Lisp_Hash_Table, count, PVEC_HASH_TABLE);
2992 struct Lisp_Vector *v = allocate_vectorlike (len); 2992}
2993 EMACS_INT i;
2994 2993
2995 v->size = len;
2996 for (i = 0; i < len; ++i)
2997 v->contents[i] = Qnil;
2998 2994
2999 return (struct Lisp_Hash_Table *) v;
3000}
3001
3002
3003struct window * 2995struct window *
3004allocate_window () 2996allocate_window ()
3005{ 2997{
@@ -5617,33 +5609,10 @@ mark_object (arg)
5617 else if (GC_HASH_TABLE_P (obj)) 5609 else if (GC_HASH_TABLE_P (obj))
5618 { 5610 {
5619 struct Lisp_Hash_Table *h = XHASH_TABLE (obj); 5611 struct Lisp_Hash_Table *h = XHASH_TABLE (obj);
5620 5612 if (mark_vectorlike ((struct Lisp_Vector *)h))
5621 /* Stop if already marked. */ 5613 { /* If hash table is not weak, mark all keys and values.
5622 if (VECTOR_MARKED_P (h)) 5614 For weak tables, mark only the vector. */
5623 break; 5615 if (GC_NILP (h->weak))
5624
5625 /* Mark it. */
5626 CHECK_LIVE (live_vector_p);
5627 VECTOR_MARK (h);
5628
5629 /* Mark contents. */
5630 /* Do not mark next_free or next_weak.
5631 Being in the next_weak chain
5632 should not keep the hash table alive.
5633 No need to mark `count' since it is an integer. */
5634 mark_object (h->test);
5635 mark_object (h->weak);
5636 mark_object (h->rehash_size);
5637 mark_object (h->rehash_threshold);
5638 mark_object (h->hash);
5639 mark_object (h->next);
5640 mark_object (h->index);
5641 mark_object (h->user_hash_function);
5642 mark_object (h->user_cmp_function);
5643
5644 /* If hash table is not weak, mark all keys and values.
5645 For weak tables, mark only the vector. */
5646 if (GC_NILP (h->weak))
5647 mark_object (h->key_and_value); 5616 mark_object (h->key_and_value);
5648 else 5617 else
5649 VECTOR_MARK (XVECTOR (h->key_and_value)); 5618 VECTOR_MARK (XVECTOR (h->key_and_value));