author | Camm Maguire <camm@debian.org> | 2015年03月11日 09:43:51 -0400 |
---|---|---|
committer | Camm Maguire <camm@debian.org> | 2015年03月11日 09:43:51 -0400 |
commit | aa07c0989508b5de8053ad50013f6b079ca63c3c (patch) | |
tree | 5e659407785cd361df1baea80d4e7008845658c4 | |
parent | 087fbbd3dcdd4ad511a3ffb5828987b36cabfbae (diff) | |
parent | a7c1e253e40f602ac174e88099e454eec8875cf0 (diff) | |
download | gcl-nsrsfgfsgba.tar.gz |
-rw-r--r-- | gcl/h/lu.h | 1 | ||||
-rwxr-xr-x | gcl/o/hash.d | 14 |
diff --git a/gcl/h/lu.h b/gcl/h/lu.h index 77318ddc0..cff9f3ef5 100644 --- a/gcl/h/lu.h +++ b/gcl/h/lu.h @@ -142,6 +142,7 @@ struct hashtable { int ht_nent; int ht_size; short ht_test; + short ht_static; SPAD; }; diff --git a/gcl/o/hash.d b/gcl/o/hash.d index 00ebd2a96..4b9ce35b9 100755 --- a/gcl/o/hash.d +++ b/gcl/o/hash.d @@ -30,6 +30,7 @@ object sLequal; object sKsize; object sKrehash_size; object sKrehash_threshold; +object sKstatic; #define MHSH(a_) ((a_) & ~(1UL<<(sizeof(a_)*CHAR_SIZE-1))) @@ -295,8 +296,9 @@ object hashtable; hashtable->ht.ht_rhthresh = make_fixnum(fix(hashtable->ht.ht_rhthresh) + (new_size - old->ht.ht_size)); - hashtable->ht.ht_self = - (struct htent *)alloc_relblock(new_size * sizeof(struct htent)); + hashtable->ht.ht_self = hashtable->ht.ht_static ? + (struct htent *)alloc_contblock(new_size * sizeof(struct htent)) : + (struct htent *)alloc_relblock(new_size * sizeof(struct htent)); for (i = 0; i < new_size; i++) { hashtable->ht.ht_self[i].hte_key = OBJNULL; hashtable->ht.ht_self[i].hte_value = OBJNULL; @@ -322,6 +324,7 @@ DEFVAR("*DEFAULT-HASH-TABLE-REHASH-THRESHOLD*",sSAdefault_hash_table_rehash_thre `sSAdefault_hash_table_rehash_sizeA->s.s_dbind`) (rehash_threshold `sSAdefault_hash_table_rehash_thresholdA->s.s_dbind`) + (static `Cnil`) &aux h) enum httest htt=0; int i; @@ -363,9 +366,11 @@ DEFVAR("*DEFAULT-HASH-TABLE-REHASH-THRESHOLD*",sSAdefault_hash_table_rehash_thre h->ht.ht_rhsize = rehash_size; h->ht.ht_rhthresh = rehash_threshold; h->ht.ht_nent = 0; + h->ht.ht_static = static!=Cnil ? 1 : 0; h->ht.ht_self = NULL; - h->ht.ht_self = (struct htent *) - alloc_relblock(fix(size) * sizeof(struct htent)); + h->ht.ht_self = h->ht.ht_static ? + (struct htent *)alloc_contblock(fix(size) * sizeof(struct htent)) : + (struct htent *)alloc_relblock(fix(size) * sizeof(struct htent)); for(i = 0; i < fix(size); i++) { h->ht.ht_self[i].hte_key = OBJNULL; h->ht.ht_self[i].hte_value = OBJNULL; @@ -547,6 +552,7 @@ gcl_init_hash() sKtest = make_keyword("TEST"); sKrehash_size = make_keyword("REHASH-SIZE"); sKrehash_threshold = make_keyword("REHASH-THRESHOLD"); + sKstatic = make_keyword("STATIC"); make_function("MAKE-HASH-TABLE", Lmake_hash_table); make_function("HASH-TABLE-P", Lhash_table_p); |