bpt/guile.git
15 years agoMerge branch 'boehm-demers-weiser-gc' into bdw-gc-static-alloc
Ludovic Courtès [Mon, 19 Jan 2009 21:31:38 +0000 (22:31 +0100)]
Merge branch 'boehm-demers-weiser-gc' into bdw-gc-static-alloc

15 years agoGOOPS: Statically allocate the PORT class array.
Ludovic Courtès [Sun, 18 Jan 2009 19:21:44 +0000 (20:21 +0100)]
GOOPS: Statically allocate the PORT class array.

* libguile/goops.c (scm_port_class): Statically allocate it.
  (create_port_classes): Don't use `scm_calloc ()'.

* libguile/goops.h (scm_port_class): Update declaration.

* libguile/ports.c (scm_make_port_type): When checking whether
  GOOPS is initialized, check whether the first element of
  SCM_PORT_CLASS is non-zero.

15 years agoPublish the maximum number of port types as `SCM_I_MAX_PORT_TYPE_COUNT'.
Ludovic Courtès [Sun, 18 Jan 2009 17:47:20 +0000 (18:47 +0100)]
Publish the maximum number of port types as `SCM_I_MAX_PORT_TYPE_COUNT'.

* libguile/goops.c (create_port_classes): Use
  `SCM_I_MAX_PORT_TYPE_COUNT' instead of a hard-wired 256.

* libguile/objects.h (SCM_OUT_PCLASS_INDEX, SCM_INOUT_PCLASS_INDEX):
  Likewise.

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

* libguile/ports.h (SCM_I_MAX_PORT_TYPE_COUNT): New macro.

15 years agoGOOPS: Statically allocate the SMOB class array.
Ludovic Courtès [Sun, 18 Jan 2009 15:53:01 +0000 (16:53 +0100)]
GOOPS: Statically allocate the SMOB class array.

* libguile/goops.c (scm_smob_class): Statically allocate it.
  (create_smob_classes): Don't malloc(3) `scm_smob_class'.

* libguile/goops.h (scm_smob_class): Update declaration.

* libguile/smob.c (scm_make_smob_type, scm_set_smob_apply): When
  checking whether GOOPS is initialized, check whether the first element
  of SCM_SMOB_CLASS is non-zero.

15 years agoPublish the maximum number of SMOB types as `SCM_I_MAX_SMOB_TYPE_COUNT'.
Ludovic Courtès [Sun, 18 Jan 2009 15:42:17 +0000 (16:42 +0100)]
Publish the maximum number of SMOB types as `SCM_I_MAX_SMOB_TYPE_COUNT'.

* libguile/goops.c (create_smob_classes): Refer to
  `SCM_I_MAX_SMOB_TYPE_COUNT' rather than 255 (which is wrong) or 256.

* libguile/smob.c (MAX_SMOB_COUNT): Alias for `SCM_I_MAX_SMOB_TYPE_COUNT'.

* libguile/smob.h (SCM_I_MAX_SMOB_TYPE_COUNT): New macro.

15 years agoUse `scm_gc_malloc ()' when allocating GOOPS `t_extension' objects.
Ludovic Courtès [Sun, 18 Jan 2009 15:30:36 +0000 (16:30 +0100)]
Use `scm_gc_malloc ()' when allocating GOOPS `t_extension' objects.

* libguile/goops.c (extension_gc_hint): New.
  (scm_c_extend_primitive_generic): Use `scm_gc_malloc ()' instead of
  `scm_malloc ()'.
  (setup_extended_primitive_generics): Don't call `free(3)' when
  removing a `t_extension' object.

15 years agoUse `scm_gc_malloc ()' when allocating hook entries.
Ludovic Courtès [Sun, 18 Jan 2009 15:13:31 +0000 (16:13 +0100)]
Use `scm_gc_malloc ()' when allocating hook entries.

* libguile/hooks.c (hook_entry_gc_hint): New.
  (scm_c_hook_add): Use `scm_gc_malloc ()' instead of `scm_malloc ()'.
  (scm_c_hook_remove): Don't explicitly free(3) the entry, let the GC do
  its job.

15 years agoUse `scm_gc malloc_pointerless ()' in `scm_i allocate_string_pointers ()'.
Ludovic Courtès [Sun, 18 Jan 2009 14:33:37 +0000 (15:33 +0100)]
Use `scm_gc malloc_pointerless ()' in `scm_i allocate_string_pointers ()'.

* libguile/dynl.c (free_string_pointers): Remove.
  (scm_dynamic_args_call): Remove reference to `free_string_pointers ()'
  and remove dynwind.

* libguile/posix.c (free_string_pointers): Remove.
  (scm_execl, scm_execlp, scm_execle, scm_environ): Remove references
  to `free_string_pointers ()'.

* libguile/simpos.c (free_string_pointers): Remove.
  (scm_system_star): Remove reference to `free_string_pointers ()',
  remove enclosing dynwind.

* libguile/strings.c (scm_i_allocate_string_pointers): Use
  `scm_gc_malloc_pointerless ()' and `scm_gc_malloc ()'
  instead of `scm_malloc ()' and `scm_to_locale_string ()',
  so that the result is automatically GC'd when no longer
  referenced.  Remove unneeded dynwind.
  (scm_i_free_string_pointers): Remove.

* libguile/strings.h (scm_i_free_string_pointers): Remove declaration.

15 years agoUse `scm_gc_malloc ()' when allocating the allocated fluid vector.
Ludovic Courtès [Sun, 18 Jan 2009 12:01:16 +0000 (13:01 +0100)]
Use `scm_gc_malloc ()' when allocating the allocated fluid vector.

