scm_copy_tree on code in order not to let memoized code to leak
out. Thus, scm_copy_tree needs to copy vectors as well since
quasiquote can introduce evaluated code also inside vector
constants.
change makes the evaluator safer at the cost of evaluation speed.
It handles the case when the user has added a non-immediate
improper end of the application form, e.g., `(+ 0 . x)'.
(Earlier only cases like `(+ 0 . 0)' were handled.) I've tried to
minimize the extra cost as much as possible. The new code is
enclosed in #ifdef CAUTIOUS regions. NOTE: This also fixes the
problem with structs planted directly in the code (e.g. by a
macro). This no longer causes segmentation fault. (Thanks to
Eric Hanchrow.)
* eval.c, eval.h (scm_eval_args, scm_deval_args): Take one extra
arg `proc' in order to be able to throw errors; New argument
checking code.
scm_make_debugobj), eval.c (scm_makprom): SCM_DEFER/ALLOW_INTS -->
A section.
* __scm.h: Start the long-term project of moving to POSIX threads.
Phase 1: Classification of all critical sections.
(SCM_ENTER_A_SECTION, SCM_EXIT_A_SECTION): New macros: Delimiters
for A sections. (See comments in __scm.h for details.)
procedure apply: Copy argument lists before pushing them unto the
environment so that the environment won't get mutated due to
manipulation of procedure arguments. This should perhaps be
regarded as a temporary solution until someone finds a more
efficient one. (Thanks to Maciej Stachowiak.)
from debug.c --> eval.c
* eval.h, eval.c (scm_eval_options_interface): New options
interface.
(SCM_EVAL_STACK): New option: Size of newly created stacks,
i.e. stacks for new threads.
* eval.c (unsafe_setjmp): Removed with #if 0.
* eval.c, numbers.c, unif.c, srcprop.c: Added a few curly braces
to avoid compiler warnings.
Some indentation fixes.
* objects.h (SCM_METACLASS_STANDARD_LAYOUT): Printer field is no
longer a user field; New field: class_flags.
* objets.c, objects.h: New metaclass: scm_metaclass_operator.
Added #include "objects.h"
* eval.c (scm_makprom): Added SCM_DEFER_INTS and SCM_ALLOW_INTS.
Add #include "feature.h".
* ports.h (SCM_EOF_OBJECT_P): New macro predicate.
This test is needed at many places in the code and should be
abstracted. (Motivated by the need of this test in libguiletk.)
* ports.c (scm_eof_object_p), vports.c (sfgetc), strports.c
(scm_eval_string), load.c (scm_primitive_load,
scm_read_and_eval_x), gh_eval.c (gh_eval_str):
Use SCM_EOF_OBJECT_P.
* eval.c (scm_init_eval): Add feature `delay'.
* gsubr.c: New global symbol scm_i_inner_name.
* debug.c (scm_procedure_name): Try procedure property
`inner-name' if `name' fails.
* print.c (scm_iprin1): Use scm_macro_name.
* eval.c (scm_m_define): Give names to macros as well; Only the
first top-level definition gives a procedure/macro a name.
Otherwise confusing names can turn up in backtraces.
(SCM_CEVAL): SCM_IM_DEFINE: Set `inner-name' property instead of
`name'; Give names to macros as well.
* procs.c (scm_closure_p), print.c (scm_iprin1), eval.c
(scm_macro_transformer): Use SCM_CLOSUREP instead of
scm_closure_p.
procedures;
(prinmacro): Removed. The code has been moved/merged into print.c
in order to decrease code redundancy. We want macros to print in
a way equivalent to procedures, and it would be silly to duplicate
the required code. (We don't want to maintain two places.)
(macrosmob): Print field is now a NULL pointer.
* eval.h (scm_macro_p, scm_macro_type, scm_macro_name,
scm_macro_transformer): New prototypes.
(scm_tc16_macro): Declared.
* * print.c (scm_iprin1): Added code for printing of macros. Macros
are now printed in a way equivalent to procedures.
is defined, to avoid warnings; it's only used in the
conflict-checking code. Which might go away anyway.
(SCM_CEVAL): All goto's targeting the `dispatch' label are in
conditionals; put the label definition in an #if too, to stifle
warnings.
condition during lookup (when using threads).
(scm_lookupcar): Implement in terms of scm_lookupcar1.
(SCM_CEVAL): Use scm_lookupcar1 instead of scm_lookupcar in one
place.
with 3 or more args internally to the evaluator. This is mainly
because we don't want to pass entry and exit points of the
debug support twice, but it also seems to increase the speed of
the evaluator for such calls (e. g. (+ 1 2 3)).
(ENTER_APPLY): Bugfix: Reset apply-frame trap on trap as is done
with the others.
(ENTER_APPLY, scm_deval): Reset trace flag on apply-frame and
exit-frame traps.
(SCM_CEVAL, SCM_APPLY): Call it, instead of setjmp, to make sure
that values of automatic variables are preserved. See comments
for safe_setjmp for details.
scm_sysintern_no_module_lookup.
(scm_sysintern): New function to take the place of the old
scm_sysintern. It uses the current toplevel lookup closure to give
the symbol its value. This is a temporary hack to put packages
like gtcltk into their own module.
(scm_can_use_top_level_lookup_closure_var): New variable to tell
us whether `scm_top_level_lookup_closure_var' has been initialized
and is usable.
* eval.c (scm_init_eval): Set it.
(Here he goes again! Why do we put up with this?!)
* debug.h (scm_debug_frame): Make the 'vect' member a pointer to
an scm_debug_info structure, not an in-line array of them. Add
'info' member, to say how many vect elements we've used, for eval
frames.
* eval.c (SCM_CEVAL): Use alloca to allocate space for vect. Use
a new variable debug_info_end to mark the end of vect, instead of
the address of the 'info' pointer itself.
[DEVAL] (ENTER_APPLY, SCM_CEVAL, SCM_APPLY): Remove casts of
&debug to scm_debug_frame *; debug is a real scm_debug_frame now.
(SCM_APPLY): Explicitly allocate space for debug.vect.
* debug.c (scm_m_start_stack): Same, for vframe.vect.
* stacks.c: Adjusted for new debug frame structure.
(RELOC_INFO, RELOC_FRAME): New macros.
(stack_depth, read_frames): Use them, and new scm_debug_frame
element 'info', instead of magically knowing that eval frames have
an info pointer sitting after vect.
(scm_make_stack, scm_stack_id, scm_last_stack_frame): Use
RELOC_FRAME.
(scm_init_stacks): Formatting tweaks.
and s_primitive_load_path.
* eval.c, load.c, error.c (scm_wta): use scm_misc_error.
* error.h: don't declare error symbols. prototype for scm_misc_error.
* stackchk.c (scm_stack_overflow_key): defined here instead of in
error.c.
* error.c: use SCM_SYMBOL to set up error keys.
scm_misc_error: new procedure.
ramap.c, symbols.c: Added new selectors SCM_CARLOC and SCM_CDRLOC
for obtaining the address of a car or cdr field. Motivation:
&SCM_CXR make assumptions about the internal structure of the
SCM_CXR selectors.
* eval.h, eval.c: Added new selector SCM_GLOC_VAL_LOC.
Motivation: see SCM_CXRLOC.
* pairs.h, eval.c, gc.c, init.c, ioext.c, ports.c, ports.h,
srcprop.h, tags.h, throw.c, unif.c: Added new selectors
SCM_SETAND_CAR, SCM_SETAND_CDR, SCM_SETOR_CAR and SCM_SETOR_CDR.
Motivation: Safer use. Some other macros are defined in terms of
these operations. If these are defined using the SCM_SETCXR
(<e1>, SCM_CXR (<e1>) <op> <e2>) pattern a complex <e1> will lead
to inefficiency and an <e1> with side-effects could potentially
break. Also, these particular operations are heavily utilized in
the garbage collector. In unoptimized code there will be a
measurable speedup.
* alist.c, arbiters.c, continuations.c, debug.c, debug.h, eval.c,
eval.h, feature.c, filesys.c, fports.c, gc.c, gsubr.c, init.c,
ioext.c, kw.c, list.c, load.c, mallocs.c, numbers.c, numbers.h,
pairs.c, pairs.h, ports.c, ports.h, posix.c, procprop.c, procs.c,
procs.h, ramap.c, read.c, root.c, srcprop.c, srcprop.h,
strports.c, symbols.c, tags.h, throw.c, unif.c, variable.c,
vports.c: Cleaned up use of pairs: Don't make any special
assumptions about the internal structure of selectors and
mutators: SCM_CXR (<e1>) = <e2> --> SCM_SETCXR (<e1>, <e2>),
SCM_CXR (<e1>) &= <e2> --> SCM_SETAND_CXR (<e1>, <e2>) etc.
(Among other things, this change makes it easier to build Guile
with certain compilers which have problems with casted lvalues.)