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

15 years agoFix misleading output from `(help rationalize)'
Neil Jerram [Sat, 2 Aug 2008 23:18:33 +0000 (00:18 +0100)]
Fix misleading output from `(help rationalize)'

* numbers.c (scm_rationalize): Update docstring to match the
manual (which is more correct).  Change argument "err" to "eps",
also to match the manual.

15 years agoSingle stepping through code from Emacs
Neil Jerram [Fri, 11 Jul 2008 16:53:43 +0000 (17:53 +0100)]
Single stepping through code from Emacs

When you use GDS to evaluate Scheme code from Emacs, you can now use
`C-u' to indicate that you want to single step through that code. See
`Evaluating Scheme Code' in the manual for more details.

* scheme-using.texi (Evaluating Scheme Code): Document use of
        `C-u' prefix with evaluation commands.

        * gds-scheme.el (gds-eval-region, gds-eval-expression)
        (gds-eval-defun, gds-eval-last-sexp): Support `C-u' prefix,
        meaning that user wants to single step through the code.

        * gds-client.scm (handle-nondebug-protocol): Add support for
        setting a trap on code that is about to be evaluated.

15 years agoChangeLog for "Improve stack direction test"
Neil Jerram [Thu, 17 Jul 2008 21:03:49 +0000 (22:03 +0100)]
ChangeLog for "Improve stack direction test"

15 years agoChangeLog for "Improved MIPS/Linux gc_os_dep.c definitions"
Neil Jerram [Thu, 17 Jul 2008 21:02:01 +0000 (22:02 +0100)]
ChangeLog for "Improved MIPS/Linux gc_os_dep.c definitions"

15 years agoHandle lack of `struct dirent64' and `readdir64_r ()' on HP-UX 11.11.
Ludovic Courtès [Wed, 16 Jul 2008 22:17:56 +0000 (00:17 +0200)]
Handle lack of `struct dirent64' and `readdir64_r ()' on HP-UX 11.11.

15 years agoImprove stack direction test
Neil Jerram [Fri, 11 Jul 2008 22:30:19 +0000 (23:30 +0100)]
Improve stack direction test

* configure.in: Update stack direction test to be like that in
Autoconf _AC_LIBOBJ_ALLOCA and Gnulib; specifically in involving a
function calling itself.

15 years agoImproved MIPS/Linux gc_os_dep.c definitions
Neil Jerram [Sat, 12 Jul 2008 18:22:59 +0000 (19:22 +0100)]
Improved MIPS/Linux gc_os_dep.c definitions

From Thiemo Seufer <ths@networkno.de>:

* gc_os_dep.c (CPP_WORDSZ, ALIGN_DOUBLE, DATAEND,
DYNAMIC_LOADING): Added #defines.
(_fdata, _end): Added declarations.
(DATASTART): Use _fdata instead of __data_start.
(STACKBOTTOM): Changed from 0x80000000 to 0x7fff8000.

15 years agoUse `-q' when running standalone tests.
Ludovic Courtès [Sun, 6 Jul 2008 21:58:15 +0000 (23:58 +0200)]
Use `-q' when running standalone tests.

15 years agoUpdate `INSTALL'.
Ludovic Courtès [Sun, 6 Jul 2008 17:55:18 +0000 (19:55 +0200)]
Update `INSTALL'.

15 years agoUpdate to Autoconf 2.61.
Ludovic Courtès [Sun, 6 Jul 2008 17:53:49 +0000 (19:53 +0200)]
Update to Autoconf 2.61.

15 years agoUpdate Gnulib files.
Ludovic Courtès [Sat, 5 Jul 2008 18:24:51 +0000 (20:24 +0200)]
Update Gnulib files.

15 years agoAdd `scm_c_symbol_length ()'.
Ludovic Courtès [Sat, 5 Jul 2008 18:10:44 +0000 (20:10 +0200)]
Add `scm_c_symbol_length ()'.

15 years agoDon't declare `scm_i_locale_mutex' as `SCM_INTERNAL'.
Ludovic Courtès [Fri, 4 Jul 2008 20:22:06 +0000 (22:22 +0200)]
Don't declare `scm_i_locale_mutex' as `SCM_INTERNAL'.