* libguile/fluids.c (next_fluid_num): Use `scm_gc_malloc ()'.  Don't
  explicitly free the previously allocated array.

15 years agoRemove useless cooperative multi-threading source files.
Ludovic Courtès [Sun, 18 Jan 2009 11:53:01 +0000 (12:53 +0100)]
Remove useless cooperative multi-threading source files.

15 years agoUse `scm_gc_malloc ()' and friends when allocating the subr table.
Ludovic Courtès [Sun, 18 Jan 2009 11:50:18 +0000 (12:50 +0100)]
Use `scm_gc_malloc ()' and friends when allocating the subr table.

* libguile/procs.c (subr_table_gc_hint): New.
  (scm_c_make_subr): Use `scm_gc_realloc ()' instead of `scm_realloc ()'.
  (scm_init_subr_table): Use `scm_gc_malloc ()' instead of `scm_malloc ()'.

15 years agoMake variables related to the subr table size private and unsigned.
Ludovic Courtès [Sun, 18 Jan 2009 11:44:15 +0000 (12:44 +0100)]
Make variables related to the subr table size private and unsigned.

* libguile/procs.c (scm_subr_table_size, scm_subr_table_room): Made
  `static' and `unsigned'.
  (scm_c_make_subr)[entry]: Made `unsigned'.

* libguile/procs.h (scm_subr_table_size, scm_subr_table_room): Remove
  declarations.

15 years agoDon't use `scm_immutable_cell ()' for subrs.
Ludovic Courtès [Sun, 18 Jan 2009 11:19:41 +0000 (12:19 +0100)]
Don't use `scm_immutable_cell ()' for subrs.

* libguile/procs.c (scm_c_make_subr): Use `scm_cell ()' instead of
  `scm_immutable_cell ()' since subr cells can be mutated, e.g., via
  `SCM_SUBR_GENERIC ()' as in `scm_c_extend_primitive_generic ()' (this
  doesn't make any difference in practice as of libgc 7.1, though).

15 years agoMerge branch 'master' into boehm-demers-weiser-gc
Ludovic Courtès [Sat, 17 Jan 2009 21:37:13 +0000 (22:37 +0100)]
Merge branch 'master' into boehm-demers-weiser-gc

Conflicts:
lib/Makefile.am
m4/gnulib-cache.m4
m4/gnulib-comp.m4

15 years agoInvoke gnulib-tool with --no-vc-files option, and
Neil Jerram [Thu, 15 Jan 2009 01:07:15 +0000 (01:07 +0000)]
Invoke gnulib-tool with --no-vc-files option, and

remove files that should not have been committed to the repository.

15 years agoRevert lib/.gitignore and m4/.gitignore to how they should be
Neil Jerram [Thu, 15 Jan 2009 00:56:53 +0000 (00:56 +0000)]
Revert lib/.gitignore and m4/.gitignore to how they should be

(before my confused Gnulib commits...)

15 years agoRevert unintended change to INSTALL made by commit 4a462e35440fdc3f10b0f88b3fb737fa76...
Neil Jerram [Thu, 15 Jan 2009 00:09:21 +0000 (00:09 +0000)]
Revert unintended change to INSTALL made by commit 4a462e35440fdc3f10b0f88b3fb737fa76ed146d

15 years agoAdd more missing Gnulib files
Neil Jerram [Thu, 15 Jan 2009 00:04:02 +0000 (00:04 +0000)]
Add more missing Gnulib files

15 years agoAdd more missing Gnulib files
Neil Jerram [Wed, 14 Jan 2009 21:05:15 +0000 (21:05 +0000)]
Add more missing Gnulib files

15 years agoAdd missing Gnulib file (m4/localcharset.m4)
Neil Jerram [Wed, 14 Jan 2009 20:50:51 +0000 (20:50 +0000)]
Add missing Gnulib file (m4/localcharset.m4)

15 years agoAdd support for static allocation of cells, strings and stringbufs.
Ludovic Courtès [Tue, 13 Jan 2009 23:05:23 +0000 (00:05 +0100)]
Add support for static allocation of cells, strings and stringbufs.

* libguile/__scm.h (SCM_ALIGNED): New macro.

* libguile/_scm.h: Include "libguile/strings.h", to make the
  string/stringbuf-related constants visible to snarffed code.

* libguile/snarf.h (SCM_SUPPORT_STATIC_ALLOCATION): New macro.
  (SCM_SYMBOL, SCM_GLOBAL_SYMBOL)[SCM_SUPPORT_STATIC_ALLOCATION]: New
  alternative versions of these macros with support for (almost) static
  allocation via the use of `string->symbol'.
  (SCM_IMMUTABLE_DOUBLE_CELL, SCM_IMMUTABLE_STRINGBUF,
  SCM_IMMUTABLE_STRING): New macros.

* libguile/tags.h (SCM)[SCM_DEBUG_TYPING_STRICTNESS==1]: Use a pointer
  type that is compatible with other pointer types, to avoid potential
  violation of strict aliasing rules.

15 years agoExpose some of the string/stringbuf internal flags and tags.
Ludovic Courtès [Tue, 13 Jan 2009 22:59:17 +0000 (23:59 +0100)]
Expose some of the string/stringbuf internal flags and tags.

* libguile/strings.h (scm_tc7_ro_string, SCM_I_STRINGBUF_F_SHARED,
  SCM_I_STRINGBUF_F_INLINE): New macros.

* libguile/strings.c (STRINGBUF_F_SHARED): Alias for
  `SCM_I_STRINGBUF_F_SHARED'.
  (STRINGBUF_F_INLINE): Alias for `SCM_I_STRINGBUF_F_INLINE'.
  (RO_STRING_TAG): Alias for `scm_tc7_ro_string'.

15 years agoFixlet for `run-benchmark.scm'.
Ludovic Courtès [Sun, 14 Dec 2008 20:07:09 +0000 (21:07 +0100)]
Fixlet for `run-benchmark.scm'.

