summaryrefslogtreecommitdiff
path: root/libguile/continuations.h
Commit message (Expand)AuthorAgeFilesLines
* Optimize make-stack...* libguile/continuations.h: * libguile/continuations.c (scm_i_continuation_to_frame): Operate on low-level C structures instead of heap objects. * libguile/frames.h: * libguile/frames.c (frame_offset, frame_stack_base): Const args. (scm_c_frame_closure): New helper. (scm_frame_procedure): Use the new helper. * libguile/stacks.c (stack_depth, narrow_stack, scm_make_stack): Rework to avoid allocating frames as we traverse the stack, and to avoid an n**2 case where there are outer cuts. Andy Wingo2014-04-141-2/+5
* One more SCM vm user: continuations....* libguile/continuations.c: * libguile/continuations.h (struct scm_t_contregs): Rename SCM vm member to struct scm_vm *vp. (scm_i_make_continuation): Take vp instead of vm. (scm_i_contregs_vp): Rename from scm_i_contregs_vm, return vp. * libguile/vm-engine.c (continuation-call, call/cc): Fix remaining SCM vm user. * libguile/vm.c (vm_return_to_continuation): Adapt prototype. Andy Wingo2013-11-211-3/+5
* Remove RTL_ infix from macros...* libguile/programs.h (SCM_PROGRAM_P): (SCM_PROGRAM_CODE): (SCM_PROGRAM_FREE_VARIABLES): (SCM_PROGRAM_FREE_VARIABLE_REF): (SCM_PROGRAM_FREE_VARIABLE_SET): (SCM_PROGRAM_NUM_FREE_VARIABLES): (SCM_VALIDATE_PROGRAM): Remove RTL_ infix. * libguile/continuations.c: * libguile/continuations.h: * libguile/control.c: * libguile/foreign.c: * libguile/frames.c: * libguile/gsubr.c: * libguile/gsubr.h: * libguile/procprop.c: * libguile/procs.c: * libguile/programs.c: * libguile/stacks.c: * libguile/vm-engine.c: Adapt. Andy Wingo2013-11-191-1/+1
* VM has "builtins": primitives addressable by emitted RTL code...* libguile/Makefile.am: * libguile/vm-builtins.h: New header, declaring stubs needed by the compiler like values, apply, and abort-to-prompt. * libguile/vm.c: Adapt the apply and values stubs to conform to a standard interface. Add an abort-to-prompt stub. Add call/cc and call-with-values stubs. (scm_vm_builtin_ref): New helper, for the builtin-ref opcode. (scm_vm_builtin_name_to_index) (scm_vm_builtin_index_to_name): New helpers, for the compiler and disassembler, respectively. (scm_init_vm_builtins, scm_bootstrap_vm): Allow the compiler helpers to be loaded later into a module. * module/language/rtl.scm: Export builtin-index->name and builtin-name->index. * libguile/vm-engine.c (RETURN_VALUE_LIST): Update to use new names of "apply" and "values". (tail-call/shuffle): New opcode. (abort): Update to be a tail VM op, and reorder and renumber other ops. (builtin-ref): New opcode. * libguile/continuations.h: * libguile/continuations.c (scm_i_call_with_current_continuation): Move this to vm.[ch], implemented as a builtin. * module/language/tree-il/compile-cps.scm (convert): Convert to 'abort-to-prompt calls, possibly with 'apply, effectively undoing the tree-il transformation. * module/language/cps/reify-primitives.scm (builtin-ref): New helper. (reify-primitives): Convert builtin primitives to builtin-ref. * module/language/cps/dfg.scm (constant-needs-allocation?): * module/language/cps/compile-rtl.scm (emit-rtl-sequence): Add support for compiling builtin-ref. * module/system/vm/disassembler.scm (code-annotation): Add annotation for builtin-ref. Andy Wingo2013-10-271-2/+0
* Continuations are RTL stubs...* libguile/continuations.h: * libguile/continuations.c: Reimplement continuations and the call_cc stub as RTL programs. * libguile/programs.c (scm_i_rtl_program_minimum_arity): Add a case for continuations. * libguile/vm-engine.c (rtl_vm_debug_engine): Always call the abort continuation hook with the number of non-procedure locals. Fix compose-continuation argument count. Enable call/cc. Andy Wingo2013-10-181-2/+2
* the dynamic stack is really a stack now, instead of a list...* libguile/dynstack.h: * libguile/dynstack.c: New files, implementing the dynamic stack as a true stack instead of a linked list. This lowers the cost of dynwinds: frames, winders, prompts, with-fluids, and dynamic-wind. For the most part, we allocate these items directly on the stack. * libguile/dynwinds.h: * libguile/dynwinds.c: Adapt all manipulators of the wind stack to use interfaces from dynstack.c. Remove heap-allocated winder and frame object types. (scm_dowinds, scm_i_dowinds): Remove these. The first was exported, but it was not a public interface. * libguile/continuations.c: * libguile/continuations.h (scm_t_contregs): Continuation objects reference scm_t_dynstack* values now. Adapt to the new interfaces. * libguile/control.c: * libguile/control.h: There is no longer a scm_tc7_prompt kind of object that can be allocated on the heap. Instead, the prompt flags, key, and registers are pushed on the dynwind stack. (The registers are still on the heap.) Also, since the vm_cont will reference the dynwinds, make the partial continuation stub take just one extra arg, instead of storing the intwinds separately in the object table. * libguile/fluids.c: * libguile/fluids.h: No more with-fluids objects; instead, the fluids go on the dynstack. The values still have to be on the heap, though. (scm_prepare_fluids, scm_swap_fluids): New internal functions, replacing scm_i_make_with_fluids and scm_i_swap_with_fluids. * libguile/print.c: Remove prompt and with-fluids printers. * libguile/tags.h: Revert prompt and with-fluids tc7 values to what they were before they were allocated. * libguile/vm-i-system.c (partial_cont_call): Just pop the vmcont, the intwinds will not be passed as a second arg. Rewind the dynamic stack from within the VM, so that any rewinder sees valid prompt entries. (call_cc, tail_call_cc): Adapt to pass the dynstack to scm_i_vm_capture_stack. (prompt, wind, unwind, wind_fluids, unwind_fluids): Adapt to the new interfaces. * libguile/vm.h (scm_i_capture_current_stack): Rename from scm_i_vm_capture_continuation. (scm_i_vm_capture_stack): Take a dynstack as an argument. * libguile/vm.c (vm_reinstate_partial_continuation): Don't wind here, as that could result in winders seeing invalid prompts. * libguile/eval.c: * libguile/root.c: * libguile/stacks.c: * libguile/threads.c: * libguile/threads.h: * libguile/throw.c: Adapt other users of dynwinds to use the dynstack. Andy Wingo2012-03-031-2/+1
* continuations return multiple values on the stack...* libguile/vm.h (struct scm_vm_cont): Instead of saving the "IP", save "RA" and "MVRA". That is, save singly-valued and multiply-valued return addresses, so that we can return multiple values on the stack. (scm_i_vm_reinstate_continuation): Remove. * libguile/vm.c (vm_capture_continuation): Rename from capture_vm_cont, and change the prototype so we can capture the RA and MVRA, and so that tail calls to call/cc can capture a continuation without the call/cc application frame. (vm_return_to_continuation): Rename from reinstate_vm_cont, and take arguments to return to the continuation. Handles returning to single or multiple-value RA. (scm_i_vm_capture_continuation): Change to invoke vm_capture_continuation. Kept around for the benefit of make-stack. * libguile/vm-i-system.c (continuation-call): Handle reinstatement of the VM stack, with arguments. (call/cc, tail-call/cc): Adapt to new vm_capture_continuation prototype. tail-call/cc captures tail continuations. * libguile/stacks.c (scm_make_stack): Update for scm_vm_cont structure change. * libguile/continuations.h (struct scm_contregs): Remove throw_value member, which was used to return a value to a continuation. (scm_i_check_continuation): New internal function, checks that a continuation may be reinstated. (scm_i_reinstate_continuation): Replaces scm_i_continuation_call; just reinstates the C stack. (scm_i_contregs_vm, scm_i_contregs_vm_cont): New internal accessors. * libguile/continuations.c (scm_i_make_continuation): Return SCM_UNDEFINED if we are returning again. (grow_stack, copy_stack_and_call, scm_dynthrow): Remove extra arg, as vm opcodes handle value returns. (copy_stack): No need to instate VM continuation. (scm_i_reinstate_continuation): Adapt. Andy Wingo2010-02-081-2/+6
* scm_i_make_continuation takes vm and vm_cont args explicitly...* libguile/continuations.h: * libguile/continuations.c (scm_i_make_continuation): Take VM and VM continuation arguments as well; I'm not convinced that saving all VM continuations was the right thing, and in any case we only ever saved the latest. Running a new VM should create a continuation barrier. * libguile/stacks.c (scm_make_stack): * libguile/vm-i-system.c (call/cc, tail-call/cc): Adapt callers. * libguile/vm.h (scm_i_vm_capture_continuation) (scm_i_vm_reinstate_continuation): Change to be internal, and to only capture and reinstate continuations for a particular VM. Andy Wingo2010-02-081-2/+3
* make scm_make_continuation internal...* libguile/continuations.h: * libguile/continuations.c (scm_i_make_continuation): Change from scm_make_continuation, and make internal. * libguile/vm-i-system.c (call/cc, tail-call/cc): Adapt callers. * test-suite/standalone/test-unwind.c (check_cont_body): Adapt a test. * doc/ref/api-control.texi (Continuations): Update docs. Andy Wingo2010-02-081-1/+1
* eval.c uses scm_i_call_with_current_continuation...* libguile/continuations.h * libguile/continuations.c (scm_i_call_with_current_continuation): New internal function. Not exported because I'm not sure whether or not this should have a continuation barrier in the future. Uses a hand-coded VM procedure. * libguile/eval.c (eval): Use scm_i_call_with_current_continuation. Andy Wingo2010-02-081-0/+1
* continuations are vm procedures...* libguile/vm-i-system.c (continuation-call): New op, like subr-call or foreign-call, but for continuations. * libguile/continuations.h: Add scm_i_continuation_call internal declaration. (SCM_CONTINUATIONP): Reimplement in terms of SCM_PROGRAM_IS_CONTINUATION. (scm_tc16_continuation, SCM_CONTREGS, SCM_CONTINUATION_LENGTH) (SCM_SET_CONTINUATION_LENGTH, SCM_JMPBUF, SCM_DYNENV, SCM_THROW_VALUE) (SCM_CONTINUATION_ROOT, SCM_DFRAME): Remove these from the exposed API. (scm_i_continuation_to_frame): New internal declaration. * libguile/continuations.c * libguile/continuations.c: Add trickery like in foreign.c, smob.c, and gsubr.c, so that we can make procedural trampolines for continuations. (scm_i_continuation_to_frame): New internal function, from stacks.c. * libguile/programs.h (SCM_F_PROGRAM_IS_CONTINUATION) (SCM_PROGRAM_IS_CONTINUATION): Add a flag for programs that are continuations. Probably should add flags for the other trampoline types too. * libguile/programs.c (scm_i_program_print): Print continuations as before. * libguile/stacks.c (scm_stack_id, scm_make_stack): Use scm_i_continuation_to_frame in the continuation case. Andy Wingo2010-02-081-15/+6
* fix SCM_CELL macro usage in continuations.[ch]...* libguile/continuations.h (SCM_CONTREGS): * libguile/continuations.c (continuation_print): Fix SCM_CELL macro usage. Andy Wingo2009-12-081-1/+1
* remove debug frames...* libguile/debug.h (scm_t_debug_frame): Remove this type, as it was internal to the old evaluator. (SCM_EVALFRAME, SCM_APPLYFRAME, SCM_VOIDFRAME, SCM_MACROEXPF) (SCM_TAILREC, SCM_TRACED_FRAME, SCM_ARGS_READY, SCM_DOVERFLOW) (SCM_MAX_FRAME_SIZE, SCM_FRAMETYPE) (SCM_EVALFRAMEP, SCM_APPLYFRAMEP, SCM_VOIDFRAMEP, SCM_MACROEXPFP) (SCM_TAILRECP, SCM_TRACED_FRAME_P, SCM_ARGS_READY_P, SCM_OVERFLOWP) (SCM_SET_MACROEXP, SCM_SET_TAILREC, SCM_SET_TRACED_FRAME) (SCM_SET_ARGSREADY, SCM_SET_OVERFLOW) (SCM_CLEAR_MACROEXP, SCM_CLEAR_TRACED_FRAME, SCM_CLEAR_ARGSREADY): Remove macro accessors to scm_t_debug_frame. (SCM_DEBUGOBJP, SCM_DEBUGOBJ_FRAME, SCM_SET_DEBUGOBJ_FRAME): (scm_debug_object_p, scm_make_debugobj): Remove debugobj accessors. (scm_i_unmemoize_expr): Remove unused declaration. * libguile/debug.c (scm_debug_options): No more max limit on frame sizes. (scm_start_stack): Just call out to scm_vm_call_with_new_stack. (scm_debug_object_p, scm_make_debugobj, scm_init_debug): No more debugobj smob type. * libguile/deprecated.h: * libguile/deprecated.c (scm_i_deprecated_last_debug_frame) (scm_last_debug_frame): Remove deprecated debug-frame bits. * libguile/stacks.c (scm_make_stack): Rework this function and its dependents to only walk VM frames. (scm_stack_id): Call out to the holder of the VM frame in question, which should be a VM or a VM continuation, for the stack ID. Currently this bit is stubbed out. (scm_last_stack_frame): Removed. It seems this is mainly useful for a debugger, and we need to rewrite the debugger to work on the Scheme level. * test-suite/tests/continuations.test ("continuations"): Remove test for last-stack-frame. * libguile/continuations.h (struct scm_t_contregs): * libguile/continuations.c (scm_make_continuation): (copy_stack_and_call, scm_i_with_continuation_barrier): No need to save and restore debug frames. * libguile/threads.h (scm_i_thread): Don't track debug frames. (scm_i_last_debug_frame, scm_i_set_last_debug_frame): Remove macro accessors. * libguile/threads.c (guilify_self_1): Don't track debug frames. * libguile/throw.c: No need to track debug frames in a jmpbuf. * libguile/vm-engine.c (vm_engine, VM_PUSH_DEBUG_FRAMES): Don't push debug frames. * libguile/vm.h: * libguile/vm.c (scm_vm_call_with_new_stack): New function. Currently stubbed out though. Andy Wingo2009-12-031-6/+1
* 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'. Neil Jerram2009-08-211-1/+1
* 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/* ) Neil Jerram2009-06-171-6/+7
* make call/cc capture and restore the vm stacks...* libguile/continuations.c (scm_make_continuation): Capture VM continuations as well, as their stack is outside the C stack. (copy_stack): Reinstate VM stacks with the C stack. * libguile/continuations.h (scm_t_contregs): Add a pointer for VM stacks. A binary-incompatible change -- hopefully not too many people were messing around with this struct, though. * libguile/vm-engine.c (vm_run): Add a note about possibly maintaining a stack of vms. * libguile/vm.c (struct scm_vm_cont): New struct, distinct from scm_vm. (vm_cont_mark, vm_cont_free, capture_vm_cont, reinstate_vm_cont): Reorder some code, and fix some bad assumptions about what part of the stack to copy; obviously this code was never used. * libguile/vm.h: * libguile/vm.c (scm_vm_capture_continuations) (scm_vm_reinstate_continuations): New public functions, used by continuations.c. Andy Wingo2008-09-241-0/+1
* Add `SCM_INTERNAL' macro, use it.Ludovic Courtès2008-05-311-8/+9
* 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.) Neil Jerram2008-05-121-2/+0
* * configure.in: New check for uca lib (needed for IA64 on HP-UX)....* threads.c (SCM_MARK_BACKING_STORE): Use scm_ia64_ar_bsp() and scm_ia64_register_backing_store_base() instead of Linux-specific implementations. * gc.h (scm_ia64_register_backing_store_base, scm_ia64_ar_bsp): New declarations. * gc.c (__libc_ia64_register_backing_store_base): Declaration removed. (scm_ia64_register_backing_store_base, scm_ia64_ar_bsp): New, with implementations for Linux and HP-UX. * coop-pthreads.c (SCM_MARK_BACKING_STORE): Use scm_ia64_ar_bsp() and scm_ia64_register_backing_store_base() instead of Linux-specific implementations. * continuations.h (__libc_ia64_register_backing_store_base): Declaration removed. (scm_t_contregs): New "fresh" field. * continuations.c (ia64_getcontext): Removed. (scm_make_continuation): Use continuation fresh field instead of interpreting getcontext return values (which isn't portable). Use scm_ia64_ar_bsp() and scm_ia64_register_backing_store_base() instead of Linux-specific implementations. (copy_stack_and_call): Use scm_ia64_register_backing_store_base() instead of Linux-specific implementation. * _scm.h (__ia64__): Also detect __ia64. Neil Jerram2006-10-251-1/+1
* merge from 1.8 branchKevin Ryde2006-04-171-1/+1
* * throw.h (scm_c_catch, scm_c_with_throw_handler,...scm_catch_with_pre_unwind_handler, scm_with_throw_handler): New. * throw.c (SCM_JBPREUNWIND, SCM_SETJBPREUNWIND): New. (struct pre_unwind_data): New, replaces struct lazy_catch. (scm_c_catch): New, replaces scm_internal_catch as the primary catch API for C code; adds pre-unwind handler support. (scm_internal_catch): Now just a wrapper for scm_c_catch, for back compatibility. (tc16_pre_unwind_data, pre_unwind_data_print, make_pre_unwind_data, SCM_PRE_UNWIND_DATA_P): Renamed from "lazy_catch" equivalents. (scm_c_with_throw_handler): New, replaces scm_internal_lazy_catch as the primary C API for a "lazy" catch. (scm_internal_lazy_catch): Now just a wrapper for scm_c_with_throw_handler, for back compatibility. (scm_catch_with_pre_unwind_handler): Renamed from scm_catch; adds pre-unwind handler support. (scm_catch): Now just a wrapper for scm_catch_with_pre_unwind_handler, for back compatibility. (scm_with_throw_handler): New. (scm_lazy_catch): Update comment to say that the handler can return, and what happens if it does. (toggle_pre_unwind_running): New. (scm_ithrow): When identifying the throw target, take running flags into account. In general, change naming of things from "lazy_catch" to "pre_unwind". When throwing to a throw handler, don't unwind the dynamic context first. Add dynwind framing to manage the running flag of a throw handler. If a lazy catch or throw handler returns, rethrow the same exception again. Add pre-unwind support to the normal catch case (SCM_JMPBUFP). * root.c (scm_internal_cwdr): Add NULL args to scm_i_with_continuation_barrier call. * dynwind.c: Change comment mentioning lazy-catch to mention pre-unwind data and throw handler also. * continuations.h (scm_i_with_continuation_barrier): Add pre-unwind handler args. * continuations.c (scm_i_with_continuation_barrier): Add pre-unwind handler args, and pass on to scm_c_catch (changed from scm_internal_catch). (c_handler): Remove scm_handle_by_message_noexit call. (scm_c_with_continuation_barrier): Call scm_i_with_continuation_barrier with scm_handle_by_message_noexit as the pre-unwind handler. (scm_handler): Remove scm_handle_by_message_noexit call. (s_scm_with_continuation_barrier): Call scm_i_with_continuation_barrier with scm_handle_by_message_noexit as the pre-unwind handler. Neil Jerram2006-02-041-1/+3
* The FSF has a new address.Marius Vollmer2005-05-231-1/+1
* See ChangeLog from 2005-03-02.Marius Vollmer2005-03-021-10/+17
* (scm_t_contregs): New 'offset' member for relocating debug frames....(scm_make_continuation): Set it. Marius Vollmer2004-12-231-2/+13
* 2003-06-25 Stefan Jahn <stefan@lkcc.org>... * continuations.c: Redeclaration of getcontext() via the __asm__ ("getcontext") directive. * continuations.h: Include <ucontext.h> instead of <sys/ucontext.h>. Stefan Jahn2003-06-251-1/+1
* * Removed uses of DEBUG_EXTENSIONS and DYNAMIC_LINKING to... fix compile errors with --disable-deprecated. Dirk Herrmann2003-04-201-2/+1
* Changed license terms to the plain LGPL thru-out.Marius Vollmer2003-04-051-35/+11
* 2002-07-24 Stefan Jahn <stefan@lkcc.org>... * continuations.h: ia64: Include <signal.h> before <sys/ucontext.h>. Stefan Jahn2002-07-241-0/+1
* 2002-07-20 Han-Wen <hanwen@cs.uu.nl>...* *.c: add space after commas everywhere. * *.c: use SCM_VECTOR_SET everywhere, where a vector is written. Document cases where SCM_WRITABLE_VELTS() is used. * vectors.h (SCM_VELTS): prepare for write barrier, and let SCM_VELTS() return a const pointer (SCM_VECTOR_SET): add macro. * autogen.sh (mscripts): find and check version number of autoconf. Complain if 2.53 is not found. Han-Wen Nienhuys2002-07-201-1/+1
* * __scm.h, alist.h, arbiters.h, async.h, backtrace.h, boolean.h,...chars.h, continuations.h, coop-defs.h, coop-threads.h, debug-malloc.h, debug.h, deprecation.h, dynl.h, dynwind.h, environments.h, eq.h, error.h, eval.h, evalext.h, extensions.h, feature.h, filesys.h, fluids.h, fports.h, gc.h, gdb_interface.h, gdbint.h, gh.h, goops.h, gsubr.h, guardians.h, hash.h, hashtab.h, hooks.h, init.h, ioext.h, iselect.h, keywords.h, lang.h, list.h, load.h, macros.h, mallocs.h, modules.h, net_db.h, numbers.h, objects.h, objprop.h, options.h, pairs.h, ports.h, posix.h, print.h, procprop.h, procs.h, properties.h, ramap.h, random.h, rdelim.h, read.h, regex-posix.h, root.h, rw.h, scmsigs.h, script.h, simpos.h, smob.h, socket.h, sort.h, srcprop.h, stackchk.h, stacks.h, stime.h, strings.h, strop.h, strorder.h, strports.h, struct.h, symbols.h, tags.h, threads.h, throw.h, unif.h, values.h, variable.h, vectors.h, vports.h, weaks.h: Prefixed each each exported symbol with SCM_API. * continuations.c: Added comment about the use of the extern declarations of {get,set}context() functions used in the ia64 port. * continuations.h, gc.c: `__libc_ia64_register_backing_store_base' is meant to be a `unsigned long *'. Marius Vollmer2001-11-021-5/+5
* * continuations.h: support ia64 register backing store....(struct scm_t_contregs): add ia64 register backing store. Rob Browning2001-10-091-0/+9
* * continuations.h, unif.h: in the descriptions of the bit patterns... of the heap cells, make bit 0 the least significant. Gary Houston2001-10-031-2/+2
* * Remove deprecated macros and typenames....* Rename header macros to SCM_<filename>_H. * Prefer !SCM_<foo> over SCM_N<foo>. Dirk Herrmann2001-08-311-11/+10
* * alist.c, arbiters.c, async.h, backtrace.h, boolean.c, chars.c,... chars.h, continuations.h, debug-malloc.h, dynl.c, feature.c, feature.h, filesys.h, fluids.h, fports.h, gc_os_dep.c, gdb_interface.h, gh_eval.c, gh_funcs.c, gh_io.c, gh_list.c, gh_predicates.c, gsubr.c, gsubr.h, guardians.h, guile-func-name-check.in, guile-snarf-docs-texi.in, guile-snarf-docs.in, guile-snarf.awk.in, guile-snarf.in, hashtab.h, iselect.h, keywords.h, lang.c, list.h, load.h, objprop.c, objprop.h, options.c, options.h, random.h, regex-posix.h, root.c, root.h, script.c, snarf.h, stackchk.c, strerror.c, strop.h, strports.h, threads.h, values.c, values.h, version.c, version.h: Updated copyright notice. Martin Grabmüller2001-07-191-1/+1
* replace "scm_*_t" with "scm_t_*".Marius Vollmer2001-06-141-6/+6
* revert the ill-considered part of the 2001-05-24 changesMichael Livshin2001-05-261-2/+2
* * validate.h...(SCM_NUM2{SIZE,PTRDIFF,SHORT,USHORT,BITS,UBITS,INT,UINT}[_DEF]): new macros. * unif.h: type renaming: scm_array -> scm_array_t scm_array_dim -> scm_array_dim_t the old names are deprecated, all in-Guile uses changed. * tags.h (scm_ubits_t): new typedef, representing unsigned scm_bits_t. * stacks.h: type renaming: scm_info_frame -> scm_info_frame_t scm_stack -> scm_stack_t the old names are deprecated, all in-Guile uses changed. * srcprop.h: type renaming: scm_srcprops -> scm_srcprops_t scm_srcprops_chunk -> scm_srcprops_chunk_t the old names are deprecated, all in-Guile uses changed. * gsubr.c, procs.c, print.c, ports.c, read.c, rdelim.c, ramap.c, rw.c, smob.c, sort.c, srcprop.c, stacks.c, strings.c, strop.c, strorder.c, strports.c, struct.c, symbols.c, unif.c, values.c, vectors.c, vports.c, weaks.c: various int/size_t -> size_t/scm_bits_t changes. * random.h: type renaming: scm_rstate -> scm_rstate_t scm_rng -> scm_rng_t scm_i_rstate -> scm_i_rstate_t the old names are deprecated, all in-Guile uses changed. * procs.h: type renaming: scm_subr_entry -> scm_subr_entry_t the old name is deprecated, all in-Guile uses changed. * options.h (scm_option_t.val): unsigned long -> scm_bits_t. type renaming: scm_option -> scm_option_t the old name is deprecated, all in-Guile uses changed. * objects.c: various long -> scm_bits_t changes. (scm_i_make_class_object): flags: unsigned long -> scm_ubits_t * numbers.h (SCM_FIXNUM_BIT): deprecated, renamed to SCM_I_FIXNUM_BIT. * num2integral.i.c: new file, multiply included by numbers.c, used to "templatize" the various integral <-> num conversion routines. * numbers.c (scm_mkbig, scm_big2num, scm_adjbig, scm_normbig, scm_copybig, scm_2ulong2big, scm_dbl2big, scm_big2dbl): deprecated. (scm_i_mkbig, scm_i_big2inum, scm_i_adjbig, scm_i_normbig, scm_i_copybig, scm_i_short2big, scm_i_ushort2big, scm_i_int2big, scm_i_uint2big, scm_i_long2big, scm_i_ulong2big, scm_i_bits2big, scm_i_ubits2big, scm_i_size2big, scm_i_ptrdiff2big, scm_i_long_long2big, scm_i_ulong_long2big, scm_i_dbl2big, scm_i_big2dbl, scm_short2num, scm_ushort2num, scm_int2num, scm_uint2num, scm_bits2num, scm_ubits2num, scm_size2num, scm_ptrdiff2num, scm_num2short, scm_num2ushort, scm_num2int, scm_num2uint, scm_num2bits, scm_num2ubits, scm_num2ptrdiff, scm_num2size): new functions. * modules.c (scm_module_reverse_lookup): i, n: int -> scm_bits_t.x * load.c: change int -> size_t in various places (where the variable is used to store a string length). (search-path): call scm_done_free, not scm_done_malloc. * list.c (scm_ilength): return a scm_bits_t, not long. some other {int,long} -> scm_bits_t changes. * hashtab.c: various [u]int -> scm_bits_t changes. scm_ihashx_closure -> scm_ihashx_closure_t (and made a typedef). (scm_ihashx): n: uint -> scm_bits_t use scm_bits2num instead of scm_ulong2num. * gsubr.c: various int -> scm_bits_t changes. * gh_data.c (gh_scm2double): no loss of precision any more. * gh.h (gh_str2scm): len: int -> size_t (gh_{get,set}_substr): start: int -> scm_bits_t, len: int -> size_t (gh_<num>2scm): n: int -> scm_bits_t (gh_*vector_length): return scm_[u]size_t, not unsigned long. (gh_length): return scm_bits_t, not unsigned long. * fports.h: type renaming: scm_fport -> scm_fport_t the old name is deprecated, all in-Guile uses changed. * fports.c (fport_fill_input): count: int -> scm_bits_t (fport_flush): init_size, remaining, count: int -> scm_bits_t * debug.h (scm_lookup_cstr, scm_lookup_soft, scm_evstr): removed those prototypes, as the functions they prototype don't exist. * fports.c (default_buffer_size): int -> size_t (scm_fport_buffer_add): read_size, write_size: int -> scm_bits_t default_size: int -> size_t (scm_setvbuf): csize: int -> scm_bits_t * fluids.c (n_fluids): int -> scm_bits_t (grow_fluids): old_length, i: int -> scm_bits_t (next_fluid_num, scm_fluid_ref, scm_fluid_set_x): n: int -> scm_bits_t (scm_c_with_fluids): flen, vlen: int -> scm_bits_t * filesys.c (s_scm_open_fdes): changed calls to SCM_NUM2LONG to the new and shiny SCM_NUM2INT. * extensions.c: extension -> extension_t (and made a typedef). * eval.h (SCM_IFRAME): cast to scm_bits_t, not int. just so there are no nasty surprises if/when the various deeply magic tag bits move somewhere else. * eval.c: changed the locals used to store results of SCM_IFRAME, scm_ilength and such to be of type scm_bits_t (and not int/long). (iqq): depth, edepth: int -> scm_bits_t (scm_eval_stack): int -> scm_bits_t (SCM_CEVAL): various vars are not scm_bits_t instead of int. (check_map_args, scm_map, scm_for_each): len: long -> scm_bits_t i: int -> scm_bits_t * environments.c: changed the many calls to scm_ulong2num to scm_ubits2num. (import_environment_fold): proc_as_ul: ulong -> scm_ubits_t * dynwind.c (scm_dowinds): delta: long -> scm_bits_t * debug.h: type renaming: scm_debug_info -> scm_debug_info_t scm_debug_frame -> scm_debug_frame_t the old names are deprecated, all in-Guile uses changed. (scm_debug_eframe_size): int -> scm_bits_t * debug.c (scm_init_debug): use scm_c_define instead of the deprecated scm_define. * continuations.h: type renaming: scm_contregs -> scm_contregs_t the old name is deprecated, all in-Guile uses changed. (scm_contregs_t.num_stack_items): size_t -> scm_bits_t (scm_contregs_t.num_stack_items): ulong -> scm_ubits_t * continuations.c (scm_make_continuation): change the type of stack_size form long to scm_bits_t. * ports.h: type renaming: scm_port_rw_active -> scm_port_rw_active_t (and made a typedef) scm_port -> scm_port_t scm_ptob_descriptor -> scm_ptob_descriptor_t the old names are deprecated, all in-Guile uses changed. (scm_port_t.entry): int -> scm_bits_t. (scm_port_t.line_number): int -> long. (scm_port_t.putback_buf_size): int -> size_t. * __scm.h (long_long, ulong_long): deprecated (they pollute the global namespace and have little value besides that). (SCM_BITS_LENGTH): new, is the bit size of scm_bits_t (i.e. of an SCM handle). (ifdef spaghetti): include sys/types.h and sys/stdtypes.h, if they exist (for size_t & ptrdiff_t) (scm_sizet): deprecated. * Makefile.am (noinst_HEADERS): add num2integral.i.c Michael Livshin2001-05-241-6/+10
* * continuations.h (SCM_SETJMPBUF): deprecation expired - removed.Rob Browning2001-04-271-8/+0
* Smob-related creanup.Keisuke Nishida2000-12-081-2/+1
* * use an applicable SMOB to represent continuations, instead of a... custom tc7 type. This will make it easier to support R5RS multiple value continuations, without the use of a Scheme-level wrapper. * continuations.c (scm_tc16_continuation, continuation_mark, continuation_free, continuation_print, continuation_apply): new SMOB support. (scm_make_continuation): new procedure, replaces scm_make_cont with a different interface. (copy_stack_and_call, scm_dynthrow, scm_init_continuations): rewritten. (CHEAP_CONTINUATIONS): removed non-working code completely. (scm_call_continuation): removed. * continuations.h (struct scm_contregs): add num_stack_items and stack fields. previously stack was stored following this struct: use a tail array instead. (SCM_CONTINUATIONP): new macro. (SCM_CONTINUATION_LENGTH, SCM_SET_CONTINUATION_LENGTH): rewritten. (SCM_SET_CONTREGS): removed. * tags.h: removed scm_tc7_contin (was tag 61). * debug.c, gc.c, hash.c, print.c, procprop.c, procs.c: removed scm_tc7_contin support. * eval.c: use scm_make_continuation instead of scm_make_cont. don't set jump buffers here. remove scm_tc7_contin support. * init.c, root.c: create SMOB continuation for rootcont instead of scm_tc7_contin. call scm_init_continuations before scm_init_root. * root.c: remove support for static jmpbuf. It's not used by default and I broke it. create SMOB continuation for rootcont. * stacks.c: use SCM_CONTINUATIONP. Gary Houston2000-11-251-8/+23
* * Added SCM_SET_CONTINUATION_LENGTH to replace SCM_SETLENGTH.Dirk Herrmann2000-11-221-0/+1
* * Added type-specific replacement macros for SCM_LENGTH.Dirk Herrmann2000-10-061-0/+1
* Updated copyrightsMikael Djurfeldt2000-06-121-1/+1
* * Wrapped deprecated code between #if (SCM_DEBUG_DEPRECATED == 0) #endif....* Replace use of deprecated macros SCM_INPORTP, SCM_OUTPORTP, SCM_ICHRP. Dirk Herrmann2000-05-151-1/+8
* * Made scm_dynthrow static....* Simplified and optimized the continuation calling code. Dirk Herrmann2000-04-131-1/+0
* Cleaned up continuation data access.Dirk Herrmann2000-03-281-7/+11
* * continuations.h (SCM_SETJMPBUF): Cast second arg into SCM.Mikael Djurfeldt2000-03-231-1/+1
* * *.[hc]: add Emacs magic at the end of file, to ensure GNU... indentation style. Michael Livshin2000-03-191-0/+6
* * list.c: Moved append docs to append! Thanks Dirk Hermann. Also,...added append docs from R4RS. * strings.c: Docstring typo fix, + eliminate unneeded IMP tests. Thanks Dirk Hermann! * chars.h: Provide SCM_CHARP, SCM_CHAR, SCM_MAKE_CHAR and deprecate SCM_ICHRP, SCM_ICHR, SCM_MAKICHR. Thanks Dirk Hermann! * *.h, *.c: Use SCM_CHARP, SCM_CHAR, SCM_MAKE_CHAR throughout. Drop use of SCM_P for function prototypes... assume an ANSI C compiler. Thanks Dirk Hermann! Greg J. Badros2000-03-021-4/+4
* * Lots of files: New address for FSF.Jim Blandy1997-05-261-3/+3