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

428 commits

Author SHA1 Message Date
Han-Wen Nienhuys
5dbc6c0679 replace port table with weak hash table. This simplifies
memory management, and fixes freed cells appearing in
port-for-each output.
2007-08-26 18:11:57 +00:00
Han-Wen Nienhuys
93632e3cfd (s_scm_gc_stats): return an entry for total-cells-allocated
too.
(gc_update_stats): update scm_gc_cells_allocated_acc too.
2007-01-03 17:26:32 +00:00
Ludovic Courtès
d9f71a0754 Changes from arch/CVS synchronization 2006-11-08 09:34:35 +00:00
Neil Jerram
9a5fa6e98a * configure.in: New check for uca lib (needed for IA64 on HP-UX).
* threads.c (SCM_MARK_BACKING_STORE): Use scm_ia64_ar_bsp() and
scm_ia64_register_backing_store_base() instead of Linux-specific
implementations.

* gc.h (scm_ia64_register_backing_store_base, scm_ia64_ar_bsp):
New declarations.

* gc.c (__libc_ia64_register_backing_store_base): Declaration
removed.
(scm_ia64_register_backing_store_base, scm_ia64_ar_bsp): New, with
implementations for Linux and HP-UX.

* coop-pthreads.c (SCM_MARK_BACKING_STORE): Use scm_ia64_ar_bsp()
and scm_ia64_register_backing_store_base() instead of
Linux-specific implementations.

* continuations.h (__libc_ia64_register_backing_store_base):
Declaration removed.
(scm_t_contregs): New "fresh" field.