15 years agoUpdate `THANKS'.
Ludovic Courtès [Fri, 4 Jul 2008 20:03:08 +0000 (22:03 +0200)]
Update `THANKS'.

15 years agoFix `SCM_INTERNAL' with GCC 4.3.
Ludovic Courtès [Fri, 4 Jul 2008 20:02:56 +0000 (22:02 +0200)]
Fix `SCM_INTERNAL' with GCC 4.3.

15 years agoAdd `NEWS' entry for SRFI-18.
Ludovic Courtès [Mon, 30 Jun 2008 17:48:50 +0000 (19:48 +0200)]
Add `NEWS' entry for SRFI-18.

15 years agosrfi-modules.texi (SRFI-18): New sections.
Julian Graham [Sat, 21 Jun 2008 04:55:17 +0000 (00:55 -0400)]
srfi-modules.texi (SRFI-18): New sections.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
15 years agoModernize Automake files.
Ludovic Courtès [Sat, 28 Jun 2008 20:00:44 +0000 (22:00 +0200)]
Modernize Automake files.

15 years agoFix doc typo regarding `use-syntax' and "syntax transformers".
Ludovic Courtès [Sat, 28 Jun 2008 18:37:21 +0000 (20:37 +0200)]
Fix doc typo regarding `use-syntax' and "syntax transformers".

15 years agoFix harmless typo in SRFI-19.
Ludovic Courtès [Sat, 28 Jun 2008 18:32:17 +0000 (20:32 +0200)]
Fix harmless typo in SRFI-19.

15 years agoDisable type-checking of `SCM_UNPACK' for the broken HP compilers.
Ludovic Courtès [Sat, 28 Jun 2008 18:31:01 +0000 (20:31 +0200)]
Disable type-checking of `SCM_UNPACK' for the broken HP compilers.

16 years agoUpdate `THANKS'.
Ludovic Courtès [Mon, 2 Jun 2008 19:47:53 +0000 (21:47 +0200)]
Update `THANKS'.

16 years agoguile-config: Show `-L$libdir' before `-lguile'.
Ludovic Courtès [Mon, 2 Jun 2008 19:47:41 +0000 (21:47 +0200)]
guile-config: Show `-L$libdir' before `-lguile'.

16 years agoWork around `#define except' on Tru64.
Ludovic Courtès [Mon, 2 Jun 2008 19:43:07 +0000 (21:43 +0200)]
Work around `#define except' on Tru64.

16 years agoSupport systems whose <inttypes.h> doesn't define `PRIiMAX'.
Ludovic Courtès [Mon, 2 Jun 2008 19:34:57 +0000 (21:34 +0200)]
Support systems whose <inttypes.h> doesn't define `PRIiMAX'.

16 years agoFix SRFI-88 URL in the manual.
Ludovic Courtès [Sun, 1 Jun 2008 11:09:36 +0000 (13:09 +0200)]
Fix SRFI-88 URL in the manual.

16 years agoUpdate `NEWS'.
Ludovic Courtès [Sat, 31 May 2008 21:19:55 +0000 (23:19 +0200)]
Update `NEWS'.

16 years agoAdd `SCM_INTERNAL' macro, use it.
Ludovic Courtès [Wed, 14 May 2008 03:20:47 +0000 (05:20 +0200)]
Add `SCM_INTERNAL' macro, use it.

16 years agoScheme SRFI-18 implementation and tests file
Julian Graham [Thu, 15 May 2008 04:50:50 +0000 (00:50 -0400)]
Scheme SRFI-18 implementation and tests file

16 years agoDelete trailing whitespace.
Neil Jerram [Wed, 14 May 2008 23:00:57 +0000 (00:00 +0100)]
Delete trailing whitespace.

16 years agoChangeLog updates for latest set of SRFI-18 changes
Julian Graham [Mon, 14 Apr 2008 00:31:18 +0000 (20:31 -0400)]
ChangeLog updates for latest set of SRFI-18 changes

16 years agoDelete trailing whitespace.
Neil Jerram [Wed, 14 May 2008 22:52:49 +0000 (23:52 +0100)]
Delete trailing whitespace.

16 years agolatest set of SRFI-18 support changes to core threads
Julian Graham [Sun, 13 Apr 2008 23:51:23 +0000 (19:51 -0400)]
latest set of SRFI-18 support changes to core threads

