1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00
Commit graph

10331 commits

Author SHA1 Message Date
Ludovic Courtès
e00634774a Mention the end of ChangeLog' files in NEWS'. 2008-12-09 00:15:25 +01:00
Ludovic Courtès
f24ceff283 Make `config.status' happier.
* guile-tools.in (datarootdir): New variable, needed since `pkgdatadir'
  may refer to `${datarootdir}'.
2008-12-09 00:15:18 +01:00
Ludovic Courtès
b2b91068a4 Add other missing Gnulib files. 2008-12-08 08:06:34 +01:00
Ludovic Courtès
de7d32d064 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.
2008-12-07 22:35:23 +01:00
Ludovic Courtès
14f02d0bcf Add missing Gnulib M4 files.
Reported by Neil Jerram.
2008-12-07 22:34:47 +01:00
Neil Jerram
38ff4606a1 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.
2008-12-07 16:30:04 +00:00
Ludovic Courtès
3ae3166b23 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.
2008-12-02 19:52:13 +01:00
Ludovic Courtès
691343ead2 Update `NEWS'. 2008-12-02 19:52:11 +01:00
Ludovic Courtès
cb823e630d 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.
2008-11-30 20:26:56 +01:00
Ludovic Courtès
d051899d17 Make GNU Libtool 2.2.x happier.
* configure.in: Use `AC_CONFIG_MACRO_DIR([m4])'.  Reverts patch
  b01284227e 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.
2008-11-30 19:38:18 +01:00
Ludovic Courtès
634aa8de8f 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).
2008-11-30 18:43:41 +01:00
Ludovic Courtès
9b36a80c79 Use Gnulib's full-write' and full-read' modules. 2008-11-30 18:11:47 +01:00
Ludovic Courtès
aa7a939cbf Update Gnulib files to commit d4b129b8e5f8a8d1198020fd6fc79310d305936c. 2008-11-30 17:44:44 +01:00
Ludovic Courtès
1da93484fb Use orthodox libtoology in `guile'.
* libguile/guile.c (main): Use `LTDL_SET_PRELOADED_SYMBOLS ()' instead
  of our own trick.
2008-11-24 22:04:44 +01:00
Ludovic Courtès
7635043239 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.
2008-11-24 09:40:00 +01:00
Ludovic Courtès
9283475935 Fix comments in `test-scm-c-read.c'.
* test-suite/standalone/test-scm-c-read.c (make_port): Fix comments.
2008-11-24 09:10:51 +01:00
Ludovic Courtès
8e7ff77376 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.
2008-11-23 22:48:29 +00:00
Neil Jerram
6d2275560d 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.
2008-11-23 22:48:26 +00:00
Ludovic Courtès
c9e44fd755 Update `THANKS'. 2008-11-14 00:41:53 +01:00
Ludovic Courtès
ccf1ca4adf 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'.
2008-11-14 00:36:58 +01:00
Ludovic Courtès
38c1da430c Augment `.gitignore'. 2008-11-13 23:27:25 +01:00
Ludovic Courtès
1660414a24 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).
2008-11-13 23:24:32 +01:00
Ludovic Courtès
9e4db0ef4d 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.
2008-11-13 23:12:34 +01:00
Neil Jerram
9c646eee43 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.
2008-10-26 21:45:33 +00:00
Neil Jerram
7776113a28 Add measure-hwm.scm to the set of distribution files.
* libguile/Makefile.am (EXTRA_DIST): Add measure-hwm.scm.
2008-10-24 23:14:20 +01:00
Neil Jerram
d2a510879b 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.
2008-10-24 21:51:47 +01:00
Neil Jerram
d8b6e19181 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.
2008-10-17 22:05:54 +01:00
Ludovic Courtès
88cefbc7de 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'.
2008-10-10 10:00:57 +02:00
Ludovic Courtès
ec9ef38615 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.
2008-10-09 22:59:58 +02:00
Ludovic Courtès
1ffa692322 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>.
2008-10-09 22:32:16 +02:00
Ludovic Courtès
45a9f43049 Revert "Make literal strings (i.e., returned by `read') read-only."
This reverts commit fb2f8886c4.

The rationale is that `read' must return mutable strings, as reported
by szgyg <szgyg@ludens.elte.hu>.
2008-10-09 22:21:33 +02:00
Han-Wen Nienhuys
89bc270db3 Remove GH and its traces. 2008-09-28 18:42:02 -03:00
Ludovic Courtès
76ed3e877f Enclose `regexp.test' in a module.
* test-suite/tests/regexp.test: Add `define-module' clause.
2008-09-25 21:36:14 +02:00
Ludovic Courtès
c633310265 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.
2008-09-25 21:07:06 +02:00
Ludovic Courtès
fb2f8886c4 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.
2008-09-23 18:45:27 +02:00
Ludovic Courtès
fd2b17b9cb 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.
2008-09-23 18:44:27 +02:00
Neil Jerram
1dd797921c 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).
2008-09-22 21:21:20 +01:00
Ludovic Courtès
f8c01b6f68 Fix strftime' documentation wrt. %Z'.
* doc/ref/posix.texi (Time)[strftime]: Remove erroneous note saying
  that `%Z' ignores `tm:zone'.  Reported by Neil Jerram.
2008-09-18 23:13:42 +02:00
Neil Jerram
b5cb4464ca Make multi-byte reads on unbuffered ports more efficient.
Idea and original patch were by Ludovic Courts, 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).
2008-09-15 18:52:51 +01:00
Ludovic Courtès
aa51e98ac5 Add `uniform-vector-read!' benchmark. 2008-09-15 01:35:04 +01:00
Ludovic Courtès
3394818c0a 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>.
2008-09-13 20:09:08 +02:00
Ludovic Courtès
dbb605f575 Include <config.h> in all C files; use #ifdef HAVE_CONFIG_H' rather than #if'. 2008-09-13 15:35:27 +02:00
Ludovic Courtès
61db429e25 Add `ChangeLog-2008' files to the distribution. 2008-09-12 21:57:52 +02:00
Ludovic Courtès
afb59d75b8 Rename ChangeLog' files to ChangeLog-2008'. 2008-09-12 21:49:58 +02:00
Ludovic Courtès
8370b00b41 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>.
2008-09-12 11:31:48 +02:00
Ludovic Courtès
3c2a5013de 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.
2008-09-12 09:41:54 +02:00
Ludovic Courtès
85ca88c68b Remove `.cvsignore' files. 2008-09-11 21:28:21 +02:00
Ludovic Courtès
ac47b09afa Use Gnulib's `autobuild' module.
* m4/gnulib-cache.m4 (gl_MODULES): Add `autobuild'.

* Makefile.am (EXTRA_DIST): Add `m4/autobuild.m4'.
2008-09-11 21:27:45 +02:00
Han-Wen Nienhuys
b71c8ec90a 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.
2008-09-11 12:10:58 -03:00
Han-Wen Nienhuys
b48efb55b0 * HACKING: update to current practice
* Drop CVS references.

  * Ask for Git based patches.

  * Drop outdated info (EGCS, SCM_P)
2008-09-11 03:35:44 -03:00