summaryrefslogtreecommitdiff
path: root/libguile
AgeCommit message (Collapse)AuthorFilesLines
2011-06-30Merge remote-tracking branch 'local-2.0/stable-2.0'Andy Wingo5-1/+23
Conflicts: libguile/deprecated.c module/ice-9/psyntax-pp.scm
2011-06-30%load-hook not just for primitive-loadAndy Wingo1-0/+9
* libguile/load.c (scm_primitive_load_path): * module/ice-9/boot-9.scm (load-in-vicinity): Call %load-hook as needed.
2011-06-30fix --disable-modules buildAndy Wingo3-2/+18
* configure.ac (HAVE_MODULES): Define HAVE_MODULES iff --enable-modules. * libguile/deprecated.c (scm_dynamic_args_call) * libguile/extensions.c (load_extension): * libguile/init.c (scm_i_init_guile): Use HAVE_MODULES in a few places.
2011-06-30HAVE_POSIX warning fixAndy Wingo1-0/+2
* libguile/filesys.c (scm_dir_free, scm_dir_print): Don't compile when not HAVE_POSIX.
2011-06-28Fix lock ordering in `fat_mutex_lock' to match that of `do_thread_exit'.Ludovic Courtès1-0/+3
Original Helgrind report: ==14160== Thread #57: lock order "0x47F6B90 before 0x7C25A28" violated ==14160== at 0x4C27730: pthread_mutex_lock (in /.../valgrind-3.6.0/lib/valgrind/vgpreload_helgrind-amd64-linux.so) ==14160== by 0x4EFF87E: do_thread_exit (threads.c:664) ==14160== by 0x4E87B89: c_body (continuations.c:512) ==14160== by 0x4F16C21: vm_regular_engine (vm-i-system.c:960) ==14160== by 0x4E90F92: scm_call_4 (eval.c:506) ==14160== by 0x4E88372: scm_i_with_continuation_barrier (continuations.c:450) ==14160== by 0x4E88424: scm_c_with_continuation_barrier (continuations.c:546) ==14160== by 0x51CA3AF: GC_call_with_gc_active (pthread_support.c:1128) ==14160== by 0x4EFF2E0: with_guile_and_parent (threads.c:206) ==14160== by 0x51C46B4: GC_call_with_stack_base (misc.c:1505) ==14160== by 0x4EFF447: scm_with_guile (threads.c:917) ==14160== by 0x51C46B4: GC_call_with_stack_base (misc.c:1505) ==14160== Required order was established by acquisition of lock at 0x47F6B90 ==14160== at 0x4C27730: pthread_mutex_lock (in /.../valgrind-3.6.0/lib/valgrind/vgpreload_helgrind-amd64-linux.so) ==14160== by 0x4F00262: fat_mutex_lock (threads.c:1362) ==14160== by 0x4F004DA: scm_lock_mutex_timed (threads.c:1462) ==14160== by 0x4F16C09: vm_regular_engine (vm-i-system.c:898) ==14160== by 0x4E90F4D: scm_call_3 (eval.c:499) ==14160== by 0x4EFFA4C: really_launch (threads.c:975) ==14160== by 0x4E87B89: c_body (continuations.c:512) ==14160== by 0x4F16C21: vm_regular_engine (vm-i-system.c:960) ==14160== by 0x4E90F92: scm_call_4 (eval.c:506) ==14160== by 0x4E88372: scm_i_with_continuation_barrier (continuations.c:450) ==14160== by 0x4E88424: scm_c_with_continuation_barrier (continuations.c:546) ==14160== by 0x4EFF289: with_guile_and_parent (threads.c:874) ==14160== followed by a later acquisition of lock at 0x7C25A28 ==14160== at 0x4C27730: pthread_mutex_lock (in /.../valgrind-3.6.0/lib/valgrind/vgpreload_helgrind-amd64-linux.so) ==14160== by 0x4F00352: fat_mutex_lock (threads.c:1374) ==14160== by 0x4F004DA: scm_lock_mutex_timed (threads.c:1462) ==14160== by 0x4F16C09: vm_regular_engine (vm-i-system.c:898) ==14160== by 0x4E90F4D: scm_call_3 (eval.c:499) ==14160== by 0x4EFFA4C: really_launch (threads.c:975) ==14160== by 0x4E87B89: c_body (continuations.c:512) ==14160== by 0x4F16C21: vm_regular_engine (vm-i-system.c:960) ==14160== by 0x4E90F92: scm_call_4 (eval.c:506) ==14160== by 0x4E88372: scm_i_with_continuation_barrier (continuations.c:450) ==14160== by 0x4E88424: scm_c_with_continuation_barrier (continuations.c:546) ==14160== by 0x4EFF289: with_guile_and_parent (threads.c:874) * libguile/threads.c (fat_mutex_lock): In the `m->level == 0' case, release M's lock before taking T's `admin_mutex'.
2011-06-23don't spawn the signal delivery thread in a thread-exit handlerAndy Wingo1-4/+0
* libguile/threads.c (do_thread_exit): Remove needless spawn of the signal delivery thread.
2011-06-23allow gc <= 7.1 to stop the signal delivery threadAndy Wingo1-0/+25
* configure.ac: Add a check for GC_get_suspend_signal(). * libguile/scmsigs.c (GC_get_suspend_signal): Define a fallback implementation if one isn't available. (signal_delivery_thread): Unmask the suspend signal so that GC can stop the world. Fixes test-pthread-create on libgc 7.1 and earlier. Thanks to Frank Terbeck <ft@bewatermyfriend.org> for the report.
2011-06-18Merge remote-tracking branch 'local-2.0/stable-2.0'Andy Wingo6-227/+51
Conflicts: module/ice-9/psyntax-pp.scm module/language/tree-il/compile-glil.scm
2011-06-17better messages on failed autocompilationAndy Wingo1-5/+18
* libguile/load.c (auto_compile_catch_handler): * module/ice-9/boot-9.scm (load-in-vicinity): Nicer messages when autocompilation fails.
2011-06-17remove win32-dirent.[ch]Andy Wingo4-205/+3
* libguile/win32-dirent.c: * libguile/win32-dirent.h: Remove these files. MinGW has opendir and readdir support, I hear. * configure.ac: * libguile/filesys.c: * libguile/Makefile.am: Adapt.
2011-06-17mingw: use $APPDATA as a possible root for cachedir.Jan Nieuwenhuizen1-0/+6
* libguile/load.c (scm_init_load_path) [MINGW32]: Fall back to using $LOCALAPPDATA or $APPDATA if $XDG_CACHE_HOME and $HOME aren't set.
2011-06-16Fix several POSIX functions to use the locale encodingMark H Weaver1-17/+24
* libguile/strings.c (scm_i_allocate_string_pointers): Encode strings using the current locale. Previously, Latin-1 was used. Indirectly, this affects the encoding of strings in `system*', `execl', `execlp', `execle', `environ', and `dynamic-args-call'. (scm_makfromstrs): In header comment, clarify that the C strings are interpreted according to the current locale encoding. * NEWS: Add NEWS entry.
2011-06-16Merge remote-tracking branch 'local-2.0/stable-2.0'Andy Wingo8-42/+65
2011-06-16O_CLOEXEC usageAndy Wingo3-17/+4
* libguile/objcodes.c (scm_load_objcode): * libguile/scmsigs.c (start_signal_delivery_thread): * libguile/threads.c (guilify_self_1): Use O_CLOEXEC.
2011-06-16gnulib updateAndy Wingo1-1/+1
Added pipe2 and open modules, to get O_CLOEXEC. * libguile/Makefile.am (guile_filter_doc_snarfage$(EXEEXT)): Add gnulib here, in the native build case, for rpl_fflush if needed. foo
2011-06-16fix initial values of reallocated fluidsAndy Wingo3-0/+24
* libguile/threads.h: * libguile/threads.c (scm_i_reset_fluid): New internal function, resets the binding of a fluid for all threads. Needed for fluid GC. * libguile/fluids.c (new_fluid): Call scm_i_reset_fluid here.
2011-06-16fix hash-set! on weak tablesAndy Wingo1-23/+30
* test-suite/tests/weaks.test: Add tests. * libguile/hashtab.c (scm_hash_fn_set_x): Fix updates to weak-value hash tables to not deadlock inside the alloc lock.
2011-06-09Fix likely crash in `stable-sort!'Andreas Rottmann1-1/+6
* libguile/sort.c (scm_stable_sort_x): Properly handle zero-length vectors. * test-suite/tests/sort.test ("stable-sort"): Add test for this case.
2011-06-02Merge remote-tracking branch 'local-2.0/stable-2.0'Andy Wingo3-2/+33
Conflicts: meta/Makefile.am
2011-06-02sequence of expressions -> seq of head and tailAndy Wingo5-35/+50
* libguile/expand.h: * module/language/tree-il.scm: Rename "sequence" to "seq", and instead of taking a list of expressions, take a head and a tail. * module/language/tree-il/analyze.scm: * module/language/tree-il/compile-glil.scm: * module/language/tree-il/fix-letrec.scm: * module/language/tree-il/spec.scm: * module/language/elisp/compile-tree-il.scm: * module/ice-9/psyntax.scm: * module/ice-9/psyntax-pp.scm: * module/ice-9/eval.scm: * libguile/memoize.h: * libguile/memoize.c: * libguile/expand.c: * libguile/eval.c: Adapt to the new seq format.
2011-06-02add <primcall> to tree-ilAndy Wingo3-0/+29
* libguile/expand.c: * libguile/expand.h (SCM_EXPANDED_PRIMCALL_TYPE_NAME): (SCM_EXPANDED_PRIMCALL_FIELD_NAMES): (SCM_EXPANDED_PRIMCALL_SRC): (SCM_EXPANDED_PRIMCALL_NAME): (SCM_EXPANDED_PRIMCALL_ARGS): (SCM_MAKE_EXPANDED_PRIMCALL): Add "primcall" Tree-IL type. * doc/ref/compiler.texi (Tree-IL): Update docs. * libguile/memoize.c (memoize): Memoizer for primcalls. * module/ice-9/psyntax.scm: Build primcalls, sometimes. Also change build-primref to just make a primitive-ref. * module/language/tree-il.scm: Add primcall to the exports, parsers, serializers, etc. * module/language/tree-il/analyze.scm: * module/language/tree-il/compile-glil.scm: * module/language/tree-il/fix-letrec.scm: * module/language/tree-il/inline.scm: * module/language/tree-il/primitives.scm: * module/language/elisp/compile-tree-il.scm: Add primcall support. * test-suite/tests/tree-il.test: Use primcalls sometimes.
2011-06-02rename <application> to <call>Andy Wingo3-26/+26
* doc/ref/compiler.texi (The Scheme Compiler): Update docs. * libguile/expand.h: * libguile/expand.c: * module/language/tree-il.scm: Rename <application> to <call>. Change the external representation from (apply proc arg ...) to (call proc arg ...). * libguile/memoize.c: * module/ice-9/psyntax-pp.scm: * module/ice-9/psyntax.scm: * module/language/brainfuck/compile-tree-il.scm: * module/language/ecmascript/compile-tree-il.scm: * module/language/elisp/compile-tree-il.scm: * module/language/tree-il/analyze.scm: * module/language/tree-il/compile-glil.scm: * module/language/tree-il/fix-letrec.scm: * module/language/tree-il/inline.scm: * module/language/tree-il/primitives.scm: * test-suite/tests/tree-il.test: Update all callers.
2011-05-31rename `guile-tools' to `guild'Andy Wingo1-1/+1
* configure.ac: Look for ln -s. Write out `guild' instead of `guile-tools'. * meta/Makefile.am (install-data-hook): Link the installed `guild' to the backward-compatible `guile-tools' name. (bin_SCRIPTS, EXTRA_DIST): Fix up for guild change. * meta/guild.in: Moved here from `guile-tools.in'. * doc/ref/Makefile.am (autoconf-macros.texi): * doc/ref/api-evaluation.texi (Compilation): * doc/ref/autoconf.texi (Autofrisk, Using Autofrisk): * doc/ref/mod-getopt-long.texi (getopt-long Reference): * doc/ref/tools.texi (Miscellaneous Tools, Executable Modules): Minimal doc update. * .gitignore: * am/guilec (.scm.go): * libguile/Makefile.am (snarf2checkedtexi): * module/Makefile.am (ice-9/psyntax-pp.go): Update makefiles, etc. * module/scripts/README: * module/scripts/lint.scm: * module/scripts/list.scm: Update commentaries.
2011-05-31write-objcode uses target-endianness, target-word-sizeAndy Wingo2-1/+32
* libguile/_scm.h (SCM_OBJCODE_ENDIANNESS_OFFSET): (SCM_OBJCODE_WORD_SIZE_OFFSET): New defines. * libguile/objcodes.c (scm_write_objcode): Use target-endianness and target-word-size when writing the objcode cookie.
2011-05-30Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo2-32/+21
2011-05-30fix subtle and bad scm_internal_hash_fold bug for weak tablesAndy Wingo1-30/+10
* libguile/hashtab.c (scm_internal_hash_fold): Don't try to unlink deleted weak pairs. Our previous code was buggy (`prev' should have only been updated in the case of a successful traversal), but more than that, we're not in the alloc lock. Thanks very much to Michael Wells for the report, and the debugging!
2011-05-27Tweak R6RS transcoded ports flushingAndreas Rottmann1-2/+11
* libguile/r6rs-ports.c (tp_flush): Only operate on the underlying port when it is open.
2011-05-26remove gc pthread redirects entirelyAndy Wingo1-18/+2
* libguile/pthread-threads.h: As an experiment, just define scm_i_pthread_create et al to their pthread_* functions, instead of the GC_ ones. It seems sufficient, given that all uses of Guile have to go through scm_with_guile anyway... Passes tests on my machine. Committing to give buildbots a go at it.
2011-05-26Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-8/+28
2011-05-26leave guile when reading signal pipeAndy Wingo1-8/+28
* libguile/scmsigs.c (read_signal_pipe_data, signal_delivery_thread): Leave guile when reading from the signal pipe. Hopefully that lets GC know not to wake up this thread.
2011-05-26scm_new_smob, scm_new_double_smob inline functionsAndy Wingo3-111/+143
* libguile/smob.h (scm_new_smob, scm_new_double_smob): New constructors, which do what SCM_NEWSMOB / SCM_NEWSMOB3 had done, but with inline functions instead of macros. They also bail to scm_i_new_smob / scm_i_new_double_smob in either the mark or the free case, so that the inline definition doesn't reference other internal details like libgc stuff. (SCM_SMOB_TYPE_MASK et al): Move definitions up so the new_smob see them as already being declared. (SCM_NEWSMOB, SCM_RETURN_NEWSMOB, SCM_NEWSMOB2, SCM_RETURN_NEWSMOB2): (SCM_NEWSMOB3, SCM_RETURN_NEWSMOB3): Reimplement in terms of the new inline functions. (scm_i_finalize_smob): Remove declaration, as it's no longer needed or used. Remove now-unneeded bdw-gc include. * libguile/smob.c (finalize_smob): Rename from scm_i_finalize_smob, and make static. (scm_i_new_smob, scm_i_new_double_smob): Slow-path allocators. * libguile/inline.c: Include smob.h, so as to reify scm_new_smob and scm_new_double_smob.
2011-05-26scm_cell, scm_double_cell, scm_words back to gc.hAndy Wingo3-97/+104
* libguile/inline.h: * libguile/gc.h (scm_cell, scm_double_cell, scm_words): Move declarations and definitions back here, from inline.h. It's more natural. * libguile/inline.c: Include gc.h as well.
2011-05-26simplify inline function infrastructureAndy Wingo4-108/+101
* libguile/__scm.h (SCM_C_EXTERN_INLINE): Move this definition here, from inline.h. We'd like to support inline function definitions in more header files: not just inline.h. (SCM_CAN_INLINE, SCM_INLINE, SCM_INLINE_IMPLEMENTATION): New definitions. * libguile/gc.h (SCM_GC_MALLOC, SCM_GC_MALLOC_POINTERLESS): Define these wrappers, which redirect to the GC_MALLOC macros when building Guile, and the scm_gc_malloc functions otherwise. A step towards getting BDW-GC out of Guile's API. * libguile/inline.h: Simplify, using SCM_INLINE, SCM_INLINE_IMPLEMENTATION, and SCM_IMPLEMENT_INLINES. Also use the new SCM_GC_MALLOC macros.
2011-05-26Merge remote-tracking branch 'local-2.0/stable-2.0'Andy Wingo5-81/+32
2011-05-26remove scm_newcell_count, scm_newcell2_countAndy Wingo2-9/+0
* libguile/inline.h: * libguile/gc.c: Remove declaration and definition of unused "scm_newcell_count" and "scm_newcell2_count". Since SCM_INTERNAL is "extern", these symbols were not externally visible anyway, at least under Linux or Windows.
2011-05-26deprecate scm_immutable_{double_,}cellAndy Wingo4-72/+32
* libguile/inline.h: * libguile/deprecated.h: * libguile/deprecated.c (scm_immutable_cell, scm_immutable_double_cell): Deprecate these, as the GC_STUBBORN API doesn't do anything any more. * libguile/strings.c (scm_i_c_make_symbol): Change the one use of scm_immutable_double_cell to scm_double_cell.
2011-05-25Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo10-136/+125
Conflicts: libguile/procprop.c
2011-05-24threadsafe addition to the goops vtable_class_mapAndy Wingo1-1/+11
* libguile/goops.c (scm_i_define_class_for_vtable): Lock around additions to the vtable_class_map. Use is unlocked though; solving GOOPS parallel-initialization would be a good thing.
2011-05-24threadsafe access to source properties weak hash tableAndy Wingo1-3/+30
* libguile/srcprop.c: Add a lock around scm_source_whash, and use it.
2011-05-24read + source properties simplificationAndy Wingo3-110/+43
* libguile/srcprop.h: Remove internal scm_source_whash declaration. * libguile/srcprop.c (scm_i_set_source_properties_x) (scm_i_has_source_properties): New helpers. (scm_source_whash): Make static. * libguile/read.c (scm_read_sexp): Remove register declarations here; let's trust the compiler. Remove code to incrementally build up a copy; instead let's let scm_i_set_source_properties_x handle copying the expression if needed. (scm_read_quote, scm_read_syntax): Use scm_i_set_source_properties_x. (recsexpr): Remove this helper from 1996. (scm_read_sharp_extension): Instead of trying to recursively label sharp-read subforms with source properties, just label the outside form and rely on the macro-expander to propagate it down.
2011-05-24safely access the trampoline weak mapAndy Wingo1-3/+12
* libguile/smob.c (scm_i_smob_apply_trampoline): Protect the trampoline weak map with a mutex.
2011-05-23set-procedure-property! threadsafety issueAndy Wingo1-8/+9
* libguile/procprop.c (scm_set_procedure_property_x): Fix a threadsafety bug pointed out by Ken Raeburn.
2011-05-23really threadsafe access to symbol tableAndy Wingo1-12/+7
* libguile/symbols.c (symbols_lock): Rename from intern_lock. (lookup_interned_symbol, lookup_interned_latin1_symbol): Instead of faith-based programming, just use the mutex. Though I haven't seen this break, Ken is right!
2011-05-22Don't call scm_lock_mutex and scm_unlock_mutex via pointer of wrong typeMark H Weaver1-2/+14
* libguile/threads.c (lock_mutex_return_void, unlock_mutex_return_void): New static functions that simply call scm_lock_mutex and scm_unlock_mutex, respectively, but return void instead of SCM. (scm_dynwind_lock_mutex): Pass unlock_mutex_return_void to scm_dynwind_unwind_handler_with_scm, and lock_mutex_return_void to scm_dynwind_rewind_handler_with_scm. Previously, we passed scm_unlock_mutex and scm_lock_mutex (which return SCM), but the scm_dynwind_* functions expect pointers to functions which return void. When SCM is of type union, this changes the calling conventions of the functions on some platforms (e.g. GCC 4.5.2 and 4.5.3 on x86).
2011-05-22Don't call scm_lock_mutex and scm_unlock_mutex via pointer of wrong typeMark H Weaver1-2/+14
* libguile/threads.c (lock_mutex_return_void, unlock_mutex_return_void): New static functions that simply call scm_lock_mutex and scm_unlock_mutex, respectively, but return void instead of SCM. (scm_dynwind_lock_mutex): Pass unlock_mutex_return_void to scm_dynwind_unwind_handler_with_scm, and lock_mutex_return_void to scm_dynwind_rewind_handler_with_scm. Previously, we passed scm_unlock_mutex and scm_lock_mutex (which return SCM), but the scm_dynwind_* functions expect pointers to functions which return void. When SCM is of type union, this changes the calling conventions of the functions on some platforms (e.g. GCC 4.5.2 and 4.5.3 on x86).
2011-05-20clocktime freebsd portabilityAndy Wingo1-3/+7
* libguile/stime.c (HAVE_POSIX_CPUTIME): Hack around buggy FreeBSD implementation of _POSIX_CPUTIME.
2011-05-20fix compile error in mingw fstat socket detectionAndy Wingo1-1/+1
* libguile/filesys.c (fstat_Win32) [__MINGW32__]: Apparently there is no _S_IFSOCK on mingw32. Thanks to Volker Grabsch for the report.
2011-05-20gen-scmconfig cross-compilation fixAndy Wingo1-3/+8
* libguile/Makefile.am (gen-scmconfig.$(OBJEXT)): Fix cross-compilation. Thanks to Volker Grabsch for the report!
2011-05-15remove SCM_EXIT_SUCCESS and SCM_EXIT_FAILURE definitionsAndy Wingo1-21/+0
* libguile/__scm.h: Remove unused SCM_EXIT_SUCCESS and SCM_EXIT_FAILURE definitions.
2011-05-15use of EXIT_SUCCESS and EXIT_FAILUREAndy Wingo2-3/+3
* libguile/threads.c (scm_init_guile): * libguile/throw.c (scm_exit_status): Use EXIT_SUCCESS and EXIT_FAILURE instead of 0 and 1.