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

197 commits

Author SHA1 Message Date
Andy Wingo
e0c332ed41 remove more unused __scm.h options
* libguile/__scm.h: Remove unused SCM_DEBUG_MARKING_API,
  SCM_DEBUG_INTERRUPTS, and SCM_DEBUG_DEBUGGING_SUPPORT defines.
2011-05-15 15:34:15 +02:00
Andy Wingo
b2f38e4f45 remove mention of GUILE_DEBUG_FREELIST
* libguile/__scm.h: Remove commented-out GUILE_DEBUG_FREELIST define.
* libguile/gen-scmconfig.c: Remove mention of GUILE_DEBUG_FREELIST.
2011-05-15 15:34:15 +02:00
Andy Wingo
b9b9a02804 remove #define STACK_CHECKING from __scm.h.
* libguile/__scm.h: Remove #define STACK_CHECKING and #undef
  NO_CEVAL_STACK_CHECKING.

* libguile/debug.c (scm_debug_options)
* libguile/init.c (scm_i_init_guile):
* libguile/stackchk.c (scm_report_stack_overflow):
* libguile/stackchk.h: Always enable stack checking.
2011-05-15 15:34:15 +02:00
Andy Wingo
2572c80673 remove SICP from __scm.h
* libguile/__scm.h: Remove #undef SICP.
* libguile/feature.c (scm_init_feature): Never add the sicp feature.
2011-05-15 15:34:15 +02:00
Andy Wingo
412ccea6c9 remove ENGNOT from __scm.h
* libguile/__scm.h: Remove #undef ENGNOT.
* libguile/numbers.c (idbl2str): Remove #ifdef ENGNOT sections.
2011-05-15 15:34:15 +02:00
Andy Wingo
80125469ef SCM is either a union or scm_t_bits
* libguile/tags.h: Elide the SCM_DEBUG_TYPING_STRICTNESS==1 case.
  Instead just have a flag, SCM_USING_PREHISTORIC_COMPILER, which if set
  uses what was SCM_DEBUG_TYPING_STRICTNESS==0.

* libguile/__scm.h: Remove SCM_DEBUG_TYPING_STRICTNESS block.
2011-05-15 15:34:15 +02:00
Andy Wingo
931b4a6ddc Bump default typing strictness to 2.
* libguile/__scm.h (SCM_DEBUG_TYPING_STRICTNESS): Bump the default to
  2.
2011-05-13 15:46:21 +02:00
Andy Wingo
a2a6c0e319 avoid tls gets when handling interrupts in the vm
* libguile/__scm.h (SCM_ASYNC_TICK_WITH_CODE): Redefine to take a
  scm_i_thread* as well.  OK to do because it's within a
  BUILDING_LIBGUILE block.

* libguile/vm-engine.c (vm_engine): Cache the scm_i_thread* instead of
  the dynstate, so we can use the thread for ticks.

* libguile/vm-engine.h (VM_HANDLE_INTERRUPTS): Tick with the
  scm_i_thread* local var, to avoid excessive tls calls.

* libguile/vm-i-system.c: Fix dynstate users to use
  current_thread->dynamic_state.
2011-05-06 00:17:35 +02:00
Ludovic Courtès
be90d0b6f9 Add `scm_t_subr' typedef (fix bug #23681).
* libguile/__scm.h (scm_t_subr): New typedef.

* libguile/deprecated.h (scm_make_gsubr, scm_make_gsubr_with_generic,
  scm_call_catching_errors): Use it.

* libguile/gsubr.h (scm_c_make_gsubr, scm_c_define_gsubr,
  scm_c_define_gsubr_with_generic): Likewise.

* libguile/smob.h (scm_smob_descriptor)[apply]: Likewise.
  (scm_set_smob_apply): Likewise.

* libguile/snarf.h (SCM_FUNC_CAST_ARBITRARY_ARGS): Likewise.
2011-02-13 14:50:05 +01:00
Ludovic Courtès
553d4bf8ea Add `SCM_GNUC_PREREQ'.
* libguile/__scm.h (SCM_GNUC_PREREQ): New macro.
  Use it in this file in lieu of hand-written GCC version tests.
2010-11-19 13:34:43 +01:00
Andy Wingo
4ca4826997 remove SCM_HAVE_T_INT64, SCM_HAVE_T_UINT64
* libguile/__scm.h:
* libguile/numbers.h:
* libguile/random.c:
* libguile/srfi-4.c:
* libguile/srfi-4.h:
* libguile/numbers.c:
* test-suite/standalone/test-conversion.c:
* libguile/gen-scmconfig.c: As we require 64-bit integers in
  configure.ac, remove conditional definition of 64-bit types.