* gc-benchmarks/run-benchmark.scm (%default-options): Default to the
  empty list for `input'.

15 years agogc-benchmarks: Adapt `gcold.scm' so that if conforms to the framework.
Ludovic Courtès [Tue, 11 Nov 2008 20:01:40 +0000 (21:01 +0100)]
gc-benchmarks: Adapt `gcold.scm' so that if conforms to the framework.

* gc-benchmarks/larceny/gcold.scm (main): Rename to `gcold-benchmark'.
  (GCOld): Fix the order of the predicate and run-maker.

15 years agogc-benchmarks: Add `gcold.scm', by Clinger, Hansen et al.
Ludovic Courtès [Tue, 11 Nov 2008 17:27:24 +0000 (18:27 +0100)]
gc-benchmarks: Add `gcold.scm', by Clinger, Hansen et al.

See http://www.ccs.neu.edu/home/will/Twobit/benchmarksAbout.html for
details.

15 years agogc-benchmarks: Add `run-benchmark.scm'.
Ludovic Courtès [Tue, 11 Nov 2008 17:20:15 +0000 (18:20 +0100)]
gc-benchmarks: Add `run-benchmark.scm'.

15 years agogc-profile: Show the result of `(version)'.
Ludovic Courtès [Tue, 11 Nov 2008 17:19:24 +0000 (18:19 +0100)]
gc-profile: Show the result of `(version)'.

* gc-benchmarks/gc-profile.scm (main): Show `(version)'.

15 years agogc-benchmarks: Allow the iteration count to be passed to `gc-profile.scm'.
Ludovic Courtès [Mon, 10 Nov 2008 21:49:29 +0000 (22:49 +0100)]
gc-benchmarks: Allow the iteration count to be passed to `gc-profile.scm'.

* gc-benchmarks/gc-profile.scm (*iteration-count*): New parameter.
  (run-benchmark): Moved from `twobit-compat.scm'.  Honor
  `*iteration-count*'.
  (%options): Add `--iterations'.
  (show-help): Document it.
  (main): Parameterize `*iteration-count*'.

15 years agoImport GC benchmarks from Larceny, by Hansen, Clinger, et al.
Ludovic Courtès [Mon, 10 Nov 2008 19:30:33 +0000 (20:30 +0100)]
Import GC benchmarks from Larceny, by Hansen, Clinger, et al.

These GPLv2+-licensed GC benchmarks are available from
http://www.ccs.neu.edu/home/will/GC/sourcecode.html .

15 years agogc-benchmarks: Add a Larceny/Twobit benchmark compatibility layer.
Ludovic Courtès [Fri, 7 Nov 2008 20:11:44 +0000 (21:11 +0100)]
gc-benchmarks: Add a Larceny/Twobit benchmark compatibility layer.

* gc-benchmarks/gc-profile.scm: Load "twobit-compat.scm".
  (save-directory-excursion, load-larceny-benchmark): New procedures.
  (%options): New variable.
  (show-help, parse-args): New procedures.
  (main): Use `parse-args' and `load-larceny-benchmark'.

15 years agoAdd GC benchmarks.
Ludovic Courtès [Sun, 12 Oct 2008 21:51:03 +0000 (23:51 +0200)]
Add GC benchmarks.

15 years agoMake sure that we have a real on-the-stack alloca()
Neil Jerram [Mon, 12 Jan 2009 21:48:17 +0000 (21:48 +0000)]
Make sure that we have a real on-the-stack alloca()

Because of how Guile saves and restores continuations (by copying the
stack), and how it uses alloca to create space for debug information
on the stack, we must have an alloca() that really does use the stack,
and not one that uses the heap.

To do this, we use the Gnulib "alloca-opt" module instead of "alloca".

This commit also updates the Gnulib sources from the current Gnulib
Git repository.

15 years agoNEWS entry for %fast-slot-ref/set! fix
Neil Jerram [Sun, 4 Jan 2009 22:45:54 +0000 (22:45 +0000)]
NEWS entry for %fast-slot-ref/set! fix

15 years agoFix implementation of %fast-slot-ref and %fast-slot-set!
Neil Jerram [Sun, 4 Jan 2009 21:32:23 +0000 (21:32 +0000)]
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.

15 years agoUpdate autogen.sh
Neil Jerram [Sun, 14 Dec 2008 14:42:08 +0000 (14:42 +0000)]
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.

15 years agoDelete redundant `config.{guess,sub}'.
Ludovic Courtès [Tue, 2 Dec 2008 19:51:12 +0000 (20:51 +0100)]
Delete redundant `config.{guess,sub}'.

15 years agoFix typo in SRFI-19.
Ludovic Courtès [Mon, 22 Dec 2008 15:24:04 +0000 (16:24 +0100)]
Fix typo in SRFI-19.

* srfi/srfi-19.scm (priv:string->date): Check for EOF on CH, not PORT.

15 years agoUpdate `INSTALL', from Automake 1.10.2.
Ludovic Courtès [Thu, 18 Dec 2008 21:43:57 +0000 (22:43 +0100)]
Update `INSTALL', from Automake 1.10.2.

15 years agoDon't use deprecated functions in `debug-malloc.c'.
Ludovic Courtès [Thu, 18 Dec 2008 21:38:06 +0000 (22:38 +0100)]
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>.

15 years agosrfi-19: Fix `string->date' weekday lookup.
Ludovic Courtès [Thu, 18 Dec 2008 21:34:23 +0000 (22:34 +0100)]
srfi-19: Fix `string->date' weekday lookup.

* srfi/srfi-19.scm (priv:locale-abbr-weekday->index): Use
  `locale-day-short' since it expects integers in the range 1-7, unlike
  `priv:locale-abbr-weekday'.
  (priv:locale-long-weekday->index): Likewise.

