diff options
| author | Pip Cet | 2024-07-01 17:08:18 +0000 |
|---|---|---|
| committer | Pip Cet | 2024-07-01 17:08:18 +0000 |
| commit | c6a3eb01f7acf9ccd00b38e0ef2ab05164e48635 (patch) | |
| tree | ab1623071d5bf53087fd09cb7ceffb583b705bd0 /src/data.c | |
| parent | f85760f00a24e0adeb4d1e54ed7991287fa40387 (diff) | |
| download | emacs-c6a3eb01f7acf9ccd00b38e0ef2ab05164e48635.tar.gz emacs-c6a3eb01f7acf9ccd00b38e0ef2ab05164e48635.zip | |
MPS weak-key hash table support
Introduce a new PVEC type for weak hash tables (if HAVE_MPS) and
handle them somewhat differently from strong hash tables to match
MPS conventions.
* src/print.c (print_vectorlike_unreadable, print_object):
Handle weak hash tables.
* src/pdumper.c (dump_enqueue_object, dump_field_lv_or_rawptr)
(dump_vectorlike): Handle weak hash tables.
* src/lisp.h (enum pvec_type): Add PVEC_WEAK_HASH_TABLE.
(union Lisp_Weak_Hash_Table_Entry, struct
Lisp_Weak_Hash_Table_Strong_Part, struct
Lisp_Weak_Hash_Table_Weak_Part): New types.
(WEAK_HASH_TABLE_P, XWEAK_HASH_TABLE)
(make_lisp_weak_hash_table)
(WEAK_HASH_KEY, WEAK_HASH_VALUE, WEAK_HASH_HASH)
(WEAK_HASH_TABLE_SIZE, weak_hash_table_index_size)
(set_weak_hash_key_slot, set_weak_hash_value_slot)
(weak_hash_from_key): New functions.
(DOHASH_WEAK, DOHASH_WEAK_SAFE): New macros.
* src/igc.h: (enum igc_obj_type): Add
IGC_OBJ_WEAK_HASH_TABLE_WEAK_PART,
IGC_OBJ_WEAK_HASH_TABLE_STRONG_PART.
* src/igc.c (obj_type_names): Add
IGC_OBJ_WEAK_HASH_TABLE_WEAK_PART,
IGC_OBJ_WEAK_HASH_TABLE_STRONG_PART.
(pvec_type_names): Add PVEC_WEAK_HASH_TABLE.
(IGC_TYPE_BITS, IGC_HASH): Adjust for more than 32 types.
(struct igc_thread): New allocation points for weak hash tables.
(struct igc): New fmt and pool for weak hash tables.
(dflt_scan_obj): Handle weak hash tables.
(fix_weak_hash_table, fix_weak_hash_table_strong_part)
(fix_weak_hash_table_weak_part): New functions.
(fix_vector): Handle weak hash tables.
(fix_vector_weak): Handle weak hash tables.
(create_weak_hash_ap, create_thread_aps): Create allocation
points for weak hash tables.
(igc_thread_remove): Destroy allocation points for weak hash
tables.
(finalize_vector, finalize, maybe_finalize): Handle weak hash
tables.
(thread_ap): Use allocation points for weak hash tables.
(weak_hash_find_dependent): New function.
(Figc_info): Walk weak hash pool.
(make_pool_with_class): Add new argument for
find-dependent-object function.
(make_pool_amc, make_pool_ams, make_pool_awl, make_pool_amcz):
Adjust to new argument.
(make_igc): Create weak hash fmt and pool.
* src/fns.c (make_hash_table): Use
make_weak_hash_table for weak hash tables.
(hash_table_thaw): Assert we're looking at a strong hash table.
(set_weak_hash_next_slot, set_weak_hash_hash_slot)
(set_weak_hash_index_slot, check_maybe_weak_hash_table)
(WEAK_HASH_NEXT, WEAK_HASH_INDEX, allocate_weak_hash_table)
(strengthen_hash_table, strengthen_hash_table_for_dump)
(make_weak_hash_table, weak_hash_index_index)
(maybe_resize_weak_hash_table, weak_hash_lookup_with_hash)
(weak_hash_lookup, weak_hash_put, weak_hash_remove_from_table)
(weak_hash_splat_from_table, weak_hash_clear): New functions.
(Fhash_table_count, Fhash_table_p, Fclrhash, Fgethash, Fputhash)
(Fremhash, Fmaphash): New functions.
* src/data.c (Fcl_type_of): Handle weak hash tables.
* src/alloc.c (purecopy): Handle weak hash tables.
Diffstat (limited to 'src/data.c')
| -rw-r--r-- | src/data.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/data.c b/src/data.c index dcf869c1a0e..bf7c54e6185 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -251,6 +251,9 @@ a fixed set of types. */) | |||
| 251 | case PVEC_BOOL_VECTOR: return Qbool_vector; | 251 | case PVEC_BOOL_VECTOR: return Qbool_vector; |
| 252 | case PVEC_FRAME: return Qframe; | 252 | case PVEC_FRAME: return Qframe; |
| 253 | case PVEC_HASH_TABLE: return Qhash_table; | 253 | case PVEC_HASH_TABLE: return Qhash_table; |
| 254 | #ifdef HAVE_MPS | ||
| 255 | case PVEC_WEAK_HASH_TABLE: return Qhash_table; | ||
| 256 | #endif | ||
| 254 | case PVEC_OBARRAY: return Qobarray; | 257 | case PVEC_OBARRAY: return Qobarray; |
| 255 | case PVEC_FONT: | 258 | case PVEC_FONT: |
| 256 | if (FONT_SPEC_P (object)) | 259 | if (FONT_SPEC_P (object)) |