1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 20:00:19 +02:00
Commit graph

108 commits

Author SHA1 Message Date
Andy Wingo
162125af16 fix build error with Compaq C V6.3-025
* 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.
2010-06-09 23:27:33 +02:00
Andy Wingo
9ea31741da fluids are tc7 objects
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-05 10:52:18 +01:00
Andy Wingo
c99de5aa27 hash tables have a tc7
* 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-05 10:07:07 +01:00
Andy Wingo
6c9e8a5354 remove uses of trampolines within guile itself
* 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-12-01 21:00:25 +01:00
Ludovic Courtès
632299050a Hold the GC lock when traversing weak hash table buckets.
* 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-11-05 23:15:54 +01:00
Ludovic Courtès
a07010bf18 Use proper fold/for-each function types in `hashtab.h'.
* 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-27 00:24:09 +01:00
Ludovic Courtès
f044da55c5 Use proper assoc/hash function types in `hashtab.c'.
This is a followup to d587c9e8b2 ("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-27 00:24:09 +01:00
Ludovic Courtès
d587c9e8b2 Use proper types for hash/assoc functions in `hashtab.h'.
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-10-20 00:10:18 +02:00
Ludovic Courtès
fbb857a472 Merge branch 'master' into boehm-demers-weiser-gc
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-08-18 00:06:45 +02:00
Neil Jerram
53befeb700 Change Guile license to LGPLv3+
(Not quite finished, the following will be done tomorrow.
   module/srfi/*.scm
   module/rnrs/*.scm
   module/scripts/*.scm
   testsuite/*.scm
   guile-readline/*
)
2009-06-17 00:22:09 +01:00
Ludovic Courtès
44e268898b Merge branch 'master' into boehm-demers-weiser-gc
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-13 22:51:27 +02:00
Ludovic Courtès
dbb605f575 Include <config.h> in all C files; use #ifdef HAVE_CONFIG_H' rather than #if'. 2008-09-13 15:35:27 +02:00
Ludovic Courtès
0306509bc8 Fix broken hash-table merge.
* libguile/hashtab.c (scm_hash_fn_create_handle_x): Return IT only when
  it satisfies `scm_is_pair ()'.
2008-09-10 23:51:21 +02:00
Ludovic Courtès
6f03035fe8 Merge branch 'master' into boehm-demers-weiser-gc
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-10 23:09:30 +02:00
Ludovic Courtes
639e56a4ed Re-fixed the hash table element counting in `scm_i_rehash ()'.
* 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-10 20:28:12 +02:00
Ludovic Courtes
72c9d17bf3 Minor weak hashtables fixes.
* 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-10 20:27:46 +02:00
Ludovic Courtes
986ec82209 Moved weak pair code into `weaks.[ch]'.
* 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-10 20:27:34 +02:00
Ludovic Courtes
c6a35e35f7 Implemented rehashing of weak hash tables.
* 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-10 20:27:20 +02:00
Ludovic Courtes
a4a141f679 Removed a lot of now-useless SMOB mark/free functions.
* 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
2008-09-05 09:34:23 +02:00
Ludovic Courtes
ce66606641 procs/weaks/hashtab: Removed a bit of useless mark/free code.
* libguile/hashtab.c (UNMARKED_CELL_P): Removed.
  (scm_i_scan_weak_hashtables): Removed.

* libguile/hashtab.h (scm_i_scan_weak_hashtables): Removed.

* libguile/procs.c (scm_mark_subr_table): Removed.

* libguile/procs.h (scm_mark_subr_table): Removed.

* libguile/weaks.c (UNMARKED_CELL_P): Removed.
  (scm_i_remove_weaks): Removed.
  (scm_i_remove_weaks_from_weak_vectors): Removed.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-18
2008-09-05 00:48:31 +02:00
Ludovic Courtes
741e83fcbf Fixes in weak hash tables handling, notably in `hash-fold'.
* libguile/hashtab.c (scm_i_rehash): Return immediately if TABLE is weak.
  (scm_hash_fn_create_handle_x): Explicitly mention that we don't support
  weak alist vectors.
  (scm_internal_hash_fold): Handle weak pairs within buckets.

* libguile/modules.c (scm_module_reverse_lookup): Handle weak alists
  (currently, don't do anything if a NULL pair is met).

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-16
2008-09-05 00:48:16 +02:00
Ludovic Courtes
d9c82e2051 Fixed `scm_fixup_weak_alist ()'; update weak hash table size as needed.
* libguile/hashtab.c (scm_fixup_weak_alist): Added a REMOVED_ITEMS
  parameter.  Fixed a bug in the case where PREV is `SCM_EOL'.
  (IS_WEAK_THING): New macro.
  (START_WEAK_BUCKET_FIXUP): New macro.
  (END_WEAK_BUCKET_FIXUP): New macro.
  (scm_hash_fn_get_handle)[buckets]: New variable.  Use the above
  macros.
  (scm_hash_fn_create_handle_x): Likewise.
  (scm_hash_fn_remove_x): Likewise.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-9
2008-09-05 00:47:03 +02:00
Ludovic Courtes
e4d21e6bc9 Fixed the weak cell implementation (for weak hash tables).
* libguile/hashtab.c (wcar_cell_descr): New.
  (wcdr_cell_descr): New.
  (scm_weak_car_cell): Use `GC_malloc_explicitly_typed ()' instead of
  `scm_gc_malloc_pointerless ()'.
  (scm_weak_cdr_cell): Likewise.
  (SCM_WEAK_CELL_WORD_DELETED_P): Use `SCM_CELL_OBJECT' instead of
  `SCM_CELL_WORD'.
  (scm_hash_fn_get_handle): Call `GC_disable ()' before calling
  `scm_fixup_weak_alist ()' and `GC_enable ()' afterwards.
  (scm_hash_fn_create_handle_x): Likewise.
  (scm_hash_fn_remove_x): Likewise.
  (scm_hashtab_prehistory): Initialize WCAR_CELL_DESCR and
  WCDR_CELL_DESCR.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-8
2008-09-05 00:46:58 +02:00
Ludovic Courtes
3a2de079d5 First stab at implementing weak hash tables and vectors. Unable to run the REPL.
* libguile/hashtab.c (scm_weak_car_cell): New.
  (scm_weak_cdr_cell): New.
  (scm_doubly_weak_cell): New.
  (SCM_WEAK_CELL_WORD_DELETED_P): New.
  (SCM_WEAK_CELL_WORD): New.
  (scm_fixup_weak_alist): New.
  (make_hash_table): Always use non-weak vectors.  Allocate
  `scm_t_hashtable' objects as pointerless.
  (scm_i_rehash): Always make NEW_BUCKETS a non-weak vector.
  (scm_hash_fn_get_handle): Call `scm_fixup_weak_alist ()' on weak
  buckets before calling ASSOC_FN.
  (scm_hash_fn_remove_x): Likewise.
  (scm_hash_fn_create_handle_x): Likewise.  Also, use `scm_.*weak.*cell
  ()' for HANDLE when needed.

* libguile/symbols.c (lookup_interned_symbol): Check for nullified
  pairs.

* libguile/vectors.c (scm_vector_elements): Abort on weak vectors.
  (scm_vector_writable_elements): Likewise.
  (scm_c_vector_ref): Check whether the referenced element has been
  nullified.
  (scm_c_vector_set_x): Use `GC_GENERAL_REGISTER_DISAPPEARING_LINK ()'.
  (scm_i_allocate_weak_vector): Use `scm_gc_malloc_pointerless ()'
  instead of `scm_gc_malloc ()' when allocating room for the vector
  itself.

* libguile/weaks.c (scm_make_weak_key_alist_vector): Use
  `scm_make_vector ()' instead of `scm_i_allocate_weak_vector ()'.
  (scm_make_weak_value_alist_vector): Likewise.
  (scm_make_doubly_weak_alist_vector): Likewise.
  (weak_vectors): Removed.
  (scm_i_init_weak_vectors_for_gc): Removed.
  (scm_i_mark_weak_vector): Removed.
  (scm_i_mark_weak_vector_non_weaks): Removed.
  (scm_i_mark_weak_vectors_non_weaks): Removed.
  (scm_i_remove_weaks_from_weak_vectors): Commented out.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-7
2008-09-05 00:46:53 +02:00
Ludovic Courtes
26224b3f5d Merge from lcourtes@laas.fr--2005-mobile
Patches applied:

 * lcourtes@laas.fr--2005-mobile/guile-core--boehm-gc--1.9  (base, patch 1)

   - tag of lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--base-0
   - Initial hack for Boehm's GC support: nothing works.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-1
2008-09-05 00:45:58 +02:00
Han-Wen Nienhuys
e89b7b3625 Remove unused macro UNMARKED_CELL_P() 2008-08-16 13:21:32 -03:00
Neil Jerram
b226295af8 Release stuff: missing NEWS and 2007/2008 copyrights. 2008-02-15 23:13:59 +00:00
Neil Jerram
15bd90eafd * hashtab.c (scm_hash_fn_create_handle_x): If supplied assoc_fn
returns neither a pair nor #f, signal a wrong-type-arg error.
(Thanks to Gregory Marton for reporting this.)

* tests/hash.test: New "hashx" test supplied by Gregory Marton;
prior to today's fix in libguile/hashtab.c, this caused a
segmentation fault.
2008-01-18 23:33:41 +00:00
Kevin Ryde
2b829bbb3d merge from 1.8 branch 2006-04-17 00:05:42 +00:00
Marius Vollmer
06c1d90009 * gc-mark.c (scm_mark_all): Do not rely on hooks to run the weak
hashtable and guardian machinery but call the relevant functions
directly.

* guardians.h, guardians.c, deprecated.h,
deprecated.c (scm_destroy_guardian_x, scm_guardian_greedy_p,
scm_guardian_destroyed_p, scm_guard, scm_get_one_zombie):
Deprecated and moved into deprecated.[ch].

* guardians.h, guardians.c: Mostly rewritten.
(scm_i_init_guardians_for_gc,
scm_i_identify_inaccessible_guardeds,
scm_i_mark_inaccessible_guardeds): New.

* weaks.h, weaks.c (SCM_I_WVECT_TYPE, SCM_I_SET_WVECT_TYPE): New.
(SCM_I_WVECT_N_ITEMS, SCM_I_SET_WVECT_N_ITEMS): New.
(SCM_WVECTF_NOSCAN, SCM_WVECT_NOSCAN_P): Removed.
(scm_weaks_prehistory): Removed.
(scm_i_init_weak_vectors_for_gc, scm_i_mark_weak_vector,
scm_i_mark_weak_vectors_non_weaks,
scm_i_remove_weaks_from_weak_vectors, scm_i_remove_weaks): New.
(scm_weak_vector_gc_init, scm_mark_weak_vector_spines,
scm_scan_weak_vectors): Removed.

* hashtab.h (scm_i_scan_weak_hashtables): New.
* hashtab.c (make_hash_table, scm_i_rehash): Do not use
SCM_WVECTF_NOSCAN.
(hashtable_print): Use SCM_HASHTABLE_N_ITEMS instead of
t->n_items.
(scan_weak_hashtables, scm_i_scan_weak_hashtables): Renamed former
to latter.  Do not scan the alists themselves, this is done by the
weak vector code now.  Just update the element count.

* vectors.h (SCM_I_WVECT_TYPE, SCM_I_WVECT_EXTRA): Renamed former
to latter.  The type is now only part of the cell word.
(SCM_I_SET_WVECT_TYPE, SCM_I_SET_WVECT_EXTRA): Likewise.

* init.c (scm_i_init_guile): Do not call scm_weaks_prehistory.
2005-07-31 23:04:36 +00:00
Mikael Djurfeldt
3e2073bd24 * gc.c (scm_gc_stats): Bugfix: Measure size of the type we are
mallocating for (unsigned long *bounds).

* hashtab.c (scm_i_rehash): Cast SCM_HASHTABLE_FLAGS (table) to
scm_t_bits before storing them in the type word.

* gc.c (tag_table_to_type_alist): Modified type of c_tag from
scm_t_bits to int.
2005-07-18 13:55:44 +00:00
Marius Vollmer
92205699d0 The FSF has a new address. 2005-05-23 19:57:22 +00:00
Kevin Ryde
4cff503fc8 (scm_hashx_remove_x): Need to pass "closure" to scm_hash_fn_remove_x. 2005-04-22 23:33:15 +00:00
Marius Vollmer
d3a80924bc (scm_t_hashtable): Removed 'closure' field. The
closure can not be stored since it is no longer valid at GC time.
(make_hash_table): Initialize 'hash_fn' field.
(scm_i_rehash): Only store hash_fn in hash table when closre is
NULL.
(rehash_after_gc): Only call scm_i_rehash when 'hash_fn' is
non-NULL.  Always use a NULL closure.
(scm_hash_fn_create_handle_x): Also rehash when table contains too
few entries.
2005-04-04 14:53:27 +00:00
Marius Vollmer
a9cf5c7168 (scm_hash_fx_remove_x): Removed delete_fn
argument; always use scm_delq_x.  The delete_fn function works on
the handle, not the key, and it therefore makes no sense to make
it configurable.  Changed all callers.
(scm_hashx_remove_x): Likewise.  Also, exported to Scheme.
(scm_hash_clear): Accept plain vectors as hashtables.
(scm_delx_x): Removed.
2005-03-29 17:47:39 +00:00
Marius Vollmer
a41666e546 (scm_hash_fn_create_handle_x, scm_hash_fn_remove_x): Use "!scm_is_eq"
instead of "!=".
2005-03-02 20:05:38 +00:00
Marius Vollmer
5b58246699 (scm_i_rehash): Remove elements from old bucket vector
so that no two weak alist vectors share a spine.
(scm_hash_fn_create_handle_x): Deal with a possible rehashing
during GC before inserting the new alist cell.
2005-02-25 22:35:26 +00:00
Marius Vollmer
c2f21af5f8 (scm_i_rehash): Remove elements from old bucket vector so that no two
weak alist vectors share a spine.
2005-02-25 21:22:44 +00:00
Marius Vollmer
bc6580eb22 * hashtab.c (scm_i_rehash): Cope with the case that a GC modifies
the hashtable.
(scm_hash_fn_create_handle_x): Likewise.
* vectors.h (SCM_I_SET_WVECT_TYPE): New, for use in scm_i_rehash.
2005-02-23 17:24:19 +00:00
Marius Vollmer
76da80e788 Reverted changed from 2005/01/24 19:14:54, which was a commit to the
wrong branch.  Sorry.
2005-01-24 23:41:14 +00:00
Marius Vollmer
a54a94b397 Threading changes. 2005-01-24 19:14:54 +00:00
Marius Vollmer
937770822e (hashtable_size, HASHTABLE_SIZE_N): Restrict hashtable sizes to be
smaller than the maximum lengths of vectors.
2005-01-20 14:39:49 +00:00
Marius Vollmer
12783367ec (SCM_HASHTAB_BUCKET_LOC): Removed.
(scan_weak_hashtables): Rewrote its use with SCM_HASHTAB_BUCKET
and SCM_SET_HASHTAB_BUCKET.
2005-01-07 15:50:01 +00:00
Marius Vollmer
3ebc1832c7 (SCM_HASHTABLE_BUCKETS): Removed.
(SCM_HASHTABLE_BUCKET, SCM_HASHTABLE_BUCKET_LOC): New.  Replaced
all uses of SCM_HASHTABLE_BUCKETS with SCM_HASHTABLE_BUCKET.
2005-01-02 20:11:15 +00:00
Marius Vollmer
0345e278f4 * variable.c, threads.c, struct.c, stackchk.c, smob.c, root.c,
print.c, ports.c, mallocs.c, hooks.c, hashtab.c, fports.c,
guardians.c, filesys.c, coop-pthreads.c, continuations.c: Use
scm_uintprint to print unsigned integers, raw heap words, and
adresses, using a cast to scm_t_bits to turn pointers into
integers.
2004-10-22 15:13:12 +00:00
Marius Vollmer
d2e53ed6f8 *** empty log message *** 2004-09-22 17:41:37 +00:00
Marius Vollmer
b9bd8526f0 * numbers.h, numbers.c, discouraged.h, discouraged.c (scm_short2num,
scm_ushort2num, scm_int2num, scm_uint2num, scm_long2num,
scm_ulong2num, scm_size2num, scm_ptrdiff2num, scm_num2short,
scm_num2ushort, scm_num2int, scm_num2uint, scm_num2long,
scm_num2ulong, scm_num2size, scm_num2ptrdiff, scm_long_long2num,
scm_ulong_long2num, scm_num2long_long, scm_num2ulong_long):
Discouraged by moving to discouraged.h and discouraged.c and
reimplementing in terms of scm_from_* and scm_to_*.  Changed all uses
to the new scm_from_* and scm_to_* functions.
2004-08-02 16:14:04 +00:00
Marius Vollmer
e11e83f3d9 * deprecated.h, deprecated.c, numbers.h (SCM_INUMP, SCM_NINUMP,
SCM_INUM): Deprecated by reenaming them to SCM_I_INUMP, SCM_I_NINUMP
and SCM_I_INUM, respectively and adding deprecated versions to
deprecated.h and deprecated.c.  Changed all uses to either use the
SCM_I_ variants or scm_is_*, scm_to_*, or scm_from_*, as appropriate.
2004-07-23 15:43:02 +00:00
Marius Vollmer
a55c2b6809 * validate.h, deprecated.h (SCM_VALIDATE_INUM, SCM_VALIDATE_INUM_COPY,
SCM_VALIDATE_BIGINT, SCM_VALIDATE_INUM_MIN,
SCM_VALIDATE_INUM_MIN_COPY,
SCM_VALIDATE_INUM_MIN_DEF_COPY,SCM_VALIDATE_INUM_DEF,
SCM_VALIDATE_INUM_DEF_COPY, SCM_VALIDATE_INUM_RANGE,
SCM_VALIDATE_INUM_RANGE_COPY): Deprecated because they make the
fixnum/bignum distinction visible.  Changed all uses to scm_to_size_t
or similar.
2004-07-10 14:35:36 +00:00
Marius Vollmer
93ccaef0c6 * numbers.h (SCM_MAKINUM, SCM_I_MAKINUM): Renamed SCM_MAKINUM to
SCM_I_MAKINUM and changed all uses.
2004-07-08 15:58:11 +00:00