* test-suite/tests/srfi-19.test ("SRFI date/time
  library")["string->date works on Sunday"]: New test.

15 years agoFixlet for `run-benchmark.scm'.
Ludovic Courtès [Sun, 14 Dec 2008 20:07:09 +0000 (21:07 +0100)]
Fixlet for `run-benchmark.scm'.

* gc-benchmarks/run-benchmark.scm (%default-options): Default to the
  empty list for `input'.

15 years agoFix typo in makefile.
Ludovic Courtès [Sun, 14 Dec 2008 19:54:18 +0000 (20:54 +0100)]
Fix typo in makefile.

* libguile/Makefile.am (DOT_X_FILES): Substitute `gettext.x' to
  `gettext.c'.

15 years agoMerge branch 'master' into boehm-demers-weiser-gc
Ludovic Courtès [Sun, 14 Dec 2008 19:25:56 +0000 (20:25 +0100)]
Merge branch 'master' into boehm-demers-weiser-gc

Conflicts:
lib/Makefile.am
libguile/struct.c
libguile/threads.c
m4/gnulib-cache.m4
m4/gnulib-comp.m4

15 years agoRevert "(scm_shell_usage): Note need for subscription to bug-guile@gnu.org."
Neil Jerram [Wed, 10 Dec 2008 19:11:28 +0000 (19:11 +0000)]
Revert "(scm_shell_usage): Note need for subscription to bug-guile@gnu.org."

This reverts commit f3e3f530c28cfa5c7830c5d9b01de6fc388bc42a, which is
appropriate because subscription is not now required for someone to
send a message to bug-guile@gnu.org.

Conflicts:

15 years agoRevert "Note need for subscription to bug-guile@gnu.org."
Neil Jerram [Wed, 10 Dec 2008 19:07:14 +0000 (19:07 +0000)]
Revert "Note need for subscription to bug-guile@gnu.org."

This reverts commit cbea802b3763aa8cb43c88f7df272da3e41c32da, which is
appropriate because subscription is not now required for someone to
send a message to bug-guile@gnu.org.

Conflicts:

15 years agoRevert "(Reporting Bugs): Note need for subscription to"
Neil Jerram [Wed, 10 Dec 2008 19:02:50 +0000 (19:02 +0000)]
Revert "(Reporting Bugs): Note need for subscription to"

This reverts commit e563095988a1c64feb30307928bcc090828cdda9, which is
appropriate because subscription is not now required for someone to
send a message to bug-guile@gnu.org.

Conflicts:

15 years agoRevert "* README: Note need for subscription to bug-guile@gnu.org."
Neil Jerram [Wed, 10 Dec 2008 18:57:20 +0000 (18:57 +0000)]
Revert "* README: Note need for subscription to bug-guile@gnu.org."

This reverts commit 51d079ab0d23e4175d333ce22eb3e74aeae5913d, which is
appropriate because subscription is not now required for someone to
send a message to bug-guile@gnu.org.

15 years agoi18n: Add comment about standardization of the `locale_t' API.
Ludovic Courtès [Wed, 10 Dec 2008 10:05:50 +0000 (11:05 +0100)]
i18n: Add comment about standardization of the `locale_t' API.

* libguile/i18n.c: Add pointer to the POSIX 2008 standardization of the
  API.

15 years agoFix erroneous differences in `NEWS' compared to `branch_release-1-8'.
Ludovic Courtès [Wed, 10 Dec 2008 09:44:24 +0000 (10:44 +0100)]
Fix erroneous differences in `NEWS' compared to `branch_release-1-8'.

15 years agoconfigure: Check for <ltdl.h>.
Ludovic Courtès [Wed, 10 Dec 2008 09:06:46 +0000 (10:06 +0100)]
configure: Check for <ltdl.h>.

* configure.in: Check for <ltdl.h>, to clarify misconfigurations.

15 years agoconfigure: Don't substitute `DLPREOPEN'.
Ludovic Courtès [Wed, 10 Dec 2008 08:57:33 +0000 (09:57 +0100)]
configure: Don't substitute `DLPREOPEN'.

* configure.in: Don't substitute `DLPREOPEN' since it's no longer used
  (see commit 72db29f200c38fca64a8ccd0d679821eb25de5a9).

15 years agoRemove everything to do with GDS Breakpoints
Neil Jerram [Tue, 9 Dec 2008 23:56:51 +0000 (23:56 +0000)]
Remove everything to do with GDS Breakpoints

(which I now regard as an unsuccesful experiment)

This commit makes all affected files the same in master as they are in branch_release-1-8.

* doc/ref/api-debug.texi (Breakpoints): Removed.

* doc/ref/scheme-using.texi (GDS Introduction, GDS Getting Started,
  Displaying the Scheme Stack): Remove mentions of breakpoints.
  (Setting Specific Breakpoints, Setting GDS-managed Breakpoints,
  Setting and Managing Breakpoints, Listing and Deleting Breakpoints,
  Moving and Losing Breakpoints): Removed.

* emacs/gds-scheme.el (gds-bufferless-breakpoints,
  gds-bpdef:behaviour, gds-bpdef:type, gds-bpdef:file-name,
  gds-bpdef:proc-name, gds-bpdef:lc, gds-breakpoint-number,
  gds-breakpoint-buffers, gds-breakpoint-programming,
  gds-breakpoint-cache, gds-breakpoint-face,
  gds-breakpoints-file-name, gds-delete-lost-breakpoints,
  gds-bpdefs-cache, gds-read-breakpoints-file, gds-adopt-breakpoints,
  gds-adopt-breakpoint, gds-make-breakpoint-overlay,
  gds-send-breakpoint-to-client, gds-default-breakpoint-type,
  gds-set-breakpoint, gds-defun-name-region,
  gds-breakpoint-overlays-at, gds-write-breakpoints-file,
  gds-fold-breakpoints, gds-delete-breakpoints, gds-delete-breakpoint,
  gds-breakpoint-at-point, gds-union, gds-user-selected-breakpoint,
  gds-describe-breakpoints, gds-describe-breakpoint,
  gds-after-save-update-breakpoints, gds-breakpoint-map): Removed.
  (gds-nondebug-protocol): Removed handling for `breakpoint' and
  `get-breakpoints'.

* emacs/gds.el (gds-scheme-first-load): Removed.

* ice-9/debugging/Makefile.am (ice9_debugging_sources): Removed
  breakpoints.scm and load-hooks.scm.

* ice-9/debugging/breakpoints.scm: Removed.

* ice-9/debugging/load-hooks.scm: Removed.

* ice-9/gds-client.scm (handle-nondebug-protocol): Remove everything
  to do with breakpoints.
  (breakpoints, set-gds-breakpoints): Removed.
  (run-utility): Call `connect-to-gds' instead of `set-gds-breakpoints'.

15 years agoMention the end of `ChangeLog' files in `NEWS'.
Ludovic Courtès [Mon, 8 Dec 2008 20:34:08 +0000 (21:34 +0100)]
Mention the end of `ChangeLog' files in `NEWS'.

15 years agoMake `config.status' happier.
Ludovic Courtès [Mon, 8 Dec 2008 20:17:21 +0000 (21:17 +0100)]
Make `config.status' happier.

* guile-tools.in (datarootdir): New variable, needed since `pkgdatadir'
  may refer to `${datarootdir}'.

15 years agoAdd other missing Gnulib files.
Ludovic Courtès [Mon, 8 Dec 2008 07:06:34 +0000 (08:06 +0100)]
Add other missing Gnulib files.

15 years agoRemove useless references to Libtool's `dlpreopen' mechanism.
Ludovic Courtès [Sun, 7 Dec 2008 21:01:50 +0000 (22:01 +0100)]
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.

15 years agoAdd missing Gnulib M4 files.
Ludovic Courtès [Sun, 7 Dec 2008 21:34:47 +0000 (22:34 +0100)]
Add missing Gnulib M4 files.

Reported by Neil Jerram.

15 years agoSeveral new hash table tests, written by Gregory Marton.
Neil Jerram [Sun, 7 Dec 2008 16:26:32 +0000 (16:26 +0000)]
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.

15 years agoFix sloppy bound checking in `string-{ref,set!}' with the empty string.
Ludovic Courtès [Tue, 2 Dec 2008 18:42:39 +0000 (19:42 +0100)]
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.

15 years agoUpdate `NEWS'.
Ludovic Courtès [Tue, 2 Dec 2008 18:30:56 +0000 (19:30 +0100)]
Update `NEWS'.

15 years agoFix potential deadlock in `make-struct'.
Ludovic Courtès [Sun, 30 Nov 2008 19:26:56 +0000 (20:26 +0100)]
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.

15 years agoMake GNU Libtool 2.2.x happier.
Ludovic Courtès [Sun, 30 Nov 2008 18:37:29 +0000 (19:37 +0100)]
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.

15 years agoCheck the return value of libc's functions to make `_FORTIFY_SOURCE=2' work.
Ludovic Courtès [Sun, 30 Nov 2008 17:43:41 +0000 (18:43 +0100)]
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): Use `full_read ()' instead of `read ()' when reading
  from WAKEUP_FD.