2010-07-26 15:00:49 +02:00
Ludovic Courtès
e3401c659e Use GCC's `malloc' attribute for malloc-like routines.
* libguile/__scm.h (SCM_MALLOC): New macro.

* libguile/gc.h (scm_malloc, scm_calloc, scm_strdup, scm_strndup,
  scm_gc_malloc_pointerless, scm_gc_calloc, scm_gc_malloc,
  scm_gc_strdup, scm_gc_strndup): Mark as `SCM_MALLOC'.
2010-05-28 17:02:13 +02:00
Andy Wingo
e8c3777214 less overhead for handling interrupts in the vm
* libguile/__scm.h (SCM_ASYNC_TICK): Add some branch prediction.
  (SCM_ASYNC_TICK_WITH_CODE): New helper for when BUILDING_LIBGUILE,
  runs code only if we're going to call async_click().
* libguile/vm-engine.h (VM_HANDLE_INTERRUPTS): New helper, uses
  SCM_ASYNC_TICK_WITH_CODE to only save regs if we'll handle an
  interrupt.
* libguile/vm-i-system.c (call, goto/args, return): use
  VM_HANDLE_INTERRUPTS.
2009-12-11 11:15:12 +01:00
Ludovic Courtès
114bc68ac9 Don't rely on `HAVE_' macros in public header "tags.h".
* configure.ac: Check for `intptr_t' and `uintptr_t'.  Substitute
  `SCM_I_GSC_T_INTPTR' and `SCM_I_GSC_T_UINPTR'.

* libguile/__scm.h (SCM_T_UINTPTR_MAX, SCM_T_INTPTR_MIN,
  SCM_T_INTPTR_MAX): New macros.

* libguile/_scm.h (SIZEOF_SCM_T_BITS): New macro.

* libguile/gen-scmconfig.c (main): Produce typedefs for `scm_t_intptr'
  and `scm_t_uintptr'.

* libguile/gen-scmconfig.h.in (SCM_I_GSC_T_INTPTR, SCM_I_GSC_T_UINPTR):
  New macros.

* libguile/tags.h: Don't check for `HAVE_INTTYPES_H' and
  `HAVE_STDINT_H'; don't include <inttypes.h> nor <stdint.h>.
  (scm_t_signed_bits, scm_t_bits): Define unconditionally as aliases for
  `scm_t_intptr' and `scm_t_uintptr', respectively.
  (SCM_T_SIGNED_BITS_MAX, SCM_T_SIGNED_BITS_MIN, SCM_T_BITS_MAX):
  Likewise.
  (SIZEOF_SCM_T_BITS): Remove.
2009-11-24 23:12:03 +01:00
Ludovic Courtès
45f1c66749 Remove unused, non-prefixed macros.
* libguile/__scm.h (BIGNUMS, TICKS): Remove.
2009-11-24 22:25:49 +01:00
Ludovic Courtès
56a3dcd431 Remove references to undefined macros.
The intent is to allow compilation with `-Wundef', which in turn should
make it easier to catch erroneous uses of nonexistent macros.

* libguile/__scm.h: Don't assume `BUILDING_LIBGUILE' is defined.

* libguile/conv-uinteger.i.c (SCM_TO_TYPE_PROTO): Remove unneeded CPP
  conditional on `TYPE_MIN == 0'.

* libguile/fports.c: Check for the definition of `HAVE_CHSIZE' and
  `HAVE_FTRUNCATE', not for their value.

* libguile/ports.c: Likewise.

* libguile/numbers.c (guile_ieee_init): Likewise with `HAVE_DINFINITY'
  and `HAVE_DQNAN'.

* test-suite/standalone/test-conversion.c (ieee_init): Likewise.

* libguile/strings.c: Likewise with `SCM_STRING_LENGTH_HISTOGRAM'.

* libguile/strings.h: Likewise.

* libguile/tags.h: Likewise with `HAVE_INTTYPES_H' and `HAVE_STDINT_H'.

* libguile/threads.c: Likewise with `HAVE_PTHREAD_GET_STACKADDR_NP'.

* libguile/vm-engine.c (VM_NAME): Likewise with `VM_CHECK_IP'.

