* libguile/eval.c (scm_debug_opts): Up the default stack limit by a
factor of 4. Psyntax expansions currently bounce back and forth between
the VM and the interpreter, due to `map'. (Hopefully that won't be the
case in the future, when have map in scheme, and we get an inliner.)
Anyway when expanding a big nested expression, as for example in
(language ecmascript compile-ghil) -- the pmatch code ends up being
super-nested -- we can consume loads o stack.
So given that on desktop machines, where rlimit is likely to be unset,
default rlimits are around 8 or 10 MB or so, let's bump up our default
limit to 640KB (on 32-bit). Should be enough for anyone.
See http://thread.gmane.org/gmane.lisp.guile.devel/8599/focus=8662 for
more info. Thanks to Mark H. Weaver for the diagnosis!
* libguile/eval.c (scm_m_eval_when): Whoops, eval-when has an implicit
begin. Fix.
* module/oop/goops.scm: Syncase doesn't like definitions in expression
context, and grudgingly I have decided to go along with that. But that
doesn't mean we can't keep the old semantics, via accessing the module
system directly. So do so. I took the opportunity to rewrite some
macros with syntax-rules and syntax-case -- the former is nicer than
the latter, of course.
* module/oop/goops/save.scm: Don't define within an expression.
* module/oop/goops/simple.scm (define-class): Use define-syntax.
* module/oop/goops/stklos.scm (define-class): Use define-syntax.
* libguile/eval.h:
* libguile/eval.c (scm_m_eval_when): Define a cheap eval-when, used
before syncase has booted.
* module/Makefile.am: Reorder to put (system vm) and (system repl)
modules after the compiler, as they are not needed at runtime.
* module/ice-9/boot-9.scm: Move the eval-when earlier, to be the first
thing -- so when we recompile Guile we do so all in the '(guile)
module, not '(guile-user).
* module/ice-9/compile-psyntax.scm: Rewrite to assume that psyntax.scm
will eval-when to set its module, etc. Have everything in a let --
otherwise the `format' call is in (guile), but `target' was defined
in (guile-user). Also, write in an eval-when to the expanded file.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/networking.scm:
* module/ice-9/psyntax.scm:
* module/ice-9/r4rs.scm: Sprinkles of eval-when, for flavor.
* libguile/eval.h:
* libguile/eval.c (error_unbound_variable, error_defined_variable):
Move these prototypes up earlier.
(scm_m_at, scm_m_atat): New functions, provide the @ and @@
functionality. Moved here from defmacros because they are
"special", inasmuch as syncase doesn't really understand them in
interpreted code.
* module/ice-9/boot-9.scm (@, @@): Don't define as defmacros, as
defmacros have to actually return source now.
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'.
* libguile/eval.c (scm_call_0, scm_call_1, scm_call_2, scm_call_3)
(scm_call_4): Special-case compiled procedures here, to avoid consing.
* libguile/vm.h:
* libguile/vm.c (scm_c_vm_run): Take a SCM after all.
(scm_vm_apply, scm_load_compiled_with_vm): Adapt to vm_run change.
* libguile/eval.c (scm_debug_opts): Whereas, today's machines are larger
than yesterday's; GCC consumes more words per stack frame than it used
to; and you can get quite some recursion in a halfway-compiled system,
be it resolved: let's bump up the C stack limit to 40k words (160 kB /
320 kB, depending on word size).
* libguile/eval.h:
* libguile/eval.c (scm_make_promise): Rename from `scm_makprom', and
export as the scheme procedure, `make-promise'.
* libguile/eval.i.c (CEVAL): s/makprom/make_promise/.
filename in the plist, and share between srcprops if possible.
Remove specialized storage.
* srcprop.h: remove macros without SCM_ prefix from
interface. Remove specialized storage/type definitions.
* eval.c: terminate option lists with 0.
(ENTER_APPLY): Remove optional use of a continuation when making
trap call.
(scm_debug_opts): Change doc for 'cheap option to make clear that
it is now obsolete.
(CEVAL, SCM_APPLY): Remove optional use of a continuation when
making trap calls, and implement substitution of eval expressions
and return values using the values that the trap call handlers
return.
* debug.h (SCM_CHEAPTRAPS_P): Removed.
(SCM_I_PTHREAD_RECURSIVE_MUTEX_INITIALIZER): Removed.
(scm_i_pthread_mutexattr_recursive): New.
* threads.c (scm_i_pthread_mutexattr_recursive): Declare.
(scm_i_critical_section_mutex): Do not initialize statically.
(scm_threads_prehistory): Initialize
scm_i_pthread_mutexattr_recursive and scm_i_critical_section_mutex
here.
* eval.c (source_mutex): Do not initialiaze statically.
(scm_init_eval): Do it here, using
scm_i_pthread_mutexattr_recursive.