* continuations.c (ia64_getcontext): Removed.
(scm_make_continuation): Use continuation fresh field instead of
interpreting getcontext return values (which isn't portable).  Use
scm_ia64_ar_bsp() and scm_ia64_register_backing_store_base()
instead of Linux-specific implementations.
(copy_stack_and_call): Use scm_ia64_register_backing_store_base()
instead of Linux-specific implementation.

* _scm.h (__ia64__): Also detect __ia64.
2006-10-25 22:37:24 +00:00
Kevin Ryde
2b829bbb3d merge from 1.8 branch 2006-04-17 00:05:42 +00:00
Han-Wen Nienhuys
4c7016dc06 Ludovic's patch for scm_t_sweep_statistics. 2006-02-14 11:38:30 +00:00
Neil Jerram
3f98874a96 * gc.c (scm_weak_vectors): Removed. 2005-11-12 08:58:51 +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
Han-Wen Nienhuys
8fecbb1900 * gc-card.c (scm_i_card_statistics): init tag.
* gc.c (tag_table_to_type_alist): check type of tag. Should be integer.
2005-07-01 12:34:58 +00:00
Han-Wen Nienhuys
e4da074025 *** empty log message *** 2005-06-11 01:48:19 +00:00
Han-Wen Nienhuys
8a00ba7178 (tag_table_to_type_alist): convert tag number to "tag %d"
string, so live object stats can be sorted with string<?.
2005-06-09 19:33:38 +00:00
Marius Vollmer
92205699d0 The FSF has a new address. 2005-05-23 19:57:22 +00:00
Neil Jerram
b01532af77 * threads.c (s_scm_lock_mutex): Don't declare msg in middle of
code.

* gc.c (s_scm_gc_live_object_stats): Don't declare alist in middle
of code.

* gc-card.c (scm_i_card_statistics): Don't declare tag in middle
of code.
(scm_i_card_statistics): Add block for declarations of tag_as_scm
and current.
2005-05-11 07:41:36 +00:00
Neil Jerram
33b320ae2a Critical section review. 2005-03-30 22:11:07 +00:00
Marius Vollmer
b17e0ac397 * gc.h, gc.c (SCM_FREECELL_P): Removed for good.
(scm_block_gc, scm_gc_heap_lock): Removed.  Removed all uses.
(scm_gc_running_p): Now a macro that refers to the scm_i_thread
field.
(scm_i_sweep_mutex): Now a non-recursive mutex.  GC can not happen
recursively.
(scm_igc, scm_i_gc): Renamed former to latter.  Changed all uses.
Do not lock scm_i_sweep_mutex, which is now non-recursive, or set
scm_gc_running_p.  Do not run the scm_after_gc_c_hook.
(scm_gc): Lock scm_i_sweep_mutex, set scm_gc_running_p and run the
scm_after_gc_c_hook here.
(scm_gc_for_new_cell): Set scm_gc_running_p here and run the
scm_after_gc_c_hook when a full GC has in fact been performed.
(scm_i_expensive_validation_check): Call scm_gc, not scm_i_gc.

* gc-segment.c (scm_i_get_new_heap_segment): Do not check
scm_gc_heap_lock.

* gc-malloc.c (scm_realloc, increase_mtrigger): Set
scm_gc_running_p while the scm_i_sweep_mutex is locked.
2005-03-10 18:39:53 +00:00
Marius Vollmer
9de87eea47 See ChangeLog from 2005-03-02. 2005-03-02 20:42:01 +00:00
Han-Wen Nienhuys
73a4c24e41 * gc.c (s_scm_gc_live_object_stats): return alist, not hashtable.
(tag_table_to_type_alist): ignore unknown types.

* gc.c (s_scm_gc_live_object_stats): new GUILE callable: return
statistics on the number of live objects of each type.

* gc-card.c (scm_i_tag_name):  new function.
(scm_i_card_statistics): new function.
2005-01-27 22:44:43 +00:00
Han-Wen Nienhuys
1367aa5e91 * gc.c (s_scm_gc_live_object_stats): return alist, not hashtable.
* gc-segment.c (scm_i_all_segments_statistics): new function.
(scm_i_heap_segment_statistics): new function

* gc.c (s_scm_gc_live_object_stats): new GUILE callable: return
statistics on the number of live objects of each type.

* gc-card.c (scm_i_tag_name):  new function.
(scm_i_card_statistics): new function.
2005-01-27 22:19:49 +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
Han-Wen Nienhuys
07b99edbe8 (scm_igc): put scm_gc_running-- before running hooks. 2004-10-07 23:42:41 +00:00
Han-Wen Nienhuys
0ff7e3ff22 (scm_gc_unprotect_object): abort if called during GC. 2004-09-24 09:23:44 +00:00
Marius Vollmer
d2e53ed6f8 *** empty log message *** 2004-09-22 17:41:37 +00:00
Marius Vollmer
eb01cb6494 * gc.h, gc.c (scm_i_gc_admin_mutex): New, to protect
scm_gc_mallocated, for now.
(scm_init_storage): Initialize it.
* gc-malloc.c (descrease_mtrigger, increase_mtrigger): Use it.

* gc-mark.c (scm_gc_mark_dependencies): Call scm_i_string_mark,
scm_i_stringbuf_mark and scm_i_symbol_mark, as appropriate.
* gc-card.c (scm_i_sweep_card):  Call scm_i_string_free,
scm_i_stringbuf_free and scm_i_symbol_free, as appropriate.
2004-08-19 16:48:38 +00:00
Marius Vollmer
8824ac88f0 * socket.c, rw.c, deprecated.h, validate.h
(SCM_VALIDATE_STRING_COPY): Deprecated.  Replaced all uses with
SCM_VALIDATE_STRING plus SCM_I_STRING_CHARS or
scm_to_locale_string, etc.
(SCM_VALIDATE_SUBSTRING_SPEC_COPY): Deprecated.  Replaced as
above, plus scm_i_get_substring_spec.

* regex-posix.c, read.c, random.c, ramap.c, print.c, numbers.c,
hash.c, gc.c, gc-card.c, convert.i.c, backtrace.c, strop.c,
strorder.c, strports.c, struct.c, symbols.c, unif.c, ports.c: Use
SCM_I_STRING_CHARS, SCM_I_STRING_UCHARS, and SCM_I_STRING_LENGTH
instead of SCM_STRING_CHARS, SCM_STRING_UCHARS, and
SCM_STRING_LENGTH, respectively.  Also, replaced scm_return_first
with more explicit scm_remember_upto_here_1, etc, or introduced
them in the first place.
2004-08-12 17:45:03 +00:00
Marius Vollmer
82c76fd357 (scm_init_storage, scm_stand_in_procs, scm_stand_in_proc): Use a
hastable for scm_stand_in_procs instead of an alist.  Thanks to
Matthias Koeppe!
2004-08-11 19:38:58 +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
bc36d0502b * tags.h, deprecated.h (SCM_EQ_P): Deprecated by moving it into
deprecated.h.  Replaced all uses with scm_is_eq.
2004-07-27 15:41:49 +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
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
Marius Vollmer
7888309be8 * deprecated.h, boolean.h (SCM_FALSEP, SCM_NFALSEP, SCM_BOOL,
SCM_NEGATE_BOOL, SCM_BOOLP): Deprecated by moving into "deprecated.h".
Replaced all uses with scm_is_false, scm_is_true, scm_from_bool, and
scm_is_bool, respectively.
2004-07-06 10:59:25 +00:00
Han-Wen Nienhuys
009c34a2da * gc.c: remove set_debug_cell_accesses! when
SCM_DEBUG_CELL_ACCESSES is not defined. Scheme source code should
use (if (defined? 'set-debug-cell-accesses!) .. ) to switch on
debugging conditionally.
2004-03-20 23:37:52 +00:00
Han-Wen Nienhuys
7eec4c37c7 * gc.c: add protected_object_count, a number that is dumped from
gc_stats()
2004-01-21 00:06:11 +00:00
Kevin Ryde
9e1569bd0d (scm_remember_upto_here_1, scm_remember_upto_here_2): Undefine
macros while defining functions.
2003-08-12 21:09:10 +00:00
Marius Vollmer
73be1d9e8e Changed license terms to the plain LGPL thru-out. 2003-04-05 19:15:35 +00:00
Rob Browning
aa54a9b0a3 * gc.c: #include <config.h> if HAVE_CONFIG_H. 2003-03-25 23:55:31 +00:00
Mikael Djurfeldt
c35738c1ae * hooks.c (scm_c_hook_add): Fixed bug in append mode.
* environments.c (obarray_enter, obarray_retrieve, obarray_remove,
leaf_environment_fold, obarray_remove_all): Use hashtable
accessors.

* gc.c (scm_init_storage): Moved hook initialization to
scm_storage_prehistory.
(scm_storage_prehistory): New function.
(scm_igc): Added commentary about placement of
scm_after_sweep_c_hook.

* gc-mark.c (scm_mark_all): Use hashtable accessors.
(scm_gc_mark_dependencies): Use SCM_WVECT_WEAK_KEY_P and
SCM_WVECT_WEAK_VALUE_P.

* hashtab.c, hashtab.h (scm_hash_for_each, scm_hash_map): New
functions.
(scm_vector_to_hash_table, scm_c_make_resizing_hash_table):
Removed.
(scm_make_weak_key_hash_table, scm_make_weak_value_hash_table,
scm_make_doubly_weak_hash_table): Moved here from weaks.c.

* init.c (scm_init_guile_1): Removed call to scm_init_weaks; Added
calls to scm_storage_prehistory and scm_hashtab_prehistory.

* modules.c (module-reverse-lookup): Use hashtable accessors.

* symbols.c, symbols.h (scm_i_hash_symbol): New function.

* weaks.c, weaks.h (scm_make_weak_key_alist_vector,
scm_make_weak_value_alist_vector,
scm_make_doubly_weak_alist_vector): New functions.

* weaks.c (scm_init_weaks_builtins): New function.

* weaks.h (SCM_WVECTF_WEAK_KEY, SCM_WVECTF_WEAK_VALUE,
SCM_WVECTF_NOSCAN, SCM_WVECT_WEAK_KEY_P, SCM_WVECT_WEAK_VALUE_P,
SCM_WVECT_NOSCAN_P): New macros.

* weaks.c (scm_scan_weak_vectors):  Use SCM_WVECT_WEAK_KEY_P
and SCM_WVECT_WEAK_VALUE_P.

* weaks.c, weaks.h (scm_i_allocate_weak_vector): Renamed from
allocate_weak_vector and exported.

* Makefile.am (ice9_sources): Added weak-vector.scm.

* weak-vector.scm: New file.

* boot-9.scm (module-clear!): Use hash-clear!.
(module-for-each): Use hash-for-each.
(module-map): Use hash-map.
2003-02-19 15:04:51 +00:00
Mikael Djurfeldt
fb50ef08ec * gc.c, gc.h (scm_i_sweep_mutex): New mutex.
* gc.c (scm_gc_for_newcell), gc-malloc.c (scm_realloc,
scm_gc_register_collectable_memory): Substitute locking of
scm_i_sweep_mutex for calls to scm_i_thread_put_to_sleep.
(scm_igc): Lock sweep mutex here instead of in callers; Calls to
scm_i_thread_put_to_sleep/scm_i_thread_wake_up used to demarkate
the single-thread section (which now only contains the mark
phase).
(scm_gc): Don't lock sweeo mutex here since scm_igc locks it;
Removed SCM_DEFER/ALLOW_INTS.  Simply call scm_igc directly.

* threads.c (gc_section_mutex): Removed.
2002-12-21 18:59:47 +00:00
Mikael Djurfeldt
392d2833a2 * gc.c (scm_igc): Don't call scm_i_thread_invalidate_freelists.
* gc.c (scm_gc_sweep): Call it here instead, which is a more
logical place.

* threads.c (create_thread): Remember root object until the handle
of the new thread is on all_threads list.

* root.c (scm_make_root): Moved copying of fluids until after
creation of root handle so that the fluids are GC protected.  Also
removed the critical section.
2002-12-11 06:54:59 +00:00
Mikael Djurfeldt
b0dc3d710a * threads.c (scm_i_thread_invalidate_freelists): New
function.

* gc.c (scm_igc): Call scm_i_thread_invalidate_freelists.
2002-12-10 16:09:37 +00:00
Mikael Djurfeldt
c7fabadfe0 * async.c, error.h (scm_ints_disabled): Removed.
* gc.c (scm_gc_for_newcell), init.c (scm_init_guile_1),
root.c (scm_internal_cwdr), gdbint.c (SCM_BEGIN_FOREIGN_BLOCK,
SCM_END_FOREIGN_BLOCK): Don't touch scm_ints_disabled.
(old_ints): Removed.

* __scm.h (SCM_DEFER_INTS, SCM_ALLOW_INTS): Define as a recursive
critical section.
(SCM_REDEFER_INTS, SCM_ALLOW_INTS): Define as SCM_DEFER_INTS and
SCM_ALLOW_INTS.
2002-12-10 09:35:06 +00:00
Mikael Djurfeldt
9bc4701cd3 * __scm.h (SCM_ALLOW_INTS_ONLY): Removed.
(SCM_NONREC_CRITICAL_SECTION_START,
SCM_NONREC_CRITICAL_SECTION_END, SCM_REC_CRITICAL_SECTION_START,
SCM_REC_CRITICAL_SECTION_END): New macros.
(SCM_CRITICAL_SECTION_START/END): Defined here.

* eval.c: Insert SOURCE_SECTION_START / SOURCE_SECTION_END around
the three calls to scm_m_expand_body.

* gc.h: #include "libguile/pthread-threads.h";
(SCM_FREELIST_CREATE, SCM_FREELIST_LOC): New macros.

* gc.c (scm_i_freelist, scm_i_freelist2): Defined to be of type
scm_t_key;

* gc.c, gc-freelist.c, inline.h: Use SCM_FREELIST_LOC for freelist
access.

* gc-freelist.c (scm_gc_init_freelist): Create freelist keys.

* gc-freelist.c, threads.c (really_launch): Use
SCM_FREELIST_CREATE.

* gc-malloc.c (scm_realloc, scm_gc_register_collectable_memory):

* gc.c (scm_i_expensive_validation_check, scm_gc,
scm_gc_for_newcell): Put threads to sleep before doing GC-related
heap administration so that those pieces of code are executed
single-threaded.  We might consider rewriting these code sections
in terms of a "call_gc_code_singly_threaded" construct instead of
calling the pair of scm_i_thread_put_to_sleep () and
scm_i_thread_wake_up ().  Also, we would want to have as many of
these sections eleminated.

* init.c (scm_init_guile_1): Call scm_threads_prehistory.

* inline.h: #include "libguile/threads.h"

* pthread-threads.h: Macros now conform more closely to the
pthreads interface.  Some of them now take a second argument.

* threads.c, threads.h: Many changes.

* configure.in: Temporarily replaced "copt" threads option with new
option "pthreads".
(USE_PTHREAD_THREADS): Define if pthreads configured.
2002-12-09 13:42:58 +00:00
Marius Vollmer
2592c4c765 (scm_init_gc): Do not use scm_system_async. 2002-10-04 13:42:43 +00:00
Han-Wen Nienhuys
1e71eafb34 * inline.h: include stdio.h
* smob.c (free_print): abort if scm_debug_cell_accesses_p is set
2002-09-08 11:31:32 +00:00
Han-Wen Nienhuys
ffd724008b * struct.h: change scm_structs_to_free to scm_i_structs_to_free
* gc-malloc.c (scm_gc_register_collectable_memory): use floats;
these won't ever wrap around with high memory usage.

* gc-malloc.c: add DEBUGINFO for mtrigger GCs.
2002-09-05 21:12:21 +00:00
Han-Wen Nienhuys
f2893a253e make scm_cells_allocated unsigned again. Thanks to
Bill Schottstaedt for the bug report
2002-08-21 22:40:03 +00:00
Han-Wen Nienhuys
67329a9eef * mallocs.c (scm_malloc_obj): use scm_gc_malloc in stead of
malloc.

* gc-segment.c (scm_i_get_new_heap_segment): remove cluster cruft:
only use SCM_MIN_HEAP_SEG_SIZE.

* ports.c (scm_add_to_port_table): add backwards compatibility
function

* ports.h: use scm_i_ prefix for port table and port table size.
2002-08-16 22:01:10 +00:00
Han-Wen Nienhuys
eab1b25970 * gc.h: add scm_debug_cells_gc_interval to public interface
* gc-card.c ("sweep_card"): set scm_gc_running while sweeping.

* gc.c (scm_i_expensive_validation_check): separate expensive
validation checks from cheap ones.
2002-08-08 19:47:31 +00:00
Han-Wen Nienhuys
c2cbcc5768 gc statistic tweaks 2002-08-04 14:09:14 +00:00
Han-Wen Nienhuys
c8a1bdc460 new gc 2002-08-04 00:17:18 +00:00