Andy Wingo [Fri, 11 Dec 2009 11:20:55 +0000 (12:20 +0100)]
inline calls to (memv foo CONSTANT-LIST)
* module/language/tree-il/primitives.scm
(*interesting-primitive-names*): Recognize memv and memq as well.
* module/language/tree-il/inline.scm (inline!): Inline calls to memq and
memv where the list is a constant.
Andy Wingo [Fri, 11 Dec 2009 11:00:27 +0000 (12:00 +0100)]
rename <conditional> then and else to consequent and alternate
* module/language/tree-il.scm (<tree-il>): Rename the "then" and "else"
clauses of <conditional> to "consequent" and "alternate". More
verbose, yes, but that way we avoid unexpected behavior with "else".
(parse-tree-il, unparse-tree-il, tree-il->scheme, tree-il-fold):
(make-tree-il-folder, post-order!, pre-order!)
* module/language/tree-il/analyze.scm (analyze-lexicals):
* module/language/tree-il/compile-glil.scm (flatten):
* module/language/tree-il/fix-letrec.scm (simple-expression?): Update
callers.
Andy Wingo [Fri, 11 Dec 2009 10:49:14 +0000 (11:49 +0100)]
rename lambda-case-else to lambda-case-alternate
* module/language/tree-il.scm (<tree-il>): Rename the "else" field of
<lambda-case> to "alternate". Conflicts less with the "else" keyword
as used by case, cond, record-case, pmatch, etc.
(parse-tree-il, unparse-tree-il, tree-il->scheme, tree-il-fold)
(make-tree-il-folder, post-order!, pre-order!): Adapt traversal
operators for <lambda-case> change.
* module/language/tree-il/analyze.scm (analyze-lexicals)
(validate-arity):
* module/language/tree-il/compile-glil.scm (flatten):
* module/language/tree-il/inline.scm (inline!): Adapt for <lambda-case>
change.
Andy Wingo [Fri, 11 Dec 2009 10:17:03 +0000 (11:17 +0100)]
vm: handle interrupts on backwards jumps
* libguile/vm-i-system.c (BR, br): Handle interrupts on backwards jumps,
so we can Ctrl-C an endless loop.
Andy Wingo [Fri, 11 Dec 2009 10:15:12 +0000 (11:15 +0100)]
less overhead for handling interrupts in the vm
* libguile/__scm.h (SCM_ASYNC_TICK): Add some branch prediction.
(SCM_ASYNC_TICK_WITH_CODE): New helper for when BUILDING_LIBGUILE,
runs code only if we're going to call async_click().
* libguile/vm-engine.h (VM_HANDLE_INTERRUPTS): New helper, uses
SCM_ASYNC_TICK_WITH_CODE to only save regs if we'll handle an
interrupt.
* libguile/vm-i-system.c (call, goto/args, return): use
VM_HANDLE_INTERRUPTS.
Andreas Rottmann [Fri, 11 Dec 2009 09:51:05 +0000 (10:51 +0100)]
add partial support for tail patterns in syntax-rules/syntax-case
I've prepared a patch that adds partial support for tail patterns.
Things like the the SRFI-34 `guard' macro from [0] are supported, but
you still can't combine dotted patterns with tail patterns, e.g.
(syntax-rules (else)
((foo bar ... (else something) . rest)
<TEMPLATE-HERE>))
will *not* work; there's the issue that one can't just transcribe
the implementation of this feature from the latest version of psyntax,
as I've done for non-dotted tail patterns, as it's implemented using a
dotted pattern like the above. Alas!
[0] <http://article.gmane.org/gmane.lisp.guile.devel/9442>
* module/ice-9/psyntax.scm (syntax-case, $sc-dispatch): Add support for
tail patterns, transcribed from the latest psyntax.
* module/ice-9/psyntax-pp.scm: Regenerated.
* test-suite/tests/syncase.test: Add tests for tail patterns.
Andy Wingo [Fri, 11 Dec 2009 09:21:31 +0000 (10:21 +0100)]
merge from master to elisp
* module/language/elisp/compile-tree-il.scm: Update for changes to
tree-il (lambda-case, mainly).
* module/language/elisp/spec.scm: Update GPL version to 3. Update reader
for new taking a port and environment argument.
* libguile/_scm.h: Bump objcode version.
* libguile/vm-i-system.c: Fix conflicts.
* module/Makefile.am: Fix conflicts, and add elisp modules to the build.
Andy Wingo [Thu, 10 Dec 2009 20:43:47 +0000 (21:43 +0100)]
add ice-9/quasisyntax.scm to NOCOMP_SOURCES
* module/Makefile.am (NOCOMP_SOURCES): Add quasisyntax.scm.
Andy Wingo [Thu, 10 Dec 2009 19:26:54 +0000 (20:26 +0100)]
fix emission of meta procedures
* module/language/glil/compile-assembly.scm: Fix the check for when to
emit a "meta" procedure. Fixes
http://thread.gmane.org/gmane.lisp.guile.user/7469/focus=7470.
Andy Wingo [Thu, 10 Dec 2009 19:26:13 +0000 (20:26 +0100)]
if we have no eval.go, load no .go
* libguile/load.c (scm_init_eval_in_scheme): If we have no eval.go, null
out the load-compiled path so that we load no compiled code. Prevents
partially compiled Guile from turning tail-calls into stack-munching
calls.
Andy Wingo [Thu, 10 Dec 2009 15:03:23 +0000 (16:03 +0100)]
add gbt macro to gdbinit, and fix a bug in program-arity
* gdbinit: Add gbt macro, to make a Guile backtrace whenever you want.
* module/system/vm/program.scm (program-arity): If ip is #f, just take
the first arity.
Andy Wingo [Wed, 9 Dec 2009 09:21:31 +0000 (10:21 +0100)]
fix arbiter compilation with the generic codepath
* libguile/arbiters.c (scm_try_arbiter, scm_release_arbiter): Fix for
the generic case; not sure why it wasn't working.
Andy Wingo [Wed, 9 Dec 2009 09:07:04 +0000 (10:07 +0100)]
fix FUNC_NAME of scm_memoize_variable_access_x
* libguile/memoize.c (scm_memoize_variable_access_x): Fix FUNC_NAME
definition.
Andy Wingo [Tue, 8 Dec 2009 21:53:21 +0000 (22:53 +0100)]
add SCM_SMOB_TYPE_BITS and SCM_SMOB_TYPE_MASK
* libguile/smob.h (SCM_SMOB_TYPE_BITS, SCM_SMOB_TYPE_MASK): New macros,
for when you want to identify a SMOB by type and mask.
* libguile/arrays.c:
* libguile/bitvectors.c:
* libguile/srfi-4.c: Use the new macros.
Andy Wingo [Tue, 8 Dec 2009 20:59:42 +0000 (21:59 +0100)]
fix SCM_CELL macro usage.
* libguile/vm.h (SCM_VM_CONT_DATA): Fix SCM_CELL macro usage.
Andy Wingo [Tue, 8 Dec 2009 20:59:01 +0000 (21:59 +0100)]
SCM_CELL in throw.c
* libguile/throw.c (JBACTIVE, ACTIVATEJB, DEACTIVATEJB, JBJMPBUF)
(SETJBJMPBUF, SCM_JBPREUNWIND, SCM_SETJBPREUNWIND)
(pre_unwind_data_print, scm_ithrow): Fix SCM_CELL macro usage.
Andy Wingo [Tue, 8 Dec 2009 20:55:20 +0000 (21:55 +0100)]
SCM_VALIDATE_SMOB uses SCM_SMOB_PREDICATE
* libguile/validate.h (SCM_VALIDATE_SMOB): Change to use
SCM_SMOB_PREDICATE instead of SCM_TYP16_PREDICATE.
Andy Wingo [Tue, 8 Dec 2009 20:54:27 +0000 (21:54 +0100)]
SCM_CELL in srfi-4.c
* libguile/srfi-4.c (SCM_UVEC_TYPE, SCM_UVEC_LENGTH, SCM_UVEC_BASE): Fix
SCM_CELL macro usage.
Andy Wingo [Tue, 8 Dec 2009 20:53:15 +0000 (21:53 +0100)]
SCM_CELL in srcprop.c
* libguile/srcprop.c (SRCPROPPOS, SRCPROPCOPY, SRCPROPALIST)
(SETSRCPROPPOS, SETSRCPROPCOPY, SETSRCPROPALIST): Fix erroneous
SCM_CELL macro usage.
Andy Wingo [Tue, 8 Dec 2009 20:52:15 +0000 (21:52 +0100)]
use the new public metatables from struct.c
* libguile/procs.c (scm_init_procs): No need to lookup the
applicable-struct-with-setter vtable, as it is now exported.
Andy Wingo [Tue, 8 Dec 2009 20:50:40 +0000 (21:50 +0100)]
scm_i_alloc_struct does not take a "what" arg
* libguile/struct.h:
* libguile/struct.c (scm_i_alloc_struct): Change to not take a "what"
argument. Callers changed.
Andy Wingo [Tue, 8 Dec 2009 20:48:33 +0000 (21:48 +0100)]
reserve a vtable flag for smobs.
* libguile/struct.h (SCM_VTABLE_FLAG_SMOB_0): Reserve a vtable flag for
smobs.
Andy Wingo [Tue, 8 Dec 2009 20:47:47 +0000 (21:47 +0100)]
add vtable finalizer and printer setter macros
* libguile/struct.h (SCM_VTABLE_INSTANCE_FINALIZER): Use DATA_REF, not
SLOT_REF.
(SCM_SET_VTABLE_INSTANCE_FINALIZER, SCM_SET_VTABLE_INSTANCE_PRINTER):
New accessor macros.
Andy Wingo [Tue, 8 Dec 2009 20:46:47 +0000 (21:46 +0100)]
make some applicable struct vtable-vtable public to C
* libguile/struct.h (scm_standard_vtable_vtable)
(scm_applicable_struct_vtable_vtable)
(scm_applicable_struct_with_setter_vtable_vtable)
* libguile/struct.c: Make these stock meta-tables public to C.
Andy Wingo [Tue, 8 Dec 2009 20:41:48 +0000 (21:41 +0100)]
SCM_CELL in modules.c
* libguile/modules.c (SCM_F_EVAL_CLOSURE_INTERFACE)
(SCM_EVAL_CLOSURE_INTERFACE_P, scm_standard_interface_eval_closure):
Fix to not use SCM_CELL macros.
Andy Wingo [Tue, 8 Dec 2009 20:38:51 +0000 (21:38 +0100)]
initialize smobs after structs
* libguile/init.c (scm_i_init_guile): Move SMOB prehistory after structs
init. No effect for now.
Andy Wingo [Tue, 8 Dec 2009 20:37:25 +0000 (21:37 +0100)]
SCM_CELL in guardians.c
* libguile/guardians.c (GUARDIAN_DATA): Fix SCM_CELL macro usage.
Andy Wingo [Tue, 8 Dec 2009 20:31:42 +0000 (21:31 +0100)]
SCM_CELL in filesys.[ch]
* libguile/filesys.h (SCM_DIR_FLAG_OPEN, SCM_DIR_OPEN_P)
* libguile/filesys.c (scm_readdir, scm_rewinddir, scm_closedir)
(scm_dir_print, scm_dir_free): Fix SCM_CELL macro usage.
Andy Wingo [Tue, 8 Dec 2009 20:28:34 +0000 (21:28 +0100)]
SCM_CELL in deprecated.c
* libguile/deprecated.c (scm_smob_free): Fix SCM_CELL macro usage.
Andy Wingo [Tue, 8 Dec 2009 20:27:26 +0000 (21:27 +0100)]
fix SCM_CELL macro usage in continuations.[ch]
* libguile/continuations.h (SCM_CONTREGS):
* libguile/continuations.c (continuation_print): Fix SCM_CELL macro
usage.
Andy Wingo [Tue, 8 Dec 2009 20:25:31 +0000 (21:25 +0100)]
fix SCM_CELL_* macro usage in async.c
* libguile/async.c (ASYNC_GOT_IT, SET_ASYNC_GOT_IT, ASYNC_THUNK): Fix
SCM_CELL_* macro usage.
Andy Wingo [Tue, 8 Dec 2009 20:23:25 +0000 (21:23 +0100)]
fix SCM_CELL_* macro usage in arbiters.c
* libguile/arbiters.c (scm_try_arbiter, scm_release_arbiter): Fix
erroneous SCM_CELL_* macro usage.
Andy Wingo [Tue, 8 Dec 2009 20:21:37 +0000 (21:21 +0100)]
fix erroneous SCM_CELL_* usage in arrays.[ch]
* libguile/arrays.h (SCM_I_ARRAY_FLAG_CONTIGUOUS, SCM_I_ARRAY_NDIM):
(SCM_I_ARRAY_CONTP, SCM_I_ARRAY_MEM):
* libguile/arrays.c (SCM_SET_ARRAY_CONTIGUOUS_FLAG):
(SCM_CLR_ARRAY_CONTIGUOUS_FLAG): Fix macros to use SCM_SMOB macros
instead of SCM_CELL macros.
Andy Wingo [Tue, 8 Dec 2009 21:14:26 +0000 (22:14 +0100)]
clean up smob macro implementation
* libguile/smob.h: Regularize the SCM_SMOB macros, and make them all go
through some generic SMOB accessor macros.
* libguile/smob.c (scm_i_set_smob_flags): Remove, as it is unused.
Andy Wingo [Mon, 7 Dec 2009 10:14:01 +0000 (11:14 +0100)]
add scm_c_make_struct[v]
* libguile/struct.h (scm_c_make_struct, scm_c_make_structv): New
functions with which you can make a struct without consing a rest
list.
* libguile/struct.c (scm_struct_init): Refactor to take an array of init
values, not a list.
(scm_make_struct, scm_make_vtable_vtable): Pull the rest arg out into
a list and pass it down to the new array-taking functions.
* libguile/memoize.c: Remove a neeless #include <alloca>.
Andy Wingo [Mon, 7 Dec 2009 08:56:58 +0000 (09:56 +0100)]
procedures-with-setters implemented in terms of structs
* libguile/tags.h (scm_tc7_pws): No more.
* libguile/procs.c (scm_procedure_with_setter_p)
(scm_make_procedure_with_setter, scm_procedure, scm_setter): Implement
procedures-with-setters in terms of applicable structs with setters.
* libguile/procs.h: Remove a big, outdated comment, and the deprecated
macros.
* libguile/deprecated.h (SCM_PROCEDURE_WITH_SETTER_P, SCM_PROCEDURE)
(SCM_SETTER): Deprecate these. SCM_PROCEDURE and SCM_SETTER are bad
names.
* libguile/evalext.c (scm_self_evaluating_p):
* libguile/gc.c (scm_i_tag_name):
* libguile/goops.c: (scm_class_of):
* libguile/print.c (iprin1):
* libguile/procprop.c (scm_i_procedure_arity):
* libguile/procs.c (scm_procedure_p):
* libguile/debug.c (scm_procedure_source): Remove a tc7_pws case.
* libguile/goops.h:
* libguile/goops.c (scm_class_procedure_with_setter): Remove this class;
it is subsumed by applicable_struct_with_setter.
* libguile/struct.h: Update a comment.
* libguile/vm-i-system.c (call, goto/args, mv-call): Remove PWS cases.
Andy Wingo [Sat, 5 Dec 2009 11:47:58 +0000 (12:47 +0100)]
structs are alive early in guile's boot
* libguile/init.c (scm_i_init_guile): Reorder deps so structs are
initialized early in the boot process.
Andy Wingo [Sat, 5 Dec 2009 11:06:16 +0000 (12:06 +0100)]
more annotations to scm_i_init_guile
* libguile/init.c (scm_i_init_guile): Annotate things that need smobs.
Andy Wingo [Sat, 5 Dec 2009 11:38:32 +0000 (12:38 +0100)]
decruftify scm_sys_protects
* libguile/root.h
* libguile/root.c (scm_sys_protects): It used to be that for some reason
we'd define a special array of "protected" values. This was a little
silly, always, but with the BDW GC it's completely unnecessary. Also
many of these variables were unused, and none of them were good API.
So remove this array, and either eliminate, make static, or make
internal the various values.
* libguile/snarf.h: No need to generate calls to scm_permanent_object.
* guile-readline/readline.c (scm_init_readline): No need to call
scm_permanent_object.
* libguile/array-map.c (ramap, rafe): Remove the dubious nullvect
optimizations.
* libguile/async.c (scm_init_async): No need to init scm_asyncs, it is
no more.
* libguile/eval.c (scm_init_eval): No need to init scm_listofnull, it is
no more.
* libguile/gc.c: Make scm_protects a static var.
(scm_storage_prehistory): Change the sanity check to use the address
of protects.
(scm_init_gc_protect_object): No need to clear the scm_sys_protects,
as it is no more.
* libguile/keywords.c: Make the keyword obarray a static var.
* libguile/numbers.c: Make flo0 a static var.
* libguile/objprop.c: Make object_whash a static var.
* libguile/properties.c: Make properties_whash a static var.
* libguile/srcprop.h:
* libguile/srcprop.c: Make scm_source_whash a global with internal
linkage.
* libguile/strings.h:
* libguile/strings.c: Make scm_nullstr a global with internal linkage.
* libguile/vectors.c (scm_init_vectors): No need to init scm_nullvect,
it's unused.
Andy Wingo [Sat, 5 Dec 2009 10:50:21 +0000 (11:50 +0100)]
further boot cleanups
* libguile/srfi-14.c (define_charset):
* libguile/deprecated.c (scm_create_hook): Don't bother making the
returned objects (hooks or charsets) into permanent objects; they are
already defined, and then the caller probably stores them away too.
* libguile/init.c (scm_i_init_guile): Add a couple annotations.
Andy Wingo [Sat, 5 Dec 2009 10:43:20 +0000 (11:43 +0100)]
more boot cleanup
* libguile/bytevectors.c (scm_bootstrap_bytevectors): Remove a call to
scm_gc_protect_object.
* libguile/gc.h:
* libguile/gc.c (scm_init_gc_protect_object): Rename from
scm_init_storage, and just return void. Make the GC boot procs have
internal linkage.
* libguile/init.c: Adapt to the name change.
Andy Wingo [Sat, 5 Dec 2009 10:30:09 +0000 (11:30 +0100)]
remove a bunch of needless scm_permanent_object calls
* libguile/array-handle.c:
* libguile/bytevectors.c:
* libguile/deprecated.c:
* libguile/eval.c:
* libguile/feature.c:
* libguile/filesys.c:
* libguile/gc.c:
* libguile/gdbint.c:
* libguile/goops.c:
* libguile/instructions.c:
* libguile/load.c:
* libguile/modules.c:
* libguile/numbers.c:
* libguile/options.c:
* libguile/ports.c:
* libguile/scmsigs.c:
* libguile/srcprop.c:
* libguile/srfi-4.c:
* libguile/stacks.c:
* libguile/threads.c:
* libguile/vm.c: Remove calls to scm_permanent_object, as they are no
longer needed with the BDW GC.
Andy Wingo [Sat, 5 Dec 2009 10:16:54 +0000 (11:16 +0100)]
some scm_i_init_guile cleanups
* libguile/init.c (scm_i_init_guile): Since hash tables are tc7 objects,
things that depend on hash tables no longer depend on smobs, so move
smob_prehistory up a bit. No more struct_prehistory.
* libguile/struct.h:
* libguile/struct.c (scm_struct_prehistory): Remove empty function.
Andy Wingo [Sat, 5 Dec 2009 10:10:11 +0000 (11:10 +0100)]
remove scm_ports_prehistory
* libguile/ports.h:
* libguile/ports.c (scm_ports_prehistory): Remove this function. Just
initialize global vars to NULL/0 instead of needing a prehistory
function.
Andy Wingo [Sat, 5 Dec 2009 09:55:37 +0000 (10:55 +0100)]
add printer for dynamic-states
* libguile/fluids.c:
* libguile/fluids.h:
* libguile/print.c: Add dynamic-state printing infrastructure.
Andy Wingo [Sat, 5 Dec 2009 09:52:18 +0000 (10:52 +0100)]
fluids are tc7 objects
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.
Andy Wingo [Sat, 5 Dec 2009 09:07:07 +0000 (10:07 +0100)]
hash tables have a tc7
* libguile/tags.h (scm_tc7_hashtable): Allocate a tc7 for hashtables.
* libguile/hashtab.h: Adjust macros accordingly.
(scm_i_hashtable_print, scm_i_hashtable_equal_p): New internal
functions.
(scm_hashtab_prehistory): Remove, no more need for this.
* libguile/hashtab.c (scm_hash_fn_remove_x): Fix a longstanding bug.
(make_hash_table): Adapt to the new hash table representation.
* libguile/eq.c (scm_equal_p)
* libguile/evalext.c (scm_self_evaluating_p)
* libguile/print.c (iprin1)
* libguile/gc.c (scm_i_tag_name): Add some tc7_hashtab cases.
* libguile/init.c: Remove unused environments init functions. Remove
call to hashtab_prehistory.
* libguile/goops.h (scm_class_hashtable)
* libguile/goops.c (scm_class_of, create_standard_classes): Have to
make a class for hash tables manually, because they aren't smobs any
more.
Andy Wingo [Fri, 4 Dec 2009 18:20:11 +0000 (19:20 +0100)]
eval.c closures are now applicable smobs, not tc3s
* libguile/debug.c (scm_procedure_name): Remove a SCM_CLOSUREP case and
some dead code.
(scm_procedure_module): Remove. This was introduced a few months ago
for the hygienic expander, but now it is no longer needed, as the
expander keeps track of this information itself.
* libguile/debug.h: Remove scm_procedure_module.
* libguile/eval.c: Instead of using tc3 closures, define a "boot
closure" applicable smob type, and represent closures with that. The
advantage is that after eval.scm is compiled, boot closures take up no
address space (besides a smob number) in the runtime, and require no
special cases in procedure dispatch.
* libguile/eval.h: Remove the internal functions scm_i_call_closure_0
and scm_closure_apply, and the public function scm_closure.
* libguile/gc.c (scm_storage_prehistory): No tc3_closure displacement
registration.
(scm_i_tag_name): Remove closure case, and a dead cclo case.
* libguile/vm.c (apply_foreign):
* libguile/print.c (iprin1):
* libguile/procs.c (scm_procedure_p, scm_procedure_documentation);
* libguile/evalext.c (scm_self_evaluating_p):
* libguile/goops.c (scm_class_of): Remove tc3_closure/tcs_closure cases.
* libguile/hash.c (scm_hasher):
* libguile/hooks.c (scm_add_hook_x): Use new scm_i_procedure_arity.
* libguile/macros.c (macro_print): Print all macros using the same code.
(scm_macro_transformer): Return any procedure, not just programs.
* libguile/procprop.h:
* libguile/procprop.c (scm_i_procedure_arity): Instead of returning a
list that the caller has to parse, have the same prototype as
scm_i_program_arity. An incompatible change, but it's an internal
function anyway.
(scm_procedure_properties, scm_set_procedure_properties)
(scm_procedure_property, scm_set_procedure_property): Remove closure
cases, and use scm_i_program_arity for arity.
* libguile/procs.h (SCM_CLOSUREP, SCM_CLOSCAR, SCM_CODE)
(SCM_CLOSURE_NUM_REQUIRED_ARGS, SCM_CLOSURE_HAS_REST_ARGS)
(SCM_CLOSURE_BODY, SCM_PROCPROPS, SCM_SETPROCPROPS, SCM_ENV)
(SCM_TOP_LEVEL): Remove these macros that pertain to boot closures
only. Only eval.c should know abut boot closures.
* libguile/procs.c (scm_closure_p): Remove this function. There is a
simple stub in deprecated.scm now.
(scm_thunk_p): Use scm_i_program_arity.
* libguile/tags.h (scm_tc3_closure): Remove. Yay, another tc3 to play
with!
(scm_tcs_closures): Remove.
* libguile/validate.h (SCM_VALIDATE_CLOSURE): Remove.
* module/ice-9/deprecated.scm (closure?): Add stub.
* module/ice-9/documentation.scm (object-documentation)
* module/ice-9/session.scm (help-doc, arity)
* module/oop/goops.scm (compute-getters-n-setters)
* module/oop/goops/describe.scm (describe)
* module/system/repl/describe.scm (display-object, display-type):
Remove calls to closure?.
Andy Wingo [Fri, 4 Dec 2009 15:39:34 +0000 (16:39 +0100)]
remove cxrs
* libguile/pairs.h:
* libguile/pairs.c: Previously scm_cdadr et al were implemented as
#defines that called scm_i_chase_pairs, and the Scheme-exposed
functions themselves were cxr subrs, which got special help in the
interpreter. Since now the special help is unnecessary (because the
compiler inlines and expands calls to car, cdadr, etc), the complexity
is a loss. So just implement cdadr etc using normal functions. There's
an advantage too, in that the compiler can unroll the cxring, reducing
branches.
* libguile/tags.h (scm_tc7_cxr): Remove this tag.
(scm_tcs_subrs): Now there's only one kind of subr, yay!
* libguile/debug.c (scm_procedure_name)
* libguile/evalext.c (scm_self_evaluating_p)
* libguile/gc.c (scm_i_tag_name)
* libguile/goops.c (scm_class_of)
* libguile/hash.c (scm_hasher)
* libguile/print.c (iprin1)
* libguile/procprop.c (scm_i_procedure_arity)
* libguile/procs.c (scm_procedure_p, scm_subr_p)
(scm_make_procedure_with_setter)
* libguile/vm.c (apply_foreign): Remove cxr cases. Replace uses of
scm_tcs_subrs with scm_tc7_gsubr.
Andy Wingo [Fri, 4 Dec 2009 12:05:00 +0000 (13:05 +0100)]
remove rpsubrs
* libguile/tags.h: Remove rpsubrs (I chose to interpret the terse name
as "recursive predicate subrs"). Just use gsubrs with rest arguments,
or do a fold yourself.
* libguile/array-map.c (scm_i_array_equal_p): Do the comparison in
order, why not.
* libguile/chars.c:
* libguile/eq.c:
* libguile/numbers.c:
* libguile/strorder.c: Add 0,2,1 gsubr wrappers for rpsubrs like eq?, <,
etc.
* libguile/goops.c (scm_class_of)
* libguile/procprop.c (scm_i_procedure_arity)
* libguile/procs.c (scm_thunk_p)
* libguile/vm.c (apply_foreign): Remove rpsubr cases.
* test-suite/tests/numbers.test ("=", "<"): Turn a couple xfails into
passes.
Andy Wingo [Thu, 3 Dec 2009 16:05:14 +0000 (17:05 +0100)]
remove asubrs
* libguile/tags.h (scm_tcs_subrs, scm_tc7_asubr): Remove definitions.
* libguile/goops.c (scm_class_of)
* libguile/procprop.c (scm_i_procedure_arity)
* libguile/procs.c (scm_thunk_p)
* libguile/vm.c (apply_foreign): Remove cases for asubrs.
* libguile/array-map.c: Gut all of the optimizations, because there are
no more asubrs, soon won't be rpsubrs, and all of this should happen
on the Scheme level, ideally.
Andy Wingo [Thu, 3 Dec 2009 14:58:43 +0000 (15:58 +0100)]
speed up scm_call_N for non-programs
* libguile/eval.c (scm_call_0, scm_call_1, scm_call_2, scm_call_3): All
of these should dispatch through the VM, without consing.
Andy Wingo [Thu, 3 Dec 2009 14:55:54 +0000 (15:55 +0100)]
simplify apply_foreign
* libguile/vm.c (apply_foreign): Simplify.
Andy Wingo [Sun, 6 Sep 2009 15:28:23 +0000 (17:28 +0200)]
+, -, min, lcm, gcd now documented
* test-suite/tests/numbers.test: Change some xfail documented? tests to
passes.
Andy Wingo [Sun, 6 Sep 2009 14:47:19 +0000 (16:47 +0200)]
change asubrs to be gsubrs
* libguile/numbers.h:
* libguile/numbers.c (scm_i_gcd, scm_i_lcm, scm_i_logand, scm_i_logior)
(scm_i_logxor, scm_i_min, scm_i_max, scm_i_sum, scm_i_difference)
(scm_i_product, scm_i_divide): Change asubrs to be gsubrs.
Andy Wingo [Sun, 6 Sep 2009 12:15:28 +0000 (14:15 +0200)]
+ is not an asubr
* libguile/numbers.h:
* libguile/numbers.c (scm_i_sum): Rework so that scm_sum is just a
normal function. Its generic is actually provided by scm_i_sum, a
gsubr with rest args. In that way, + is no longer an asubr.
Andy Wingo [Sun, 6 Sep 2009 11:51:31 +0000 (13:51 +0200)]
remove scm_tc7_dsubr
* libguile/tags.h: Remove scm_tc7_dsubr. There are no more users of
this.
* libguile/array-map.c:
* libguile/eval.c:
* libguile/eval.i.c:
* libguile/goops.c:
* libguile/procprop.c:
* libguile/procs.h: Remove all dsubr cases.
Andy Wingo [Thu, 3 Sep 2009 20:35:01 +0000 (22:35 +0200)]
remove "primitive numerics" from the docs
* doc/ref/api-data.texi: Update for $sin deprecation.
Andy Wingo [Thu, 3 Sep 2009 20:29:10 +0000 (22:29 +0200)]
implement transcendental sin, cos etc in c; deprecate $sin, $cos, etc
* libguile/deprecated.h:
* libguile/deprecated.c (scm_asinh, scm_acosh, scm_atanh): Deprecate
these stand-ins for the C99 asinh, acosh, and atanh functions. Guile
is not gnulib.
(scm_sys_atan2): Deprecate as well, in favor of scm_atan.
* libguile/numbers.h:
* libguile/numbers.c (scm_sin, scm_cos, scm_tan)
(scm_sinh, scm_cosh, scm_tanh)
(scm_asin, scm_acos, scm_atan)
(scm_sys_asinh, scm_sys_acosh, scm_sys_atanh): New functions,
replacing the combination of dsubrs and boot-9 wrappers with C subrs
that handle complex values. The latter three have _sys_ in their names
due to the name conflict with the deprecated scm_asinh et al.
Remove the $abs, $sin etc "dsubrs".
* module/ice-9/boot-9.scm: Remove transcendental functions, as this all
happens in C now.
* module/ice-9/deprecated.scm: Add aliases for $sin et al.
* test-suite/tests/ramap.test ("array-map!"): Adjust "dsubr" tests to
use sqrt, not $sqrt. They don't actually test dsubrs now. In the
two-source test, I'm pretty sure the dsubr array-map! should have been
failing, as indeed it does now; I've changed the test case to expect
the failure. I'd still like to know why it was succeeding before.
Andy Wingo [Thu, 3 Sep 2009 10:19:39 +0000 (12:19 +0200)]
expt implemented in C, handles complex numbers
* libguile/numbers.h:
* libguile/numbers.c (scm_expt): Rename from scm_sys_expt, and handle
the complex cases as well.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_sys_expt): Add a deprecated shim.
* module/ice-9/boot-9.scm (expt): Remove definition, scm_expt does all
we need.
Andy Wingo [Thu, 3 Sep 2009 09:57:29 +0000 (11:57 +0200)]
remove tc7_subr_* and tc7_lsubr_*
* libguile/tags.h: Remove tc7 #defines for subrs, replacing them with
placeholders. These were public, but hopfully unused. I don't see how
to usefully deprecate them.
* libguile/array-map.c (scm_array_map_x): Remove special cases for
certain subr types. This might make things slower for the moment,
otoh, native compilation should moot that question.
* libguile/eval.i.c:
* libguile/eval.c: Remove subr-handling cases. To regain this speed and
more won't have to wait for native compilation, though -- this change
smooths the way for subr dispatch in the VM.
* libguile/gsubr.c (scm_i_gsubr_apply): Fix a bug in which we didn't
detect too-many-arguments. This would only show up when using ceval,
as only ceval called this function.
* test-suite/tests/ramap.test ("array-map!"): Change the expected
exception if passed a procedure of the wrong arity. It now gives
wrong-num-args.
more won't have to wait for native compilation, though -- this change
smooths the way for subr dispatch in the VM.
* libguile/goops.c (scm_class_of): Remove subr cases. No speed
implication.
* libguile/objects.c (scm_valid_object_procedure_p): Remove this public
but undocumented, and useless, function. I do not think this will
affect anyone at all.
(scm_set_object_procedure_x): Replace a call to
scm_valid_object_procedure_p with scm_procedure_p, and actually wrap
with a scm_is_true.
* module/oop/goops.scm (initialize-object-procedure): Don't call
valid-object-procedure?.
Andy Wingo [Thu, 3 Sep 2009 09:14:24 +0000 (11:14 +0200)]
all subrs are gsubrs
* libguile/gsubr.c (create_gsubr, create_gsubr_with_generic): Always
create gsubrs -- never the specialized tc7 types. Allow gsubrs to have
generics, there doesn't seem to be any reason not to.
* libguile/macros.c (scm_make_synt):
* libguile/values.c (scm_init_values):
* libguile/eval.c (scm_init_eval):
* libguile/gc.c (scm_init_gc): Use scm_c_define_gsubr instead of
scm_c_define_subr.
* libguile/goops.c (scm_class_of): Allow gsubrs to be primitive
generics.
Andy Wingo [Thu, 3 Dec 2009 12:09:58 +0000 (13:09 +0100)]
replace frame implementation with VM frames
* libguile/stacks.h: Rework so that a stack doesn't copy information out
of VM frames, it just holds onto a VM frame, along with the stack id
and length. VM frames are now the only representation of frames in
Guile.
(scm_t_info_frame, SCM_FRAME_N_SLOTS, SCM_FRAME_REF, SCM_FRAME_NUMBER)
(SCM_FRAME_FLAGS, SCM_FRAME_SOURCE, SCM_FRAME_PROC, SCM_FRAME_ARGS)
(SCM_FRAME_PREV, SCM_FRAME_NEXT)
(SCM_FRAMEF_VOID, SCM_FRAMEF_REAL, SCM_FRAMEF_PROC)
(SCM_FRAMEF_EVAL_ARGS, SCM_FRAMEF_OVERFLOW)
(SCM_FRAME_VOID_P, SCM_FRAME_REAL_P, SCM_FRAME_PROC_P)
(SCM_FRAME_EVAL_ARGS_P, SCM_FRAME_OVERFLOW_P): Remove these macros
corresponding to the old frame implementation.
(scm_frame_p scm_frame_source, scm_frame_procedure)
(scm_frame_arguments): These definitions are now in frames.h.
(scm_last_stack_frame): Remove declaration of previously-removed
constructor. Probably should re-instate it though.
(scm_frame_number, scm_frame_previous, scm_frame_next)
(scm_frame_real_p, scm_frame_procedure_p, scm_frame_evaluating_args_p)
(scm_frame_overflow_p) : Remove these procedures corresponding to the
old stack implementation.
* libguile/stacks.c: Update for new frames implementation.
* libguile/frames.h:
* libguile/frames.c: Rename functions operating on VM frames to have a
scm_frame prefix, not scm_vm_frame -- because they really are the only
frames we have. Rename corresponding Scheme functions too, from
vm-frame-foo to frame-foo.
* libguile/deprecated.h: Remove scm_stack and scm_info_frame data types.
* libguile/vm.c (vm_dispatch_hook): Adapt to scm_c_make_frame name
change.
* module/system/vm/frame.scm: No need to export functions provided
frames.c now, as we load those procedures into the default environment
now. Rename functions, and remove a couple of outdated, unused
functions. The bottom half of this file is still bitrotten, though.
* libguile/backtrace.c: Rework to operate on the new frame
representation. Also fix a bug displaying file names for compiled
procedures.
* libguile/init.c: Load the VM much earlier, just because we can. Also
it allows us to have frames.[ch] loaded in time for stacks to be
initialized, so that scm_frame_arguments can do the right thing.
Andy Wingo [Thu, 3 Dec 2009 10:03:39 +0000 (11:03 +0100)]
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 Wingo [Wed, 2 Dec 2009 23:15:02 +0000 (00:15 +0100)]
clarify comments in eval.scm
* module/ice-9/eval.scm: Add some more comments.
Andy Wingo [Tue, 1 Dec 2009 22:54:25 +0000 (23:54 +0100)]
really boot primitive-eval from scheme.
* libguile/eval.c (scm_primitive_eval, scm_c_primitive_eval):
(scm_init_eval): Rework so that scm_primitive_eval always calls out to
the primitive-eval variable. The previous definition is the default
value, which is probably overridden by scm_init_eval_in_scheme.
* libguile/init.c (scm_i_init_guile): Move ports and load-path up, so we
can debug when initing eval. Call scm_init_eval_in_scheme. Awesome.
* libguile/load.h:
* libguile/load.c (scm_init_eval_in_scheme): New procedure, loads up
ice-9/eval.scm to replace the primitive-eval definition, if everything
is there and up-to-date.
* libguile/modules.c (scm_module_transformer): Export to Scheme, so it's
there for eval.go.
* module/ice-9/boot-9.scm: No need to define module-transformer.
* module/ice-9/eval.scm (capture-env): Only reference the-root-module if
modules are booted.
(primitive-eval): Inline a definition for identity. Throw a more
standard error for "wrong number of arguments".
* module/ice-9/psyntax.scm (chi-install-global): The macro binding for a
syncase macro is now a pair: the transformer, and the module that was
current when the transformer was installed. The latter is used for
hygiene purposes, replacing the use of procedure-module, which didn't
work with the interpreter's shared-code closures.
(chi-macro): Adapt for the binding being a pair, and get the hygiene
from the cdr.
(eval-local-transformer): Adapt to new form of macro bindings.
* module/ice-9/psyntax-pp.scm: Regenerated.
* .gitignore: Ignore eval.go.stamp.
* module/Makefile.am: Reorder for fastest serial compilation, now that
there are no ordering constraints. I did a number of experiments here
and this seems to be the best; but the bulk of the time is compiling
psyntax-pp.scm with eval.scm. Not so great.
* libguile/vm-engine.c (vm-engine): Throw a more standard error for
"wrong type to apply".
* test-suite/tests/gc.test ("gc"): Remove a hack that shouldn't affect
the new evaluator, and throw in another (gc) for good measure.
* test-suite/tests/goops.test ("defining classes"):
* test-suite/tests/hooks.test (proc1): We can't currently check what the
arity is of a closure made by eval.scm -- or more accurately all
closures have 0 required args and no rest args. So punt for now.
* test-suite/tests/syntax.test ("letrec"): The scheme evaluator can't
check that a variable is unbound, currently; perhaps the full "fixing
letrec" expansion could fix this. But barring that, punt.
Andy Wingo [Tue, 1 Dec 2009 21:20:03 +0000 (22:20 +0100)]
apply goes to the vm, not the interpreter
* libguile/eval.c (eval): Call scm_vm_apply instead of apply.
(apply): Deleted, no longer referenced. Heh.
(scm_apply): Call scm_vm_apply.
* libguile/init.c (scm_i_init_guile): Bootstrap the VM before the
evaluator.
* libguile/vm.c (scm_vm_apply): Actually it's not necessary that the
procedure is a program; so that's cool, relax the check.
Andy Wingo [Tue, 1 Dec 2009 21:11:15 +0000 (22:11 +0100)]
vm doesn't call the evaluator at all (at least not directly)
* libguile/vm-i-system.c (goto/args, mv-call): Finish the port to use
apply_foreign instead of scm_apply.
Andy Wingo [Tue, 1 Dec 2009 20:59:42 +0000 (21:59 +0100)]
first step to make the vm stop calling the interpreter
* libguile/eval.h:
* libguile/eval.c (scm_closure_apply): New function, applies a closure.
Won't be necessary in the future, but for now here it is, with
internal linkage.
* libguile/gsubr.h:
* libguile/gsubr.c (scm_i_gsubr_apply_array): New function, applies a
gsubr to an array of values, potentially extending that array for
optional arguments and rest arguments and such.
* libguile/vm.c (apply_foreign): New function, applies a foreign
function to arguments on the stack, in place.
* libguile/vm-i-system.c (call): Add a case for procedures-with-setters
(will go away when they are applicable structs). Instead of calling
the evaluator for foreign functions, call apply_foreign.
Andy Wingo [Mon, 30 Nov 2009 22:32:28 +0000 (23:32 +0100)]
add new scheme evaluator
* module/ice-9/eval.scm: New evaluator, written in Scheme. Whee!
Batteries included but not wired up.
* module/Makefile.am: Abuse touch(1) to make sure eval.go gets built
before everything. Can't just depend on eval.go, because eval.go will
get the timestamp of eval.scm, which might be newer than foo.go (and
thus foo.scm). Something better is warranted.
Andy Wingo [Mon, 30 Nov 2009 21:21:31 +0000 (22:21 +0100)]
add memoized expression accessors to scheme
* libguile/eval.c: Fix a comment.
(eval): Abstract out the variable memoization into a function,
scm_memoize_variable_access_x.
* libguile/memoize.c (memoized_tags): Fix a couple names.
(scm_memoize_variable_access_x): New internal function. Actually it's
public to Scheme, but we can't do much about that, because the new
evaluator will need it.
(scm_memoized_expression_typecode, scm_memoized_expression_data): New
accessors for memoized code, for Scheme.
(scm_memoized_typecode): Looks up the typecode for a symbol.
Andy Wingo [Mon, 30 Nov 2009 21:17:46 +0000 (22:17 +0100)]
export scm_define to scheme as define!
* libguile/modules.c (scm_define): Export to Scheme as `define!'. The
evaluator needs it, and actually it's an OK thing to have around.
Andy Wingo [Mon, 30 Nov 2009 21:16:59 +0000 (22:16 +0100)]
wire through the existing vm ops for variable-ref and variable-set!
* module/language/tree-il/compile-glil.scm (*primcall-ops*): Compile
variable-ref and variable-set instructions specially.
* module/language/tree-il/primitives.scm
(*interesting-primitive-names*): Add cases for variable-ref and
variable-set!. The latter is a little tricky, because the args are
switched for the VM op, and we can't really change that easily.
Andy Wingo [Mon, 30 Nov 2009 21:14:52 +0000 (22:14 +0100)]
fixes to variable-ref, variable-set vm ops
* libguile/vm-i-system.c (variable-ref, variable-set): Fix declared
number of pops and pushes.
Andy Wingo [Sat, 28 Nov 2009 10:18:14 +0000 (11:18 +0100)]
promises are in their own file now
* libguile.h:
* libguile/Makefile.am:
* libguile/eval.c:
* libguile/eval.h:
* libguile/init.c:
* libguile/promises.c:
* libguile/promises.h: Split promises out into their own file.
Andy Wingo [Sat, 28 Nov 2009 00:19:50 +0000 (01:19 +0100)]
new evaluator, y'all
* libguile/eval.c: So, ladies & gents, a new evaluator. It's similar to
the old one, in that we memoize and then evaluate, but in this
incarnation, memoization of an expression happens before evaluation,
not lazily as the expression is evaluated. This makes the evaluation
itself much cleaner, in addition to being threadsafe. In addition,
since this C evaluator will in the future just serve to bootstrap the
Scheme evaluator, we don't have to pay much concern for debugging
conveniences. So the environment is just a list of values, and the
memoizer pre-computes where it's going to find each individual value
in the environment.
Interface changes are commented below, with eval.h.
(scm_evaluator_traps): No need to reset the debug mode after rnning te
traps thing. But really, the whole traps system needs some love.
* libguile/memoize.h:
* libguile/memoize.c: New memoizer, which runs before evaluation,
checking all syntax before evaluation begins. Significantly, no
debugging information is left for lexical variables, which is not so
great for interactive debugging; perhaps we should change this to have
a var list in the future as per the classic interpreters. But it's
quite fast, and the resulting code is quite good. Also note that it
doesn't produce ilocs, memoized code is a smob whose type is in the
first word of the smob itself.
* libguile/eval.h (scm_sym_and, scm_sym_begin, scm_sym_case)
(scm_sym_cond, scm_sym_define, scm_sym_do, scm_sym_if, scm_sym_lambda)
(scm_sym_let, scm_sym_letstar, scm_sym_letrec, scm_sym_quote)
(scm_sym_quasiquote, scm_sym_unquote, scm_sym_uq_splicing, scm_sym_at)
(scm_sym_atat, scm_sym_atapply, scm_sym_atcall_cc)
(scm_sym_at_call_with_values, scm_sym_delay, scm_sym_eval_when)
(scm_sym_arrow, scm_sym_else, scm_sym_apply, scm_sym_set_x)
(scm_sym_args): Remove public declaration of these symbols.
(scm_ilookup, scm_lookupcar, scm_eval_car, scm_eval_body)
(scm_eval_args, scm_i_eval_x, scm_i_eval): Remove public declaration
of these functions.
(scm_ceval, scm_deval, scm_ceval_ptr): Remove declarations of these
deprecated functions.
(scm_i_print_iloc, scm_i_print_isym, scm_i_unmemocopy_expr)
(scm_i_unmemocopy_body): Remove declarations of these internal
functions.
(scm_primitive_eval_x, scm_eval_x): Redefine as macros for their less
destructive siblings.
* libguile/Makefile.am: Add memoize.[ch] to the build.
* libguile/debug.h (scm_debug_mode_p, scm_check_entry_p)
(scm_check_apply_p, scm_check_exit_p, scm_check_memoize_p)
(scm_debug_eframe_size): Remove these vars that were tied to the old
evaluator's execution model.
(SCM_RESET_DEBUG_MODE): Remove, no more need for this.
(SCM_MEMOIZEDP, SCM_MEMOIZED_EXP, SCM_MEMOIZED_ENV): Remove macros
referring to old memoized code representation.
(scm_local_eval, scm_procedure_environment, scm_memoized_environment)
(scm_make_memoized, scm_memoized_p): Remove functions operating on old
memoized code representation.
(scm_memcons, scm_mem_to_proc, scm_proc_to_mem): Remove debug-only
code for old evaluator.
* libguile/debug.c: Remove code to correspond with debug.h removals.
(scm_debug_options): No need to set the debug mode or frame limit
here, as we don't have C stack limits any more. Perhaps this is a bug,
but as long as we can compile eval.scm, we should be fine.
* libguile/init.c (scm_i_init_guile): Init memoize.c.
* libguile/modules.c (scm_top_level_env, scm_env_top_level)
(scm_env_module, scm_system_module_env_p): Remove these functions.
* libguile/print.c (iprin1): No more need to handle isyms. Adapt to new
form of interpreted procedures.
* libguile/procprop.c (scm_i_procedure_arity): Adapt to new form of
interpreted procedures.
* libguile/procs.c (scm_thunk_p): Adapt to new form of interpreted
procedures.
* libguile/procs.h (SCM_CLOSURE_FORMALS): Removed, this exists no more.
(SCM_CLOSURE_NUM_REQUIRED_ARGS, SCM_CLOSURE_HAS_REST_ARGS): New
accessors.
* libguile/srcprop.c (scm_source_properties, scm_source_property)
(scm_set_source_property_x): Remove special cases for memoized code.
* libguile/stacks.c (read_frame): Remove a source-property case for
interpreted code.
(NEXT_FRAME): Remove a case that I don't fully understand, that seems
to be designed to skip over apply frames. Will be obsolete in the
futures.
(read_frames): Default source value for interpreted frames to #f.
(narrow_stack): Don't pay attention to the system_module thing.
* libguile/tags.h: Remove isyms and ilocs. Whee!
* libguile/validate.h (SCM_VALIDATE_MEMOIZED): Fix to use the new
MEMOIZED_P formulation.
* module/ice-9/psyntax-pp.scm (do, quasiquote, case): Adapt for these no
longer being primitive macros.
* module/ice-9/boot-9.scm: Whitespace change, but just a poke to force a
rebuild due to and/or/cond/... not being primitives any more.
* module/ice-9/deprecated.scm (unmemoize-expr): Deprecate, it's
unmemoize-expression now.
* test-suite/tests/eval.test ("define set procedure-name"): XFAIL a
couple of tests here; I don't know what to do about them. I reckon the
expander should ensure that defined values are named.
* test-suite/tests/chars.test ("basic char handling"): Fix expected
exception when trying to apply a char.
Andy Wingo [Sat, 28 Nov 2009 00:19:31 +0000 (01:19 +0100)]
goops moving away from evaluator opcodes, and a primitive compilation fix
* module/oop/goops.scm (@slot-ref, @slot-set!): Define "primitives" for
these. Probably should do something more general, though, allowing
@struct-ref.
* module/language/tree-il/primitives.scm (add-interesting-primitive!):
Error if the primitive isn't bound.
Andy Wingo [Fri, 27 Nov 2009 10:37:17 +0000 (11:37 +0100)]
remove (lang elisp), as it won't work with the new evaluator
* lang/: Delete. This causes me some pain, but the new elisp compiler is
coming soon, and the old one really won't work with the new evaluator.
* Makefile.am:
* configure.ac: Autotoolery for elisp removal.
* test-suite/tests/elisp.test: Comment out the body of the elisp test.
The tests themselves should be useful in the new world, though.
Andy Wingo [Thu, 26 Nov 2009 21:11:40 +0000 (22:11 +0100)]
local-eval will go away
* module/ice-9/debugger/commands.scm:
* module/ice-9/debugging/traps.scm:
* module/ice-9/emacs.scm:
* module/ice-9/gds-client.scm: Add some FIXMEs due to impending
local-eval removal.
* module/oop/goops.scm (make-generic-bound-check-getter): Just the
compiled closure case here.
Andy Wingo [Fri, 27 Nov 2009 20:31:43 +0000 (21:31 +0100)]
no special treatment for memoized code in srcprop.c
* libguile/srcprop.c (scm_set_source_properties_x): No need to treat
memoized code specially.
* test-suite/tests/srcprop.test ("set-source-property!")
("set-source-properties!"): Well, just throw 'unresolved on these for
now, because we need a few more things to land before these can be
fixed, or even considered.
Andy Wingo [Fri, 27 Nov 2009 22:12:35 +0000 (23:12 +0100)]
factor copy-tree and cons-source out of eval.[ch]
* libguile.h:
* libguile/Makefile.am
* libguile/init.c (scm_i_init_guile): Add trees.[ch] to the build.
* libguile/eval.c:
* libguile/eval.h: Remove scm_copy_tree and scm_cons_source...
* libguile/trees.h:
* libguile/trees.c:
* libguile/srcprop.h:
* libguile/srcprop.c: ... factoring them out here and here,
respectively.
* test-suite/tests/eval.test ("memoization"): Change expected exception
for circular data structures, given new copy-tree location.
Andy Wingo [Fri, 27 Nov 2009 20:17:42 +0000 (21:17 +0100)]
remove unused scm_eval_stack var
* libguile/private-options.h:
* libguile/eval.c (scm_eval_stack): Remove declaration and definition of
unused scm_eval_stack variable.
Andy Wingo [Fri, 27 Nov 2009 23:22:47 +0000 (00:22 +0100)]
remove evaluator-specific code from macros.c
* libguile/macros.c (macro_print): No special printing for macros
whose code is an interpreted procedure.
Andy Wingo [Fri, 27 Nov 2009 19:50:40 +0000 (20:50 +0100)]
remove class-environment slot, goops grubs less in the evaluator
* libguile/goops.h (scm_sys_tag_body): Remove declaration of undefined
function.
(SCM_CLASS_CLASS_LAYOUT, scm_si_environment, SCM_N_CLASS_SLOTS)
(scm_class_environment) Remove class environment slot and getter.
* libguile/goops.c (compute_getters_n_setters): Use scm_primitive_eval
to produce the init thunk, instead of scm_i_eval_x; though really we
should be doing this in Scheme.
(scm_basic_basic_make_class, build_class_class_slots)
(create_basic_classes, scm_class_environment): Remove class
environment slot.
(get_slot_value, set_slot_value): Use scm_call_1 instead of evaluator
tricks.
* module/oop/goops.scm: Remove class-environment export, and
environments throughout the file.
Andy Wingo [Fri, 27 Nov 2009 19:43:22 +0000 (20:43 +0100)]
fix to gdb_eval to use newer interfaces
* libguile/gdbint.c (gdb_eval): Use scm_primitive_eval instead of
scm_i_eval_x.
Andy Wingo [Fri, 27 Nov 2009 19:36:09 +0000 (20:36 +0100)]
formally deprecate trampolines
* libguile/eval.c:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_trampoline_0, scm_trampoline_1)
(scm_trampoline_2): Actually deprecate trampolines.
* srfi/srfi-1.c: Fix all trampoline uses in srfi-1.c.
Andy Wingo [Fri, 27 Nov 2009 17:13:59 +0000 (18:13 +0100)]
remove uses of trampolines within guile itself
* libguile/eval.c (scm_map, scm_for_each)
* libguile/hashtab.c (scm_hash_for_each_handle)
* libguile/list.c (scm_filter, scm_filter_x)
* libguile/quicksort.i.c:
* libguile/sort.c (scm_restricted_vector_sort_x, scm_sorted_p)
(scm_merge, scm_merge_list_x, scm_merge_x)
(scm_merge_list_step, scm_sort_x, scm_sort, scm_merge_vector_x)
(scm_merge_vector_step, scm_stable_sort_x, scm_sort_list_x)
(scm_sort_list)nn
* libguile/srfi-13.c (scm_string_any, scm_string_every)
(scm_string_tabulate, scm_string_trim, string_trim_right)
(scm_string_trim_both, scm_string_index, scm_string_index_right)
(scm_string_skip, scm_string_skip_right, scm_string_count)
(scm_string_map, scm_string_map_x, scm_string_for_each)
(scm_string_for_each_index, scm_string_filter, scm_string_delete):
Remove uses of trampolines.
Andy Wingo [Fri, 27 Nov 2009 16:35:37 +0000 (17:35 +0100)]
gut the backtrace implementation for memoized code
* libguile/backtrace.c (display_header, display_expression)
(display_error_body, display_backtrace_get_file_line, display_frame):
Gut the implementation for memoized code, as memoized code as it is
currently understood is going away.
Andy Wingo [Fri, 27 Nov 2009 16:24:12 +0000 (17:24 +0100)]
remove some deprecated things, undeprecate scm_the_root_module()
* libguile/deprecated.h
* libguile/deprecated.c (SCM_ILOC00, SCM_IDINC, SCM_IDSTMSK)
(scm_s_expression, scm_s_test, scm_s_body, scm_s_bindings)
(scm_s_variable, scm_s_clauses, scm_s_formals, SCM_EVALIM2)
(SCM_EVALIM, SCM_XEVAL, SCM_XEVALCAR): Remove these macros and
constants, deprecated in 2003.
(scm_the_root_module): Undeprecate, it's actually a useful function,
that other parts of the code use.
* libguile/modules.h (scm_the_root_module): Undeprecated.
* libguile/modules.c (scm_the_root_module): Rename from
the_root_module. Use it in the rest of this file.
Andy Wingo [Thu, 20 Aug 2009 23:17:32 +0000 (01:17 +0200)]
tweak to eval.c
* libguile/eval.c (eval_letrec_inits): Rename from ceval_letrec_inits.
Caller changed.
Andy Wingo [Thu, 20 Aug 2009 23:14:57 +0000 (01:14 +0200)]
eval.i.c -> eval.c
* libguile/Makefile.am:
* libguile/eval.i.c: Remove eval.i.c.
* libguile/eval.c: Fold eval.i.c's contents into eval.c.
Andy Wingo [Thu, 20 Aug 2009 23:06:00 +0000 (01:06 +0200)]
more ceval excision
* libguile/eval.c:
* libguile/eval.i.c: Rename deval to eval. Substitute in some
preprocessor macros.
Andy Wingo [Thu, 20 Aug 2009 23:00:28 +0000 (01:00 +0200)]
remove code from eval.i.c that was only for CEVAL.
* libguile/eval.i.c: Remove CEVAL-only code.
Andy Wingo [Thu, 20 Aug 2009 22:54:34 +0000 (00:54 +0200)]
Don't double-include eval.i.c -- let's only build deval.
* libguile/eval.c (SCM_I_XEVAL, SCM_I_XEVALCAR): No more debug_p args,
we are always debugging. Adapt all callers.
(ceval_letrec_inits): For some reason this function is used by deval.
No idea why. Pull it out here.
* libguile/eval.i.c (SCM_APPLY): scm_dapply is scm_apply.
Andy Wingo [Thu, 20 Aug 2009 22:38:48 +0000 (00:38 +0200)]
gut trampolines
* libguile/eval.c: Gut the trampoline implementation. We'll be doing
much more clever things here that will obviate the need for the
procedure arg of map and for-each to be allocated in many cases...
trampolines were a noble attempt at optimizing in the wrong place.
* srfi/srfi-1.c (scm_srfi1_lset_difference_x): Validate that we get a
proc, because the trampoline won't do it for us.
* test-suite/tests/sort.test ("sort"):
* test-suite/tests/srfi-1.test ("count", "fold", "list-index"):
Change expected exceptions, due to trampoline functions not doing any
computation.
Andy Wingo [Thu, 20 Aug 2009 22:37:39 +0000 (00:37 +0200)]
expand out named let to letrec in the eval case
* module/ice-9/psyntax.scm: In the eval case, expand out named let to
letrec.
* module/ice-9/psyntax-pp.scm: Regenerated.
Ludovic Courtès [Sun, 29 Nov 2009 15:45:38 +0000 (16:45 +0100)]
Make `SCM' type definition acceptable for C++ compilers.
* libguile/tags.h (SCM) [SCM_DEBUG_TYPING_STRICTNESS == 1]: Use a named
struct to avoid errors from C++ compilers such as "error: non-local
function ‘<anonymous struct>* foo(<anonymous struct>*)’ uses anonymous
type". This fixes a regression introduced in
c6054feaf03f8bde236f5e45a946f38827074923 ("Add support for static
allocation of cells, strings and stringbufs."). Reported by Linas
Vepstas <linasvepstas@gmail.com>.
Ludovic Courtès [Sat, 28 Nov 2009 21:52:16 +0000 (22:52 +0100)]
Remove remaining uses of discouraged constructs, really.
* libguile/throw.c, libguile/vm-engine.h, libguile/vm-i-system.c,
libguile/vm.c: Replace uses of discouraged constructs by their
current counterparts.
Ludovic Courtès [Sat, 28 Nov 2009 14:11:31 +0000 (15:11 +0100)]
Remove remaining uses of discouraged constructs.
* libguile/frames.c, libguile/instructions.c, libguile/objcodes.c,
libguile/programs.c, libguile/throw.c, libguile/vm-i-scheme.c,
libguile/vm.c: Replace uses of discouraged constructs by their
current counterparts.
Ludovic Courtès [Fri, 27 Nov 2009 16:00:51 +0000 (17:00 +0100)]
Disable encoding scanning on non-seekable file ports.
* libguile/read.c (scm_i_scan_for_encoding): Don't attempt to scan
non-seekable file ports.