16 years agoExpand DEFFROM and DEFTO macros in discouraged.c
Neil Jerram [Mon, 12 May 2008 23:00:34 +0000 (00:00 +0100)]
Expand DEFFROM and DEFTO macros in discouraged.c

* discouraged.c: Expand DEFFROM and DEFTO macros, to avoid
compiler warnings about excess semicolons.  (Reported by Didier
Godefroy.)

16 years agoFix continuation problems on IA64.
Neil Jerram [Wed, 7 May 2008 23:29:53 +0000 (00:29 +0100)]
Fix continuation problems on IA64.

* Specific problems in IA64 make check

** test-unwind

Representation of the relevant dynamic context:

                  non-rewindable
           catch      frame       make cont.
  o----o-----a----------b-------------c
        \
         \             call cont.
          o-----o-----------d

A continuation is captured at (c), with a non-rewindable frame in the
dynamic context at (b).  If a rewind through that frame was attempted,
Guile would throw to the catch at (a).  Then the context unwinds back
past (a), then winds forwards again, and the captured continuation is
called at (d).

We should end up at the catch at (a).  On ia64, we get an "illegal
instruction".

The problem is that Guile does not restore the ia64 register backing
store (RBS) stack (which is saved off when the continuation is
captured) until all the unwinding and rewinding is done.  Therefore,
when the rewind code (scm_i_dowinds) hits the non-rewindable frame at
(b), the RBS stack hasn't yet been restored.  The throw finds the
jmp_buf (for the catch at (a)) correctly from the dynamic context, and
jumps back to (a), but the RBS stack is invalid, hence the illegal
instruction.

This could be fixed by restoring the RBS stack earlier, at the same
point (copy_stack) where the normal stack is restored.  But that
causes a problem in the next test...

** continuations.test

The dynamic context diagram for this case is similar:

                   non-rewindable
  catch                 frame       make cont.
    a----x-----o----------b-------------c
          \
           \    call cont.
            o-------d

The only significant difference is that the catch point (a) is
upstream of where the dynamic context forks.  This means that the RBS
stack at (d) already contains the correct RBS contents for throwing
back to (a), so it doesn't matter whether the RBS stack that was saved
off with the continuation gets restored.

This test passes with the Guile 1.8.4 code, but fails (with an
"illegal instruction") when the code is changed to restore the RBS
stack earlier as described above.

The problem now is that the RBS stack is being restored _too_ early;
specifically when there is still stuff to do that relies on the old
RBS contents.  When a continuation is called, the sequence of relevant
events is:

  (1) Grow the (normal) stack until it is bigger than the (normal)
      stack saved off in the continuation.  (scm_dynthrow, grow_stack)

  (2) scm_i_dowinds calls itself recursively, such that

      (2.1) for each rewind (from (x) to (c)) that will be needed,
            another frame is added to the stack (both normal and RBS),
            with local variables specifying the required rewind; the
            rewinds don't actually happen yet, they will happen when
            the stack unwinds again through these frames

      (2.2) required unwinds - back from where the continuation was
            called (d) to the fork point (x) - are done immediately.

  (3) The normal (i.e. non-RBS) stack that was stored in the
      continuation is restored (i.e. copied on top of the actual
      stack).

      Note that this doesn't overwrite the frames that were added in
      (2.1), because the growth in (1) ensures that the added frames
      are beyond the end of the restored stack.

  (4) ? Restore the RBS stack here too ?

  (5) Return (from copy_stack) through the (2.1) frames, which means
      that the rewinds now happen.

  (6) setcontext (or longjmp) to the context (c) where the
      continuation was captured.

The trouble is that step (1) does not create space in the RBS stack in
the same kind of way that it does for the normal stack.  Therefore, if
the saved (in the continuation) RBS stack is big enough, it can
overwrite the RBS of the (2.1) frames that still need to complete.
This causes an illegal instruction when we return through those frames
and try to perform the rewinds.

* Fix

The key to the fix is that the saved RBS stack only needs to be
restored at some point before the next setcontext call, and that doing
it as close to the setcontext call as possible will avoid bad
interactions with the pre-setcontext stack.  Therefore we do the
restoration at the last possible point, immediately before the next
setcontext call.