* libguile/async.c (scm_i_queue_async_cell): Use `full_write ()' instead
  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): Use `full_write ()' instead of
  write(2).

15 years agoUse Gnulib's `full-write' and `full-read' modules.
Ludovic Courtès [Sun, 30 Nov 2008 16:48:06 +0000 (17:48 +0100)]
Use Gnulib's `full-write' and `full-read' modules.

15 years agoUpdate Gnulib files to commit d4b129b8e5f8a8d1198020fd6fc79310d305936c.
Ludovic Courtès [Sun, 30 Nov 2008 16:44:44 +0000 (17:44 +0100)]
Update Gnulib files to commit d4b129b8e5f8a8d1198020fd6fc79310d305936c.

15 years agoUse orthodox libtoology in `guile'.
Ludovic Courtès [Mon, 24 Nov 2008 21:04:44 +0000 (22:04 +0100)]
Use orthodox libtoology in `guile'.

* libguile/guile.c (main): Use `LTDL_SET_PRELOADED_SYMBOLS ()' instead
  of our own trick.

15 years agoRun the handler of SRFI-34's `with-exception-handler' in the right dyn. env.
Ludovic Courtès [Mon, 24 Nov 2008 08:40:00 +0000 (09:40 +0100)]
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.

15 years agoFix comments in `test-scm-c-read.c'.
Ludovic Courtès [Mon, 24 Nov 2008 08:10:51 +0000 (09:10 +0100)]
Fix comments in `test-scm-c-read.c'.

* test-suite/standalone/test-scm-c-read.c (make_port): Fix comments.

15 years agoAdd C unit test for `scm_c_read ()' and the port API.
Ludovic Courtès [Sat, 22 Nov 2008 14:48:16 +0000 (15:48 +0100)]
Add C unit test for `scm_c_read ()' and the port API.

