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

5484 commits

Author SHA1 Message Date
Ludovic Courtès
a284cc7ed8 Use immutable double-cells for symbols.
* libguile/strings.c (scm_i_make_symbol): Use `scm_immutable_double_cell ()'.
2008-09-16 12:12:38 +02:00
Ludovic Courtès
737219ddbb Add `scm_immutable_double_cell ()'.
* libguile/inline.h (scm_immutable_double_cell): New.
2008-09-16 12:10:52 +02:00
Ludovic Courtès
3db825b067 Use immutable cells for closures.
* libguile/eval.c (scm_closure): Use `scm_immutable_cell ()' instead
  of `scm_cell ()'.

* libguile/procs.h (SCM_SETCODE, SCM_SETENV): Remove.
2008-09-15 23:45:37 +02:00
Ludovic Courtès
d3be55145a Use immutable cells (aka. libgc "stubborn") for subrs.
* libguile/procs.c (scm_c_make_subr): Use `scm_immutable_cell ()' instead
  of `scm_cell ()'.
  (scm_free_subr_entry): Remove.

* libguile/procs.h (SCM_SET_SUBRNUM, SCM_SET_SUBRF): Remove.
  (scm_free_subr_entry): Remove declaration.
2008-09-15 23:32:11 +02:00
Ludovic Courtès
53ea4fdf99 Add `scm_immutable_cell ()'.
* libguile/inline.h (scm_immutable_cell): New.
2008-09-15 23:28:35 +02:00
Ludovic Courtès
d6c74168a7 Remove unused GC string/symbol functions.
* libguile/strings.c (scm_i_stringbuf_mark, scm_i_stringbuf_free,
  scm_i_string_mark, scm_i_string_free, scm_i_symbol_mark,
  scm_i_symbol_free): Remove.

* libguile/strings.h: Remove corresponding declarations.
2008-09-15 22:59:08 +02:00
Ludovic Courtès
11d2fc0660 Conditionalize GC 6.x code.
* libguile/gc.c (scm_storage_prehistory): Have `GC_init ()' called only
  with GC 6.x (it doesn't hurt with 7.x, though).
2008-09-15 22:57:24 +02:00
Ludovic Courtès
04f8c62ca6 Fix detection of the GC version.
* libguile/boehm-gc.h: Don't expect `GC_VERSION_MAJOR' to be defined,
  as it's defined only since 7.x.
2008-09-14 22:07:34 +02: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
61db429e25 Add `ChangeLog-2008' files to the distribution. 2008-09-12 21:57:52 +02:00
Ludovic Courtès
afb59d75b8 Rename ChangeLog' files to ChangeLog-2008'. 2008-09-12 21:49:58 +02:00
Ludovic Courtès
3c2a5013de Include <config.h> in `discouraged.c'.
* libguile/discouraged.c: Include <config.h> first so that files that
  rely on `config.h' macros (such as Gnulib-provided headers) work as
  expected.
2008-09-12 09:41:54 +02:00
Ludovic Courtès
85ca88c68b Remove `.cvsignore' files. 2008-09-11 21:28:21 +02:00
Han-Wen Nienhuys
b71c8ec90a Revise GC asserts.
* libguile/gc.c (scm_i_gc): Change assert into printed warning.

* libguile/private-gc.h (nil): introduce scm_i_last_marked_cell_count,
  as a private mechanism for maintaining cell counts.  Remove variable
  scm_cells_allocated.
2008-09-11 12:10:58 -03:00
Ludovic Courtès
ebd7821321 Adjust to be usable with `libgc' 7.1.
* libguile/boehm-gc.h: Only include <gc/gc_local_alloc.h> with
  `libgc' 6.x.  Define `GC_PTR' for `libgc' 7.x+.
2008-09-11 00:44:13 +02:00
Ludovic Courtès
e9d8bc2558 Fix bug in port eviction code
* libguile/fports.c (scm_i_evict_port): Check whether PORT has a
  ptab entry associated with it.  It's unclear when this can happen.
2008-09-11 00:06:55 +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
b359b36a63 Fix broken GC and threads merge.
* libguile/private-gc.h (scm_i_tag_name): New declaration.

* libguile/threads.c: Include <config.h>.
2008-09-10 23:33:59 +02:00
Ludovic Courtès
7f2a6c387c Fix broken port merge.
* libguile/ports.c (finalize_port): Don't call `scm_remove_from_port_table ()'.
  (scm_flush): Don't refer to `scm_i_port_table_size'.
  (scm_ports_prehistory): Don't allocate `scm_i_port_table'.

* libguile/ports.h (scm_i_port_table_room): Remove declaration.
2008-09-10 23:32:50 +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
35747a3e06 Add comment about `GC_local_malloc ()' upon thread destruction.
* libguile/threads.c (on_thread_exit): Add caveat about possible
  segfault.

git-archimport-id: lcourtes@laas.fr--2006-libre/guile-core--boehm-gc--0--patch-8
2008-09-10 22:52:10 +02:00
Ludovic Courtes
071e0d9329 Remove `scm_get_stack_base ()'.
* libguile/threads.c: Replace `scm_get_stack_base ()' by
  `GC_stackbottom'.

* libguile/gc.h (scm_get_stack_base): Remove declaration.

git-archimport-id: lcourtes@laas.fr--2006-libre/guile-core--boehm-gc--0--patch-7
2008-09-10 22:52:03 +02:00
Ludovic Courtès
e0513d4d77 Merge commit '2e77f7202b' into boehm-demers-weiser-gc
Conflicts:
	libguile/threads.c
2008-09-10 22:51:46 +02:00
Ludovic Courtès
6774820f1e Merge commit '29776e85da' into boehm-demers-weiser-gc
Conflicts:
	libguile/gc-card.c
	libguile/gc.c
	libguile/gc.h
	libguile/ports.c
2008-09-10 22:50:04 +02:00
Ludovic Courtes
b74e86cf5f Fixed warnings due to unused stuff.
* libguile/gc.c (scm_cells_allocated, scm_last_cells_allocated,
  scm_gc_cells_collected, scm_gc_cells_collected_1,
  scm_gc_malloc_collected, scm_gc_time_taken, t_before_gc,
  scm_gc_mark_time_taken, scm_gc_times, scm_gc_cells_swept,
  scm_gc_cells_marked_acc, scm_gc_cells_swept_acc,
  scm_gc_cell_yield_percentage, scm_gc_malloc_yield_percentage):
  Removed.

* libguile/gc.h: Updated accordingly.

* libguile/gdbint.c (port_mark_p, stream_mark_p, string_mark_p,
  unmark_port, remark_port): Removed.

git-archimport-id: lcourtes@laas.fr--2006-libre/guile-core--boehm-gc--0--patch-4
2008-09-10 22:45:59 +02:00
Ludovic Courtès
e9b8556ec9 Merge commit '7337d56d57' into boehm-demers-weiser-gc
Conflicts:
	libguile/struct.c
2008-09-10 22:44:31 +02:00
Ludovic Courtes
ea4f8ea13f scm_gc_malloc: Handle zero-octet allocations.
* libguile/gc-malloc.c (scm_gc_malloc): Pass a non-zero size to
  `GC_MALLOC ()' when SIZE is zero.

git-archimport-id: lcourtes@laas.fr--2006-libre/guile-core--boehm-gc--0--patch-2
2008-09-10 22:34:13 +02:00
Ludovic Courtès
4a4849dbe0 Merge commit '0329137392' into boehm-demers-weiser-gc
Conflicts:
	libguile/gc.c
	libguile/srcprop.c
	libguile/srcprop.h
2008-09-10 22:33:40 +02:00
Ludovic Court`es
3ec17f28b8 Reverted inappropriate merge in `gc.c'.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-53
2008-09-10 22:28:17 +02:00
Ludovic Courtès
35a9197ccc Merge commit 'f30e1bdf97' into boehm-demers-weiser-gc
Conflicts:
	libguile/Makefile.am
	libguile/coop-pthreads.c
	libguile/gc-freelist.c
	libguile/gc-segment.c
	libguile/gc.c
	libguile/private-gc.h
	test-suite/tests/environments.nottest
2008-09-10 22:27:30 +02:00
Ludovic Courtes
e7bca22779 Use thread-local allocation (significant perf. improvement!); added the `boehm-gc.h' header.
* libguile/Makefile.am (modinclude_HEADERS): Added `boehm-gc.h'.

* libguile/coop-defs.h: Use "libguile/boehm-gc.h" instead of <gc/gc.h>.

* libguile/coop-threads.h: Likewise.

* libguile/coop.c: Likewise.

* libguile/gc.c: Likewise.
  (scm_storage_prehistory): Invoke `GC_init ()'.

* libguile/guardians.c: Use "libguile/boehm-gc.h" instead of <gc/gc.h>.

* libguile/inline.h: Likewise.
  (scm_double_cell): Use `GC_MALLOC' instead of `GC_malloc'.

* libguile/pthread-threads.h: Use "libguile/boehm-gc.h" instead of
  <gc/gc.h>.

* libguile/smob.c: Likewise.

* libguile/smob.h: Likewise.

* libguile/struct.c: Likewise.

* libguile/threads.c: Likewise.

* libguile/weaks.c: Likewise.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-51
2008-09-10 22:19:49 +02:00
Ludovic Courtes
8e7b3e9807 Removed scm_gc_registered_roots' and scm_permobjs'.
* libguile/gc.c (scm_permanent_object): Use `scm_gc_protect_object ()'.
  (scm_gc_register_root): Do nothing.
  (scm_init_storage): Removed initialization of `scm_permobjs' and
  `scm_gc_register_roots'.

* libguile/root.h (scm_permobjs): Removed.
  (scm_gc_registered_roots): Removed.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-50
2008-09-10 22:19:30 +02:00
Ludovic Courtes
fdab75a144 Expand heap size at startup time.
* libguile/gc.c (scm_storage_prehistory): Invoke `GC_expand_hp ()'.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-49
2008-09-10 22:19:22 +02:00
Ludovic Courtes
184327a68d Turn "all interior pointers" off (slight performance gain).
* libguile/gc.c (scm_storage_prehistory): Set `GC_all_interior_pointers'
  to 0.  Register `scm_tc3_cons' and `scm_tc3_closure' as valid
  displacements.

* libguile/struct.c (scm_alloc_struct): Register additional
  displacements.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-48
2008-09-10 22:19:11 +02:00
Ludovic Courtes
915b3f9f9a Implemented gc-stats' using libgc' information.
* libguile/gc.c (protected_obj_count): Made `static'.
  (scm_heap_size): Mapped to `heap-size' rather than `cell-heap-size'.
  (scm_heap_free_size): New.
  (scm_heap_total_allocated): New.
  (scm_gc_stats): Rewritten.  Return the (little) information available
  from `libgc'.
  (scm_gc_disable): New.
  (scm_gc_enable): New.
  (scm_storage_prehistory): Don't call `GC_add_roots ()' with
  SCM_SYS_PROTECTS.  Use `GC_is_visible ()' to check whether
  SCM_SYS_PROTECTS is visible.

* libguile/gc.h (scm_gc_enable): New declaration.
  (scm_gc_disable): New declaration.
  (scm_gc_for_alloc): Removed.
  (scm_gc_for_newcell): Removed.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-46
2008-09-10 20:28:41 +02:00
Ludovic Courtes
42e6668b5e Have source properties only use regular GC mechanisms.
* libguile/srcprop.c: Include "libguile/gc.h".
  (srcprops_chunklist): Removed.
  (srcprops_freelist): Removed.
  (srcprops_free): Removed.
  (scm_make_srcprops): Use `scm_gc_malloc ()' rather than
  SRCPROPS_FREELIST et al.
  (scm_init_srcprop): Don't call `scm_set_smob_free ()'.
  (scm_finish_srcprop): Do nothing.

* libguile/srcprop.h (SRCPROPS_CHUNKSIZE): Removed.
  (scm_t_srcprops_chunk): Removed.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-45
2008-09-10 20:28:33 +02:00
Ludovic Courtes
488b10b5a5 Fixed symbols so that interned symbols are only weakly referenced.
* libguile/symbols.c (lookup_interned_symbol): When a deleted weak pair
  is encountered, remove it and update the hashtable's item count.  Also,
  check the hash table threshold and trigger a rehashing if needed.
  (scm_i_c_mem2symbol): Allocate CELL using `scm_weak_car_pair ()' rather
  than `scm_cons ()'.
  (scm_i_mem2symbol): Likewise.
  (scm_symbols_prehistory): Don't invoke `scm_permanent_object ()' for
  SYMBOLS.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-44
2008-09-10 20:28:21 +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
9778b58a19 Allow guardians to be GC'd before the objects they guard.
* libguile/guardians.c (finalize_guarded): While traversing
  GUARDIANS_LIST, check for deleted weak-car pairs.
  (scm_i_guard): Instantiate GUARDIANS_FOR_OBJ using `scm_weak_car_pair ()'
  rather than `scm_cons ()'.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-41
2008-09-10 20:27:54 +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
651a073522 Implemented port finalization.
* libguile/ports.c (register_finalizer_for_port): New.
  (finalize_port): New.
  (scm_new_port_table_entry): Call `register_finalizer_for_port ()'
  before returning the new port.
  (scm_ports_prehistory): Use `scm_gc_malloc_pointerless ()' instead of
  `scm_gc_malloc ()' when allocating room for SCM_I_PORT_TABLE.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-37
2008-09-10 20:27:08 +02:00
Ludovic Courtes
92d8fd328c Use `scm_gc_malloc_pointerless' in various places (improves performance).
* libguile/fports.c (scm_fport_buffer_add): Use
  `scm_gc_malloc_pointerless ()' instead of `scm_gc_malloc ()' when
  allocating room for the read/write buffers.

* libguile/numbers.c (scm_c_make_rectangular): Likewise.

* libguile/ports.c (scm_ungetc): Likewise.

* libguile/random.c (scm_i_copy_rstate): Likewise.
  (scm_c_make_rstate): Likewise.

* libguile/regex-posix.c (scm_make_regexp): Likewise.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-36
2008-09-10 20:27:00 +02:00
Ludovic Courtes
6cc80cb6ab Removed the now-useless `scm_struct_free_*' functions.
* libguile/struct.c (scm_alloc_struct): Set the `scm_struct_i_free'
  element to 0 instead of `scm_struct_free_standard'.
  (scm_struct_free_0): Removed.
  (scm_struct_free_light): Removed.
  (scm_struct_free_standard): Removed.
  (scm_struct_free_entity): Removed.

* libguile/struct.h (scm_struct_free_0): Removed.
  (scm_struct_free_light): Removed.
  (scm_struct_free_standard): Removed.
  (scm_struct_free_entity): Removed.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-35
2008-09-10 20:26:47 +02:00
Ludovic Courtes
077644c8a4 Removed unnecessary uses of class destructors.
* libguile/goops.c (scm_sys_inherit_magic_x): Don't invoke
  `SCM_SET_CLASS_DESTRUCTOR' for legacy destructors that are no longer
  needed (e.g., `scm_struct_free_entity ()', etc.).

* libguile/objects.c (scm_init_objects): Likewise.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-34
2008-09-10 20:26:35 +02:00
Ludovic Courtès
c5cd474d8c Fix compilation of `libguile-i18n' on MinGW.
* libguile/locale-categories.h (MESSAGES): Enclose in `#ifdef LC_MESSAGES' as
  it's not available on MinGW.  Reported by Han-Wen.
2008-09-10 11:38:23 +02:00
Han-Wen Nienhuys
7ddb9baf80 Cleanup mark-during-GC debug checks.
* libguile/__scm.h (SCM_DEBUG): add SCM_DEBUG_MARKING_API

* libguile/gc.h (SCM_SET_GC_MARK): depending on
SCM_DEBUG_MARKING_API crash if someone is touching markbits
outside regular hours.

Rename ensure_marking() to scm_i_ensure_marking().

* libguile/inline.h (scm_double_cell, scm_cell): only set mark bits
for debugging if SCM_DEBUG_MARKING_API is unset

* libguile/gc-mark.c: Issue deprecation warning if we are marking
outside of the GC mark phase.
2008-09-09 23:08:16 -03:00
Ludovic Courtès
a8db4a59c8 Use Gnulib's count-one-bits' as a replacement for scm_i_uint_bit_count ()'.
* libguile/gc-card.c: Include <config.h> and <count-one-bits.h>.
  (scm_i_uint_bit_count): Remove.
  (scm_i_card_marked_count): Use `count_one_bits_l ()' instead
  of `scm_i_uint_bit_count ()'.

* libguile/gc-segment.c: Include <config.h> and <count-one-bits.h>.
  (scm_i_heap_segment_marked_count): Use `count_one_bits_l ()' instead
  of `scm_i_uint_bit_count ()'.

* libguile/private-gc.h (scm_i_uint_bit_count): Remove.
2008-09-09 22:46:04 +02:00