The situation is complicated by there being two ways that the next
setcontext call can happen.

  - If the unwinding and rewinding is all successful, the next
    setcontext will be the one from step (6) above.  This is the
    "normal" continuation invocation case.

  - If one of the rewinds throws an error, the next setcontext will
    come from the throw implementation code.  (And the one in step (6)
    will never happen.)  This is the rewind error case.

In the rewind error case, the code calling setcontext knows nothing
about the continuation.  So to cover both cases, we:

  - copy (in step (4) above) the address and length of the
    continuation's saved RBS stack to the current thread state
    (SCM_I_CURRENT_THREAD)

  - modify all setcontext callers so that they check the current
    thread state for a saved RBS stack, and restore it if so before
    calling setcontext.

* Notes

** I think rewinders cannot rely on using any stack data

Unless it can be guaranteed that the data won't go into a register.
I'm not 100% sure about this, but I think it follows from the fact
that the RBS stack is not restored until after the rewinds have
happened.

Note that this isn't a regression caused by the current fix.  In Guile
1.8.4, the RBS stack was restored _after_ the rewinds, and this is
still the case now.

** Most setcontext calls for `throw' don't need to change the RBS stack

In the absence of continuation invocation, the setcontext call in the
throw implementation code always sets context to a place higher up the
same stack (both normal and RBS), hence no stack restoration is
needed.

* Other changes

** Using setcontext for all non-local jumps (for __ia64__)

Along the way, I read a claim somewhere that setcontext was more
reliable than longjmp, in cases where the stack has been manipulated.

I don't now have any reason to believe this, but it seems reasonable
anyway to leave the __ia64__ code using getcontext/setcontext, instead
of setjmp/longjmp.

(I think the only possible argument against this would be performance -
if getcontext was significantly slower than setjmp.  It that proves to
be the case, we should revisit this.)

** Capping RBS base for non-main threads

Somewhere else along the way, I hit a problem in GC, involving the RBS
stack of a non-main thread.  The problem was, in
SCM_MARK_BACKING_STORE, that scm_ia64_register_backing_store_base was
returning a value that was massively greater than the value of
scm_ia64_ar_bsp, leading to a seg fault.  This is because the
implementation of scm_ia64_register_backing_store_base is only valid
for the main thread.  I couldn't find a neat way of getting the true
RBS base of a non-main thread, but one idea is simply to call
scm_ia64_ar_bsp when guilifying a thread, and use the value returned
as an upper bound for that thread's RBS base.  (Note that the RBS
stack grows upwards.)

(Were it not for scm_init_guile, we could be much more definitive
about this.  We could take the value of scm_ia64_ar_bsp as a
definitive base address for the part of the RBS stack that Guile cares
about.  We could also then discard
scm_ia64_register_backing_store_base.)

16 years agoMerge changes for 1.8.5.
Ludovic Courtès [Wed, 7 May 2008 18:52:59 +0000 (20:52 +0200)]
Merge changes for 1.8.5.

16 years agoRemove uses of non-portable makefile constructs.
Ludovic Courtès [Wed, 7 May 2008 17:57:40 +0000 (19:57 +0200)]
Remove uses of non-portable makefile constructs.

16 years agoAvoid warning with GCC on FreeBSD 6.2 in `numbers.c'.
Ludovic Courtès [Wed, 7 May 2008 15:43:17 +0000 (17:43 +0200)]
Avoid warning with GCC on FreeBSD 6.2 in `numbers.c'.

16 years agoFix c-tokenize.c error: 'input' defined but not used, when compiling with GCC 4.3.0
Neil Jerram [Mon, 5 May 2008 22:47:24 +0000 (23:47 +0100)]
Fix c-tokenize.c error: 'input' defined but not used, when compiling with GCC 4.3.0

16 years agoAdd NEWS and concept index entries for traps infrastructure and Emacs support.
Neil Jerram [Mon, 5 May 2008 21:31:07 +0000 (22:31 +0100)]
Add NEWS and concept index entries for traps infrastructure and Emacs support.

16 years agoFix omissions and typos in previous commit.
Ludovic Courtès [Sun, 4 May 2008 20:42:13 +0000 (22:42 +0200)]
Fix omissions and typos in previous commit.

16 years agoAdd `pkg-config' support.
Ludovic Courtès [Sun, 4 May 2008 20:19:30 +0000 (22:19 +0200)]
Add `pkg-config' support.

16 years agoFix type-checking of SRFI-1 `partition'.
Ludovic Courtès [Mon, 28 Apr 2008 16:03:27 +0000 (18:03 +0200)]
Fix type-checking of SRFI-1 `partition'.

16 years agoInclude <config.h> in SRFI-1.
Ludovic Courtès [Sat, 26 Apr 2008 22:50:05 +0000 (00:50 +0200)]
Include <config.h> in SRFI-1.

16 years agoOnly run `test-with-guile-module' when pthread support is built.
Ludovic Courtès [Sat, 26 Apr 2008 19:55:29 +0000 (21:55 +0200)]
Only run `test-with-guile-module' when pthread support is built.

16 years agoRemove extraneous semi-colon in `read.c'.
Ludovic Courtès [Sat, 26 Apr 2008 19:39:27 +0000 (21:39 +0200)]
Remove extraneous semi-colon in `read.c'.

16 years agoMake `(srfi srfi-35)' visible through `cond-expand'.
Ludovic Courtès [Sat, 26 Apr 2008 19:09:40 +0000 (21:09 +0200)]
Make `(srfi srfi-35)' visible through `cond-expand'.

