summaryrefslogtreecommitdiff
Commit message (Expand)AuthorAgeFilesLines
* wipwip-nj-thread-safetyNeil Jerram2009-03-252-2/+4
* Allow non-weak hash tables to be automatically thread-safe•••This patch allows a fat mutex to be associated with a hash table. When a hash table has an associated mutex, that mutex will be automatically locked and unlocked around all operations (include lookups) on the hash table's internal data. * libguile/hashtab.c (make_hash_table): Init mutex field to #f. (hashtable_mark): New function. (scm_hash_fn_get_handle, scm_hash_fn_create_handle_x, scm_hash_fn_remove_x, scm_hash_clear_x, scm_internal_hash_fold, scm_internal_hash_for_each_handle): If the hash table has a mutex, lock and unlock it around all accessing of the hash table's internals. (scm_hash_use_mutex_x): New function. (scm_hashtab_prehistory): Use hashtable_mark as hash table mark function. * libguile/hashtab.h (SCM_HASHTABLE_MUTEX, SCM_SET_HASHTABLE_MUTEX, scm_hash_use_mutex_x): New declarations. (scm_t_hashtable): New mutex field. Neil Jerram2009-03-252-15/+119
* Make the interned symbols hash thread-safe•••These changes introduce a mutex that protects all accesses to and modifications of the symbols hash. They allow the test-define-race test to run without errors for a long time. (Well, for 200s anyway.) * libguile/environments.c (obarray_enter, obarray_replace): Extra parameter on scm_i_rehash calls. * libguile/hashtab.c: Include symbols.h. (scm_i_rehash): New mutex parameter. When non-NULL, unlock and relock this mutex around allocations, and recheck new size calculation (in case another thread has changed it). (rehash_after_gc): Special treatment for the symbol hash. (scm_hash_fn_create_handle_x, scm_hash_fn_remove_x): Extra parameter on scm_i_rehash calls. * libguile/hashtab.h (scm_i_rehash): New mutex parameter. * libguile/symbols.c (symbols): Rename scm_i_symbols and make non-static. (symbols_mutex): New variable. (scm_sys_symbols): symbols -> scm_i_symbols. (lookup_interned_symbol): Lock symbols_mutex while performing lookup. (intern_symbol): Add name, len and raw_hash parameters. Lock symbols_mutex while checking and modifying the symbols hash. Once the mutex is locked, recheck in case another thread has already interned the symbol. Return interned symbol, in order to tell callers about this last case. (scm_i_c_mem2symbol, scm_i_mem2symbol, scm_take_locale_symboln): Update intern_symbol calls. (scm_i_rehash_symbols_after_gc): New function. (scm_symbols_prehistory): symbols -> scm_i_symbols. Initialize symbols_mutex. * libguile/symbols.h (scm_i_symbols, scm_i_rehash_symbols_after_gc): New declarations. Neil Jerram2009-03-255-37/+117
* New test for thread-safe define•••Written by Linas Vepstas; modified by Neil Jerram. * test-suite/standalone/Makefile.am: Add test-define-race test. * test-suite/standalone/test-define-race.c: New test. Neil Jerram2009-03-252-0/+173
* Fix spurious `throw from within critical section' errors•••The crux of this problem was that the thread doing a throw, and so checking scm_i_critical_section_level, was different from the thread that was in a critical section. * libguile/async.h (scm_i_critical_section_level): Removed, replaced by per-thread critical_section_level. (SCM_CRITICAL_SECTION_START, SCM_CRITICAL_SECTION_END): Use per-thread critical_section_level. * libguile/continuations.c (scm_dynthrow): Check per-thread critical_section_level. * libguile/threads.c (guilify_self_1): Init per-thread critical_section_level. (scm_i_critical_section_level): Removed. * libguile/threads.h (scm_i_thread): New critical_section_level field. * libguile/throw.c (scm_ithrow): Check per-thread critical_section_level. Neil Jerram2009-03-255-8/+9
* NEWS entry for lock ordering and critical section fixes•••(I don't think we need more specific entries than this.) Neil Jerram2009-03-251-0/+1
* Avoid throw from critical section, given invalid sigaction call•••* libguile/scmsigs.c (scm_sigaction_for_thread): Exit critical section before raising out-of-range error. * test-suite/Makefile.am (SCM_TESTS): Add signals.test. * test-suite/tests/signals.test: New file. Neil Jerram2009-03-253-1/+34
* Aggregate `Makefile.am' files under `examples/'.•••* configure.in: Don't produce `examples/*/Makefile'. * examples/Makefile.am (SUBDIRS): Remove. (EXTRA_DIST, AM_CFLAGS, AM_LIBS): New. (box/box, box/box.o, box-module/box, box-module/box.o, libbox.la, box-dynamic/box.lo, libbox-module.la, box-dynamic-module/box.lo, installcheck, CLEANFILES, clean-local): New targets, aggregated from `Makefile.am' files formerly in sub-directories. * examples/check.test: New file, aggregated from `check.test' files in sub-directories. Ludovic Courtès2009-03-2017-512/+311
* Have `scm_take_locale_symbol ()' return an interned symbol (fixes bug #25865).•••* libguile/symbols.c (intern_symbol): New function, with code formerly duplicated in `scm_i_c_mem2symbol ()' and `scm_i_mem2symbol ()'. (scm_i_c_mem2symbol, scm_i_mem2symbol): Use it. (scm_take_locale_symboln): Use `intern_symbol ()'. This fixes bug #25865. * test-suite/standalone/Makefile.am (test_scm_take_locale_symbol_SOURCES, test_scm_take_locale_symbol_CFLAGS, test_scm_take_locale_symbol_LDADD): New variables. (check_PROGRAMS, TESTS): Add `test-scm-take-locale-symbol'. Ludovic Courtès2009-03-195-42/+116
* Aggregate `Makefile.am' files under `lang/'.•••* lang/Makefile.am (SUBDIRS): Remove. (elisp_sources): Aggregate the value of `elisp_SOURCES' formerly found in sub-directories' `Makefile.am'. Ludovic Courtès2009-03-085-138/+47
* Move `guardians.test' to its own module.•••* test-suite/tests/guardians.test: Add `define-module' clause. Ludovic Courtès2009-03-081-4/+5
* Add new subr invocation benchmarks.•••* benchmark-suite/benchmarks/subr.bm (hook1, hook3): New variables. ("subr invocation")("generic subr with rest arg", "generic subr with rest arg and 3+ parameters"): New benchmarks. ("subr application")("generic subr with rest arg", "generic subr with rest arg and 3+ parameters"): New benchmarks. Ludovic Courtès2009-03-081-2/+22
* Add subr invocation benchmark.•••* benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add `subr.bm'. Ludovic Courtès2009-03-082-0/+47
* Add tests for the stack inspection API.•••* test-suite/tests/eval.test (stack->frames): New procedure. ("stacks"): New test prefix. Ludovic Courtès2009-03-081-1/+64
* Add new GOOPS tests for built-in types.•••* test-suite/tests/goops.test ("classes for built-in types"): New test prefix. Ludovic Courtès2009-03-081-1/+19
* Add test for `procedure-properties'.•••* test-suite/Makefile.am (SCM_TESTS): Add `tests/procprop.test'. Ludovic Courtès2009-03-082-1/+63
* Lock ordering: don't allocate when in critical section (scm_sigaction_for_thr...•••This fixes the following helgrind report. Thread #1: lock order "0x4114748 before 0x4331084" violated at 0x40234F7: pthread_mutex_lock (hg_intercepts.c:408) by 0x407A55F: deval (eval.c:4077) by 0x407A071: scm_dapply (eval.c:5012) by 0x407888A: scm_apply (eval.c:4811) by 0x407E20C: scm_call_0 (eval.c:4666) by 0x406BDF7: scm_dynamic_wind (dynwind.c:111) by 0x407620C: ceval (eval.c:4571) by 0x407E8D9: scm_primitive_eval_x (eval.c:5921) by 0x407E934: scm_eval_x (eval.c:5956) by 0x40B9140: scm_shell (script.c:737) by 0x4095AC5: invoke_main_func (init.c:367) by 0x4065A81: c_body (continuations.c:349) Required order was established by acquisition of lock at 0x4114748 at 0x40234F7: pthread_mutex_lock (hg_intercepts.c:408) by 0x40B7BE1: scm_sigaction_for_thread (scmsigs.c:339) by 0x40911DE: scm_gsubr_apply (gsubr.c:223) by 0x4079E36: scm_dapply (eval.c:4930) by 0x407AB68: deval (eval.c:4378) by 0x407A071: scm_dapply (eval.c:5012) by 0x407888A: scm_apply (eval.c:4811) by 0x407E1D0: scm_call_1 (eval.c:4672) by 0x407FEEE: scm_map (eval.c:5489) by 0x407BDCC: deval (eval.c:4367) by 0x407D197: deval (eval.c:3698) by 0x407A071: scm_dapply (eval.c:5012) followed by a later acquisition of lock at 0x4331084 at 0x40234F7: pthread_mutex_lock (hg_intercepts.c:408) by 0x40DC397: scm_enter_guile (threads.c:377) by 0x40DC8F4: scm_pthread_mutex_lock (threads.c:1485) by 0x4083FAA: scm_gc_for_newcell (gc.c:484) by 0x40A9781: scm_cons (inline.h:115) by 0x4079867: scm_dapply (eval.c:4850) by 0x407888A: scm_apply (eval.c:4811) by 0x40796D6: scm_call_3 (eval.c:4684) by 0x409A7C2: module_variable (modules.c:302) by 0x409A7EE: module_variable (modules.c:312) by 0x409A962: scm_sym2var (modules.c:466) by 0x40738F4: scm_lookupcar1 (eval.c:2874) * libguile/scmsigs.c (close_1): Renamed `handler_to_async'; also handle #f case and wrapping the async in a cons, if necessary. (install_handler): Pass in async instead of constructing it; combine two branches into one. (scm_sigaction_for_thread): Allocate async upfront instead of inside the critical section, and pass it to install_handler calls. Leave critical section before signaling out-of-range error. Neil Jerram2009-03-051-23/+25
* Don't leave Guile mode to lock async_mutex•••This fixes lots of helgrind-reported problems, such as: Thread #1: lock order "0x4325084 before 0x4108928" violated at 0x40234F7: pthread_mutex_lock (hg_intercepts.c:408) by 0x40CFD37: scm_enter_guile (threads.c:377) by 0x40D0284: scm_pthread_mutex_lock (threads.c:1485) by 0x405A736: scm_async_click (async.c:155) by 0x406F9EE: deval (eval.c:4080) by 0x40761D9: scm_primitive_eval_x (eval.c:5921) by 0x40AD20E: install_handler (scmsigs.c:113) by 0x40AD402: scm_sigaction_for_thread (scmsigs.c:394) by 0x4087D1F: scm_gsubr_apply (gsubr.c:223) by 0x406DF55: scm_dapply (eval.c:4930) by 0x407147C: deval (eval.c:4378) by 0x406E1BD: scm_dapply (eval.c:5012) Required order was established by acquisition of lock at 0x4325084 at 0x40234F7: pthread_mutex_lock (hg_intercepts.c:408) by 0x40CFD37: scm_enter_guile (threads.c:377) by 0x408C58B: scm_i_init_guile (init.c:421) by 0x40D1873: scm_i_init_thread_for_guile (threads.c:589) by 0x40D18B4: scm_i_with_guile_and_parent (threads.c:731) by 0x40D19BD: scm_with_guile (threads.c:720) by 0x408C42E: scm_boot_guile (init.c:350) by 0x8048710: main (guile.c:69) followed by a later acquisition of lock at 0x4108928 at 0x40234F7: pthread_mutex_lock (hg_intercepts.c:408) by 0x40AFD61: scm_make_smob_type (smob.c:294) by 0x40AFF19: scm_smob_prehistory (smob.c:512) by 0x408C595: scm_i_init_guile (init.c:423) by 0x40D1873: scm_i_init_thread_for_guile (threads.c:589) by 0x40D18B4: scm_i_with_guile_and_parent (threads.c:731) by 0x40D19BD: scm_with_guile (threads.c:720) by 0x408C42E: scm_boot_guile (init.c:350) by 0x8048710: main (guile.c:69) * libguile/async.c (scm_async_click): Don't leave Guile mode when locking async_mutex. We don't need to, because none of the code that has async_mutex locked can block, and doing so may lead to lock ordering problems between async_mutex and a thread's heap_mutex. Neil Jerram2009-03-041-4/+4
* Lock ordering: don't lock heap_mutex and then thread_admin_mutex•••This fixes the following helgrind report. Thread #1: lock order "0x4325084 before 0x4105328" violated at 0x40234F7: pthread_mutex_lock (hg_intercepts.c:408) by 0x40D01EA: scm_i_thread_put_to_sleep (threads.c:1622) by 0x4078958: scm_make_fluid (fluids.c:114) by 0x40778D6: scm_init_feature (feature.c:101) by 0x408C62E: scm_i_init_guile (init.c:464) by 0x40D1873: scm_i_init_thread_for_guile (threads.c:583) by 0x40D18B4: scm_i_with_guile_and_parent (threads.c:725) by 0x40D19BD: scm_with_guile (threads.c:714) by 0x408C42E: scm_boot_guile (init.c:350) by 0x8048710: main (guile.c:69) Required order was established by acquisition of lock at 0x4325084 at 0x40234F7: pthread_mutex_lock (hg_intercepts.c:408) by 0x40CFFA4: guilify_self_1 (threads.c:468) by 0x408C58B: scm_i_init_guile (init.c:421) by 0x40D1873: scm_i_init_thread_for_guile (threads.c:583) by 0x40D18B4: scm_i_with_guile_and_parent (threads.c:725) by 0x40D19BD: scm_with_guile (threads.c:714) by 0x408C42E: scm_boot_guile (init.c:350) by 0x8048710: main (guile.c:69) followed by a later acquisition of lock at 0x4105328 at 0x40234F7: pthread_mutex_lock (hg_intercepts.c:408) by 0x40CFFAC: guilify_self_1 (threads.c:470) by 0x408C58B: scm_i_init_guile (init.c:421) by 0x40D1873: scm_i_init_thread_for_guile (threads.c:583) by 0x40D18B4: scm_i_with_guile_and_parent (threads.c:725) by 0x40D19BD: scm_with_guile (threads.c:714) by 0x408C42E: scm_boot_guile (init.c:350) by 0x8048710: main (guile.c:69) * threads.c (guilify_self_1): Add self to global thread list _before_ entering Guile mode. Neil Jerram2009-03-041-2/+8
* Update SRFI-11 docs to use correct name for let*-values.•••Signed-off-by: Ludovic Courtès <ludo@gnu.org> Julian Graham2009-02-111-4/+4
* Allow @ to work with (ice-9 syncase)•••(Reported by Panicz Maciej Godek.) * test-suite/tests/syncase.test ("@ works with syncase"): New test. * ice-9/syncase.scm (guile-macro): When a Guile macro transformer produces a variable, don't pass it through sc-expand. Neil Jerram2009-02-054-3/+16
* Fix build when compiled with -Wundef -Werror•••(Reported by David Fang) * libguile/inline.h: Check if __APPLE_CC__ is defined before testing its value. Neil Jerram2009-02-053-1/+3
* cleanups to value and help help handlers•••* ice-9/session.scm (*value-help-handlers*): Define object-documentation as the default value help handler. (remove-value-help-handler!, add-name-help-handler!) (remove-name-help-handler!): Fix docs. (help, help-doc): Fix so that we try object-documentation through try-value-help, and we obey the docs regarding what happens with return values. Andy Wingo2009-01-281-19/+14
* merge in from guile-lib: add some extensibility to `help'•••* ice-9/session.scm (add-value-help-handler!) (remove-value-help-handler!, add-name-help-handler!) (remove-name-help-handler!): New public interfaces, to allow some basic extensibility of the help interface. Merged in from guile-lib's (scheme session). Andy Wingo2009-01-281-8/+64
* Fix build when scm_t_timespec is different from struct timespec•••Reported by Roland Haeder. The declaration and definition of scm_pthread_cond_timedwait were using possibly different types for the third arg. * THANKS: Added Roland Haeder. * libguile/threads.h (scm_pthread_cond_timedwait): Use scm_t_timespec for third arg rather than struct timespec, for consistency with the function implementation. Neil Jerram2009-01-233-1/+3
* Fix MinGW HAVE_STRUCT_TIMESPEC build problem•••Reported by Carlo Bramini. See the comment in _scm.h. * THANKS: Add Carlo Bramini. * libguile/_scm.h: Undefine HAVE_STRUCT_TIMESPEC. Neil Jerram2009-01-233-0/+21
* Remove `INSTALL'•••* INSTALL: Removed. Neil Jerram2009-01-172-291/+1
* NEWS entry for %fast-slot-ref/set! fixNeil Jerram2009-01-041-0/+7
* Fix implementation of %fast-slot-ref and %fast-slot-set!•••* libguile/goops.c (scm_sys_fast_slot_ref, scm_sys_fast_slot_set_x): Correct incantation for getting the number of slots of the specified instance. * libguile/goops.h (SCM_NUMBER_OF_SLOTS): Removed (because wrong). * test-suite/standalone/test-fast-slot-ref.in: New standalone test. * configure.in: Generate test-suite/standalone/test-fast-slot-ref. * test-suite/standalone/Makefile.am (check_SCRIPTS): Add test-fast-slot-ref. Neil Jerram2009-01-046-4/+54
* Update/remove references to the CVS repository.Ludovic Courtès2009-01-011-26/+0
* * HACKING: update to current practice••• * Drop CVS references. * Ask for Git based patches. * Drop outdated info (EGCS, SCM_P) Han-Wen Nienhuys2009-01-011-146/+23
* Fix typo in SRFI-19.•••* srfi/srfi-19.scm (priv:string->date): Check for EOF on CH, not PORT. Ludovic Courtès2008-12-221-1/+1
* Update `INSTALL', from Automake 1.10.2.Ludovic Courtès2008-12-181-20/+74
* Don't use deprecated functions in `debug-malloc.c'.•••* libguile/debug-malloc.c (scm_malloc_stats): Use `scm_from_locale_string ()'. Patch by Linas Vepstas <linasvepstas@gmail.com>. Ludovic Courtès2008-12-181-1/+1
* Update autogen.sh•••* autogen.sh: Don't call guile-readline/autogen.sh; not needed because autoreconf recurses itself. Remove copies of config.guess and config.sub, which are now invalid because we don't have those files in the top level directory. Remove mention of --enable-maintainer-mode, as we don't use AM_MAINTAINER_MODE any more. Neil Jerram2008-12-141-9/+0
* configure: Check for <ltdl.h>.•••* configure.in: Check for <ltdl.h>, to clarify misconfigurations. Ludovic Courtès2008-12-101-0/+2
* configure: Don't substitute `DLPREOPEN'.•••* configure.in: Don't substitute `DLPREOPEN' since it's no longer used (see commit 72db29f200c38fca64a8ccd0d679821eb25de5a9). Ludovic Courtès2008-12-101-2/+0
* Bump version number for 1.8.6.•••* GUILE-VERSION (GUILE_MICRO_VERSION): Increment. (LIBGUILE_INTERFACE_CURRENT): Increment due to the addition of `scm_c_symbol_length ()'. (LIBGUILE_INTERFACE_AGE): Increment. release_1-8-6Ludovic Courtès2008-12-081-3/+3
* Mention the end of `ChangeLog' files in `NEWS'.Ludovic Courtès2008-12-082-1/+7
* Make `config.status' happier.•••* guile-tools.in (datarootdir): New variable, needed since `pkgdatadir' may refer to `${datarootdir}'. Ludovic Courtès2008-12-081-1/+2
* Remove useless references to Libtool's `dlpreopen' mechanism.•••* libguile/Makefile.am (guile_LDFLAGS): Remove `@DLPREOPEN@' since it has no effect. * libguile/guile.c (main): Don't invoke `LTDL_SET_PRELOADED_SYMBOLS ()' since it had no effect given how we invoke `libtool'. It also fixes compatibility issues when using libltdl 1.5 with a Libtool 2.2 package. Ludovic Courtès2008-12-072-4/+1
* Delete redundant `config.{guess,sub}'.Ludovic Courtès2008-12-072-3180/+0
* Several new hash table tests, written by Gregory Marton.•••* test-suite/tests/hash.test ("make-hash-table, hash-table?", "hash-set and hash-ref", "auto-resizing hashx", "hashx"): New tests. * AUTHORS, THANKS: Add Gregory Marton as a contributor. Neil Jerram2008-12-073-0/+208
* Fix sloppy bound checking in `string-{ref,set!}' with the empty string.•••* libguile/strings.c (scm_string_ref): Add proper range checking for the empty string. (scm_string_set_x): Likewise. Reported by Bill Schottstaedt <bil@ccrma.Stanford.EDU>. * test-suite/tests/strings.test ("string-ref"): New test prefix. ("string-set!")["empty string", "empty string and non-zero index", "out of range", "negative index", "regular string"]: New tests. * NEWS: Update. Ludovic Courtès2008-12-023-4/+66
* Update `NEWS'.Ludovic Courtès2008-12-021-0/+1
* Fix potential deadlock in `make-struct'.•••* libguile/struct.c (scm_make_struct): Remove critical section, as suggested by Linas Vepstas <linasvepstas@gmail.com>. See http://lists.gnu.org/archive/html/bug-guile/2008-11/msg00036.html for a discussion. Ludovic Courtès2008-11-302-10/+9
* Make GNU Libtool 2.2.x happier.•••* configure.in: Use `AC_CONFIG_MACRO_DIR([m4])'. Reverts patch b01284227e180d223c97e1b9ba7e2cbd0ddded7e and makes `libtoolize' from Libtool 2 happier (removes a couple of warnings). * Makefile.am (ACLOCAL_AMFLAGS): Remove `-I guile-config' since that directory only contains macros that we distribute, not macros that we use. Ludovic Courtès2008-11-303-1/+4
* Check the return value of libc's functions to make `_FORTIFY_SOURCE=2' work.•••This fixes bug #24009 reported by Martin Pitt. * libguile/threads.c (guilify_self_1): Check the return value of pipe(2). (scm_std_select): Store the return value of read(2) when reading from WAKEUP_FD. * libguile/async.c (scm_i_queue_async_cell): Store the return value of write(2) when writing to SLEEP_FD. * libguile/fports.c (fport_flush): Likewise. * libguile/posix.c (getgroups): Use the return value of getgroups(2) as NGROUPS. (scm_nice): Get the return value of nice(2) to make glibc happy. * libguile/scmsigs.c (take_signal): Store the return value of write(2). Ludovic Courtès2008-11-305-12/+27
* Use orthodox libtoology in `guile'.•••* libguile/guile.c (main): Use `LTDL_SET_PRELOADED_SYMBOLS ()' instead of our own trick. Ludovic Courtès2008-11-241-4/+2
* Run the handler of SRFI-34's `with-exception-handler' in the right dyn. env.•••* srfi/srfi-34.scm (with-exception-handler): Use `with-throw-handler' instead of `lazy-catch'. * test-suite/tests/srfi-34.test ("SRFI 34")["`with-exception-handler' invokes HANDLER in THUNK's dynamic env."]: New test. * test-suite/tests/srfi-39.test: Use `(srfi srfi-34)'. ("SRFI-39")["SRFI-34"]: New test. * NEWS: Update. Ludovic Courtès2008-11-244-7/+44