scm_m_atslot_set_x, scm_m_atdispatch): Move the declarations and
definitions of the special goops memoizers from goops.[ch] to
eval.[ch]. Hmm... it seems that scm_m_atdispatch is not used
throughout guile.
minor stylistic ones. Still, in order to prepare a patch between
my local copy and the CVS version, I decided to submit the changes
below. Then, the patch will hopefully only contain relevant
modifications :-)
* eval.c (iqq): Added const specifier.
* eval.c (scm_trampoline_0, scm_trampoline_1, scm_trampoline_2):
Use NULL instead of 0 to indicate that a pointer is returned.
Removed some misleading 'fall through' comments.
* eval.c (scm_i_call_closure_0, call_closure_1, call_closure_2):
Split up long expressions into smaller ones to be more debugging
friendly.
scm_m_generalized_set_x, scm_init_evalext): Move the declaration
and definition of the memoizer for the generalized set! macro from
evalext.[ch] to eval.[ch]. Use the SCM_SYNTAX snarfer macro to
define the macro object.
* eval.c, eval.h (s_set_x, scm_s_set_x, scm_m_set_x,
scm_m_generalized_set_x): Since now scm_s_set_x is only used in
eval.c, it is made static and renamed to s_set_x.
* evalext.c (scm_defined_p, scm_m_undefine): Prefer !SCM_<foo>
over SCM_N<foo>.
scm_init_eval): Made scm_undefineds static in eval.c, renamed it
to undefineds and registered the object as a permanent object.
* eval.c, eval.h (scm_f_apply, scm_init_eval): Made scm_f_apply
static in eval.c, renamed it to f_apply and registered the object
as a permanent object.
"libguile/__scm.h" rather than scmconfig.h. Rename usage of
HAVE_ARRAYS to SCM_HAVE_ARRAYS. Replace usage of HAVE_LONG_LONGS
with "SCM_SIZEOF_LONG_LONG != 0".
Simply lock a thread C API recursive mutex.
(SCM_NONREC_CRITICAL_SECTION_START,
SCM_NONREC_CRITICAL_SECTION_END, SCM_REC_CRITICAL_SECTION_START,
SCM_REC_CRITICAL_SECTION_END): Removed.
* eval.c: Replaced SOURCE_SECTION_START / SOURCE_SECTION_END with
direct calls to scm_rec_mutex_lock / unlock around the three calls
to scm_m_expand_body.
* eval.c, eval.h (promise_free): New function.
(scm_force): Rewritten; Now thread-safe; Removed
SCM_DEFER/ALLOW_INTS.
* pthread-threads.h: Added partially implemented plugin interface
for recursive mutexes. These are, for now, only intended to be
used internally within the Guile implementation.
* pthread-threads.c: New file.
* threads.c: Conditionally #include "pthread-threads.c".
* eval.c, eval.h (scm_makprom, scm_force): Rewritten to be
thread-safe;
* snarf.h (SCM_MUTEX, SCM_GLOBAL_MUTEX, SCM_REC_MUTEX,
SCM_GLOBAL_REC_MUTEX): New macros.
* eval.c, threads.c, threads.h, snarf.h: Rewrote critical section
macros---use mutexes instead.
* tags.h (SCM_IM_FUTURE): New tag.
* eval.c (scm_m_future): New primitive macro.
(SCM_CEVAL): Support futures.
(unmemocopy): Support unmemoization of futures.
* print.c (scm_isymnames): Name of future isym.
(SCM_NONREC_CRITICAL_SECTION_START,
SCM_NONREC_CRITICAL_SECTION_END, SCM_REC_CRITICAL_SECTION_START,
SCM_REC_CRITICAL_SECTION_END): New macros.
(SCM_CRITICAL_SECTION_START/END): Defined here.
* eval.c: Insert SOURCE_SECTION_START / SOURCE_SECTION_END around
the three calls to scm_m_expand_body.
* gc.h: #include "libguile/pthread-threads.h";
(SCM_FREELIST_CREATE, SCM_FREELIST_LOC): New macros.
* gc.c (scm_i_freelist, scm_i_freelist2): Defined to be of type
scm_t_key;
* gc.c, gc-freelist.c, inline.h: Use SCM_FREELIST_LOC for freelist
access.
* gc-freelist.c (scm_gc_init_freelist): Create freelist keys.
* gc-freelist.c, threads.c (really_launch): Use
SCM_FREELIST_CREATE.
* gc-malloc.c (scm_realloc, scm_gc_register_collectable_memory):
* gc.c (scm_i_expensive_validation_check, scm_gc,
scm_gc_for_newcell): Put threads to sleep before doing GC-related
heap administration so that those pieces of code are executed
single-threaded. We might consider rewriting these code sections
in terms of a "call_gc_code_singly_threaded" construct instead of
calling the pair of scm_i_thread_put_to_sleep () and
scm_i_thread_wake_up (). Also, we would want to have as many of
these sections eleminated.
* init.c (scm_init_guile_1): Call scm_threads_prehistory.
* inline.h: #include "libguile/threads.h"
* pthread-threads.h: Macros now conform more closely to the
pthreads interface. Some of them now take a second argument.
* threads.c, threads.h: Many changes.
* configure.in: Temporarily replaced "copt" threads option with new
option "pthreads".
(USE_PTHREAD_THREADS): Define if pthreads configured.
* eval.c, eval.h (scm_trampoline_1, scm_trampoline_2): New functions.
* eval.c (call_subr2_2, call_lsubr_2, call_closure_2): New functions;
(map, for-each): Handle also application on two args as a special
case; Use trampolines.
* sort.c (scm_cmp_function): Choose subr2less for scm_tc7_subr_2o;
(subr2oless): Removed.
(scm_restricted_vector_sort_x): Use scm_return_first to keep the
vector GC protected.
* eval.c (check_map_args): Use scm_out_of_range_pos instead of
scm_out_of_range.
* *.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.
scm_sym_macro, scm_macro_type), macros.h (scm_makmacro):
Deprecated the special kind of built-in dynamic syntax transformer
that was inaccurately named "macro". Note: The built-in syntax
transformers that are named "mmacro" or "memoizing-macro" still
exist, and it is these which come much closer to what one would
call a macro.
SCM_CEVAL): Removed compile time option SCM_CAUTIOUS to clean up
the code. Full number of arguments checking of closures is
mandatory now. However, the option to disable the checking has
most probably not been used anyway.
(scm_lookupcar, scm_lookupcar1, scm_badargsp, SCM_CEVAL,
SCM_APPLY, scm_map, scm_for_each), feature.c (scm_init_feature),
gsubr.c (scm_gsubr_apply), numbers.c (scm_logand, scm_logior,
scm_logxor, scm_i_dbl2big), srcprop.c (scm_source_properties,
scm_set_source_properties_x, scm_source_property): Removed
compile time option SCM_RECKLESS to clean up the code. Full
number of arguments checking of closures is mandatory now.
However, the option to disable the checking has most probably not
been used anyway.
* srcprop.c (scm_source_properties, scm_set_source_properties_x,
scm_source_property): Use !SCM_CONSP instead of SCM_NCONSP.
MEMOIZE_LOCALS to clean up the code. Now, caching of local
variable positions during memoization is mandatory. However, the
option to disable the caching has most probably not been used
anyway.
function, replaces macro SRCBRKP.
(SRCBRKP): Deprecated.
* eval.c (SCM_CEVAL): Replaced use of SRCBRKP by call to
scm_c_source_property_breakpoint_p. Removed some use of arg1 as
temporary variable.
(SCM_CEVAL): Minimized scope of variable orig_sym. Eliminated
goto-labels cdrxnoap, cdrxbegin and nontoplevel_cdrxnoap. Changed
argument checking order for set! to locals, variables and symbols.
Improvements to control structure. Removed some uses of arg1 and
arg2 as temporary variables.
'slot-set!' and 'nil-cond'. Removed some uses of t.arg1, arg2 and
proc as temporary variables. Introduced temporary variables with
hopefully descriptive names for clarification. Replaced SCM_N?IMP
by a more explicit predicate in some places.
Added lots of comments regarding the implementation of #@dispatch.
Changed intra-procedure communication to use t.arg1 instead of
arg2. Removed some uses of t.arg1, t.lloc and proc as temporary
variables. Introduced temporary variables with hopefully
descriptive names for clarification. Replaced SCM_N?IMP by a more
explicit predicate in some places. Use SCM_INSTANCE_HASH instead
of computing the expression explicitly. Eliminate now unused
label nontoplevel_cdrxbegin.
* goops.h (SCM_INSTANCE_HASH): New macro.
* objects.h (SCM_CMETHOD_FORMALS, SCM_CMETHOD_BODY): New macros.
side-effecting operations from conditions and macro calls.
Replaced SCM_N?IMP by a more explicit predicate in some places.
Minimized the scope of some variables.
'letrec' and 'set*': Removed some uses of t.arg1, t.lloc and proc
as temporary variables. Removed side-effecting operations from
conditions and macro calls. Introduced temporary variables with
hopefully descriptive names for clarification. Replaced SCM_N?IMP
by a more explicit predicate in some places. Removed code that
was conditionally compiled if SICP was defined - which it never
is.
Removed some uses of t.arg1 and proc as temporary variables.
Removed side-effecting operations from conditions and macro calls.
Introduced temporary variables with hopefully descriptive names
for clarification. Replaced SCM_N?IMP by a more explicit
predicate in some places.
explicit predicate in some places.
(CHECK_EQVISH): Removed.
(SCM_CEVAL): Removed some uses of t.arg1 and proc as temporary
variables. Removed side-effecting operations from conditions and
macro calls. Introduced temporary variables for clarification.
Sorted if-else-if check for the type of the last form in a list by
frequency. Avoided some unnecessary tail-recursion calls.
comments.
(scm_deval_args, deval_args): Renamed scm_deval_args to
deval_args, since it is not part of the interface.
(SCM_CEVAL): Added (maybe somewhat verbose) comment. Avoid to
use references to debug.vect[0] before it exists. Add parentheses
to switch statement.
* goops.h: Added local emacs variables.
* srcprop.c (scm_source_property): Remove redundant SCM_IMP
test.
* strings.c (scm_c_string2str): Clarified comment. Replaced
THINKME by FIXME for uniformness. Removed question about whether
arguments need to be protected from garbage collection: Arguments
must be protected as any other variable.