* test-suite/standalone/Makefile.am (check_PROGRAMS, TESTS): Add
  `test-scm-c-read'.
  (test_scm_c_read_SOURCES, test_scm_c_read_CFLAGS,
  test_scm_c_read_LDADD): New.

15 years agoMake scm_c_read use caller buffer only for unbuffered ports.
Neil Jerram [Sun, 23 Nov 2008 22:37:23 +0000 (22:37 +0000)]
Make scm_c_read use caller buffer only for unbuffered ports.

We recently modified scm_c_read so that it temporarily swaps the
caller's buffer with the port's normal read buffer, in order to
improve performance in the case where the port is unbuffered (which
actually means having a single-byte buffer) - but we implemented the
swap in the buffered case too.  The latter turns out to be a bad idea
- because it means that the C code of a custom port implementation
cannot rely on a port's buffer always being the same as when it was
first set up - and so this commit reverts that.  The buffer swapping
trick now applies to unbuffered ports only.

* libguile/ports.c (scm_c_read): Only do swapping of port and caller
  buffer for unbuffered ports.

15 years agoUpdate `THANKS'.
Ludovic Courtès [Thu, 13 Nov 2008 23:41:41 +0000 (00:41 +0100)]
Update `THANKS'.

15 years agoUpdate the thread stack base when `scm_with_guile' is invoked multiple times.
Ludovic Courtès [Thu, 13 Nov 2008 23:35:32 +0000 (00:35 +0100)]
Update the thread stack base when `scm_with_guile' is invoked multiple times.

* NEWS: Update.

* libguile/threads.c (scm_i_init_thread_for_guile): When the thread is
  already guilified, update `t->base' so that it corresponds to the new
  stack base.  Bug report and patch by Linas Vepstas <linasvepstas@gmail.com>.

* test-suite/standalone/Makefile.am (test_scm_with_guile_CFLAGS,
  test_scm_with_guile_LDADD): New.
  (check_PROGRAMS, TESTS): Add `test-scm-with-guile'.

15 years agoAugment `.gitignore'.
Ludovic Courtès [Thu, 13 Nov 2008 22:27:25 +0000 (23:27 +0100)]
Augment `.gitignore'.

15 years agoUpdate "guile(1)" man page.
Ludovic Courtès [Thu, 13 Nov 2008 22:24:32 +0000 (23:24 +0100)]
Update "guile(1)" man page.

* doc/guile.1: Remove reference to the version and date.  Mention R5RS,
  instead of R4RS.  Explicitly say that the full documentation is in
  Texinfo (as other GNU packages do).

15 years agoAdd "guile(1)" man page.
Ludovic Courtès [Thu, 13 Nov 2008 22:12:34 +0000 (23:12 +0100)]
Add "guile(1)" man page.

Robert Merkel's copyright assignment to the FSF had apparently been on
file for some time.

* NEWS: Update.

* doc/Makefile.am (dist_man1_MANS): New.

15 years agogc-benchmarks: Adapt `gcold.scm' so that if conforms to the framework.
Ludovic Courtès [Tue, 11 Nov 2008 20:01:40 +0000 (21:01 +0100)]
gc-benchmarks: Adapt `gcold.scm' so that if conforms to the framework.

* gc-benchmarks/larceny/gcold.scm (main): Rename to `gcold-benchmark'.
  (GCOld): Fix the order of the predicate and run-maker.

15 years agogc-benchmarks: Add `gcold.scm', by Clinger, Hansen et al.
Ludovic Courtès [Tue, 11 Nov 2008 17:27:24 +0000 (18:27 +0100)]
gc-benchmarks: Add `gcold.scm', by Clinger, Hansen et al.

See http://www.ccs.neu.edu/home/will/Twobit/benchmarksAbout.html for
details.

15 years agogc-benchmarks: Add `run-benchmark.scm'.
Ludovic Courtès [Tue, 11 Nov 2008 17:20:15 +0000 (18:20 +0100)]
gc-benchmarks: Add `run-benchmark.scm'.

15 years agogc-profile: Show the result of `(version)'.
Ludovic Courtès [Tue, 11 Nov 2008 17:19:24 +0000 (18:19 +0100)]
gc-profile: Show the result of `(version)'.

* gc-benchmarks/gc-profile.scm (main): Show `(version)'.

15 years agoHave `version' return `PACKAGE_VERSION'.
Ludovic Courtès [Mon, 10 Nov 2008 22:46:29 +0000 (23:46 +0100)]
Have `version' return `PACKAGE_VERSION'.

* libguile/version.c (scm_version): Return `PACKAGE_VERSION' instead of
  "MAJOR.MINOR.MICRO".

15 years agoChange `GUILE_VERSION' to `1.9.0-bdwgc'.
Ludovic Courtès [Mon, 10 Nov 2008 22:45:28 +0000 (23:45 +0100)]
Change `GUILE_VERSION' to `1.9.0-bdwgc'.

* GUILE-VERSION (GUILE_VERSION): Add `-bdwgc' prefix.

15 years agoUse `pkg-config' to detect BDW-GC at configure-time.
Ludovic Courtès [Sun, 9 Nov 2008 22:31:09 +0000 (23:31 +0100)]
Use `pkg-config' to detect BDW-GC at configure-time.

* configure.in: Use `PKG_CHECK_MODULES' to look for libgc.  This only
  works with GC 7.x+, which is what we want anyway.

15 years agogc-benchmarks: Allow the iteration count to be passed to `gc-profile.scm'.
Ludovic Courtès [Mon, 10 Nov 2008 21:49:29 +0000 (22:49 +0100)]
gc-benchmarks: Allow the iteration count to be passed to `gc-profile.scm'.

* gc-benchmarks/gc-profile.scm (*iteration-count*): New parameter.
  (run-benchmark): Moved from `twobit-compat.scm'.  Honor
  `*iteration-count*'.
  (%options): Add `--iterations'.
  (show-help): Document it.
  (main): Parameterize `*iteration-count*'.

15 years agoImport GC benchmarks from Larceny, by Hansen, Clinger, et al.
Ludovic Courtès [Mon, 10 Nov 2008 19:30:33 +0000 (20:30 +0100)]
Import GC benchmarks from Larceny, by Hansen, Clinger, et al.