* libguile/gen-scmconfig.c (main): Use "#ifdef HAVE_", not "#if HAVE_".

* libguile/socket.c (scm_setsockopt): Likewise.
2009-11-17 23:42:22 +01:00
Ludovic Courtès
731dd0ce19 Merge branch 'bdw-gc-static-alloc'
Conflicts:
	acinclude.m4
	libguile/__scm.h
	libguile/bdw-gc.h
	libguile/eval.c
2009-11-01 18:17:31 +01:00
Ludovic Courtès
705edb959b Use TLS when available for `SCM_I_CURRENT_THREAD'.
* acinclude.m4 (GUILE_THREAD_LOCAL_STORAGE): New macro.

* configure.ac: Use it.

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

* libguile/gen-scmconfig.c (main): Define `SCM_HAVE_THREAD_STORAGE_CLASS'.

* libguile/gen-scmconfig.h.in (SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS):
  New.

* libguile/threads.c
  (scm_i_current_thread)[SCM_HAVE_THREAD_STORAGE_CLASS]: New.
  (SET_CURRENT_THREAD): New macro.
  (guilify_self_1, on_thread_exit, init_thread_key): Use it.

* libguile/threads.h
  (scm_i_current_thread)[SCM_HAVE_THREAD_STORAGE_CLASS]: New
  declaration.
  (SCM_I_CURRENT_THREAD)[SCM_HAVE_THREAD_STORAGE_CLASS]: New macro.
  (init_thread_key_once, init_thread_key): Conditionalize on
  `!defined SCM_HAVE_THREAD_STORAGE_CLASS'.
  (scm_i_init_thread_for_guile): Update accordingly.
2009-10-09 14:10:05 +02:00
Ludovic Courtès
46935a1fac Arrange so that `SCM_I_CURRENT_THREAD' is not accessed outside of libguile.
* libguile/__scm.h (scm_async_tick): New declaration.
  (SCM_ASYNC_TICK)[!BUILDING_LIBGUILE]: Use `scm_async_tick ()'.

* libguile/async.c (scm_critical_section_start,
  scm_critical_section_end, scm_async_tick): New functions.

* libguile/async.h (scm_i_critical_section_mutex): Made internal.
  (scm_critical_section_start, scm_critical_section_end): New
  declarations.
  (SCM_CRITICAL_SECTION_START,
  SCM_CRITICAL_SECTION_END)[!BUILDING_LIBGUILE]: Use the same-named
  function (lower-case).

* libguile/stackchk.h (SCM_STACK_OVERFLOW_P): Conditionalize on
  `BUILDING_LIBGUILE'.

* libguile/threads.h (SCM_I_CURRENT_THREAD, scm_i_dynwinds,
  scm_i_set_dynwinds, scm_i_last_debug_frame,
  scm_i_set_last_debug_frame): Conditionalize on `BUILDING_LIBGUILE'.
2009-10-09 14:10:03 +02:00
Ludovic Courtès
743b887290 Add `SCM_DEPRECATED' macro to declare deprecated C functions/variables.
* libguile/__scm.h (SCM_DEPRECATED): New macro.
2009-10-02 14:45:11 +02:00
Ludovic Courtès
5f236208d0 Merge branch 'boehm-demers-weiser-gc' into bdw-gc-static-alloc
Conflicts:
	acinclude.m4
	libguile/strings.c
2009-09-02 01:37:37 +02:00
Neil Jerram
a4dbe1ac3d Avoid clash with system setjmp/longjmp on IA64
Problem was that if an application includes both libguile.h and the
system's setjmp.h, and is compiled on IA64, it gets compile errors
because of jmp_buf, setjmp and longjmp being multiply defined.

* libguile/__scm.h (__ia64__): Define scm_i_jmp_buf, SCM_I_SETJMP and
  SCM_I_LONGJMP instead of jmp_buf, setjmp and longjmp.

  (all other platforms): Map scm_i_jmp_buf, SCM_I_SETJMP and
  SCM_I_LONGJMP to jmp_buf, setjmp and longjmp.

* libguile/continuations.c (scm_make_continuation): Use `SCM_I_SETJMP'
  instead of `setjmp'.
  (copy_stack_and_call): Use `SCM_I_LONJMP' instead of `longjmp'.
  (scm_ia64_longjmp): Use type `scm_i_jmp_buf' instead of `jmp_buf'.

