bpt/guile.git
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 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 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 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.

15 years agoAdd test case to make sure `read' returns mutable strings.
Ludovic Courtès [Thu, 9 Oct 2008 20:32:16 +0000 (22:32 +0200)]
Add test case to make sure `read' returns mutable strings.

* test-suite/tests/reader.test ("reading")["returned strings are
  mutable"]: New test, as reported by szgyg <szgyg@ludens.elte.hu>.

15 years agoRevert "Make literal strings (i.e., returned by `read') read-only."
Ludovic Courtès [Thu, 9 Oct 2008 20:21:33 +0000 (22:21 +0200)]
Revert "Make literal strings (i.e., returned by `read') read-only."

This reverts commit fb2f8886c4d537b0c7d3e9e78a8d4e5e272a36f4.

The rationale is that `read' must return mutable strings, as reported
by szgyg <szgyg@ludens.elte.hu>.

15 years agoRemove GH and its traces.
Han-Wen Nienhuys [Sat, 13 Sep 2008 03:19:23 +0000 (00:19 -0300)]
Remove GH and its traces.

15 years agoEnclose `regexp.test' in a module.
Ludovic Courtès [Thu, 25 Sep 2008 19:36:14 +0000 (21:36 +0200)]
Enclose `regexp.test' in a module.

* test-suite/tests/regexp.test: Add `define-module' clause.

15 years agoFix handling of the FLAGS argument in `fold-matches'.
Ludovic Courtès [Thu, 25 Sep 2008 19:07:06 +0000 (21:07 +0200)]
Fix handling of the FLAGS argument in `fold-matches'.

* ice-9/regex.scm (fold-matches): If FLAGS is non-null, use
  `(car flags)', not `flags'.

* test-suite/tests/regexp.test ("fold-matches"): New test prefix.

* NEWS: Update.

15 years agoMake literal strings (i.e., returned by `read') read-only.
Ludovic Courtès [Mon, 22 Sep 2008 21:03:20 +0000 (23:03 +0200)]
Make literal strings (i.e., returned by `read') read-only.

* libguile/read.c (scm_read_string): Use `scm_i_make_read_only_string ()' to
  return a read-only string, as mandated by R5RS.  Reported by Bill
  Schottstaedt <bil@ccrma.Stanford.EDU>.

* libguile/strings.c (scm_i_make_read_only_string): New function.
  (scm_i_shared_substring_read_only): Special-case the empty string
  so that the read-only and read-write empty strings are `eq?'.  This
  optimization is relied on by the `substring/shared' `empty string'
  test case in `srfi-13.test'.

* libguile/strings.h (scm_i_make_read_only_string): New declaration.

* test-suite/tests/strings.test ("string-set!")["literal string"]: New test.

* NEWS: Update.

15 years agoMake `symbol->string' return a read-only string.
Ludovic Courtès [Mon, 22 Sep 2008 20:51:36 +0000 (22:51 +0200)]
Make `symbol->string' return a read-only string.

* libguile/strings.c (scm_i_symbol_substring): Return a read-only string
  since R5RS requires `symbol->string' to return a read-only string.
  Reported by Bill Schottstaedt <bil@ccrma.Stanford.EDU>.

* test-suite/tests/symbols.test: Add `define-module' clause.
  (exception:immutable-string): Adjust to current exception.
  ("symbol->string")["result is an immutable string"]: Use
  `pass-if-exception' instead of `expect-fail-exception'.

* NEWS: Update.

15 years agoFix for incorrect (gcd -2) => -2; should give 2.
Neil Jerram [Wed, 17 Sep 2008 20:46:40 +0000 (21:46 +0100)]
Fix for incorrect (gcd -2) => -2; should give 2.

(reported by Bill Schottstaedt)

* libguile/numbers.c (scm_gcd): When only one arg given, use scm_abs
  to ensure that result is non-negative.

* test-suite/tests/numbers.test ("gcd"): New test, (gcd -2).

15 years agoFix `strftime' documentation wrt. `%Z'.
Ludovic Courtès [Thu, 18 Sep 2008 21:13:42 +0000 (23:13 +0200)]
Fix `strftime' documentation wrt. `%Z'.

* doc/ref/posix.texi (Time)[strftime]: Remove erroneous note saying
  that `%Z' ignores `tm:zone'.  Reported by Neil Jerram.

15 years agoMake multi-byte reads on unbuffered ports more efficient.
Neil Jerram [Sun, 14 Sep 2008 23:25:25 +0000 (00:25 +0100)]
Make multi-byte reads on unbuffered ports more efficient.

Idea and original patch were by Ludovic Courtès, this is Neil Jerram's
reworking of it.

* libguile/srfi-4.c (scm_uniform_vector_read_x): Use scm_c_read,
instead of equivalent code here.

* libguile/ports.c (scm_fill_input): Add assertion that read
buffer is empty when called.
(port_and_swap_buffer, swap_buffer): New, for...
(scm_c_read): Use caller's buffer for reading, to avoid making N
1-byte low-level read calls, in the case where the port is
unbuffered (or has a very small buffer).

15 years agoAdd `uniform-vector-read!' benchmark.
Ludovic Courtès [Sun, 1 Jun 2008 17:31:36 +0000 (19:31 +0200)]
Add `uniform-vector-read!' benchmark.

15 years agoInclude <config.h> in standalone tests.
Ludovic Courtès [Sat, 13 Sep 2008 18:09:08 +0000 (20:09 +0200)]
Include <config.h> in standalone tests.

* test-suite/standalone/Makefile.am (test_cflags): Add `-I$(top_builddir)' so
  that <config.h> can be found.
  (snarfcppopts): Likewise.

* test-suite/standalone/*.c: Include <config.h>.

15 years agoInclude <config.h> in all C files; use `#ifdef HAVE_CONFIG_H' rather than `#if'.
Ludovic Courtès [Sat, 13 Sep 2008 13:35:27 +0000 (15:35 +0200)]
Include <config.h> in all C files; use `#ifdef HAVE_CONFIG_H' rather than `#if'.

15 years agoAdd `ChangeLog-2008' files to the distribution.
Ludovic Courtès [Fri, 12 Sep 2008 19:46:32 +0000 (21:46 +0200)]
Add `ChangeLog-2008' files to the distribution.

15 years agoRename `ChangeLog' files to `ChangeLog-2008'.
Ludovic Courtès [Fri, 12 Sep 2008 19:48:04 +0000 (21:48 +0200)]
Rename `ChangeLog' files to `ChangeLog-2008'.

15 years agodoc: Correct the default value of `%load-path'.
Ludovic Courtès [Fri, 12 Sep 2008 09:30:04 +0000 (11:30 +0200)]
doc: Correct the default value of `%load-path'.

* doc/ref/api-options.texi (Build Config): Remove "." from the default value
  of `%load-path'.  Reported by David Séverin <david@altosw.be>.

15 years agoInclude <config.h> in `discouraged.c'.
Ludovic Courtès [Fri, 12 Sep 2008 07:41:54 +0000 (09:41 +0200)]
Include <config.h> in `discouraged.c'.

* libguile/discouraged.c: Include <config.h> first so that files that
  rely on `config.h' macros (such as Gnulib-provided headers) work as
  expected.

15 years agoRemove `.cvsignore' files.
Ludovic Courtès [Thu, 11 Sep 2008 19:28:21 +0000 (21:28 +0200)]
Remove `.cvsignore' files.

15 years agoUse Gnulib's `autobuild' module.
Ludovic Courtès [Thu, 11 Sep 2008 19:16:47 +0000 (21:16 +0200)]
Use Gnulib's `autobuild' module.

* m4/gnulib-cache.m4 (gl_MODULES): Add `autobuild'.

* Makefile.am (EXTRA_DIST): Add `m4/autobuild.m4'.

15 years agoRevise GC asserts.
Han-Wen Nienhuys [Wed, 10 Sep 2008 03:11:02 +0000 (00:11 -0300)]
Revise GC asserts.

* libguile/gc.c (scm_i_gc): Change assert into printed warning.

* libguile/private-gc.h (nil): introduce scm_i_last_marked_cell_count,
  as a private mechanism for maintaining cell counts.  Remove variable
  scm_cells_allocated.

15 years ago* HACKING: update to current practice
Han-Wen Nienhuys [Wed, 3 Sep 2008 04:35:18 +0000 (01:35 -0300)]
* HACKING: update to current practice

  * Drop CVS references.

  * Ask for Git based patches.

  * Drop outdated info (EGCS, SCM_P)

15 years agoFix compilation of `libguile-i18n' on MinGW.
Ludovic Courtès [Wed, 10 Sep 2008 09:38:23 +0000 (11:38 +0200)]
Fix compilation of `libguile-i18n' on MinGW.

* libguile/locale-categories.h (MESSAGES): Enclose in `#ifdef LC_MESSAGES' as
  it's not available on MinGW.  Reported by Han-Wen.

15 years agoCleanup mark-during-GC debug checks.
Han-Wen Nienhuys [Wed, 10 Sep 2008 02:08:16 +0000 (23:08 -0300)]
Cleanup mark-during-GC debug checks.

* libguile/__scm.h (SCM_DEBUG): add SCM_DEBUG_MARKING_API

* libguile/gc.h (SCM_SET_GC_MARK): depending on
SCM_DEBUG_MARKING_API crash if someone is touching markbits
outside regular hours.

Rename ensure_marking() to scm_i_ensure_marking().

* libguile/inline.h (scm_double_cell, scm_cell): only set mark bits
for debugging if SCM_DEBUG_MARKING_API is unset

* libguile/gc-mark.c: Issue deprecation warning if we are marking
outside of the GC mark phase.

15 years agoUse Gnulib's `count-one-bits' as a replacement for `scm_i_uint_bit_count ()'.
Ludovic Courtès [Tue, 9 Sep 2008 20:46:04 +0000 (22:46 +0200)]
Use Gnulib's `count-one-bits' as a replacement for `scm_i_uint_bit_count ()'.

* libguile/gc-card.c: Include <config.h> and <count-one-bits.h>.
  (scm_i_uint_bit_count): Remove.
  (scm_i_card_marked_count): Use `count_one_bits_l ()' instead
  of `scm_i_uint_bit_count ()'.

* libguile/gc-segment.c: Include <config.h> and <count-one-bits.h>.
  (scm_i_heap_segment_marked_count): Use `count_one_bits_l ()' instead
  of `scm_i_uint_bit_count ()'.

* libguile/private-gc.h (scm_i_uint_bit_count): Remove.

15 years agoUse Gnulib's `count-one-bits' module.
Ludovic Courtès [Tue, 9 Sep 2008 20:37:43 +0000 (22:37 +0200)]
Use Gnulib's `count-one-bits' module.

* m4/gnulib-cache.m4 (gl_MODULES): Add `count-one-bits'.

15 years agoMerge branch 'master' into strftime-gnulib
Ludovic Courtès [Tue, 9 Sep 2008 20:03:42 +0000 (22:03 +0200)]
Merge branch 'master' into strftime-gnulib

Conflicts:
libguile/ChangeLog
srfi/ChangeLog
test-suite/ChangeLog

15 years agoGet rid of Automake's "maintainer mode".
Ludovic Courtès [Tue, 9 Sep 2008 16:06:37 +0000 (18:06 +0200)]
Get rid of Automake's "maintainer mode".

* NEWS: Update.
* configure.in: Remove `AM_MAINTAINER_MODE' invocation.
* doc/Makefile.am, ice-9/Makefile.am: Ignore `MAINTAINER_MODE'
  conditional.

15 years agoUpdate `NEWS' wrt. `mutex-lock' deadlock fix.
Ludovic Courtès [Mon, 8 Sep 2008 12:36:12 +0000 (14:36 +0200)]
Update `NEWS' wrt. `mutex-lock' deadlock fix.

15 years agoUpdate `NEWS' wrt. the removal of `scm_i_' symbols.
Ludovic Courtès [Thu, 4 Sep 2008 19:33:44 +0000 (21:33 +0200)]
Update `NEWS' wrt. the removal of `scm_i_' symbols.

15 years ago* eval.c: Mark #endif with comment.
Han-Wen Nienhuys [Wed, 3 Sep 2008 04:50:30 +0000 (01:50 -0300)]
* eval.c: Mark #endif with comment.

15 years agoDon't sanity check GC numbers on 64 bit platforms, while we
Han-Wen Nienhuys [Wed, 3 Sep 2008 04:37:58 +0000 (01:37 -0300)]
Don't sanity check GC numbers on 64 bit platforms, while we
investigate a real fix.

15 years agoFix compilation of `libguile-i18n' on NetBSD.
Ludovic Courtès [Tue, 2 Sep 2008 21:01:47 +0000 (23:01 +0200)]
Fix compilation of `libguile-i18n' on NetBSD.

* libguile/i18n.c (str_upcase, str_downcase, scm_char_locale_downcase,
  scm_char_locale_upcase): Cast chars to `int' when invoking `toupper ()'
  et al. to avoid "array subscript has type 'char'" on NetBSD.
  Reported by Greg Toxel <gdt@ir.bbn.com>.

15 years agoUse Gnulib's `strftime' to address bug #24130.
Ludovic Courtès [Tue, 2 Sep 2008 19:24:53 +0000 (21:24 +0200)]
Use Gnulib's `strftime' to address bug #24130.

* libguile/stime.c (scm_strftime): Use `nstrftime ()' from Gnulib.
  This provides the same semantics on all platforms, thereby fixing
  bug #24130.

* doc/ref/posix.texi (Time): Remove note about non-portable `%Z'
  behavior.  Describe the new, portable behavior.

* test-suite/tests/time.test ("strftime")["strftime %Z doesn't return
  garbage"]: Reinstate.
  ["C99 %z format"](have-strftime-%z): Remove.
  ("GMT", "EST+5"): Don't use `have-strftime-%z'.

15 years agoAdd Gnulib `strftime' module, update Gnulib files.
Ludovic Courtès [Tue, 2 Sep 2008 19:16:10 +0000 (21:16 +0200)]
Add Gnulib `strftime' module, update Gnulib files.

* m4/gnulib-cache.m4 (gl_MODULES): Add `strftime'.

15 years agoResolve a deadlock caused by not checking mutex state after calling `SCM_TICK'.
Julian Graham [Sat, 30 Aug 2008 23:03:21 +0000 (19:03 -0400)]
Resolve a deadlock caused by not checking mutex state after calling `SCM_TICK'.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
15 years agoRaise error on SRFI-18 load if Guile built without threading support
Julian Graham [Sat, 30 Aug 2008 17:49:38 +0000 (13:49 -0400)]
Raise error on SRFI-18 load if Guile built without threading support

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
15 years agoRemove `coop-threads' files that had been useless since 2005-03-02.
Ludovic Courtès [Wed, 27 Aug 2008 21:47:56 +0000 (23:47 +0200)]
Remove `coop-threads' files that had been useless since 2005-03-02.

15 years agoFix builds `--without-threads'.
Ludovic Courtès [Wed, 27 Aug 2008 21:05:44 +0000 (23:05 +0200)]
Fix builds `--without-threads'.

15 years agoMerge branch 'master' of git://git.sv.gnu.org/guile into nits
Han-Wen Nienhuys [Wed, 27 Aug 2008 02:48:20 +0000 (23:48 -0300)]
Merge branch 'master' of git://git.sv.gnu.org/guile into nits

15 years agoOnly sanity check numbers if SCM_DEBUG_CELL_ACCESSES is unset.
Han-Wen Nienhuys [Wed, 27 Aug 2008 01:49:05 +0000 (22:49 -0300)]
Only sanity check numbers if SCM_DEBUG_CELL_ACCESSES is unset.

SCM_DEBUG_CELL_ACCESSES uses the mark bits for its own purposes.

15 years agoSet SRCPROP{PLIST,COPY} through a macro, so SCM_DEBUG_CELL_ACCESSES compiles.
Han-Wen Nienhuys [Wed, 27 Aug 2008 01:47:19 +0000 (22:47 -0300)]
Set SRCPROP{PLIST,COPY} through a macro, so SCM_DEBUG_CELL_ACCESSES compiles.

15 years agoUse $(GCC_CFLAGS) for `-Werror' et al. so that it's not used to compile
Ludovic Courtès [Mon, 25 Aug 2008 09:20:02 +0000 (11:20 +0200)]
Use $(GCC_CFLAGS) for `-Werror' et al. so that it's not used to compile
Gnulib code.

15 years agoUse $(GCC_CFLAGS) for `-Werror' et al. so that it's not used to compile
Ludovic Courtès [Mon, 25 Aug 2008 09:20:02 +0000 (11:20 +0200)]
Use $(GCC_CFLAGS) for `-Werror' et al. so that it's not used to compile
Gnulib code.

15 years agoFix 2 indentation nitpicks.
Han-Wen Nienhuys [Fri, 22 Aug 2008 02:21:57 +0000 (23:21 -0300)]
Fix 2 indentation nitpicks.

15 years agoStyle nitpicks: space before () in function call.
Han-Wen Nienhuys [Fri, 22 Aug 2008 02:16:20 +0000 (23:16 -0300)]
Style nitpicks: space before () in function call.

15 years agoAdd Gnulib-provided files for convenience.
Ludovic Courtès [Thu, 21 Aug 2008 20:23:59 +0000 (22:23 +0200)]
Add Gnulib-provided files for convenience.

These come from Gnulib's Git commit
ae3a0d62f26d8156b403e40d6007475006f3136f, dated 2008-08-19.

15 years agoNever define `_GNU_SOURCE' explicitly since `AC_USE_SYSTEM_EXTENSIONS'
Ludovic Courtès [Wed, 20 Aug 2008 17:31:46 +0000 (19:31 +0200)]
Never define `_GNU_SOURCE' explicitly since `AC_USE_SYSTEM_EXTENSIONS'
takes care of it.

Conflicts:

ChangeLog
configure.in
libguile/eval.c
libguile/srfi-14.c
libguile/threads.c

15 years agoAdd test case for the GOOPS `class-redefinition' memory corruption.
Ludovic Courtès [Tue, 19 Aug 2008 22:44:20 +0000 (00:44 +0200)]
Add test case for the GOOPS `class-redefinition' memory corruption.

15 years agoAdd ChangeLog and NEWS entry for the GOOPS `class-redefinition' memory
Ludovic Courtès [Tue, 19 Aug 2008 17:13:39 +0000 (19:13 +0200)]
Add ChangeLog and NEWS entry for the GOOPS `class-redefinition' memory
corruption fix.

15 years agoComplete fix of `hell' allocation in GOOPS.
Ludovic Courtès [Tue, 19 Aug 2008 17:08:29 +0000 (19:08 +0200)]
Complete fix of `hell' allocation in GOOPS.

15 years agoFix sizeof() nitpick for goops corruption.
Han-Wen Nienhuys [Mon, 18 Aug 2008 14:02:43 +0000 (11:02 -0300)]
Fix sizeof() nitpick for goops corruption.

15 years agoMake marked conservatively statistic accumulative.
Han-Wen Nienhuys [Sat, 16 Aug 2008 18:34:04 +0000 (15:34 -0300)]
Make marked conservatively statistic accumulative.

15 years agoIf realloc() fails in scm_realloc, then do a complete GC with complete
Han-Wen Nienhuys [Sat, 16 Aug 2008 18:20:55 +0000 (15:20 -0300)]
If realloc() fails in scm_realloc, then do a complete GC with complete
sweep directly.

15 years agoAdd a statistic for tracking how many cells are marked conservatively.
Han-Wen Nienhuys [Sat, 16 Aug 2008 18:03:48 +0000 (15:03 -0300)]
Add a statistic for tracking how many cells are marked conservatively.

This allows an informed choice for deciding how many segments to
create.  After startup, ~2% of the cells are scanned conservatively.

15 years agoGarbage collection cleanup.
Han-Wen Nienhuys [Sat, 16 Aug 2008 16:57:23 +0000 (13:57 -0300)]
Garbage collection cleanup.

* New file gc-segment-table.c: hold code for the segment table.

* Remove data that might be out of date; remove
  scm_i_adjust_min_yield().  We don't store min_yields, since they
  are only accurate at one point in time (when the sweep finishes).
  We decide the min yield at that point from min_yield_fraction and
  freelist->collected / freelist->swept

* Introduce scm_i_gc_heap_size_delta() replacing
  scm_i_gc_grow_heap_p().

* Remove foo_1 fields containing penultimate results.

* After GC, count mark bit vector to discover number of live
  objects. This simplifies hairy updates.

* Many formatting and layout cleanups.

* Fix in scm_i_sweep_card(): return the length of free_list returned,
  rather than number of deleted objects.

* For mtrigger GCs: do not also run a full sweep after the gc() call, as
  this is inconsistent with lazy sweeping.

* Remove scm_i_make_initial_segment().

* Use calloc in scm_i_make_empty_heap_segment() to save on
  initialization code.

* New function scm_i_sweep_for_freelist() which sweeps, with proper
  statistic variable updates.

* New segments are conceptually blocks with 100% reclaimable cells.

* Remove some useless constants/comments: SCM_HEAP_SIZE,
  SCM_INIT_HEAP_SIZE, SCM_EXPHEAP, SCM_HEAP_SEG_SIZE

* Do not increment scm_cells_allocated() from the
  scm_[double]cell(). This would be a race condition.

* Move some deprecation checks in separate functions to not distract
  from main code flow.

15 years agoRemove comments about removed variables.
Han-Wen Nienhuys [Sat, 16 Aug 2008 16:27:17 +0000 (13:27 -0300)]
Remove comments about removed variables.

15 years agoIntroduce scm_i_marking to detect when GC mark bits are touched
Han-Wen Nienhuys [Sat, 16 Aug 2008 14:57:27 +0000 (11:57 -0300)]
Introduce scm_i_marking to detect when GC mark bits are touched
outside of marking stage.

15 years agoRemove unused macro UNMARKED_CELL_P()
Han-Wen Nienhuys [Sat, 16 Aug 2008 05:58:36 +0000 (02:58 -0300)]
Remove unused macro UNMARKED_CELL_P()

15 years agoUse word_2 to store mark bits for freeing structs and vtables in the
Han-Wen Nienhuys [Sat, 16 Aug 2008 05:58:17 +0000 (02:58 -0300)]
Use word_2 to store mark bits for freeing structs and vtables in the
correct order.

This ensures that we only use GC Marks during the actual GC Mark.

15 years agoDo not include private-gc.h in srfi-60.
Han-Wen Nienhuys [Sat, 16 Aug 2008 15:28:19 +0000 (12:28 -0300)]
Do not include private-gc.h in srfi-60.

15 years agoFix memory corruption issue with hell[] array: realloc/calloc need to
Han-Wen Nienhuys [Sat, 16 Aug 2008 05:18:51 +0000 (02:18 -0300)]
Fix memory corruption issue with hell[] array: realloc/calloc need to
factor in sizeof(scm_t_bits)

15 years agoInclude min-yields in gc-stats output.
Han-Wen Nienhuys [Thu, 14 Aug 2008 05:16:41 +0000 (02:16 -0300)]
Include min-yields in gc-stats output.

15 years agoWhitespace and formatting fixes.
Han-Wen Nienhuys [Thu, 14 Aug 2008 04:51:24 +0000 (01:51 -0300)]
Whitespace and formatting fixes.

Conflicts:

libguile/gc-freelist.c
libguile/gc-segment.c
libguile/gc.h

15 years agoRemove the now useless `qthreads.m4'.
Ludovic Courtès [Wed, 13 Aug 2008 22:15:03 +0000 (00:15 +0200)]
Remove the now useless `qthreads.m4'.

15 years agoFix build failure on Debian hppa architecture (bad stack growth detection)
Neil Jerram [Thu, 7 Aug 2008 21:24:31 +0000 (23:24 +0200)]
Fix build failure on Debian hppa architecture (bad stack growth detection)

* configure.in (SCM_I_GSC_STACK_GROWS_UP): Remove use of
AC_CACHE_CHECK, which was inadvertently causing
SCM_I_GSC_STACK_GROWS_UP _always_ to be 0.