summaryrefslogtreecommitdiff
path: root/libguile/hashtab.c
AgeCommit message (Collapse)AuthorFilesLines
2012-03-02hash-set! on weak tables returns the valueAndy Wingo1-10/+29
* libguile/weak-table.h: * libguile/weak-table.c (scm_weak_table_putq_x) (scm_weak_table_remq_x, scm_weak_table_clear_x) (scm_weak_table_for_each): Declare these as returning void instead of SCM. * libguile/hashtab.c (scm_hashq_set_x, scm_hashq_remove_x) (scm_hashv_set_x, scm_hashv_remove_x) (scm_hash_set_x, scm_hash_remove_x) (scm_hashx_set_x, scm_hashx_remove_x): (scm_hash_for_each): For weak tables, have the set! functions return the values, as they used to do. Have remove! functions return #f, indicating the lack of a handle. Shim around for-each to return unspecified, even though that wasn't yet a problem. * test-suite/tests/weaks.test: Add a test.
2012-02-08Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-5/+5
Conflicts: GUILE-VERSION libguile/gc-malloc.c libguile/ports.c
2012-02-02Improve the usage of variable names in C docstrings.Bake Timmons1-5/+5
* libguile/alist.c: * libguile/array-map.c: * libguile/arrays.c: * libguile/bitvectors.c: * libguile/filesys.c: * libguile/foreign.c: * libguile/generalized-arrays.c: * libguile/hashtab.c: * libguile/ioext.c: * libguile/load.c: * libguile/numbers.c: * libguile/ports.c: * libguile/posix.c: * libguile/print.c: * libguile/procprop.c: * libguile/promises.c: * libguile/simpos.c: * libguile/socket.c: * libguile/srfi-1.c: * libguile/srfi-13.c: * libguile/srfi-14.c: * libguile/stacks.c: * libguile/stime.c: * libguile/strings.c: * libguile/struct.c: * libguile/symbols.c: * libguile/threads.c: * libguile/weak-table.c: * libguile/weak-vector.c: Make the variable names in the C docstrings more consistent. Replace a few instances of @var with @code when appropriate.
2012-01-30Merge commit '3d51e57cfb0404db568a6adfde2a346d3fd9907e'Andy Wingo1-2/+5
Conflicts: libguile/foreign.c libguile/hashtab.c module/ice-9/psyntax-pp.scm module/language/tree-il/compile-glil.scm
2012-01-23Adjust tests that relied on the output of the hash table printer.Ludovic Courtès1-1/+1
* libguile/hashtab.c (scm_i_hashtable_print): Use `SCM_UNPACK', not `SCM2PTR'. * test-suite/tests/hash.test: Adjust tests that rely on the output of the printer to just check for the suffix of the hash table's external representation.
2012-01-23Print the address of hash tables.Ludovic Courtès1-2/+5
* libguile/hashtab.c (scm_i_hashtable_print): Print the address of EXP.
2011-11-08locking for putc, putsAndy Wingo1-3/+3
* libguile/ports.c (scm_putc, scm_puts): * libguile/ports.h (scm_putc_unlocked, scm_puts_unlocked): Separate into _unlocked and locked variants. Change all callers to use the _unlocked versions.
2011-10-24add SCM_{PACK,UNPACK}_POINTERAndy Wingo1-2/+2
* libguile/tags.h (SCM_UNPACK_POINTER, SCM_PACK_POINTER): New macros. The old SCM2PTR and PTR2SCM were defined in such a way that round-tripping through a pointer could lose precision, even in the case in which you weren't interested in actually dereferencing the pointer, it was simply that you needed to plumb a SCM through APIs that take pointers. These new macros are more like SCM_PACK and SCM_UNPACK, but for pointer types. The bit representation of the pointer should be the same as the scm_t_bits representation. * libguile/gc.h (PTR2SCM, SCM2PTR): Remove support for (old) UNICOS pointers. We are going to try tagging the SCM object itself in the future, and I don't think that keeping this support is worth its cost. It probably doesn't work anyway. * libguile/backtrace.c: * libguile/bytevectors.c: * libguile/continuations.c: * libguile/fluids.c: * libguile/foreign.c: * libguile/gc.h: * libguile/guardians.c: * libguile/hashtab.c: * libguile/load.c: * libguile/numbers.c: * libguile/ports.c: * libguile/smob.c: * libguile/strings.c: * libguile/symbols.c: * libguile/vm.c: * libguile/weak-set.c: * libguile/weak-table.c: * libguile/weak-vector.c: Update many sites to use the new macros.
2011-10-24reimplement hashtab.c's weak hash tables in terms of weak-table.cAndy Wingo1-566/+138
* libguile/hashtab.c: * libguile/hashtab.h: Reimplement the weak hash table implementation in terms of weak tables. All is well except for the horrific hack for hashx tables. * libguile/weak-table.h: * libguile/weak-table.c (scm_make_weak_key_hash_table) (scm_make_weak_value_hash_table, scm_make_doubly_weak_hash_table) (scm_weak_key_hash_table_p, scm_weak_value_hash_table_p) (scm_doubly_weak_hash_table_p): Move these definitions here.
2011-07-28fix read beyond end of hashtable size array in hashtab.cAndy Wingo1-1/+1
* libguile/hashtab.c (make_hash_table): Fix read beyond end of hashtable_size array. Thanks to http://article.gmane.org/gmane.lisp.guile.devel/12685.
2011-06-16fix hash-set! on weak tablesAndy Wingo1-23/+30
* test-suite/tests/weaks.test: Add tests. * libguile/hashtab.c (scm_hash_fn_set_x): Fix updates to weak-value hash tables to not deadlock inside the alloc lock.
2011-05-30fix subtle and bad scm_internal_hash_fold bug for weak tablesAndy Wingo1-30/+10
* libguile/hashtab.c (scm_internal_hash_fold): Don't try to unlink deleted weak pairs. Our previous code was buggy (`prev' should have only been updated in the case of a successful traversal), but more than that, we're not in the alloc lock. Thanks very much to Michael Wells for the report, and the debugging!
2011-05-13weak_bucket_assoc tweakAndy Wingo1-2/+4
* libguile/hashtab.c (weak_bucket_assoc): Change assertion to be a check and abort, and so that only calls GC_is_visible if the check fails.
2011-05-13correct use of SCM2PTR in SCM_I_REGISTER_DISAPPEARING_LINK formsAndy Wingo1-3/+3
* libguile/hashtab.c (set_weak_cdr): * libguile/vectors.c (scm_c_vector_set_x): * libguile/weaks.c (scm_weak_car_pair, scm_weak_cdr_pair): (scm_doubly_weak_pair): Use SCM2PTR for the target of SCM_I_REGISTER_DISAPPEARING_LINK calls.
2011-05-13scm_is_false instead of == SCM_BOOL_F; also is_null, is_true, etcAndy Wingo1-2/+2
* libguile/deprecation.c (scm_issue_deprecation_warning) * libguile/eval.c (CAPTURE_ENV): * libguile/goops.c (make_dispatch_procedure, make_class_from_symbol): (create_smob_classes): * libguile/guardians.c (finalize_guarded, scm_i_get_one_zombie): * libguile/hashtab.c (scm_fixup_weak_alist, scm_internal_hash_fold): * libguile/i18n.c (scm_nl_langinfo) * libguile/load.c (scm_primitive_load) * libguile/posix.c (scm_setrlimit) * libguile/socket.c (scm_to_sockaddr): * libguile/srcprop.c (scm_make_srcprops): Use scm_is_false / scm_is_true / scm_is_null instead of comparing against SCM_BOOL_F et al.
2011-05-01disallow get-handle / create-handle! of weak hash tablesAndy Wingo1-0/+29
* libguile/hashtab.c (scm_hashq_get_handle, scm_hashq_create_handle_x) (scm_hashv_get_handle, scm_hashv_create_handle_x) (scm_hash_get_handle, scm_hash_create_handle_x) (scm_hashx_get_handle, scm_hashx_create_handle_x): Don't allow these functions to be called on weak hash tables, as we have no idea when the GC will null out fields of the handle, and set-cdr! won't register disappearing links, and set-car! would never work of course.
2011-05-01fix hash-set! in weak-value table from non-immediate to immediateAndy Wingo1-7/+42
* libguile/hashtab.c (set_weak_cdr, scm_hash_fn_set_x): If we have a weak-value hash table with a previous non-immediate value for a given key, and we are setting an immediate as the new value, we were not unregistering the disappearing link. Fixed.
2011-04-15pre-GC_set_start_callback compatibilityAndy Wingo1-8/+31
* configure.ac: Add a check for GC_set_start_callback. * libguile/gc.c (scm_i_gc): If we don't have GC_set_start_callback, run the before-gc hook manually here. (scm_init_gc): Otherwise set it as a start callback. * libguile/hashtab.c (weak_gc_callback, weak_gc_hook) (weak_gc_finalizer, scm_c_register_weak_gc_callback): Fix to work either way, with or without GC_set_start_callback.
2011-04-15weak hash table vacuum on before-gc C hookAndy Wingo1-14/+13
* libguile/hashtab.c (weak_gc_callback) (scm_c_register_weak_gc_callback): Change implementation to use the before-gc C hook instead of the after-gc finalizers.
2011-02-25make-weak-key-hash-table vacuumingAndy Wingo1-3/+9
* libguile/hashtab.c (scm_make_weak_key_hash_table): Whoops, fix the case I actually cared about.
2011-02-24weak hash tables vacuum stale entries after a gcAndy Wingo1-21/+49
* libguile/hashtab.c (scm_c_register_weak_gc_callback): New private helper, arranges for a C function to be called with a SCM as an argument, as long as the argument is reachable by GC. (scm_make_weak_key_hash_table) (scm_make_weak_value_hash_table) (scm_make_doubly_weak_hash_table): Register a weak GC callback to vacuum_weak_hash_table.
2011-02-23GC dead links in weak hash tables before a possible rehashAndy Wingo1-5/+29
* libguile/hashtab.c (vacuum_weak_hash_table): New helper, goes through the entirety of a weak hash table, vacuuming dead entries. (scm_hash_fn_create_handle_x): If when adding to a weak hash table, we would trigger a rehash, vacuum the table first. The weak_bucket_assoc would have only caught dead entries within one bucket. Without this patch, the following code leaks: (let lp () (call-with-output-string (lambda (port) (display "foo" port))) (lp))
2011-01-07fix tab completion in repl (doh)Andy Wingo1-25/+19
* libguile/hashtab.c: Fix remaining vector hash table support. * module/ice-9/session.scm (apropos-fold): Use a hash table instead of a vector for the completions.
2011-01-07add scm_hash_fn_get_handle_by_hashAndy Wingo1-0/+89
* libguile/hashtab.h: * libguile/hashtab.c (scm_hash_fn_get_handle_by_hash): New internal procedure, which should make symbol table lookup faster.
2011-01-07remove vector hash table codeAndy Wingo1-70/+38
* libguile/hashtab.c: Remove deprecated hash-tables-as-vectors support code.
2011-01-07hashtab cleanupsAndy Wingo1-16/+9
* libguile/hashtab.c: Update comments. (hashtable_size): Allow bigger vectors on 64-bit machines.
2010-12-16Rehash weak hash tables less frequently.Ludovic Courtès1-1/+2
* libguile/hashtab.c (weak_bucket_assoc): Call `scm_i_rehash' only when REMAINING is below `SCM_HASHTABLE_LOWER (table)'.
2010-11-19Include <alloca.h> wherever `alloca' is used.Ludovic Courtès1-0/+1
Patch provided by <carlo.bramix@libero.it> (tiny change). * libguile/control.c, libguile/fluids.c, libguile/foreign.c, libguile/hashtab.c, libguile/strings.c: Include <alloca.h>.
2010-10-11Allow arbitrary code in ASSOC procedures for weak hash tables (bug #29616).Ludovic Courtès1-41/+48
* libguile/hashtab.c (struct t_assoc_args, do_weak_bucket_assoc): Remove. (struct t_fixup_args): New type. (do_weak_bucket_fixup): New function. (weak_bucket_assoc): Use it. Keep strong references to BUCKET's entries in STRONG_REFS. Call ASSOC once the alloc lock has been released. This fixes bug #29616. * test-suite/tests/weaks.test ("assoc can do anything"): New test.
2010-10-11Fix a bug in weak hash table bucket fixup.Ludovic Courtès1-14/+14
* libguile/hashtab.c (scm_fixup_weak_alist): Keep the value of PREV unchanged after a nullified pair is deleted; this fixes a bug whereby if several successive nullified pairs were encountered, not all of them would be removed, and the assertion in `weak_bucket_assoc' would be hit. In addition, remove the `scm_is_pair (pair)' test.
2010-09-23Fix weak-value hash tables.Ludovic Courtès1-0/+7
* libguile/hashtab.c (scm_hash_fn_set_x): Register a disappearing link to VAL when TABLE is weak-value. * test-suite/tests/weaks.test ("weak-hash")["weak-key dies", "weak-value dies", "doubly-weak dies"]: Use `hash-set!' and `hash-ref', not `hashq-set!' and `hashq-ref', otherwise these tests would always succeed because (eq? "this" "this") => #f. ["lives"]: Use `hash-ref' and `hash-set!' too for consistency.
2010-06-09fix build error with Compaq C V6.3-025Andy Wingo1-90/+88
* libguile/hashtab.c: Re-arrange functions to avoid the need for pre-declaring character arrays with no length. Fixes compilation on Compaq C V6.3-025. Thanks to Jay Krell for the report.
2009-12-05fluids are tc7 objectsAndy Wingo1-6/+0
If you're wondering what I'm doing, I'm trying to eventually reimplement smobs in terms of structs, so that applicable smobs can just follow the applicable struct dispatch path. But to do that I have to get structs initialized before things that use smobs, which means transforming a bunch of smobby things to tc7 things. But this transformation is good for performance anyway, and we currently have a glut of unused tc7s, so here we go... * libguile/tags.h (scm_tc7_fluid, scm_tc7_dynamic_state): Fluids (and dynamic states) now have tc7s. * libguile/fluids.h: Remove scm_fluids_prehistory, and add internal scm_i_fluid_print. Update a comment. * libguile/fluids.c: Update for tc7 representation. Also remove the next pointers while we're at it, as they aren't used in the new BDW GC. * libguile/eq.c (scm_equal_p): Remove the hashtable case. Hashtables could never be equal? before, I don't see why to add stubs doing the same thing now. * libguile/print.c (iprin1): * libguile/gc.c (scm_i_tag_name): * libguile/evalext.c (scm_self_evaluating_p): Add fluid and dynamic_state cases. * libguile/goops.h: Remove scm_class_hashtable; it will be static. * libguile/goops.c: Make <hashtable> static, and add <fluid> and <dynamic-state> classes. * libguile/hashtab.h: * libguile/hashtab.c: Remove scm_i_hashtable_equal_p. * libguile/init.c (scm_i_init_guile): Remove call to fluids_prehistory.
2009-12-05hash tables have a tc7Andy Wingo1-22/+14
* libguile/tags.h (scm_tc7_hashtable): Allocate a tc7 for hashtables. * libguile/hashtab.h: Adjust macros accordingly. (scm_i_hashtable_print, scm_i_hashtable_equal_p): New internal functions. (scm_hashtab_prehistory): Remove, no more need for this. * libguile/hashtab.c (scm_hash_fn_remove_x): Fix a longstanding bug. (make_hash_table): Adapt to the new hash table representation. * libguile/eq.c (scm_equal_p) * libguile/evalext.c (scm_self_evaluating_p) * libguile/print.c (iprin1) * libguile/gc.c (scm_i_tag_name): Add some tc7_hashtab cases. * libguile/init.c: Remove unused environments init functions. Remove call to hashtab_prehistory. * libguile/goops.h (scm_class_hashtable) * libguile/goops.c (scm_class_of, create_standard_classes): Have to make a class for hash tables manually, because they aren't smobs any more.
2009-12-01remove uses of trampolines within guile itselfAndy Wingo1-3/+2
* libguile/eval.c (scm_map, scm_for_each) * libguile/hashtab.c (scm_hash_for_each_handle) * libguile/list.c (scm_filter, scm_filter_x) * libguile/quicksort.i.c: * libguile/sort.c (scm_restricted_vector_sort_x, scm_sorted_p) (scm_merge, scm_merge_list_x, scm_merge_x) (scm_merge_list_step, scm_sort_x, scm_sort, scm_merge_vector_x) (scm_merge_vector_step, scm_stable_sort_x, scm_sort_list_x) (scm_sort_list)nn * libguile/srfi-13.c (scm_string_any, scm_string_every) (scm_string_tabulate, scm_string_trim, string_trim_right) (scm_string_trim_both, scm_string_index, scm_string_index_right) (scm_string_skip, scm_string_skip_right, scm_string_count) (scm_string_map, scm_string_map_x, scm_string_for_each) (scm_string_for_each_index, scm_string_filter, scm_string_delete): Remove uses of trampolines.
2009-11-05Hold the GC lock when traversing weak hash table buckets.Ludovic Courtès1-65/+102
* libguile/hashtab.c (scm_fixup_weak_alist): Clarify comment. (struct t_assoc_args): New. (do_weak_bucket_assoc, weak_bucket_assoc): New. (START_WEAK_BUCKET_FIXUP, END_WEAK_BUCKET_FIXUP): Remove. (scm_hash_fn_get_handle, scm_hash_fn_create_handle_x, scm_hash_fn_remove_x): Use `weak_bucket_assoc ()' instead of `START_WEAK_BUCKET_FIXUP'/`END_WEAK_BUCKET_FIXUP'.
2009-10-27Use proper fold/for-each function types in `hashtab.h'.Ludovic Courtès1-4/+7
* libguile/hashtab.h (scm_t_hash_fold_fn, scm_t_hash_handle_fn): New types. (scm_internal_hash_fold, scm_internal_hash_for_each_handle): Use them. * libguile/hashtab.c (scm_internal_hash_fold): Take an `scm_t_hash_fold_fn'. Update callers. (scm_internal_hash_for_each_handle): Take an `scm_t_hash_handle_fn'. Update callers.
2009-10-27Use proper assoc/hash function types in `hashtab.c'.Ludovic Courtès1-11/+14
This is a followup to d587c9e8b27219e68f8813fb648fc6913c93be0f ("Use proper types for hash/assoc functions in `hashtab.h'."). * libguile/hashtab.c (scm_i_rehash, scm_hash_fn_create_handle_x, scm_hash_fn_ref, scm_hash_fn_set_x, scm_hash_fn_remove_x): Use `scm_t_hash_fn' and `scm_t_assoc_fn' as appropriate.
2009-10-20Use proper types for hash/assoc functions in `hashtab.h'.Ludovic Courtès1-21/+72
Partly fixes bug #23681 ("Function declarators with empty parentheses should not be used"). * libguile/goops.c (scm_wrap_component): Cast `scm_sloppy_assq'. * libguile/hashtab.c (scm_hash_fn_get_handle): Update to take functions of type `scm_t_hash_fn' and `scm_t_assoc_fn'. Update callers. (scm_ihashx): Change to match `scm_t_hash_fn'. (scm_sloppy_assx): Change to match `scm_t_assoc_fn'. * libguile/hashtab.h (scm_t_hash_fn, scm_t_assoc_fn): New types. (scm_t_hashtable)[hash_fn]: Change to `scm_t_hash_fn'. (scm_i_rehash, scm_hash_fn_get_handle, scm_hash_fn_create_handle_x, scm_hash_fn_ref, scm_hash_fn_set_x, scm_hash_fn_remove_x): Change to take `scm_t_hash_fn' and `scm_t_assoc_fn' parameters. * libguile/srcprop.h (scm_whash_get_handle, scm_whash_create_handle, scm_whash_lookup): Implement in terms of `scm_hashq_*' instead of `scm_hash_fn_*'. * libguile/struct.c (scm_struct_ihashq): Change to match `scm_t_hash_fn'. (scm_struct_create_handle): Cast `scm_sloppy_assq'. * libguile/struct.h (scm_struct_ihashq): Update, make internal.
2009-08-18Merge branch 'master' into boehm-demers-weiser-gcLudovic Courtès1-6/+7
Conflicts: lib/Makefile.am libguile/Makefile.am libguile/frames.c libguile/gc-card.c libguile/gc-freelist.c libguile/gc-mark.c libguile/gc-segment.c libguile/gc_os_dep.c libguile/load.c libguile/macros.c libguile/objcodes.c libguile/programs.c libguile/strings.c libguile/vm.c m4/gnulib-cache.m4 m4/gnulib-comp.m4 m4/inline.m4
2009-06-17Change Guile license to LGPLv3+Neil Jerram1-6/+7
(Not quite finished, the following will be done tomorrow. module/srfi/*.scm module/rnrs/*.scm module/scripts/*.scm testsuite/*.scm guile-readline/* )
2008-09-13Merge branch 'master' into boehm-demers-weiser-gcLudovic Courtès1-0/+3
Conflicts: lib/Makefile.am libguile/gc-card.c libguile/gc-freelist.c libguile/gc-mark.c libguile/gc-segment.c libguile/gc.c libguile/gc.h libguile/gc_os_dep.c libguile/private-gc.h m4/.cvsignore m4/gnulib-cache.m4 m4/gnulib-comp.m4
2008-09-13Include <config.h> in all C files; use `#ifdef HAVE_CONFIG_H' rather than `#if'.Ludovic Courtès1-0/+3
2008-09-10Fix broken hash-table merge.Ludovic Courtès1-2/+2
* libguile/hashtab.c (scm_hash_fn_create_handle_x): Return IT only when it satisfies `scm_is_pair ()'.
2008-09-10Merge branch 'master' into boehm-demers-weiser-gcLudovic Courtès1-1/+3
Conflicts: libguile/Makefile.am libguile/coop-defs.h libguile/gc-card.c libguile/gc-freelist.c libguile/gc-malloc.c libguile/gc-mark.c libguile/gc-segment.c libguile/gc.c libguile/gc.h libguile/gc_os_dep.c libguile/hashtab.c libguile/hashtab.h libguile/inline.h libguile/private-gc.h libguile/struct.c libguile/struct.h libguile/threads.c libguile/threads.h libguile/vectors.h libguile/weaks.h test-suite/tests/gc.test
2008-09-10Re-fixed the hash table element counting in `scm_i_rehash ()'.Ludovic Courtes1-5/+2
* libguile/hashtab.c (scm_i_rehash): Don't invoke `SCM_HASHTABLE_DECREMENT ()' when a weak pair is encountered in the source bucket. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-43
2008-09-10Minor weak hashtables fixes.Ludovic Courtes1-12/+8
* libguile/hashtab.c (scm_fixup_weak_alist): Cosmetic change. (scm_i_rehash): Call `SCM_HASHTABLE_DECREMENT ()' when a deleted weak pair is encountered. (scm_internal_hash_fold): Call `SCM_HASHTABLE_DECREMENT ()' instead of a complicated `SCM_SET_HASHTABLE_N_ITEMS ()'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-40
2008-09-10Moved weak pair code into `weaks.[ch]'.Ludovic Courtes1-124/+12
* libguile/hashtab.c: Don't include <gc/gc_typed.h> and <gc/gc.h>. Updated users of weak (wcar_cell_descr): Removed. (wcdr_cell_descr): Removed. (scm_weak_car_cell): Removed. (scm_weak_cdr_cell): Removed. (scm_doubly_weak_cell): Removed. (SCM_WEAK_CELL_*_DELETED_P): Removed. (SCM_WEAK_CELL_WORD): Removed. (SCM_WEAK_CELL_C[AD]R): Removed. (scm_hashtab_prehistory): Don't initialize weak pairs. * libguile/init.c (scm_i_init_guile): Invoke `scm_weaks_prehistory ()' before `scm_hashtab_prehistory ()' in order to initialize weak pairs. * libguile/weaks.c: Include <gc/gc.h> and <gc/gc_typed.h>. (wc[ad]r_cell_descr): New. (scm_weak_c[ad]r_pair): New. (scm_doubly_weak_pair): New. (scm_weaks_prehistory): New. * libguile/weaks.h (scm_weak_c[ad]r_pair): New declaration. (scm_doubly_weak_pair): New declaration. (SCM_WEAK_PAIR_WORD_DELETED_P): New. (SCM_WEAK_PAIR_CAR_DELETED_P): New. (SCM_WEAK_PAIR_CDR_DELETED_P): New. (SCM_WEAK_PAIR_DELETED_P): New. (SCM_WEAK_PAIR_WORD): New. (SCM_WEAK_PAIR_CAR): New. (SCM_WEAK_PAIR_CDR): New. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-39
2008-09-10Implemented rehashing of weak hash tables.Ludovic Courtes1-76/+44
* libguile/hashtab.c (weak_hashtables): Removed. (SCM_WEAK_CELL_DELETED_P): New macro. (START_WEAK_BUCKET_FIXUP): Added the HASHFN argument. Invoke `scm_i_rehash ()' when pairs have been removed. (END_WEAK_BUCKET_FIXUP): Added the HASHFN argument. (make_hash_table): Use `SCM_NEWSMOB2 ()' instead of `SCM_NEWSMOB3 ()' -- last argument used to be WEAK_HASHTABLES. (scm_i_rehash): Handle weak hash tables. (to_rehash): Removed. (scm_internal_hash_fold): Use `SCM_WEAK_CELL_DELETED_P ()' rather than hand-written equivalent code. (rehash_after_gc): Removed. (scm_hashtab_prehistory): Don't add it as an after-gc hook. * libguile/hashtab.h (SCM_HASHTABLE_NEXT): Removed. (SCM_HASHTABLE_NEXTLOC): Removed. (SCM_SET_HASHTABLE_NEXT): Removed. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-38
2008-09-05Removed a lot of now-useless SMOB mark/free functions.Ludovic Courtes1-9/+0
* libguile/arbiters.c (scm_init_arbiters): Don't invoke `scm_set_smob_mark'. * libguile/async.c (async_gc_mark): Removed. (scm_init_async): Don't invoke `scm_set_smob_mark'. * libguile/coop-pthreads.c (thread_mark): Removed. (create_thread): Use `scm_gc_malloc' instead of `scm_malloc' when allocating `launch_data'. (mutex_mark): Removed. (scm_threads_init): Don't invoke `scm_set_smob_mark' and `scm_set_smob_free'. * libguile/debug.c (scm_init_debug): Don't invoke `scm_set_smob_mark'. * libguile/dynl.c (dynl_obj_mark): Removed. (scm_init_dynamic_linking): Don't invoke `scm_set_smob_mark'. * libguile/dynwind.c (winder_mark): Removed. (scm_init_dynwind): Don't invoke `scm_set_smob_mark'. * libguile/environments.c (environment_mark): Removed. (environment_free): Removed. (observer_mark): Removed. (core_environments_mark): Removed. (core_environments_finalize): Removed. (leaf_environment_mark): Removed. (leaf_environment_free): Removed. (leaf_environment_funcs): Don't refer to the above funcs. (eval_environment_mark): Removed. (eval_environment_free): Removed. (eval_environment_funcs): Don't refer to the above funcs. (import_environment_mark): Removed. (import_environment_free): Removed. (import_environment_funcs): Don't refer to the above funcs. (export_environment_mark): Removed. (export_environment_free): Removed. (export_environment_funcs): Don't refer to the above funcs. (scm_environments_prehistory): Don't invoke `scm_set_smob_mark' and `scm_set_smob_free'. * libguile/environments.h (scm_environment_funcs)[mark]: Removed. [free]: Removed. * libguile/eval.c (promise_mark): Removed. (promise_free): Removed. (scm_init_eval): Don't invoke `scm_set_smob_mark' and `scm_set_smob_free'. * libguile/fluids.c (fluid_free): Removed. (scm_fluids_prehistory): Don't invoke `scm_set_smob_mark' and `scm_set_smob_free'. * libguile/futures.c (future_mark): Removed. (scm_init_futures): Don't invoke `scm_set_smob_mark'. * libguile/hashtab.c (hashtable_free): Removed. (scm_hashtab_prehistory): Don't invoke `scm_set_smob_mark' and `scm_set_smob_free'. * libguile/hooks.c (scm_init_hooks): Don't invoke `scm_set_smob_mark'. * libguile/keywords.c (scm_init_keywords): Don't invoke `scm_set_smob_mark'. * libguile/macros.c (scm_init_macros): Don't invoke `scm_set_smob_mark'. * libguile/modules.c (scm_init_modules): Don't invoke `scm_set_smob_mark'. * libguile/print.c (scm_init_print): Don't invoke `scm_set_smob_mark'. * libguile/random.c (scm_i_copy_rstate): Use `scm_gc_malloc' instead of `scm_malloc'. (scm_c_make_rstate): Likewise. (rstate_free): Removed. (scm_init_random): Don't invoke `scm_set_smob_free'. * libguile/srcprop.c (srcprops_mark): Removed. (scm_init_srcprop): Don't invoke `srcprops_mark'. * libguile/srfi-14.c (charset_free): Removed. (scm_init_srfi_14): Don't invoke `scm_set_smob_free'. * libguile/srfi-4.c (uvec_mark): Removed. (uvec_free): Removed. (scm_init_srfi_4): Don't invoke `scm_set_smob_free' and `scm_set_smob_mark'. * libguile/threads.c (thread_mark): Removed. (fat_mutex_mark): Removed. (fat_cond_mark): Removed. (scm_init_threads): Dont invoke `scm_set_smob_mark' and `scm_set_smob_free'. * libguile/unif.c (bitvector_free): Removed. (array_mark): Removed. (array_free): Removed. (scm_init_unif): Don't invoke `scm_set_smob_free' and `scm_set_smob_mark'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-28