summaryrefslogtreecommitdiff
path: root/libguile/fluids.h
AgeCommit message (Collapse)AuthorFilesLines
2012-03-03the dynamic stack is really a stack now, instead of a listAndy Wingo1-15/+4
* 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.
2011-12-01Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-1/+3
Conflicts: configure.ac libguile/fluids.c libguile/gc.c libguile/gc.h libguile/objcodes.c libguile/procprop.c libguile/vm.c module/ice-9/psyntax-pp.scm module/ice-9/psyntax.scm
2011-11-23optional default-value arg to make-fluidAndy Wingo1-2/+4
* libguile/fluids.c (grow_dynamic_state, new_fluid): Arrange for the default value in the dynamic-state vector to be SCM_UNDEFINED instead of SCM_BOOL_F. If the value in the dynamic-state is #f, default to a value attached to the fluid instead. This allows useful default values. (scm_make_fluid_with_default): New function, allows the user to specify a default value for the fluid. Defaults to #f. Bound to `make-fluid' on the Scheme side. (scm_make_unbound_fluid): Use SCM_UNDEFINED as the default in all threads. (scm_fluid_unset_x): Also unset the default value. Not sure if this is the right thing. (fluid_ref): Update to the new default-value strategy. * libguile/threads.c (scm_i_reset_fluid): Reset to SCM_UNDEFINED. * libguile/threads.h: Remove extra arg to scm_i_reset_fluid. * libguile/vm-i-system.c (fluid-ref): Update to new default-value strategy. * module/ice-9/vlist.scm (block-growth-factor): Default to 2 in all threads. Fixes http://debbugs.gnu.org/10093.
2011-10-24refactor tc7 and tc16 checksAndy Wingo1-4/+4
* libguile/tags.h (SCM_HAS_TYP7, SCM_HAS_TYP7S, SCM_HAS_TYP16): New macros. * libguile/bytevectors.h (SCM_BYTEVECTOR_P): * libguile/control.h (SCM_PROMPT_P): * libguile/filesys.h (SCM_DIRP): * libguile/fluids.h (SCM_WITH_FLUIDS_P, SCM_FLUID_P) (SCM_I_DYNAMIC_STATE_P): * libguile/foreign.h (SCM_POINTER_P): * libguile/fports.h (SCM_FPORTP): * libguile/frames.h (SCM_VM_FRAME_P): * libguile/hashtab.h (SCM_HASHTABLE_P): * libguile/inline.h (scm_get_byte_or_eof): * libguile/numbers.h (SCM_REALP, SCM_BIGP, SCM_COMPLEXP, SCM_FRACTIONP): * libguile/objcodes.h (SCM_OBJCODE_P): * libguile/ports.h (SCM_OUTPUT_PORT_P): * libguile/programs.h (SCM_PROGRAM_P): * libguile/smob.h (SCM_SMOB_PREDICATE): * libguile/srfi-14.h (SCM_CHARSETP): * libguile/strings.c (IS_STRING): * libguile/strports.h (SCM_STRPORTP): * libguile/symbols.h (scm_is_symbol): * libguile/variable.h (SCM_VARIABLEP): * libguile/vectors.h (SCM_I_IS_VECTOR, SCM_I_IS_NONWEAK_VECTOR): * libguile/vm-i-system.c (call, tail-call, mv-call) * libguile/vm.h (SCM_VM_P, SCM_VM_CONT_P): * libguile/weak-set.c (SCM_WEAK_SET_P): * libguile/weak-table.c (SCM_WEAK_TABLE_P): * libguile/weak-vector.h (SCM_I_WVECTP): Use them.
2010-12-17rename make-undefined-fluid to make-unbound-fluidAndy Wingo1-1/+1
* libguile/fluids.c (scm_make_unbound_fluid): Rename from scm_make_undefined_fluid. * libguile/fluids.h: * module/language/elisp/runtime.scm: Update referrers.
2010-12-07unbound fluidsBrian Templeton1-0/+3
* libguile/fluids.c (scm_make_undefined_fluid, scm_fluid_unset_x) (scm_fluid_bound_p): New functions. (fluid_ref): New function; like scm_fluid_ref, but will not throw an error for unbound fluids. (scm_fluid_ref, swap_fluid): Use `fluid_ref'. * libguile/fluids.h (scm_make_undefined_fluid, scm_fluid_unset_x) (scm_fluid_bound_p): New prototypes. * libguile/vm-i-system.c (fluid_ref): If fluid is unbound, jump to `vm_error_unbound_fluid'. * libguile/vm-engine.c (VM_NAME)[vm_error_unbound_fluid]: New error message. * test-suite/tests/fluids.test ("unbound fluids")["fluid-ref of unbound fluid", "fluid-bound? of bound fluid", "fluid-bound? of unbound fluid", "unbound fluids can be set", "bound fluids can be unset"]: New tests.
2010-07-17SCM_I_FLUID_P -> SCM_FLUID_PAndy Wingo1-1/+5
* libguile/fluids.h (SCM_FLUID_P): Change from SCM_I_FLUID_P. (SCM_I_FLUID_NUM, SCM_I_DYNAMIC_STATE_P, SCM_I_DYNAMIC_STATE_FLUIDS): Wrap in BUILDING_LIBGUILE ifdef.
2010-03-04add printers for prompts and with-fluids objectsAndy Wingo1-0/+1
* libguile/control.c: * libguile/control.h (scm_i_prompt_print): * libguile/fluids.c: * libguile/fluids.h (scm_i_with_fluids_print): * libguile/print.c (iprin1): Add printers for prompts and with-fluids objects.
2010-02-19fluids.h exposes more of its interface, internally at leastAndy Wingo1-7/+5
* libguile/fluids.h (SCM_I_FLUID_P, SCM_I_FLUID_NUM) (SCM_I_DYNAMIC_STATE_P, SCM_I_DYNAMIC_STATE_FLUIDS): Expose these predicates and accessors, internally at least. * libguile/fluids.c (IS_FLUID, FLUID_NUM, IS_DYNAMIC_STATE) (DYNAMIC_STATE_FLUIDS): Implement in terms of the exposed macros.
2010-02-18add with-fluids objects and primitive syntaxAndy Wingo1-1/+16
* libguile/tags.h (scm_tc7_with_fluids): Allocate a tc7 for "with-fluids" objects, which will only live on the dynamic stack (wind list), not in normal scheme-land. * libguile/fluids.h (SCM_WITH_FLUIDS_P, SCM_WITH_FLUIDS_LEN) (SCM_WITH_FLUIDS_NTH_FLUID, SCM_WITH_FLUIDS_NTH_VAL) (SCM_WITH_FLUIDS_SET_NTH_VAL): Add some accessors. * libguile/fluids.c (scm_i_make_with_fluids, scm_i_swap_with_fluids): New internal functions. (scm_c_with_fluids, scm_c_with_fluid): Push with-fluids objects on the dynwind list, not winders. * libguile/dynwind.c (scm_i_dowinds): Add cases for winding and unwinding with-fluids objects. * libguile/memoize.h (scm_sym_with_fluids, SCM_M_BEGIN): New public data. * libguile/memoize.c (scm_m_with_fluids): Define with-fluids as a primitive syntax. (unmemoize): Add with-fluids case. * libguile/eval.c (eval): * module/ice-9/eval.scm (primitive-eval): Add with-fluids cases. * test-suite/tests/fluids.test ("fluids not modified if nonfluid passed to with-fluids"): Enable a now-passing test.
2009-12-05add printer for dynamic-statesAndy Wingo1-0/+1
* libguile/fluids.c: * libguile/fluids.h: * libguile/print.c: Add dynamic-state printing infrastructure.
2009-12-05fluids are tc7 objectsAndy Wingo1-14/+13
If you're wondering what I'm doing, I'm trying to eventually reimplement smobs in terms of structs, so that applicable smobs can just follow the applicable struct dispatch path. But to do that I have to get structs initialized before things that use smobs, which means transforming a bunch of smobby things to tc7 things. But this transformation is good for performance anyway, and we currently have a glut of unused tc7s, so here we go... * libguile/tags.h (scm_tc7_fluid, scm_tc7_dynamic_state): Fluids (and dynamic states) now have tc7s. * libguile/fluids.h: Remove scm_fluids_prehistory, and add internal scm_i_fluid_print. Update a comment. * libguile/fluids.c: Update for tc7 representation. Also remove the next pointers while we're at it, as they aren't used in the new BDW GC. * libguile/eq.c (scm_equal_p): Remove the hashtable case. Hashtables could never be equal? before, I don't see why to add stubs doing the same thing now. * libguile/print.c (iprin1): * libguile/gc.c (scm_i_tag_name): * libguile/evalext.c (scm_self_evaluating_p): Add fluid and dynamic_state cases. * libguile/goops.h: Remove scm_class_hashtable; it will be static. * libguile/goops.c: Make <hashtable> static, and add <fluid> and <dynamic-state> classes. * libguile/hashtab.h: * libguile/hashtab.c: Remove scm_i_hashtable_equal_p. * libguile/init.c (scm_i_init_guile): Remove call to fluids_prehistory.
2009-08-18Merge branch 'master' into boehm-demers-weiser-gcLudovic Courtès1-6/+7
Conflicts: lib/Makefile.am libguile/Makefile.am libguile/frames.c libguile/gc-card.c libguile/gc-freelist.c libguile/gc-mark.c libguile/gc-segment.c libguile/gc_os_dep.c libguile/load.c libguile/macros.c libguile/objcodes.c libguile/programs.c libguile/strings.c libguile/vm.c m4/gnulib-cache.m4 m4/gnulib-comp.m4 m4/inline.m4
2009-06-17Change Guile license to LGPLv3+Neil Jerram1-6/+7
(Not quite finished, the following will be done tomorrow. module/srfi/*.scm module/rnrs/*.scm module/scripts/*.scm testsuite/*.scm guile-readline/* )
2008-09-17Remove GC-related code from fluids.Ludovic Courtès1-7/+0
* libguile/fluids.c (all_dynamic_states, all_fluids): Remove. Together, they prevented dynamic states and fluids to be collected. Callers no longer use them. (resize_all_states): Remove. (grow_dynamic_state): New function. (next_fluid_num): Don't call `resize_all_states ()'. (scm_i_fluid_num, scm_i_fast_fluid_ref, scm_i_fast_fluid_set_x): Remove, as they broke encapsulation and would have needed duplication of the lazy dynamic state growing code. (scm_fluid_ref, scm_fluid_set_x): Lazily grow the dynamic state's fluid vector. (scm_fluids_prehistory): Don't set an `scm_after_sweep_c_hook'. * libguile/fluids.h (SCM_FLUID_NUM, SCM_FAST_FLUID_REF, SCM_FAST_FLUID_SET_X, scm_i_fluid_num, scm_i_fast_fluid_set_x, scm_i_fast_fluid_ref): Remove. * libguile/load.c (the_reader_fluid_num): Remove. (scm_primitive_load): Use `scm_fluid_ref ()' instead of `SCM_FAST_FLUID_REF ()'. (scm_init_load): Likewise.
2008-05-31Add `SCM_INTERNAL' macro, use it.Ludovic Courtès1-4/+4
2006-04-17merge from 1.8 branchKevin Ryde1-1/+1
2006-01-29Renamed the "frames" that are related to dynamic-wind to "dynamicMarius Vollmer1-2/+2
contexts. Renamed all functions from scm_frame_ to scm_dynwind_. Updated documentation.
2005-05-23The FSF has a new address.Marius Vollmer1-1/+1
2005-03-02See ChangeLog from 2005-03-02.Marius Vollmer1-30/+33
2004-05-06Use SCM_SMOB_* instead of SCM_CELL_* as appropriate. UseMarius Vollmer1-1/+1
SCM_SMOB_FLAGS and SCM_SET_SMOB_FLAGS instead of accessing the zeroth word directly. Use SCM_SMOB_PREDICATE as appropriate.
2004-01-07* fluids.c (scm_c_with_fluids): Use frames instead of adding toMarius Vollmer1-2/+1
the wind chain explicitely. Use scm_c_with_fluid for the common case of only one fluid. (scm_with_fluid): New. (scm_c_with_fluid): Use frames instead of scm_c_with_fluids. * fluids.h, fluids.c (scm_frame_fluid): New. (scm_with_fluid): New. (scm_i_swap_fluids, scm_i_swap_fluids_reverse): Removed.
2004-01-07(scm_frame_fluid): New.Marius Vollmer1-0/+2
2004-01-06(scm_make_initial_fluids, scm_copy_fluids, scm_swap_fluids,Marius Vollmer1-4/+4
scm_swap_fluids_reverse): Renamed to scm_i_... since they are internal. Changed all uses.
2003-04-05Changed license terms to the plain LGPL thru-out.Marius Vollmer1-35/+11
2001-11-02Prefixed each each exported symbol with SCM_API.Marius Vollmer1-15/+15
2001-08-31* Removed deprecated stuff.Dirk Herrmann1-15/+8
* Some more renamings to SCM_<filename>_H.
2001-07-19 * alist.c, arbiters.c, async.h, backtrace.h, boolean.c, chars.c,Martin Grabmüller1-1/+1
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.
2001-07-09Remove "face-lift" comment.Thien-Thi Nguyen1-2/+0
2001-06-14replace "scm_*_t" with "scm_t_*".Marius Vollmer1-1/+1
2001-05-19(scm_internal_with_fluids): Deprecated.Marius Vollmer1-2/+12
(scm_c_with_fluids): Renamed from scm_internal_with_fluids. (scm_c_with_fluid): New. (scm_with_fluids): Use scm_c_with_fluids instead of scm_internal_with_fluids.
2000-12-08Smob-related creanup.Keisuke Nishida1-1/+1
2000-06-12Updated copyrightsMikael Djurfeldt1-1/+1
2000-05-25* Replace SCM_UNPACK_CAR appropriately.Dirk Herrmann1-2/+2
* Only access cons cells via SCM_{SET}?C[AD]R. * gc.c: Remove unused struct member variable 'valid'.
2000-03-19 * *.[hc]: add Emacs magic at the end of file, to ensure GNUMichael Livshin1-0/+6
indentation style.
2000-03-12*** empty log message ***Mikael Djurfeldt1-2/+2
2000-03-12* async.c, boolean.h, debug.c, dynl.c, dynwind.c, eval.c, eval.h,Mikael Djurfeldt1-2/+2
feature.h, filesys.h, fluids.h, fports.c, fports.h, gc.c, gc.h, hash.c, keywords.h, macros.c, numbers.c, numbers.h, objects.c, objects.h, options.c, pairs.h, ports.c, ports.h, print.c, procs.h, ramap.c, read.c, smob.c, smob.h, srcprop.h, stacks.c, stacks.h, strports.c, struct.c, struct.h, tag.c, tags.h, throw.c, unif.c, unif.h, variable.h, vectors.h, weaks.c, weaks.h (SCM_SCM, SCM_BITS, SCM_CARBITS): Renamed from SCM_ASSCM, SCM_ASWORD, SCM_CARW).
2000-03-09*.[ch]: make a distinction between SCM as a genericGreg J. Badros1-2/+2
name for a Scheme object (now a void*), and SCM as 32 bit word for storing tags and immediates (now a long int). Introduced SCM_ASWORD and SCM_ASSCM for conversion. Fixed various dubious code in the process: arbiter.c (use macros), unif.c (scm_array_p),
2000-03-02* list.c: Moved append docs to append! Thanks Dirk Hermann. Also,Greg J. Badros1-12/+12
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!
1999-12-16* *.h: Use SCM_NIMP(X) && in all the FOOP macros.Greg J. Badros1-1/+4
* *.[ch]: Use do { ... } while (0) idiom in macros that expanded to a bare block.
1998-09-30Warning fixes from Maciej Stachowiak:Jim Blandy1-0/+1
* backtrace.h (scm_display_application, scm_backtrace): Add prototypes. * debug.c (scm_m_start_stack): Make this function static. * fluids.h (scm_fluid_p): Add prototype. * procprop.c (scm_i_procedure_arity): Make this function static. * regex-posix.c (scm_regexp_error_msg): Make this function static. * regex-posix.h (scm_init_regex_posix): Use prototype, not K&R decl. * root.h (scm_dynamic_root): Add external prototype. * scmsigs.h (scm_usleep): Add external prototype. * script.h (scm_init_script): Use prototype, not K&R decl. * stacks.h (scm_stack_id): Add external prototype. * symbols.h (scm_sysintern0_no_module_lookup): Add external prototype.
1997-07-26* dynwind.c (scm_dowinds): Handle fluids on the wind list.Marius Vollmer1-4/+10
* fluids.h (scm_internal_with_fluids, scm_with_fluids, scm_swap_fluids, scm_swap_fluids_reverse): New prototypes. * fluids.c (scm_internal_with_fluids, scm_with_fluids, scm_swap_fluids, scm_swap_fluids_reverse): New functions.
1997-07-18*** empty log message ***Marius Vollmer1-0/+99