+2005-03-09 Marius Vollmer <mvo@zagadka.de>
+
+ * script.c (scm_compile_shell_switches): Added 2005 to Copyright
+ years.
+
+2005-03-09 Marius Vollmer <marius.vollmer@uni-dortmund.de>
+
+ * gc-card.c (scm_i_sweep_card): Do not increase/decrease
+ scm_gc_running_p. Sweeping can happen in parallel with
+ allocation.
+
+ * inline.h: Updated comments for current threading implementation.
+
+ * threads.h, threads.c (scm_i_frame_single_threaded): Removed.
+ (scm_i_thread): Removed unused signal_asyncs field.
+ (threads_mark): Do not mark it.
+ (guilify_self_1): Do not initialize it. Do initialize
+ continuation_root field.
+ (do_thread_exit): Do not remove thread from all_threads list.
+ (on_thread_exit): Do it here, after leaving guile mode.
+ (sleep_level): Removed.
+ (scm_i_thread_put_to_sleep): Leave thread_admin_mutex locked when
+ returning. Do not support recursive sleeps.
+ (scm_i_thread_wake_up): Expect thread_admin_mutex to be locked on
+ entry. Do not support recursive sleeps.
+
+ * fluids.c (ensure_state_size, ensure_all_state_sizes,
+ resize_all_states): Collapsed ensure_state_size and
+ ensure_all_state_sizes into one function named resize_all_states.
+ Allocate new vectors outside of single threaded region. Do only
+ simple things inside that region.
+ (scm_make_fluid, scm_make_dynamic_state): Lock fluid_admin_mutex
+ while adding to the global lists.
+
+
+2005-03-08 Marius Vollmer <mvo@zagadka.de>
+
+ libltdl is no longer distributed. We expect it to be installed
+ already.
+
+ * Makefile.am (INCLUDES): Removed @LTDLINCL@.
+ (libguile_la_LIBADD): Removed @LIBLTDL@.
+
+2005-03-07 Marius Vollmer <mvo@zagadka.de>
+
+ * threads.h, async.h, threads.c (SCM_CRITICAL_SECTION_START,
+ SCM_CRITICAL_SECTION_END): Moved here from threads.h since now
+ they also block/unblock execution of asyncs and call
+ scm_async_click which is declared in async.h but threads.h can not
+ include async.h since async.h already includes threads.h.
+ (scm_i_critical_section_level): New, for checking mistakes in the
+ use of the SCM_CRITICAL_SECTION_* macros.
+ (scm_i_critical_section_mutex): Make it a recursive mutex so that
+ critical sections can be nested.
+
+ * throw.c (scm_ithrow): Abort when scm_i_critical_section_level is
+ not zero.
+
+ * threads.h, threads.c (scm_frame_lock_mutex): New.
+ (scm_frame_critical_section): Take mutex as argument.
+ (framed_critical_section_mutex): New, used as default for above.
+ (scm_init_threads): Initialize it.
+ (scm_threads_prehistory): Do not initialize thread_admin_mutex and
+ scm_i_critical_section_mutex; both are initialized statically.
+
+ * continuation.c, deprecated.c, goops.c, guardians.c keywords.c,
+ libguile_la-arrays.loT, objprop.c, ports.c, smob.c, sort.s,
+ srcprop.c, stime.c, struct.c, throw.c, regex-posix.c: Include
+ "libguile/async.h" for SCM_CRITICAL_SECTION_START/END.
+
+ * debug.c (scm_debug_options): Replace
+ SCM_CRITICAL_SECTION_START/END with a frame and
+ scm_frame_critical_section.
+
+ * continuations.c (scm_make_continuation): No longer a critical
+ section.
+ (scm_dynthrow): Abort when scm_i_critical_section_level is
+ not zero.
+
+2005-03-04 Marius Vollmer <marius.vollmer@uni-dortmund.de>
+
+ * threads.c (scm_try_mutex): Renamed argument for consistency.
+
+ * root.c (scm_call_with_dynamic_root): New docstring.
+
+ * eval.c: Define _GNU_SOURCE.
+
+2005-03-02 Marius Vollmer <marius.vollmer@uni-dortmund.de>
+
+ Big merge from the mvo-thread-cleanup branch. The main changes
+ are:
+
+ - The dynamic roots functionality has been split into dynamic
+ states and continuations barriers. Fluids have been
+ reimplemented and can now be garbage collected.
+
+ - Initialization of Guile now works in a multi-thread friendly
+ manner. Threads can freely enter and leave guile mode.
+
+ - Blocking on mutexes or condition variables or while selecting
+ can now be reliably interrupted via system asyncs.
+
+ - The low-level threading interface has been removed.
+
+ - Signals are delivered via a pipe to a dedicated 'signal delivery
+ thread'.
+
+ - SCM_DEFER_INTS, SCM_ALLOW_INTS etc have been deprecated.
+
+ * throw.c (scm_handle_by_message): Exit only the current thread,
+ not the whole process.
+ (scm_handle_by_message_noexit): Exit when catching 'quit.
+
+ * scmsigs.c (take_signal, signal_delivery_thread,
+ start_signal_delivery_thread, ensure_signal_delivery_thread,
+ install_handler): Reimplemented signal delivery as explained in
+ the comments.
+
+ * pthreads-threads.h (scm_i_pthread_t, scm_i_pthread_self,
+ scm_i_pthread_create, scm_i_pthread_detach, scm_i_pthread_exit,
+ scm_i_sched_yield, scm_i_pthread_sigmask,
+ SCM_I_PTHREAD_MUTEX_INITIALIZER,
+ SCM_I_PTHREAD_RECURSIVE_MUTEX_INITIALIZER, scm_i_pthread_mutex_t ,
+ scm_i_pthread_mutex_init, scm_i_pthread_mutex_destroy,
+ scm_i_pthread_mutex_trylock, scm_i_pthread_mutex_lock,
+ scm_i_pthread_mutex_unlock, SCM_I_PTHREAD_COND_INITIALIZER,
+ scm_i_pthread_cond_t, scm_i_pthread_cond_init,
+ scm_i_pthread_cond_destroy, scm_i_pthread_cond_signal,
+ scm_i_pthread_cond_broadcast, scm_i_pthread_cond_wait,
+ scm_i_pthread_cond_timedwait, scm_i_pthread_once_t,
+ SCM_I_PTHREAD_ONCE_INIT, scm_i_pthread_once, scm_i_pthread_key_t ,
+ scm_i_pthread_key_create, scm_i_pthread_setspecific,
+ scm_i_pthread_getspecific, scm_i_scm_pthread_mutex_lock,
+ scm_i_frame_pthread_mutex_lock, scm_i_scm_pthread_cond_wait,
+ scm_i_scm_pthread_cond_timedwait): Provide the obvious mapping
+ when using pthreads.
+ * null-threads.c, null-threads.h: Provide dummy definitions for
+ the above symbols when not using pthreads.
+
+ * modules.h, modules.c (scm_frame_current_module): New.
+
+ * load.c (scm_primitive_load): Use scm_i_frame_current_load_port
+ instead of scm_internal_dynamic_wind.
+
+ * init.h, init.c (restart_stack, start_stack): Removed.
+ (scm_boot_guile, invoke_main_func): Simply use scm_with_guile.
+ (scm_boot_guile_1): Removed.
+ (scm_i_init_mutex): New.
+ (really_cleanup_for_exit, cleanup_for_exit): New.
+ (scm_init_guile_1, scm_i_init_guile): Renamed former to latter.
+ Moved around some init funcs. Call
+ scm_init_threads_default_dynamic_state. Register cleanup_for_exit
+ with atexit.
+
+ * hashtab.c (scm_hash_fn_create_handle_x, scm_hash_fn_remove_x):
+ Use "!scm_is_eq" instead of "!=".
+
+ * ge-scmconfig.c, gen-scmconfig.h.in (SCM_I_GSC_USE_COOP_THREADS,
+ SCM_USE_COOP_THREADS): Removed.
+
+ * gc.c (scm_igc): Take care that scm_gc_running_p is properly
+ maintained. Unlock scm_i_sweep_mutex before running
+ scm_after_gc_c_hook.
+ (scm_permanent_object): Allocate outside of critical section.
+ (cleanup): Removed.
+
+ * fluids.h, fluids.c: Reimplemented completely.
+ (SCM_FLUID_NUM, SCM_FAST_FLUID_REF,
+ SCM_FAST_FLUID_SET): Reimplemented as functions.
+ (scm_is_fluid): New.
+ (scm_i_make_initial_fluids, scm_i_copy_fluids): Removed.
+ (scm_make_dynamic_state, scm_dynamic_state_p,
+ scm_is_dynamic_state, scm_current_dynamic_state,
+ scm_set_current_dynamic_state, scm_frame_current_dynamic_state,
+ scm_c_with_dynamic_state, scm_with_dynamic_state,
+ scm_i_make_initial_dynamic_state, scm_fluids_prehistory): New.
+
+ * feature.c (progargs_fluid): New.
+ (scm_program_arguments, scm_set_program_arguments): Use it instead
+ of scm_progargs.
+ (scm_init_feature): Allocate it. Also, only add "threads" feature
+ when SCM_USE_PTHREAD_THREADS is true.
+
+ * eval.c (scm_makprom): Use scm_make_recursive_mutex instead of
+ scm_make_rec_mutex, with all the consequences.
+ (scm_eval_x, scm_eval): Use scm_frame_begin etc instead of
+ scm_internal_dynamic_wind. Handle dynamic states as second
+ argument.
+
+ * threads.h, threads.c (scm_internal_select): Renamed to
+ scm_std_select and discouraged old name.
+ (scm_thread_sleep, scm_thread_usleep): Likewise, as scm_std_sleep
+ and scm_std_usleep.
+ (scm_tc16_fair_mutex, scm_tc16_fair_condvar, SCM_MUTEXP,
+ SCM_FAIR_MUTEX_P, SCM_MUTEX_DATA, SCM_CONDVARP,
+ SCM_FAIR_CONDVAR_P, SCM_CONDVAR_DATA, SCM_THREADP,
+ SCM_THREAD_DATA): Removed.
+ (SCM_I_IS_THREAD, SCM_I_THREAD_DATA): New.
+ (scm_i_thread): New.
+ (SCM_VALIDATE_THREAD, SCM_VALIDATE_MUTEX, SCM_VALIDATE_CONDVAR):
+ Use scm_assert_smob_type.
+ (scm_c_scm2thread, scm_thread_join, scm_thread_detach,
+ scm_thread_self, scm_thread_yield, scm_mutex_init,
+ scm_mutex_destroy, scm_mutex_trylock, scm_mutex_unlock,
+ scm_rec_mutex_init, scm_rec_mutex_destroy, scm_make_rec_mutex,
+ scm_rec_mutex_free, scm_rec_mutex_lock, scm_rec_mutex_trylock,
+ scm_cond_init, scm_cond_destroy, scm_cond_wait,
+ scm_cond_timedwait, scm_cond_signal, scm_cond_broadcast,
+ scm_key_create, scm_key_delete, scm_setspecific, scm_getspecific,
+ scm_thread_select): Removed. Replaced with scm_i_pthread
+ functions as appropriate.
+ (scm_in_guile, scm_outside_guile): Removed.
+ (scm_t_guile_ticket, scm_leave_guile, scm_enter_guile): Return and
+ take a ticket.
+ (scm_with_guile, scm_without_guile, scm_i_with_guile_and_parent):
+ New.
+ (scm_i_frame_single_threaded): New.
+ (scm_init_threads_default_dynamic_state): New.
+ (scm_i_create_thread): Removed.
+ (scm_make_fair_mutex, scm_make_fair_condition_variable): Removed.
+ (scm_make_recursive_mutex): New.
+ (scm_frame_critical_section): New.
+ (SCM_CURRENT_THREAD, SCM_I_CURRENT_THREAD): Renamed former to
+ latter, changed all uses.
+ (scm_i_dynwinds, scm_i_setdynwinds, scm_i_last_debug_frame,
+ scm_i_set_last_debug_frame): New, use them instead of scm_root
+ stuff.
+ (SCM_THREAD_LOCAL_DATA, SCM_SET_THREAD_LOCAL_DATA,
+ scm_i_root_state_key,m scm_i_set_thread_data): Removed.
+ (scm_pthread_mutex_lock, scm_frame_pthread_mutex_lock,
+ scm_pthread_cond_wait, scm_pthread_cond_timedwait).
+ (remqueue): Allow the removal of already removed cells. Indicate
+ whether a real removal has happened.
+ (scm_thread): Removed, replaced with scm_i_thread.
+ (make_thread, init_thread_creatant): Removed.
+ (cur_thread): Removed.
+ (block_self, unblock_from_queue): New.
+ (block, timed_block, unblock): Removed.
+ (guilify_self_1, guilify_self_2, do_thread_exit,
+ init_thread_key_once, init_thread_key,
+ scm_i_init_thread_for_guile, get_thread_stack_base,
+ scm_init_guile): New initialisation method.
+ (scm_call_with_new_thread, scm_spawn_thread): Use it to simplify
+ thread creation.
+ (fair_mutex, fat_mutex, etc, fair_condvar, fat_condvar): Renamed
+ "fair" to fat and implemented new semantics, including reliable
+ interruption.
+ (all_threads): Now a pointer to a scm_i_thread, not a SCM.
+ (scm_threads_mark_stacks): Explicitly mark handle.
+ (scm_std_select): Allow interruption by also selecting on the
+ sleep_pipe.
+ (scm_i_thread_put_to_sleep): Handle recursive requests for
+ single-threadedness.
+ (scm_threads_prehistory, scm_init_threads): Put current thread
+ into guile mode via guileify_self_1 and guileify_self_2,
+ respectively.
+
+ * fluid.h (SCM_FLUIDP): Deprecated.
+
+ * coop-threads.c: Removed.
+
+ * continuations.h, continuations.c (scm_with_continuation_barrier,
+ scm_c_with_continuation_barrier, scm_i_with_continuation_barrier):
+ New.
+
+ * async.h, async.c (scm_i_setup_sleep, scm_i_reset_sleep): New.
+ (async_mutex): New.
+ (scm_async_click): Protected with async_mutex. Do not deal with
+ signal_asyncs, which are gone. Set cdr of handled async cell to
+ #f.
+ (scm_i_queue_async_cell): Protected with async_mutex. Interrupt
+ current sleep.
+ (scm_system_async_mark_for_thread): Do not use scm_current_thread
+ since that might not work during early initialization.
+
+ * __scm.h (SCM_DEFER_INTS, SCM_ALLOW_INTS, SCM_REDEFER_INTS,
+ SCM_REALLOW_INTS): Deprecated by moving into deprecated.h and
+ deprecated.c. Replaced all uses with SCM_CRITICAL_SECTION_START
+ and SCM_CRITICAL_SECTION_END.
+ (SCM_ENTER_A_SECTION, SCM_EXIT_A_SECTION): Removed. Replaced with
+ SCM_CRITICAL_SECTION_START/END.
+
+ * Makefile.am (modinclude_HEADER): Removed threads-plugin.h.
+ (libguile_la_SOURCES): Added null-threads.c
+ (EXTRA_libguile_la_SOURCES): Removed pthread-threads.c and
+ threads-plugin.c.
+ * pthread-threads.c, threads-plugin.c, threads-plugin.h: Removed.
+
+ * root.h, root.c (scm_tc16_root, SCM_ROOTP, SCM_ROOT_STATE,
+ scm_root_state, scm_stack_base, scm_save_regs_gc_mark,
+ scm_errjmp_bad, scm_rootcont, scm_dynwinds, scm_progargs,
+ scm_last_debug_frame, scm_exitval, scm_cur_inp, scm_outp,
+ scm_cur_err, scm_cur_loadp, scm_root, scm_set_root,
+ scm_make_root): Removed or deprecated. Replaced with references
+ to the current thread, dynamic state, continuation barrier, or
+ some fluid, as appropriate.
+ (root_mark, root_print): Removed.
+ (scm_internal_cwdr): Reimplemented guts with
+ scm_frame_current_dynamic_state and
+ scm_i_with_continuation_barrier.
+ (scm_dynamic_root): Return current continuation barrier.
+
+
+2005-02-28 Marius Vollmer <mvo@zagadka.de>
+
+ * socket.c (scm_setsockopt): Handle IP_ADD_MEMBERSHIP and
+ IP_DROP_MEMBERSHIP options. Also, reorganized the code a bit for
+ cleanliness.
+ (scm_init_socket): Define IP_ADD_MEMBERSHIP and
+ IP_DROP_MEMBERSHIP.
+ Thanks to Greg Troxel!
+
+2005-02-27 Mikael Djurfeldt <djurfeldt@nada.kth.se>
+
+ * gh.h: Bugfix: Include <libguile.h> outside of the extern "C"
+ block.
+
+2005-02-25 Marius Vollmer <mvo@zagadka.de>
+
+ * hashtab.c (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-23 Marius Vollmer <marius.vollmer@uni-dortmund.de>
+
+ * 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-10 Mikael Djurfeldt <djurfeldt@nada.kth.se>
+
+ * unif.c (prototype_to_type): Bugfix: Don't compare prototype to
+ the prototypical examples mentioned in the old reference manual.
+ Instead keep the old semantics of dispatching on type. (Yes, this
+ is extremely ugly, but the whole point of keeping the deprecated
+ interface is not to break old code.)
+
+2005-02-08 Mikael Djurfeldt <djurfeldt@nada.kth.se>
+
+ * deprecated.h (SCM_ARRAY_DIMS): Rename scm_i_attay_dims -->
+ scm_i_array_dims.
+
+2005-01-28 Kevin Ryde <user42@zip.com.au>
+
+ * numbers.c (scm_ash): Rewrite using shifts, much faster than
+ integer-expt and multiply/divide. Inexacts and fractions no longer
+ supported (they happened to work before for left shifts, but not
+ right). Don't really need inexacts and fractions, since ash is
+ documented as a "bitwise operation", and all the rest of those only
+ take exact integers.
+
+2005-01-27 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * gc-card.c (scm_i_card_statistics): map structs, closures and
+ subrs to one tag.
+
+ * gc.c (s_scm_gc_live_object_stats): return alist, not hashtable.
+ (tag_table_to_type_alist): ignore unknown types.
+
+ * 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-24 Kevin Ryde <user42@zip.com.au>
+
+ * posix.c (scm_setlocale): Force errno=EINVAL for an error, since
+ POSIX and C99 don't document errno being set. Reported by Bruno
+ Haible.
+ (scm_flock): Update docstring from manual.
+
+ * random.c (scm_i_init_rstate): Compare w to -1 not 0xffffffffUL, now
+ that it's an scm_t_int32. Otherwise gcc 3.4 says it's always false on
+ a 64-bit system.
+
+ * scmsigs.c (scm_sigaction_for_thread): Use scm_to_long for
+ sa_handler, needs to be a long on 64-bit systems where int is only 32
+ bits.
+
+2005-01-20 Marius Vollmer <marius.vollmer@uni-dortmund.de>
+
+ * environments.c (obarray_enter, obarray_replace): Call
+ SCM_HASHTABLE_INCREMENT when adding a new entry.
+
+ * objects.c: Include goops.h for the scm_class_of prototype.
+
+ * hashtab.c (hashtable_size, HASHTABLE_SIZE_N): Restrict hashtable
+ sizes to be smaller than the maximum lengths of vectors.
+
+2005-01-18 Marius Vollmer <marius.vollmer@uni-dortmund.de>
+
+ * ports.c, smob.c: Include "libguile/goops.h".
+
+ * objects.h, objects.c, goops.c, goops.h (scm_class_boolean,
+ scm_class_char, scm_class_pair, scm_class_procedure,
+ scm_class_string, scm_class_symbol,
+ scm_class_procedure_with_setter, scm_class_primitive_generic,
+ scm_class_vector, scm_class_null, scm_class_real,
+ scm_class_complex, scm_class_integer, scm_class_fraction,
+ scm_class_unknown, scm_port_class, scm_smob_class,
+ scm_no_applicable_method, scm_class_of): Moved from objects to
+ goops since they are only useable once goops has been loaded.
+ (scm_classes_initialized): Removed.
+ (scm_class_of): Do not check it.
+ (create_standard_classes): Do not set it.
+
2005-01-17 Marius Vollmer <marius.vollmer@uni-dortmund.de>
* objects.h, objects.c (scm_classes_initialized): New.
2004-10-08 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * gc.c (scm_igc): put scm_gc_running-- before running hooks.
+
* inline.h (scm_double_cell): abort if GC running.
(scm_cell): idem.