* libguile/continuations.h (scm_t_contregs): Use type `scm_i_jmp_buf'
  instead of `jmp_buf'.

* libguile/threads.c (suspend): Use `SCM_I_SETJMP' instead of
  `setjmp'.

* libguile/threads.h (scm_i_thread): Use type `scm_i_jmp_buf' instead
  of `jmp_buf'.

* libguile/throw.c (JBJMPBUF, make_jmpbuf, jmp_buf_and_retval): Use
  type `scm_i_jmp_buf' instead of `jmp_buf'.
  (scm_c_catch): Use `SCM_I_SETJMP' instead of `setjmp'.
  (scm_ithrow): Use `SCM_I_LONGJMP' instead of `longjmp'.
2009-08-21 23:29:08 +01:00
Michael Gran
0193377d24 Avoid accessing symbol internals in call_dsubr_1 and DEVAL
The symbol's characters are only accessed in case they are needed
for an error message.  This can be avoided by passing the symbol
all the way to a error message function.

* libguile/__scm.h (SCM_WTA_DISPATCH_1_SUBR): new macro

* libguile/error.c (scm_i_wrong_type_arg_symbol): new error function

* libguile/error.h: declaration of scm_i_wrong_type_arg_symbol

* libguile/eval.c (call_dsubr_1): use new macro SCM_WTA_DISPATCH_1_SUBR
  to avoid having to unpack the symbol's chars