These GPLv2+-licensed GC benchmarks are available from
http://www.ccs.neu.edu/home/will/GC/sourcecode.html .

15 years agogc-benchmarks: Add a Larceny/Twobit benchmark compatibility layer.
Ludovic Courtès [Fri, 7 Nov 2008 20:11:44 +0000 (21:11 +0100)]
gc-benchmarks: Add a Larceny/Twobit benchmark compatibility layer.

* gc-benchmarks/gc-profile.scm: Load "twobit-compat.scm".
  (save-directory-excursion, load-larceny-benchmark): New procedures.
  (%options): New variable.
  (show-help, parse-args): New procedures.
  (main): Use `parse-args' and `load-larceny-benchmark'.

15 years agoWork around unintentional retention of modules by the GC.
Ludovic Courtès [Wed, 5 Nov 2008 17:50:23 +0000 (18:50 +0100)]
Work around unintentional retention of modules by the GC.

This reverts par of "Document the failure of `gc.test' wrt. unused modules."
(commit 328efeb9a66dddcf78a24fad96d3db58e9c3375d.)

* ice-9/boot-9.scm (set-module-eval-closure!): Don't set the `module' property
  on CLOSURE.

* libguile/modules.c (scm_lookup_closure_module): Call `abort ()' to make it
  clear that code that uses the `module' property no longer works.  That code
  is unused anyway.

15 years agoMerge branch 'master' into boehm-demers-weiser-gc
Ludovic Courtès [Tue, 4 Nov 2008 18:07:07 +0000 (19:07 +0100)]
Merge branch 'master' into boehm-demers-weiser-gc

Conflicts:
libguile/threads.c

15 years agoRemove the SMOB mark procedure for source properties.
Ludovic Courtès [Sun, 2 Nov 2008 22:24:10 +0000 (23:24 +0100)]
Remove the SMOB mark procedure for source properties.

* libguile/srcprop.c (srcprops_mark): Remove.
  (scm_init_srcprop): Remove call to `scm_set_smob_mark ()'.

15 years agoFix initialization of the SMOB GC "kind".
Ludovic Courtès [Fri, 31 Oct 2008 20:55:55 +0000 (21:55 +0100)]
Fix initialization of the SMOB GC "kind".

* libguile/smob.c (scm_smob_prehistory): When initializing
  SMOB_GC_KIND, pass 1 as the CLEAR_NEW_OBJECTS argument to
  `GC_new_kind ()'.  Without this, an assertion failure is
  triggered in libgc's `reclaim.c'.

15 years agoDon't invoke `on_thread_exit ()' from a pthread key destructor.
Ludovic Courtès [Thu, 30 Oct 2008 23:27:20 +0000 (00:27 +0100)]
Don't invoke `on_thread_exit ()' from a pthread key destructor.

The `on_thread_exit ()' function allocates memory via libgc.  When
called from the context of a pthread key detructor, the thread is
essentially "dead" already and `GC_lookup_thread ()' returns NULL,
which triggers an assertion in libgc's `thread_local_alloc.c'.  This
patch arranges so that `on_thread_exit ()' is called from a suitable
context.

* libguile/threads.c (on_thread_exit): Remove now invalid comment
  about access to libgc's TLS.
  (init_thread_key): Don't pass `on_thread_exit ()' to
  `scm_i_pthread_key_create ()'.
  (scm_leave_guile_cleanup): Invoke `do_thread_exit ()'.
  (really_launch): Invoke `pthread_exit ()'.

15 years agoDocument the impossibility to call the GC from within `on_thread_exit ()'.
Ludovic Courtès [Tue, 28 Oct 2008 08:52:51 +0000 (09:52 +0100)]
Document the impossibility to call the GC from within `on_thread_exit ()'.

* libguile/threads.c (on_thread_exit): Add `FIXME' comment.

15 years agoFix stack calibration-related errors when running make distcheck.
Neil Jerram [Sun, 26 Oct 2008 21:43:04 +0000 (21:43 +0000)]
Fix stack calibration-related errors when running make distcheck.

* libguile/Makefile.am (stack-limit-calibration.scm): Use $(srcdir), to
  support building in a different directory.
  (MOSTLYCLEANFILES): Add stack-limit-calibration.scm.

15 years agoAdd measure-hwm.scm to the set of distribution files.
Neil Jerram [Fri, 24 Oct 2008 21:46:43 +0000 (22:46 +0100)]
Add measure-hwm.scm to the set of distribution files.

* libguile/Makefile.am (EXTRA_DIST): Add measure-hwm.scm.

15 years agoFix hang in srfi-18.test
Neil Jerram [Wed, 22 Oct 2008 07:45:42 +0000 (08:45 +0100)]
Fix hang in srfi-18.test

* libguile/threads.h (held_mutex): New field.

* libguile/threads.c (enqueue, remqueue, dequeue): Use critical
section to protect access to the queue.
(guilify_self_1): Initialize held_mutex field.
(on_thread_exit): If held_mutex non-null, unlock it.
(fat_mutex_unlock, fat_cond_free, scm_make_condition_variable,
fat_cond_signal, fat_cond_broadcast): Delete now unnecessary uses
of c->lock.
(fat_mutex_unlock): Pass m->lock to block_self() instead of
c->lock; move scm_i_pthread_mutex_unlock(m->lock) call from before
block_self() to after.
(scm_pthread_cond_wait, scm_pthread_cond_timedwait,
scm_i_thread_sleep_for_gc): Set held_mutex before pthread call;
reset it afterwards.

I was seeing a hang in srfi-18.test, when running make check in master,
in the "exception handler installation is thread-safe" test.  It wasn't
100% reproducible, so looked like a race.