16 years agoAdd `(srfi srfi-88)'.
Ludovic Courtès [Sat, 26 Apr 2008 17:34:37 +0000 (19:34 +0200)]
Add `(srfi srfi-88)'.

16 years agoFix dangling references to files that have been removed.
Ludovic Courtès [Sat, 26 Apr 2008 17:27:55 +0000 (19:27 +0200)]
Fix dangling references to files that have been removed.

16 years agoDon't use "-I$(srcdir)", so that our "random.h" doesn't shadow libc's on Tru64.
Ludovic Courtès [Thu, 24 Apr 2008 17:25:30 +0000 (19:25 +0200)]
Don't use "-I$(srcdir)", so that our "random.h" doesn't shadow libc's on Tru64.

16 years agoDocument file-exists?
Neil Jerram [Thu, 17 Apr 2008 20:36:20 +0000 (21:36 +0100)]
Document file-exists?

16 years agoAdd `read' benchmark.
Ludovic Courtès [Thu, 17 Apr 2008 08:04:09 +0000 (10:04 +0200)]
Add `read' benchmark.

16 years agoUpdate `NEWS'.
Ludovic Courtès [Wed, 16 Apr 2008 10:00:49 +0000 (12:00 +0200)]
Update `NEWS'.

16 years agoInline `scm_getc', `scm_putc' and `scm_puts'.
Ludovic Courtès [Mon, 14 Apr 2008 16:09:49 +0000 (18:09 +0200)]
Inline `scm_getc', `scm_putc' and `scm_puts'.

16 years agoMerge branch 'master' of ssh://civodul@git.sv.gnu.org/srv/git/guile
Ludovic Courtès [Wed, 16 Apr 2008 07:06:02 +0000 (09:06 +0200)]
Merge branch 'master' of ssh://civodul@git.sv.gnu.org/srv/git/guile

16 years agoDon't use "echo -n" in `guile-readline/configure.in'.
Ludovic Courtès [Wed, 16 Apr 2008 07:01:33 +0000 (09:01 +0200)]
Don't use "echo -n" in `guile-readline/configure.in'.

16 years agoAdd TAGS to .gitignore
Neil Jerram [Tue, 15 Apr 2008 22:52:58 +0000 (23:52 +0100)]
Add TAGS to .gitignore

16 years agoA few elisp fixes and enhancements
Neil Jerram [Mon, 14 Apr 2008 20:25:17 +0000 (21:25 +0100)]
A few elisp fixes and enhancements

16 years ago* gds-client.scm (gds-debug-trap): Ensure that frame index passed to Emacs is always...
Neil Jerram [Mon, 14 Apr 2008 18:40:02 +0000 (19:40 +0100)]
* gds-client.scm (gds-debug-trap): Ensure that frame index passed to Emacs is always positive.