* libguile/eval.i.c: use new macro SCM_WTA_DISPATCH_1_SUBR
2009-08-20 21:39:56 -07:00
Neil Jerram
53befeb700 Change Guile license to LGPLv3+
(Not quite finished, the following will be done tomorrow.
   module/srfi/*.scm
   module/rnrs/*.scm
   module/scripts/*.scm
   testsuite/*.scm
   guile-readline/*
)
2009-06-17 00:22:09 +01:00
Andy Wingo
442f3f20dd symbols are now hidden unless explicitly exported by SCM_API
* libguile/__scm.h (SCM_API, SCM_INTERNAL): Take the reverse strategy: symbols will
  be hidden by default, and only exported with SCM_API. In addition to working
  on Mac OS, it has the several nice efficiency benefits on Linux, and unifies
  codepaths with Win32.

* libguile/Makefile.am: Define BUILDING_LIBGUILE when building Guile.
2009-05-26 17:46:03 +02:00
Ludovic Courtès
a4167c920a Merge branch 'boehm-demers-weiser-gc' into bdw-gc-static-alloc
Conflicts:
	libguile/procs.h
2009-03-16 18:39:16 +01:00
Ludovic Courtès
e20d7001c3 Remove "compiled closures" ("cclos") in favor of a simpler mechanism.
The idea is to introduce `gsubrs' whose arity is encoded in their type
(more precisely in the sizeof (void *) - 8 MSBs).  This removes the
indirection introduced by cclos and simplifies the code.

* libguile/__scm.h (CCLO): Remove.

* libguile/debug.c (scm_procedure_source, scm_procedure_environment):
  Remove references to `scm_tc7_cclo'.

* libguile/eval.c (scm_trampoline_0, scm_trampoline_1,
  scm_trampoline_2): Replace `scm_tc7_cclo' with `scm_tc7_gsubr'.

* libguile/eval.i.c (CEVAL): Likewise.  No longer make PROC the first
  argument.  Directly invoke `scm_gsubr_apply ()' instead of jump to the
  `evap(N+1)' label or call to `SCM_APPLY ()'.

* libguile/evalext.c (scm_self_evaluating_p): Remove reference to
  `scm_tc7_cclo'.

* libguile/gc-card.c (scm_i_sweep_card, scm_i_tag_name): Likewise.

* libguile/gc-mark.c (scm_gc_mark_dependencies): Likewise.

* libguile/goops.c (scm_class_of): Likewise.

* libguile/print.c (iprin1): Likewise.

* libguile/gsubr.c (create_gsubr): Use `unsigned int's for REQ, OPT and
  RST.  Use `scm_tc7_gsubr' instead of `scm_makcclo ()' in the default
  case.
  (scm_gsubr_apply): Remove calls to `SCM_GSUBR_PROC ()'.
  (scm_f_gsubr_apply): Remove.

* libguile/gsubr.h (SCM_GSUBR_TYPE): New definition.
  (SCM_GSUBR_MAX): Changed to 33.
  (SCM_SET_GSUBR_TYPE, SCM_GSUBR_PROC, SCM_SET_GSUBR_PROC,
  scm_f_gsubr_apply): Remove.

* libguile/procprop.c (scm_i_procedure_arity): Remove reference to
  `scm_tc7_cclo'; add proper handling of `scm_tc7_gsubr'.

* libguile/procs.c (scm_makcclo, scm_make_cclo): Remove.
  (scm_procedure_p): Remove reference to `scm_tc7_cclo'.
  (scm_thunk_p): Likewise, plus add proper `scm_tc7_gsubr' handling.

* libguile/procs.h (SCM_CCLO_LENGTH, SCM_MAKE_CCLO_TAG,
  SCM_SET_CCLO_LENGTH, SCM_CCLO_BASE, SCM_SET_CCLO_BASE, SCM_CCLO_REF,
  SCM_CCLO_SET, SCM_CCLO_SUBR, SCM_SET_CCLO_SUBR, scm_makcclo,
  scm_make_cclo): Remove.

* libguile/stacks.c (read_frames): Remove reference to `scm_f_gsubr_apply'.

* libguile/tags.h (scm_tc7_cclo): Remove.
  (scm_tc7_gsubr): New.
  (scm_tcs_subrs): Add `scm_tc7_gsubr'.
2009-03-02 00:20:43 +01:00
Ludovic Courtès
c6054feaf0 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.
2009-01-14 00:05:23 +01:00
Han-Wen Nienhuys
7ddb9baf80 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.
2008-09-09 23:08:16 -03:00
Ludovic Courtès
3e28462ffb Fix `SCM_INTERNAL' with GCC 4.3. 2008-07-04 22:02:56 +02:00
Ludovic Courtès
102dbb6f6c Add `SCM_INTERNAL' macro, use it. 2008-05-31 23:21:02 +02:00
Neil Jerram
346e4402a4 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.)
2008-05-12 23:24:28 +01:00
Neil Jerram
d3cf93bc25 * srfi-39.scm: Update copyright statement to LGPL.
* __scm.h, _scm.h, weaks.c: Update copyright statement to LGPL.

* compat/compat.h: Update copyright statement to LGPL.

* oldfmt.c: Update copyright statement to LGPL.

* libguile.h: Update copyright statement to LGPL.
2008-01-22 21:06:22 +00:00
Ludovic Courtès
9cc37597af Changes from arch/CVS synchronization 2007-12-08 16:00:56 +00:00
Kevin Ryde
2b829bbb3d merge from 1.8 branch 2006-04-17 00:05:42 +00:00
Marius Vollmer
92205699d0 The FSF has a new address. 2005-05-23 19:57:22 +00:00
Marius Vollmer
9de87eea47 See ChangeLog from 2005-03-02. 2005-03-02 20:42:01 +00:00
Marius Vollmer
76da80e788 Reverted changed from 2005/01/24 19:14:54, which was a commit to the
wrong branch.  Sorry.
2005-01-24 23:41:14 +00:00
Marius Vollmer
a54a94b397 Threading changes. 2005-01-24 19:14:54 +00:00
Kevin Ryde
ed7ba6d12f (SCM_DEFER_INTS, SCM_ALLOW_INTS): Add comments about past
and current usage and migration.
2004-08-02 00:36:49 +00:00
Marius Vollmer
e88d45aa73 * __scm.h (SCM_I_UTYPE_MAX, SCM_I_TYPE_MAX, SCM_I_TYPE_MIN,
SCM_I_SIZE_MAX, SCM_I_SSIZE_MIN, SCM_I_SSIZE_MAX): New.

* __scm.h, gen-scmconfig.c (SCM_I_LLONG_MAX, SCM_I_LLONG_MIN,
SCM_I_ULLONG_MAX, SCM_T_INT8_MIN, SCM_T_INT8_MAX, SCM_T_UINT8_MAX,
SCM_T_INT16_MIN, SCM_T_INT16_MAX, SCM_T_UINT16_MAX,
SCM_T_INT32_MIN, SCM_T_INT32_MAX, SCM_T_UINT32_MAX,
SCM_T_INT64_MIN, SCM_T_INT64_MAX, SCM_T_UINT64_MAX,
SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX, SCM_T_UINTMAX_MAX): Moved
definition into __scm.h, using new SCM_I_TYPE_MIN, etc.
2004-07-29 14:03:40 +00:00
Marius Vollmer
93ccaef0c6 * numbers.h (SCM_MAKINUM, SCM_I_MAKINUM): Renamed SCM_MAKINUM to
SCM_I_MAKINUM and changed all uses.
2004-07-08 15:58:11 +00:00
Marius Vollmer
189b66ba87 (SCM_FENCE): Use __memory_barrier with the Intel compiler on IA64. 2003-09-12 15:42:29 +00:00
Marius Vollmer
570b6821e3 * __scm.h (SCM_C_INLINE_KEYWORD): New.
* numbers.c: Use it in place of SCM_C_INLINE so that the code
compiles when SCM_C_INLINE is undefined.
2003-07-27 13:34:32 +00:00
Dirk Herrmann
59c4bb82e3 * __scm.h: Reformulated the architecture and compiler properties
in terms of properties of scm_t_bits and SCM variables rather than
	in terms of c standard types.  This is since it is not known which
	of the standard types scm_t_bits and SCM variables will be defined
	to.
2003-07-24 06:32:20 +00:00
Han-Wen Nienhuys
aeb4c2e162 (SCM_ASSERT): change "else" expansion to "do { } while (0)" 2003-07-02 23:04:54 +00:00
Han-Wen Nienhuys
4c27f8d23b (SCM_ASRTGO): add "else" to macro expansions with if
clauses.
2003-07-02 16:11:08 +00:00
Dirk Herrmann
d0624e391b * __scm.h, gc-card.c (SCM_DEBUG_DEBUGGER_SUPPORT,
SCM_DEBUG_DEBUGGING_SUPPORT): Renamed macro
	SCM_DEBUG_DEBUGGER_SUPPORT to SCM_DEBUG_DEBUGGING_SUPPORT and
	generalized it to apply not only to C level functions but also to
	scheme level functions.

	* debug.c, debug.h, eval.c (make-iloc, scm_make_iloc, iloc?,
	scm_iloc_p, dbg-make-iloc, scm_dbg_make_iloc, dbg-iloc?,
	scm_dbg_iloc_p): Moved functions scm_make_iloc, scm_iloc_p to
	eval.c, made them available under SCM_DEBUG_DEBUGGING_SUPPORT == 1
	only and renamed them to scm_dbg_make_iloc, scm_dbg_iloc_p,
	respectively.

	* deprecated.h, eval.c, eval.h (SCM_ILOC00, SCM_IDINC,
	SCM_IDSTMSK): Deprecated.  The macro definitions are moved from
	eval.h into eval.c and a copy is placed into deprecated.h.

	* eval.c, eval.h (SCM_MAKE_ILOC): Removed from eval.h and placed
	into eval.c. This definition was not part of the API in any
	officially released version of guile and thus does not need to go
	through a phase of deprecation.
2003-06-04 05:28:34 +00:00
Mikael Djurfeldt
79f55b7c6b * __scm.h (SCM_STACK_PTR): New macro. (Cast argument through
(void *) in order to avoid an aliasing warning; thanks to Bruce
Korb.)

* stackchk.h (SCM_STACK_OVERFLOW_P): Use SCM_STACK_PTR.

* threads.c (suspend, launch_thread, scm_threads_mark_stacks): Use
SCM_STACK_PTR.

* threads.c (scm_threads_mark_stacks): Bugfix: Changed
thread->base --> t->base.

* eval.c (SCM_CEVAL): Don't cast argument of SCM_STACK_OVERFLOW_P.
2003-05-22 09:16:33 +00:00
Dirk Herrmann
94fb5a6e31 * __scm.h (SCM_DEBUG_DEBUGGER_SUPPORT): New compile-time option.
* gc.card.c (scm_gc_marked_p): Fixed compiler warning when
	compiling with SCM_DEBUG==1 by moving definition behind prototype.

	* gc.card.c (scm_dbg_t_list_cell, scm_dbg_t_double_cell,
	scm_dbg_gc_marked_p, scm_dbg_gc_get_card, scm_dbg_gc_get_bvec,
	scm_t_list_cell_struct, scm_t_list_cell, scm_t_double_cell,
	scm_gc_marked_p, scm_gc_get_card, scm_gc_get_bvec): Fixed
	functions such that they check if the object is a non-immediate.
	Further, renamed identifiers to use the scm_dbg_ prefix and made
	their inclusion into the lib dependent of the
	SCM_DEBUG_DEBUGGER_SUPPORT compile time option.
2003-04-21 14:39:37 +00:00