The problem is that wait-condition-variable is not actually
atomic in the way that it is supposed to be.  It unlocks the mutex,
then starts waiting on the cond var.  So it is possible for another
thread to lock the same mutex, and signal the cond var, before the
wait-condition-variable thread starts waiting.

In order for wait-condition-variable to be atomic - e.g. in a race
where thread A holds (Scheme-level) mutex M, and calls
(wait-condition-variable C M), and thread B calls (begin (lock-mutex
M) (signal-condition-variable C)) - it needs to call pthread_cond_wait
with the same underlying mutex as is involved in the `lock-mutex'
call.  In terms of the threads.c code, this means that it has to use
M->lock, not C->lock.

block_self() used its mutex arg for two purposes: for protecting
access and changes to the wait queue, and for the pthread_cond_wait
call.  But it wouldn't work reliably to use M->lock to protect C's
wait queue, because in theory two threads can call
(wait-condition-variable C M1) and (wait-condition-variable C M2)
concurrently, with M1 and M2 different.  So we either have to pass
both C->lock and M->lock into block_self(), or use some other mutex to
protect the wait queue.  For this patch, I switched to using the
critical section mutex, because that is a global and so easily
available.  (If that turns out to be a problem for performance, we
could make each queue structure have its own mutex, but there's no
reason to believe yet that it is a problem, because the critical
section mutex isn't used much overall.)

So then we call block_self() with M->lock, and move where M->lock is
unlocked to after the block_self() call, instead of before.

That solves the first hang, but introduces a new one, when a SRFI-18
thread is terminated (`thread-terminate!') between being launched
(`make-thread') and started (`thread-start!').  The problem now is
that pthread_cond_wait is a cancellation point (see man
pthread_cancel), so the pthread_cond_wait call is one of the few
places where a thread-terminate! call can take effect.  If the thread
is cancelled at that point, M->lock ends up still being locked, and
then when do_thread_exit() tries to lock M->lock again, it hangs.

The fix for that is a new `held_mutex' field in scm_i_thread, which is
set to point to the mutex just before a pthread_cond_(timed)wait call,
and set to NULL again afterwards.  If on_thread_exit() finds that
held_mutex is non-NULL, it unlocks that mutex.

A detail is that checking and unlocking held_mutex must be done before
on_thread_exit() calls scm_i_ensure_signal_delivery_thread(), because
the innards of scm_i_ensure_signal_delivery_thread() can do another
pthread_cond_wait() call and so overwrite held_mutex.  But that's OK,
because it's fine for the mutex check and unlock to happen outside
Guile mode.

Lastly, C->lock is then not needed, so I've removed it.

15 years agoExpose `GC_dump ()' at the Scheme level.
Ludovic Courtès [Thu, 23 Oct 2008 15:46:08 +0000 (17:46 +0200)]
Expose `GC_dump ()' at the Scheme level.

* libguile/gc.h (scm_gc_dump): New declaration.

* libguile/gc.c (scm_gc_dump): New function.

15 years agoAvoid `Stack overflow' errors when running `make check'
Neil Jerram [Fri, 17 Oct 2008 20:43:36 +0000 (21:43 +0100)]
Avoid `Stack overflow' errors when running `make check'

For explanation, see comments and text in the new file
libguile/measure-hwm.scm.

* .gitignore: Add libguile/stack-limit-calibration.scm.

* check-guile.in: Load libguile/stack-limit-calibration.scm.

* configure.in: Add AC_CONFIG_FILES to generate test-use-srfi from
  test-use-srfi.in.

* libguile/Makefile.am (TESTS, TESTS_ENVIRONMENT,
  stack-limit-calibration.scm): New targets, so that `make check'
  calibrates the stack limit before running the Guile test suite.

* libguile/measure-hwm.scm: New file, calibrates stack limit for `make
  check'.

* libguile/stackchk.c (scm_sys_get_stack_size): New primitive.

* libguile/stackchk.h (scm_sys_get_stack_size): New primitive
  (declaration).

* test-suite/standalone/test-use-srfi: Renamed test-use-srfi.in, so
  that ./configure can fill in variables in it.

* test-suite/standalone/test-use-srfi.in: Load
  libguile/stack-limit-calibration.scm.

15 years agoAdd GC benchmarks.
Ludovic Courtès [Sun, 12 Oct 2008 21:51:03 +0000 (23:51 +0200)]
Add GC benchmarks.

15 years agoMerge branch 'master' into boehm-demers-weiser-gc
Ludovic Courtès [Sat, 11 Oct 2008 17:25:54 +0000 (19:25 +0200)]
Merge branch 'master' into boehm-demers-weiser-gc

Conflicts:
libguile/Makefile.am
libguile/threads.c

15 years agoFix compilation error due to strict aliasing rules on `i386-unknown-freebsd7.0'.
Ludovic Courtès [Fri, 10 Oct 2008 08:00:21 +0000 (10:00 +0200)]
Fix compilation error due to strict aliasing rules on `i386-unknown-freebsd7.0'.

* libguile/threads.c (scm_threads_mark_stacks): Cast `&t->regs' to
  `(void *)' rather than `(SCM_STACKITEM *)' to avoid "warning:
  dereferencing type-punned pointer will break strict-aliasing rules"
  with GCC 4.2.1 on `i386-unknown-freebsd7.0'.

15 years agoFix compilation of the hard copy of the R5RS, tutorial and GOOPS manual.
Ludovic Courtès [Thu, 9 Oct 2008 20:56:19 +0000 (22:56 +0200)]
Fix compilation of the hard copy of the R5RS, tutorial and GOOPS manual.

* doc/tutorial/Makefile.am (TEXINFO_TEX): Remove.

* doc/goops/Makefile.am (TEXINFO_TEX): Remove.

* doc/r5rs/Makefile.am (TEXINFO_TEX): Remove.