Ludovic Courtès [Sun, 8 Nov 2009 00:13:46 +0000 (01:13 +0100)]
Fix C99-style comments.
* libguile/generalized-vectors.c, libguile/programs.c, libguile/vm.c:
Replace C99-style comments by plain old C89 comments.
Ludovic Courtès [Sun, 8 Nov 2009 00:12:35 +0000 (01:12 +0100)]
Compile with `-Warity-mismatch'.
* am/guilec (GUILE_WARNINGS): New variable; add `-Warity-mismatch'.
(.scm.go): Use it.
Ludovic Courtès [Sun, 8 Nov 2009 00:11:19 +0000 (01:11 +0100)]
Add tests for `unbound-variable-analysis'.
* test-suite/tests/tree-il.test ("warnings")["unbound
variable"]("optional arguments are visible", "keyword arguments are
visible"): New tests.
Ludovic Courtès [Sun, 8 Nov 2009 00:08:54 +0000 (01:08 +0100)]
Fix optional argument handling in `unused-variable-analysis'.
* module/language/tree-il/analyze.scm (unused-variable-analysis): Fix
optional argument handling in <lambda-case>.
Ludovic Courtès [Sun, 8 Nov 2009 00:02:08 +0000 (01:02 +0100)]
Add support for keyword arguments in `arity-mismatch-analysis'.
* module/language/tree-il/analyze.scm
(validate-arity)[filter-keyword-args]: New procedure.
[arity]: Get accurate arity for programs, return ALLOW-OTHER-KEYS? as
an additional value.
Update to `arity' change; use `filter-keyword-args'.
* test-suite/tests/tree-il.test ("warnings")["arity mismatch"]("keyword
not passed and quiet", "keyword passed and quiet", "keyword passed to
global and quiet", "extra keyword", "extra keywords allowed"): New
tests.
Ludovic Courtès [Sat, 7 Nov 2009 18:24:49 +0000 (19:24 +0100)]
Fix typos leading to wrong argument counts.
* module/ice-9/channel.scm (eval): Fix number of arguments to
`guile:eval'.
* module/oop/goops/save.scm (write-readably): Fix number of arguments to
`write-array'.
* module/srfi/srfi-19.scm (priv:char->int): Fix number of arguments to
`priv:time-error'.
Ludovic Courtès [Sat, 7 Nov 2009 18:19:16 +0000 (19:19 +0100)]
Fix typos in `psyntax'.
* module/ice-9/psyntax.scm (lambda*-formals): Fix argument count in
`rest' invocations.
[pred]: Fix argument count in `syntax->datum' invocation.
Ludovic Courtès [Sat, 7 Nov 2009 17:32:26 +0000 (18:32 +0100)]
Add `arity-mismatch' warning type.
* module/language/tree-il/analyze.scm (<arity-info>): New record type.
(validate-arity, arity-analysis): New variables.
* module/language/tree-il/compile-glil.scm (%warning-passes): Add
`arity-mismatch'.
* module/system/base/message.scm (%warning-types): Likewise.
* test-suite/tests/tree-il.test (read-and-compile): Remove, as it's now
public.
(%opts-w-arity): New.
("warnings")["arity mismatch"]: New test prefix.
Ludovic Courtès [Fri, 6 Nov 2009 09:42:45 +0000 (10:42 +0100)]
Coalesce tree traversals made for warnings.
* module/language/tree-il/analyze.scm (<tree-analysis>): New type.
(analyze-tree): New procedure.
(report-unused-variables): Replace by...
(unused-variable-analysis): ... this, as a <tree-analysis>.
(report-possibly-unbound-variables): Replace by...
(unbound-variable-analysis): ... this, as a <tree-analysis>.
* module/language/tree-il/compile-glil.scm (%warning-passes): Adjust
accordingly.
(compile-glil): Likewise. Use `analyze-tree'.
Ludovic Courtès [Fri, 30 Oct 2009 10:31:51 +0000 (11:31 +0100)]
Hold the GC lock when traversing weak hash table buckets.
* libguile/hashtab.c (scm_fixup_weak_alist): Clarify comment.
(struct t_assoc_args): New.
(do_weak_bucket_assoc, weak_bucket_assoc): New.
(START_WEAK_BUCKET_FIXUP, END_WEAK_BUCKET_FIXUP): Remove.
(scm_hash_fn_get_handle, scm_hash_fn_create_handle_x,
scm_hash_fn_remove_x): Use `weak_bucket_assoc ()' instead of
`START_WEAK_BUCKET_FIXUP'/`END_WEAK_BUCKET_FIXUP'.
Ludovic Courtès [Thu, 5 Nov 2009 22:06:45 +0000 (23:06 +0100)]
Fix snarfing of `SCM_DEFINE' with static allocation.
* libguile/snarf.h (SCM_DEFINE)[SCM_SUPPORT_STATIC_ALLOCATION]: Provide
a declaration for FNAME since the last argument to
`SCM_IMMUTABLE_SUBR ()' refers to it.
Neil Jerram [Tue, 3 Nov 2009 21:51:28 +0000 (21:51 +0000)]
Fill code coverage holes in continuations.c and keywords.c
* test-suite/Makefile.am (SCM_TESTS): Add tests/keywords.test.
* test-suite/standalone/Makefile.am (test-loose-ends): New test.
* test-suite/standalone/test-loose-ends.c: New file.
* test-suite/tests/continuations.test: Three new tests.
* test-suite/tests/keywords.test: New file.
Neil Jerram [Tue, 3 Nov 2009 22:50:07 +0000 (22:50 +0000)]
Increase benchmark iterations to improve precision in comparisons over time
* benchmark-suite/benchmarks/continuations.bm: Increase "call/cc"
iterations from 300 to 12000.
* benchmark-suite/benchmarks/srfi-13.bm ("strings"): Increase "copy"
iterations from 1100 to 20000, and "pad" from 6800 to 34000.
* benchmark-suite/benchmarks/uniform-vector-read.bm
("uniform-vector-read!"): Increase "uniform-vector-write" iterations
from 500 to 4000, and "uniform-vector-read!" from 500 to 20000.
Ludovic Courtès [Sun, 1 Nov 2009 23:55:17 +0000 (00:55 +0100)]
Allocate vectors in a contiguous memory area.
* libguile/vectors.c (scm_c_make_vector): Allocate the whole vector and
header with `scm_gc_malloc ()'.
(scm_vector_copy): Use `scm_c_make_vector ()'.
(scm_i_vector_free, MAKE_WEAK_VECTOR): Remove.
(allocate_weak_vector): Rename to...
(make_weak_vector): ... this. Change to return the whole weak vector,
allocated with `scm_gc_malloc_pointerless ()'.
(scm_i_make_weak_vector, scm_i_make_weak_vector_from_list): Use
`make_weak_vector ()'.
* libguile/vectors.h (SCM_I_VECTOR_HEADER_SIZE): New macro.
(SCM_I_VECTOR_ELTS): Write in terms of `SCM_I_VECTOR_WELTS ()'.
(SCM_I_VECTOR_WELTS): Update to the new representation.
(SCM_I_WVECT_EXTRA, SCM_I_SET_WVECT_EXTRA): Likewise.
(SCM_I_WVECT_GC_CHAIN, SCM_I_SET_WVECT_GC_CHAIN): Remove.
* libguile/weaks.h (SCM_I_WVECT_DELTA, SCM_I_SET_WVECT_DELTA): Remove.
Ludovic Courtès [Sun, 1 Nov 2009 22:29:36 +0000 (23:29 +0100)]
Restore signature of `scm_search_path ()' as found in 1.8.
The incompatibly was introduced by
22f4ee48822db5e30df3abf9a11b6066f2bab9d3 ("make primitive-load-path load
compiled files if available").
* doc/ref/api-options.texi (Build Config): Update `search-path'
documentation.
* libguile/load.c (scm_search_path): Change C prototype to expect only 3
arguments. Parse the rest argument accordingly. Update callers.
* libguile/load.h (scm_search_path): Update accordingly.
Ludovic Courtès [Sun, 1 Nov 2009 17:17:31 +0000 (18:17 +0100)]
Merge branch 'bdw-gc-static-alloc'
Conflicts:
acinclude.m4
libguile/__scm.h
libguile/bdw-gc.h
libguile/eval.c
Ken Raeburn [Thu, 29 Oct 2009 16:16:12 +0000 (12:16 -0400)]
Clean up some uses of old GC macros that don't exist any more.
* libguile/deprecated.h (SCM_GC8MARKP, SCM_SETGC8MARK, SCM_CLRGC8MARK):
Delete.
* libguile/gc.c (scm_assert_cell_valid): Remove check of SCM_GC_MARK_P.
Ken Raeburn [Thu, 29 Oct 2009 21:22:17 +0000 (17:22 -0400)]
Since support for "futures" in C has been completely disabled for some
time, and should be easily implementable in Scheme with the current
thread support, delete the C code.
* libguile/futures.c, libguile/futures.h: Delete.
* libguile/Makefile.am (libguile_la_SOURCES, DOT_X_FILES,
DOT_DOC_FILES, modinclude_HEADERS): Delete references to futures.*
files.
* libguile.h: Don't include futures.h.
* libguile/eval.c: Don't include futures.h.
(isymnames): Delete "#@future" entry.
(scm_m_future, s_future, scm_sym_future, unmemoize_future,
unmemoize_builtin_macro): Delete disabled futures code.
* libguile/eval.i.c (CEVAL): Delete disabled futures code.
* libguile/init.c: Don't include futures.h.
(scm_i_init_guile): Delete disabled futures initialization call.
* libguile/tags.h (SCM_IM_FUTURE): Delete.
(SCM_IM_CALL_WITH_VALUES, SCM_IM_ELSE, SCM_IM_ARROW,
SCM_IM_NIL_COND, SCM_IM_BIND): Renumber.
* doc/ref/api-scheduling.texi: Delete commented-out node on Futures.
* doc/maint/guile.texi: Delete make-future and future-ref mentions.
Ken Raeburn [Thu, 29 Oct 2009 16:45:04 +0000 (12:45 -0400)]
* meta/gdb-uninstalled-guile.in: Specify a path to libtool.
Ken Raeburn [Thu, 29 Oct 2009 17:06:35 +0000 (13:06 -0400)]
Fix autogen.sh for Mac OS X.
* autogen.sh: If uname indicates that the OS is Darwin, run "glibtool"
instead of "libtool" for the version number check.
Michael Gran [Wed, 28 Oct 2009 13:27:47 +0000 (06:27 -0700)]
Fix incorrect display of wide strings in decompilation
A byte ordering error caused incorrect display of wide strings
when using the ",c" decompilation from the REPL.
* module/language/assembly/decompile-bytecode.scm (decode-bytecode):
wide strings are encoded in native endianness
Michael Gran [Wed, 28 Oct 2009 13:24:23 +0000 (06:24 -0700)]
Modify bytevectors/string conversions to allow wide strings
The bytevector to string conversion functions were accomplished
by converting via locale strings. This did not allow conversions
of wide strings in an 8-bit locale. This is avoided by using knowledge
of the storage format of the string.
* libguile/bytevectors.c (STRING_TO_UTF, scm_string_to_utf8): modify
string to bytevector conversion to use internal string information
(UTF_TO_STRING, scm_utf8_to_string): modify bytevector to string
conversion
Mark H Weaver [Tue, 27 Oct 2009 21:59:22 +0000 (22:59 +0100)]
fix nil handling in the vm
* libguile/vm-i-scheme.c (not, not-not): Treat nil as false.
(null?, not-null?): Treat nil as null.
* libguile/vm-i-system.c (br-if, br-if-not): Treat nil as false.
(br-if-null, br-if-not-null): Treat nil as null.
Mark H Weaver [Mon, 26 Oct 2009 22:56:03 +0000 (23:56 +0100)]
the cube of lisp booleans (#f nil () #t)
* Renumbers the IFLAG constants.
* Adds several macros related to boolean type tests, null tests, and
boolean-truth testing (including lisp-style boolean-truth tests).
* Adds compile-time checks to verify the necessary IFLAG numbering
properties needed for the checks to work properly.
* Changes some existing code to use the new optimized macros, without
changing the semantics of the code at all (except that scm_is_bool
is changed from a function to a macro).
I added the following macros, whose names explicitly state how %nil
should be handled. See the comments in the patch for more information
about these.
scm_is_false_assume_not_lisp_nil scm_is_true_assume_not_lisp_nil
scm_is_false_and_not_lisp_nil scm_is_true_or_lisp_nil
scm_is_false_or_lisp_nil scm_is_true_and_not_lisp_nil
scm_is_lisp_false scm_is_lisp_true
scm_is_null_assume_not_lisp_nil
scm_is_null_and_not_lisp_nil
scm_is_null_or_lisp_nil
scm_is_bool_and_not_lisp_nil
scm_is_bool_or_lisp_nil
The following already-existing macros are defined as aliases, such
that their semantics is unchanged (although scm_is_bool used to be a
function and is now a macro).
scm_is_null --> scm_is_null_and_not_lisp_nil
scm_is_false --> scm_is_false_and_not_lisp_nil
scm_is_true --> scm_is_true_or_lisp_nil
scm_is_bool --> scm_is_bool_and_not_lisp_nil
(I still believe that these should be changed to versions that handle
%nil properly, but await approval on that point, so these patches do
not make those changes)
Also, if the preprocessor macro SCM_ENABLE_ELISP is not true (this
macro already existed and was used in lang.h), all overheads
associated with %nil handling are eliminated from the above macros.
* libguile/tags.h (SCM_BOOL_F, SCM_BOOL_T, SCM_UNSPECIFIED)
(SCM_UNDEFINED, SCM_UNBOUND, SCM_ELISP_NIL): Renumber, so that a
number of important distinctions (false versus true, end-of-list, etc)
can be made by masking a single bit. Also define a number of
build-time tests to assert that this condition holds.
* libguile/boolean.h (scm_is_false_and_not_nil, scm_is_true_or_nil)
(scm_is_false_assume_not_nil, scm_is_true_assume_not_nil):
(scm_is_false_or_nil, scm_is_true_and_not_nil)
(scm_is_bool_or_nil, scm_is_bool_and_not_nil): New exciting macros to
test certain boolean/end-of-list properties.
(scm_is_false, scm_is_true): Use a restrictive definition, where only
SCM_BOOL_F is false. Should probably change in the future.
(scm_is_bool): Incompatible change: changed to be a macro. Was a
function before. Probably should allow nil as a boolean, but that will
be for a later patch.
(scm_is_lisp_false, scm_is_lisp_true): New macros, implementing the
standard Lisp boolean predicates, where '() is actually false.
* libguile/eval.i.c (CEVAL): Fix a number of false-or-nil and similar
tests to use the new macros.
* libguile/lang.h (SCM_NULL_OR_NIL_P): Use scm_is_null_or_nil.
* libguile/pairs.c: Add a compile-time check that null and nil differ by
only one bit.
* libguile/pairs.h (scm_is_null_and_not_nil, scm_is_null_assume_not_nil)
(scm_is_null_or_nil): New exciting macros!
(scm_is_null): Just be scm_is_null_and_not_nil, for now.
* libguile/print.c: Adapt to the reordering, and print suitably nasty
things for the not-to-be-used values.
Ludovic Courtès [Mon, 26 Oct 2009 22:56:03 +0000 (23:56 +0100)]
Use proper fold/for-each function types in `hashtab.h'.
* libguile/hashtab.h (scm_t_hash_fold_fn, scm_t_hash_handle_fn): New
types.
(scm_internal_hash_fold, scm_internal_hash_for_each_handle): Use them.
* libguile/hashtab.c (scm_internal_hash_fold): Take an
`scm_t_hash_fold_fn'. Update callers.
(scm_internal_hash_for_each_handle): Take an `scm_t_hash_handle_fn'.
Update callers.
Ludovic Courtès [Mon, 26 Oct 2009 22:38:13 +0000 (23:38 +0100)]
Use proper assoc/hash function types in `hashtab.c'.
This is a followup to
d587c9e8b27219e68f8813fb648fc6913c93be0f ("Use
proper types for hash/assoc functions in `hashtab.h'.").
* libguile/hashtab.c (scm_i_rehash, scm_hash_fn_create_handle_x,
scm_hash_fn_ref, scm_hash_fn_set_x, scm_hash_fn_remove_x): Use
`scm_t_hash_fn' and `scm_t_assoc_fn' as appropriate.
Andy Wingo [Mon, 26 Oct 2009 23:08:20 +0000 (00:08 +0100)]
update procedure docs for programs, lambda*, case-lambda
* module/system/vm/program.scm: Export the arity things again, and
program-arity. Why not.
* doc/ref/api-procedures.texi (Compiled Procedures): Update for current
API.
(Optional Arguments): Update to assume lambda* and define* are always
available, and (ice-9 optargs) is now the ghetto.
(Case-lambda): Now here, moved from SRFI-16 docs. Also docs
case-lambda*.
* doc/ref/srfi-modules.texi: Point to core case-lambda docs.
Andy Wingo [Mon, 26 Oct 2009 20:20:23 +0000 (21:20 +0100)]
implement #:predicate
will be useful for making e.g. typecase-lambda. Tough to tell though.
* module/ice-9/psyntax.scm (lambda-formals, lambda*-formals): Parse out
a #:predicate, which goes right before the rest args. The vanilla
lambda doesn't parse it out of course, but it does return another
value.
(chi-lambda-case, lambda*, lambda): Expand and pass the predicate on
to build-lambda-case.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/language/tree-il/compile-glil.scm (flatten): Compile a failing
predicate without an else clause into a call to `error'. Also, fix
something the compile warnings caught.
Ludovic Courtès [Mon, 26 Oct 2009 09:25:38 +0000 (10:25 +0100)]
Don't use memset(3) after `GC_MALLOC ()' calls.
* libguile/gc-malloc.c (scm_gc_calloc): Don't use memset(3) as it's not
needed. Reported by Andy Wingo.
Julian Graham [Sun, 25 Oct 2009 17:00:08 +0000 (13:00 -0400)]
Resolve warning in gcc-4.3 about transposed parameters passed to memset
* libguile/gc-malloc.c (scm_gc_calloc): Add explicit check on size parameter
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Ludovic Courtès [Sun, 25 Oct 2009 21:57:29 +0000 (22:57 +0100)]
SRFI-35: Provide nice vtable names, to make GOOPS happier.
* module/srfi/srfi-35.scm (%make-condition-type): New procedure.
(make-condition-type, make-compound-condition-type): Use it.
* test-suite/tests/srfi-35.test ("condition
types")["struct-vtable-name"]: New test.
Ludovic Courtès [Sun, 25 Oct 2009 21:49:28 +0000 (22:49 +0100)]
Fix GOOPS `class-of' for nameless structs.
* libguile/goops.c (scm_class_of): Fix second argument for
`scm_make_extended_class_from_symbol ()' for nameless structs.
* test-suite/tests/goops.test ("classes for built-in types")["struct
vtable"]: New test case.
Andy Wingo [Sun, 25 Oct 2009 12:19:11 +0000 (13:19 +0100)]
srfi-16 just re-exports psyntax's case-lambda
* module/srfi/srfi-16.scm (case-lambda): Just re-export the core's
case-lambda, it's semantically the same but faster and better
integrated.
Andy Wingo [Sun, 25 Oct 2009 11:39:03 +0000 (12:39 +0100)]
case-lambda, case-lambda* in psyntax
* module/ice-9/psyntax.scm (case-lambda, case-lambda*): Add
implementations of these, present in the base environment.
* module/ice-9/psyntax-pp.scm: Regenerated.
* module/srfi/srfi-16.scm (case-lambda): Replace the core's case-lambda
definition with our own. We're not quite ready to switch yet.
Andy Wingo [Sun, 25 Oct 2009 11:41:48 +0000 (12:41 +0100)]
assembly/disassembly support for br-if-nargs-*
* module/language/assembly/compile-bytecode.scm (write-bytecode): Handle
br-if-nargs compilation.
* module/language/assembly/decompile-bytecode.scm (decode-load-program):
And decompile them nicely as well.
* module/language/assembly/disassemble.scm (code-annotation): And,
present the disassembly if br-if-nargs-* nicely.
Andy Wingo [Sun, 25 Oct 2009 12:01:57 +0000 (13:01 +0100)]
arities can have noncontiguous starts and ends
* module/language/glil/compile-assembly.scm (open-arity, close-arity)
(begin-arity, glil->assembly): Refactor so that arities can have
noncontiguous starts and ends. So within a prelude there is no arity
-- only before (the previous arity) or after (the new arity).
* module/system/vm/program.scm (arity:end): Add this private accessor.
Arities are expected to be in the new format. While not a change in
objcode format, it is an incompatible change, so I'll bump the objcode
cookie.
(program-arity): Check that the ip is within both bounds of the arity.
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump.
* libguile/programs.c (scm_i_program_arity): Update for new arity format.
* module/system/vm/frame.scm (vm-frame-arguments): Avoid throwing an
error in this function, which is called from the backtrace code.
Andy Wingo [Sun, 25 Oct 2009 11:36:44 +0000 (12:36 +0100)]
refactor psyntax.scm's treatment of lambda and lambda*
* module/ice-9/psyntax.scm (lambda-formals, chi-simple-lambda)
(lambda*-formals, chi-lambda-case): Refactor the lambda
transformations with an eye to being able to do case-lambda.
* module/ice-9/psyntax-pp.scm: Regenerated.
* test-suite/tests/syntax.test: Adapted tests so that the errors we
expect match what is given by psyntax.
Andy Wingo [Sat, 24 Oct 2009 14:32:27 +0000 (16:32 +0200)]
define* in psyntax
* module/ice-9/optargs.scm:
* module/ice-9/psyntax-pp.scm:
* module/ice-9/psyntax.scm: Make define* available in the default
environment, as lambda* is available there.
Andy Wingo [Sat, 24 Oct 2009 14:18:56 +0000 (16:18 +0200)]
procedure property table is only key-weak, not doubly-weak
* libguile/procprop.c: Make the procedure property table only key-weak.
It seems that we want the association as long as the key is around.
Ken Raeburn [Fri, 23 Oct 2009 18:00:19 +0000 (14:00 -0400)]
Reduce some errors under -DSCM_DEBUG=1.
* goops.c (scm_sys_modify_instance, scm_sys_modify_class): Use
SCM_{,SET_}CELL_WORD_[01] instead of SCM_{,SET}C[AD]R since the
objects passed are not pairs.
Andy Wingo [Fri, 23 Oct 2009 14:29:06 +0000 (16:29 +0200)]
(ice-9 optargs) based on the new lambda* work
* module/ice-9/optargs.scm (let-optional, let-optional*, let-keywords)
(let-keywords*): Implement in terms of parse-lambda-case, so all the
logic is in one place.
(lambda*): Re-export from the default environment -- it's all in the
VM now :-))
(define*, define*-public, defmacro*, defmacro*-public): Implement with
syntax-case.
Andy Wingo [Fri, 23 Oct 2009 13:50:53 +0000 (15:50 +0200)]
lambda* in psyntax
* module/ice-9/psyntax.scm (build-lambda-case): Take an "inits" arg.
Also work around a nasty memoizer bug: see
http://article.gmane.org/gmane.lisp.guile.devel/9561.
(lambda*): Implement in psyntax, in the default environment. Exciting
stuff!
* module/ice-9/psyntax-pp.scm: Regenerated.
* module/ice-9/optargs.scm (parse-lambda-case): Helper for lambda* when
we're running under the interpreter.
Andy Wingo [Fri, 23 Oct 2009 13:51:00 +0000 (15:51 +0200)]
separate "inits" field in <lambda-case>; compile fixes for inits, kwargs
* module/language/tree-il.scm (<lambda-case>): Add "inits" field, so we
don't have to parse it out of opt and kw. Adapt the traversal
procedures.
* module/language/tree-il/analyze.scm (analyze-lexicals): Analyze
lexicals in the <lambda-case> init expressions as well. Fix keyword
allocation.
* module/language/tree-il/compile-glil.scm (compile-glil): Adapt to
make-lambda-case change.
(flatten): Adapt to "inits" slot, actually init uninitialized args,
and fix bugs related to keyword arguments.
* module/language/tree-il/inline.scm (inline!): Adapt a little bit --
but with no effect.
* module/language/glil/compile-assembly.scm (glil->assembly): Flesh out
<glil-kw-prelude> compilation some more. Add a "bound?" op for
<glil-lexical>, which will push #t if the local is bound.
* module/ice-9/psyntax.scm (build-simple-lambda, build-lambda-case):
Update for new signature of make-lambda-case.
* module/ice-9/psyntax-pp.scm: Regenerated.
* module/language/brainfuck/compile-tree-il.scm (compile-body):
* module/language/ecmascript/compile-tree-il.scm (comp):
* test-suite/tests/tree-il.test ("lambda"): Update for new lambda-case
syntax.
Andy Wingo [Fri, 23 Oct 2009 13:47:08 +0000 (15:47 +0200)]
add some optargs tests
* libguile/modules.c (scm_module_lookup, scm_lookup): Throw to
'unbound-variable, like eval.i.c does.
* test-suite/tests/optargs.test: Add an optargs test. Run optargs tests
under both the VM and the interpreter.
Andy Wingo [Fri, 23 Oct 2009 13:44:22 +0000 (15:44 +0200)]
vm support for optional/kwarg init code, and bugfixes
* libguile/vm-i-system.c (local-bound?, long-local-bound?)
(variable-bound?): New instructions, push #f unless the local is
bound. You can get unbound locals from optional arguments.
(bind-optionals/shuffle): A number of bugfixes.
(bind-kwargs): Bugfixes. If we enocunter an improper kwarg list but
the procedure has a rest argument, just stop kwarg processing, but
without an error.
Renumbered ops.
* libguile/_scm.h (SCM_OBJCODE_MAJOR_VERSION): Bump.
Andy Wingo [Mon, 19 Oct 2009 20:13:08 +0000 (22:13 +0200)]
more work towards compiling and interpreting keyword args
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bumparoo
* libguile/vm-i-system.c (push-rest, bind-rest): Logically there are
actually two rest binders -- one that pops, conses, and pushes, and
one that pops, conses, and local-sets. The latter is used on keyword
arguments, because the keyword arguments themselves have been shuffled
up on the stack. Renumber ops again.
* module/language/tree-il/compile-glil.scm (flatten): Attempt to handle
compilation of lambda-case with keyword arguments. Might need some
help.
* module/ice-9/psyntax.scm (build-lambda-case): An attempt to handle the
interpreted case correctly. This might need a couple iterations, but
at least it looks like the compile-glil code.
* module/ice-9/psyntax-pp.scm: Regenerated.
* module/language/glil.scm (<glil>): Rename "rest?" to "rest" in
<glil-opt-prelude> and <glil-kw-prelude>, as it is no longer a simple
boolean, but if true is an integer: the index of the local variable to
which the rest should be bound.
* module/language/glil/compile-assembly.scm (glil->assembly): Adapt to
"rest" vs "rest?". In the keyword case, use "bind-rest" instead of
"push-rest".
* test-suite/tests/tree-il.test: Update for opt-prelude change.
Andy Wingo [Sat, 17 Oct 2009 15:23:09 +0000 (17:23 +0200)]
finish support for optional & keyword args; update ecmascript compiler
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump.
* libguile/vm-i-system.c (br-if-nargs-ne, br-if-args-lt)
(br-if-nargs-gt): New instructions, for use by different lambda cases.
(bind-optionals, bind-optionals/shuffle, bind-kwargs): New
instructions, for binding optional and keyword arguments. Renumber
other ops.
* module/language/ecmascript/compile-tree-il.scm (comp, comp-body):
Update for new tree-il. Use the new optional argument mechanism
instead of emulating it with rest arguments.
* module/language/glil/compile-assembly.scm (glil->assembly): Tweaks for
optional and keyword argument compilation.
* module/language/tree-il.scm (parse-tree-il, unparse-tree-il): Make the
else case optional, in the s-expression serialization of tree-il.
* module/language/tree-il/compile-glil.scm (flatten): Handle all of the
lambda-case capabilities.
Andy Wingo [Fri, 16 Oct 2009 15:56:39 +0000 (17:56 +0200)]
fix brainfuck for new tree-il, and add tests
* test-suite/Makefile.am:
* test-suite/tests/brainfuck.test: Add a brainfuck test.
* module/system/base/compile.scm: Also export read-and-compile.
* module/language/tree-il/spec.scm (join): Fix the joiner in the
0-expression case.
* module/language/tree-il/primitives.scm (+): Recognize (+ x -1) as 1-.
* module/language/brainfuck/parse.scm (read-brainfuck): Return EOF if we
actually received EOF, and there were no expressions read.
* module/language/brainfuck/compile-tree-il.scm (compile-body): Fix the
compiler for the new format of "lambda" in tree-il.
Andy Wingo [Tue, 13 Oct 2009 22:08:35 +0000 (00:08 +0200)]
tree-il support for case-lambda
* module/language/tree-il.scm (<lambda>, <lambda-case>): Split lambda
into the lambda itself, denoting the procedure, and lambda-case,
denoting a particular arity case. Lambda-case is fairly featureful,
and has not yet been fully tested.
(<let-values>): Use a <lambda-case> as the binding expression. Seems
to suit the purpose well.
Adapt parsers, unparsers, traversal operators, etc. Sometimes in this
first version we assume there are no optional args, rest args, or a
predicate.
* module/language/tree-il/analyze.scm (analyze-lexicals): Adapt for the
new case-lambda regime. Fairly well commented. It actually simplifies
things.
(report-unused-variables): Update for new tree-il.
* module/language/tree-il/compile-glil.scm: Adapt for the new tree-il.
There are some first stabs here at proper case-lambda compilation, but
they are untested as of yet.
* module/language/tree-il/inline.scm (inline!): Rework so we can
recurse on a single node; though these transformations are strictly
reductive, so they should complete in bounded time. Simplify
accordingly, and adapt to case-lambda. Oh, and we handle lambda->let
in not just the nullary case.
* module/ice-9/psyntax.scm (build-simple-lambda, build-case-lambda)
(build-lambda-case): New constructors. The idea is that after syntax
expansion, we shouldn't have to deal with improper lists any more.
Build-simple-lambda is a shortcut for the common case. The others are
not fully exercised yet. Adapt callers.
(syntax): Add some debugging in the lambda case. I don't fully
understand this, but in practice we don't seem to see rest args here.
(lambda): Inline chi-lambda-clause, and adapt for build-simple-lambda.
* module/ice-9/psyntax-pp.scm: Regenerated.
* test-suite/tests/tree-il.test: Update tests for new tree-il lambda
format, and to expect post-prelude labels for all glil programs.
Andy Wingo [Tue, 13 Oct 2009 21:58:36 +0000 (23:58 +0200)]
procedure property efficiency tweak
* libguile/procprop.c (scm_procedure_property)
scm_set_procedure_property_x): Fix to not call
scm_procedure_properties(), and thus to avoid consing up the arity as
well.
Andy Wingo [Tue, 13 Oct 2009 21:55:58 +0000 (23:55 +0200)]
flesh out glil support for optional and keyword arguments
* libguile/vm-i-system.c (bind-rest): Renamed from push-rest-list.
(reserve-locals): Change so that instead of reserving space for some
additional number of locals, reserve-locals takes the absolute number
of locals, including the arguments.
* module/language/glil.scm (<glil-std-prelude>, <glil-opt-prelude>)
(<glil-kw-prelude>): New GLIL constructs, to replace <glil-arity>.
* module/language/glil/compile-assembly.scm (glil->assembly): Compile
the new preludes. Some instructions are not yet implemented, though.
* module/language/tree-il/analyze.scm (analyze-lexicals): The nlocs for
a lambda will now be the total number of locals, including arguments.
* module/language/tree-il/compile-glil.scm (flatten-lambda): Update to
write the new prelude.
* module/system/vm/program.scm (program-bindings-for-ip): If a given
index doesn't have a binding at the ip given, don't cons it on the
resulting list.
* test-suite/tests/tree-il.test: Update for GLIL changes.
Andy Wingo [Tue, 13 Oct 2009 21:45:22 +0000 (23:45 +0200)]
de-nargs struct scm_objcode; procedure-property refactor
* libguile/objcodes.h (struct scm_objcode): Remove nargs, nrest, and
nlocs, as they are no longer needed. Also obviates the need for a
padding word.
* libguile/procs.c (scm_thunk_p): Use scm_i_program_arity for programs.
* libguile/procprop.c (scm_i_procedure_arity): Use scm_i_program_arity
for programs.
(scm_procedure_properties, scm_set_procedure_properties_x)
(scm_procedure_property, scm_set_procedure_property_x): Rework so that
non-closure properties are stored directly in a weak hash, instead of
needing a weak hash of "stand-in" closures to hold the properties. Fix
docstrings also.
* libguile/root.h (scm_stand_in_procs): Remove from the scm_sys_protects
set. Actually with libGC, we should be able to store the elements of
scm_sys_protects directly as global variables.
* libguile/gc.c (scm_init_storage): Remove scm_stand_in_procs
initialization.
* libguile/programs.c (scm_i_program_arity): New private accessor, tries
to determine the "minimum arity" of a program.
* libguile/vm.c (really_make_boot_program): Adapt to changes in
struct scm_objcode.
* module/language/assembly.scm (*program-header-len*, byte-length):
* module/language/assembly/compile-bytecode.scm (write-bytecode):
* module/language/assembly/decompile-bytecode.scm (decode-load-program):
* module/language/assembly/disassemble.scm (disassemble-load-program):
Adapt to changes in objcode.
* module/system/xref.scm (program-callee-rev-vars): Adapt to changes in
assembly.
* module/language/glil.scm: Remove nargs, nrest, and nlocs from
glil-program.
* module/language/glil/compile-assembly.scm (make-meta, glil->assembly):
* module/language/glil/decompile-assembly.scm (decompile-toplevel):
(decompile-load-program): Adapt to changes in GLIL and assembly.
* module/language/tree-il/compile-glil.scm (flatten-lambda): Adapt to
changes in GLIL.
* test-suite/tests/asm-to-bytecode.test: Adapt to assembly and bytecode
changes.
* test-suite/tests/tree-il.test: Adapt to GLIL changes.
Andy Wingo [Mon, 28 Sep 2009 00:25:39 +0000 (20:25 -0400)]
callees now check their args, cons rest list, reserve locals
* gdbinit: Ignore SIGPWR and SIGXCPU, which the BDW GC seems to use.
* libguile/vm-engine.h (FETCH_WIDTH): Remove unused macro.
(INIT_ARGS, INIT_FRAME): Remove; callees now check their args and
reserve space for their locals.
* libguile/vm-engine.c:
* libguile/vm-i-system.c: Turn on callee arg checking and local
reservation. Seems to work!
Andy Wingo [Sun, 27 Sep 2009 23:50:06 +0000 (19:50 -0400)]
callees reserve their own local vars
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump.
* libguile/vm-i-system.c (reserve-locals): New instruction, to reserve
space for local vars. Other ops renumbered.
* module/language/tree-il/compile-glil.scm (flatten-lambda): Emit
reserve-locals instructions as necessary.
* test-suite/tests/tree-il.test: Update to expect reserve-locals as
appropriate.
Andy Wingo [Sun, 27 Sep 2009 23:25:58 +0000 (19:25 -0400)]
runtime and debugging support for callee-parsed procedure args
* libguile/objcodes.h: Bump for metadata format change.
* libguile/frames.h: Rework so we don't frob the program's nargs, nlocs,
etc at runtime. Instead we don't really know what's a local var, an
argument, or an intermediate value. It's a little unfortunate, but
this will allow for case-lambda, and eventually for good polymorphic
generic dispatch; and the nlocs etc can be heuristically
reconstructed. Such a reconstruction would be better done at the
Scheme level, though.
(SCM_FRAME_STACK_ADDRESS): New macro, the pointer to the base of the
stack elements (not counting the program).
(SCM_FRAME_UPPER_ADDRESS): Repurpose to be the address of the last
element in the bookkeeping part of the stack -- i.e. to point to the
return address.
* libguile/vm-engine.h:
* libguile/vm-i-system.c: Adapt to removal of stack_base. Though we
still detect stack-smashing underflow, we don't do so as precisely as
we did before, because now we only detect overwriting of the frame
metadata.
* libguile/vm-engine.c (vm_engine): Remove the stack_base variable. It
is unnecessary, and difficult to keep track of in the face of
case-lambda. Also fix miscommented "ra" and "mvra" pushes. Push the
vp->ip as the first ra...
* libguile/vm-i-system.c (halt): ...because here we can restore the
vp->ip instead of setting ip to 0. Allows us to introspect ips all
down the stack, including in recursive VM invocations.
* libguile/frames.h:
* libguile/frames.c (scm_vm_frame_stack): Removed, because it's getting
more difficult to tell what's an argument and what's a temporary stack
element.
(scm_vm_frame_num_locals): New accessor.
(scm_vm_frame_instruction_pointer): New accessor.
(scm_vm_frame_arguments): Defer to an implementation in Scheme.
(scm_vm_frame_num_locals scm_vm_frame_local_ref)
(scm_vm_frame_local_set_x): Since we can get not-yet-active frames on
the stack now, with our current calling convention, we have to add a
heuristic here to jump over those frames -- because frames have
pointers in them, not Scheme values.
* libguile/programs.h:
* libguile/programs.c (scm_program_arity): Remove, in favor of..
(scm_program_arities): ...this, which a list of arities, in a new
format, occupying a slot in the metadata.
* module/language/assembly/decompile-bytecode.scm (decode-load-program):
Fix mv-call decompilation.
* module/system/vm/frame.scm (vm-frame-bindings, vm-frame-binding-ref)
(vm-frame-binding-set!): New functions, to access bindings by name in
a frame.
(vm-frame-arguments): Function now implemented in Scheme. Commented
fairly extensively.
* module/system/vm/program.scm (program-bindings-by-index)
(program-bindings-for-ip): New accessors, parsing the program bindings
metadata into something more useful.
(program-arities, program-arguments): In a case-lambda world, we have
to assume that programs can have multiple arities. But it's tough to
detect this algorithmically; instead we're going to require that the
program metadata include information about the arities, and the parts
of the program that that metadata applies to.
(program-lambda-list): New accessor.
(write-program): Show multiple arities.
* module/language/glil/compile-assembly.scm (glil->assembly): Add
"arities" to the state of the compiler, and add arities entries as
appropriate.
Andy Wingo [Sun, 27 Sep 2009 22:16:56 +0000 (18:16 -0400)]
steps on the way to have the callee check the number of arguments
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump.
* libguile/vm-i-system.c (assert-nargs-ee, assert-nargs-ge)
(push-rest-list): New instructions, which for now don't actually do
anything. Renumber the rest of the ops in this file.
* module/language/glil.scm (<glil-arity>): New GLIL type, an entity that
checks the number of args for a block, optionally consing a rest list,
and either branching or erroring if the arity doesn't match.
* module/language/glil/compile-assembly.scm (glil->assembly): Compile
<glil-arity> to assembly. Some of these VM ops are not implemented --
notably the branching case.
* module/language/tree-il/compile-glil.scm (flatten-lambda): Emit
<glil-arity>.
* test-suite/tests/tree-il.test: Update.
Ludovic Courtès [Thu, 22 Oct 2009 20:58:03 +0000 (22:58 +0200)]
Compile Guile modules with `-Wunbound-variable'.
* am/guilec (.scm.go): Compile with `-Wunbound-variable'.
Ludovic Courtès [Thu, 22 Oct 2009 20:42:45 +0000 (22:42 +0200)]
Fix typos leading to unbound variable references.
* module/ice-9/session.scm (help): Fix unbound reference to `env'.
* module/system/vm/program.scm (program-property): Fix typo.
* module/system/vm/frame.scm: Add missing `#:use-module (system vm
objcode)'.
* module/system/repl/command.scm (guile:load): New.
(load): Use either `primitive-load' or `load'.
* module/srfi/srfi-18.scm (thread-sleep!): Fix typo.
* module/srfi/srfi-19.scm: Use `(ice-9 rdelim)'.
(date->broken-down-time, priv:year-day, priv:char->int): Fix typo.
(time-*->time-*, time-*->time-*!): Fix reference to unbound variable
`caller'.
* module/oop/goops.scm (bound-check-get): Fix typo.
* module/language/glil/compile-assembly.scm (glil->assembly): Fix typo.
* module/language/glil.scm (parse-glil): Fix typo.
* module/language/ecmascript/base.scm (object->value/string,
object->value/number, ->number): Fix typos.
* module/language/assembly/disassemble.scm (disassemble-free-vars): Fix
typo.
Ludovic Courtès [Thu, 22 Oct 2009 20:33:53 +0000 (22:33 +0200)]
Adjust `unbound-variable' GOOPS heuristic for `goops.scm'.
* module/language/tree-il/analyze.scm (goops-toplevel-definition): Add
ENV argument. Deal with GOOPS macros expanded within `goops.scm'.
(report-possibly-unbound-variables): Adjust.
Ludovic Courtès [Thu, 22 Oct 2009 20:29:22 +0000 (22:29 +0200)]
Fix bytecode disassembler.
* module/language/assembly/decompile-bytecode.scm (decode-load-program):
Add missing argument to `ensure-label'.
Ludovic Courtès [Thu, 22 Oct 2009 17:05:59 +0000 (19:05 +0200)]
SRFI-88: Call `read-set!' at compile time and run time.
* module/srfi/srfi-88.scm: Call `read-set!' both at compile time and run
time.
Ludovic Courtès [Wed, 21 Oct 2009 22:51:53 +0000 (00:51 +0200)]
Remove obsolete `save-stack' case.
* module/ice-9/boot-9.scm (save-stack): Remove obsolete `tk-stack' case.
Ludovic Courtès [Wed, 21 Oct 2009 22:37:36 +0000 (00:37 +0200)]
Have `-Wunbound-variable' account for GOOPS top-level definitions.
* module/language/tree-il/analyze.scm (goops-toplevel-definition): New
procedure.
(report-possibly-unbound-variables): Check for GOOPS top-level
definitions.
* test-suite/tests/tree-il.test ("warnings")["GOOPS definitions are
visible"]: New test.
Ludovic Courtès [Wed, 21 Oct 2009 21:41:56 +0000 (23:41 +0200)]
Add a `guile-2' SRFI-0 feature.
* doc/ref/srfi-modules.texi (SRFI-0): Mention the `guile-2' feature.
* module/ice-9/boot-9.scm (%cond-expand-features): Add `guile-2'.
Ludovic Courtès [Mon, 19 Oct 2009 22:10:18 +0000 (00:10 +0200)]
Use proper types for hash/assoc functions in `hashtab.h'.
Partly fixes bug #23681 ("Function declarators with empty parentheses
should not be used").
* libguile/goops.c (scm_wrap_component): Cast `scm_sloppy_assq'.
* libguile/hashtab.c (scm_hash_fn_get_handle): Update to take functions
of type `scm_t_hash_fn' and `scm_t_assoc_fn'. Update callers.
(scm_ihashx): Change to match `scm_t_hash_fn'.
(scm_sloppy_assx): Change to match `scm_t_assoc_fn'.
* libguile/hashtab.h (scm_t_hash_fn, scm_t_assoc_fn): New types.
(scm_t_hashtable)[hash_fn]: Change to `scm_t_hash_fn'.
(scm_i_rehash, scm_hash_fn_get_handle, scm_hash_fn_create_handle_x,
scm_hash_fn_ref, scm_hash_fn_set_x, scm_hash_fn_remove_x): Change to
take `scm_t_hash_fn' and `scm_t_assoc_fn' parameters.
* libguile/srcprop.h (scm_whash_get_handle, scm_whash_create_handle,
scm_whash_lookup): Implement in terms of `scm_hashq_*' instead of
`scm_hash_fn_*'.
* libguile/struct.c (scm_struct_ihashq): Change to match
`scm_t_hash_fn'.
(scm_struct_create_handle): Cast `scm_sloppy_assq'.
* libguile/struct.h (scm_struct_ihashq): Update, make internal.
Julian Graham [Sun, 18 Oct 2009 21:56:13 +0000 (17:56 -0400)]
Fix typo in psyntax.scm related to syntax-violation reporting.
* module/ice-9/psyntax.scm (chi-macro): Replace `s' with `(wrap-subst w)'.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Ludovic Courtès [Mon, 19 Oct 2009 20:38:34 +0000 (22:38 +0200)]
Add support for R6RS/SRFI-30 nested block comments.
Suggested by Andreas Rottmann <a.rottmann@gmx.at>.
* libguile/read.c (flush_ws, scm_read_sharp): Add support for
R6RS/SRFI-30 block comments.
(scm_read_r6rs_block_comment): New function.
* test-suite/tests/reader.test (exception:unterminated-block-comment):
Adjust to match both block comment styles.
("reading")["R6RS/SRFI-30 block comment", "R6RS/SRFI-30 nested block
comment", "R6RS/SRFI-30 block comment syntax overridden"]: New tests.
("exceptions")["R6RS/SRFI-30 unterminated nested block comment"]: New
test.
* doc/ref/api-evaluation.texi (Block Comments): Mention SRFI-30/R6RS
block comments.
* doc/ref/srfi-modules.texi (SRFI-30): New node.
Andy Wingo [Sun, 27 Sep 2009 19:57:06 +0000 (15:57 -0400)]
comment fixups to tree-il/compile-glil.scm
* module/language/tree-il/compile-glil.scm: Remove some outdated
comments.
Andy Wingo [Thu, 17 Sep 2009 12:58:31 +0000 (14:58 +0200)]
jumps encoded using 24 bits, not 19; blocks no longer aligned
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump.
* libguile/vm-i-system.c (FETCH_OFFSET, BR): Labels are no longer 8-byte
aligned; instead, jumps are encoded into 3 bytes instead of 2.
(br, br-if, br-if-not, br-if-eq, br-if-not-eq, br-if-null)
(br-if-not-null, mv-call): Adapt for new length of br instructions (3
bytes instead of 2).
* libguile/vm.c (really_make_boot_program): Adapt hand-coded bytecode
for new offset regime.
* module/language/assembly.scm (align-block): No alignment necessary.
* module/language/assembly/compile-bytecode.scm (write-bytecode): Write
out breaks as 24-bit relative jumps.
* module/language/assembly/decompile-bytecode.scm (decode-load-program):
Decompile break instructions.
Andy Wingo [Fri, 16 Oct 2009 13:27:10 +0000 (15:27 +0200)]
compilation enviroments are always modules; simplifications & refactorings
* module/ice-9/boot-9.scm (make-fresh-user-module): New public function,
makes an anonymous beautified module.
* module/language/objcode/spec.scm: We used to have some things in here
that allowed lexical variable names and values to be a part of the
environment, but no more. Now an environment is just a module. If you
want to "inject" free variables into code, just use lambda.
* module/language/scheme/compile-tree-il.scm (compile-tree-il): Same
here. Also, rely on the fact that an environment *will* be a module --
because (system base compile) guarantees that for us.
* module/language/scheme/spec.scm (scheme): In the reader, rely on the
environment being a module. Define a #:make-default-environment
handler, which returns a beautified module, augmented with a fresh
definition for current-reader, so that side effects to current-reader
are restricted to the compilation unit.
* module/language/tree-il/analyze.scm
(report-possibly-unbound-variables):
* module/language/tree-il/compile-glil.scm (compile-glil):
* module/language/tree-il/optimize.scm (optimize!): The environment will
be a module.
* module/system/base/language.scm (<language>): New field,
`make-default-environment'. Defaults to `make-fresh-user-module'.
(default-environment): New accessor, returns a default environment for
a language.
* module/system/repl/common.scm (repl-compile): Always compile relative
to the current module, because a module is always acceptable as an
environment.
* module/system/base/compile.scm (compile-file, compile-and-load): Both
of these have a new keyword argument, #:env. For `compile-file', it
defaults to the default environment of the source language, and for
`compile-and-load', to the current module.
(read-and-compile): If there are no expressions read, pass the joiner
its default environment (via `default-environment joint').
Andy Wingo [Fri, 16 Oct 2009 12:04:42 +0000 (14:04 +0200)]
no more *compilation-environment* fluid
* module/system/base/compile.scm (current-compilation-environment):
Remove, as the only thing that needed it (language readers) now get
the environment as an argument.
(read-and-compile, compile): Rework for no *compilation-environment*,
and default the environment using the define* mechanism.
* module/language/tree-il/analyze.scm (env-module): Hack around the lack
of a current compilation module. Will fix this in the next commit so
that the environment is always valid.
Andy Wingo [Fri, 16 Oct 2009 11:39:24 +0000 (13:39 +0200)]
language-readers receive environment as an arg
* module/language/assembly/spec.scm:
* module/language/brainfuck/spec.scm:
* module/language/bytecode/spec.scm:
* module/language/ecmascript/spec.scm:
* module/language/glil/spec.scm:
* module/language/scheme/spec.scm:
* module/language/tree-il/spec.scm: Language-readers now take two
arguments: the port and the environment. This should allow for
compile-environment-specific reader behavior.
* module/system/base/compile.scm (read-and-compile):
* module/system/repl/common.scm (repl-read): Pass the environment to the
language-reader.
* module/system/repl/repl.scm (meta-reader, prompting-meta-read):
* module/system/repl/command.scm (define-meta-command): Use the second
argument to repl-reader, so we avoid frobbing current-reader.
Andy Wingo [Fri, 16 Oct 2009 11:30:52 +0000 (13:30 +0200)]
repl-reader accepts optional "read" argument
* module/ice-9/boot-9.scm (repl-reader): Accept an optional second
argument, the reader to use. If it is given, use it instead of
dereferencing the current-reader fluid.
* guile-readline/ice-9/readline.scm (activate-readline): Make our
replacement definition of repl-reader compatible with boot-9.
Andy Wingo [Fri, 16 Oct 2009 10:19:43 +0000 (12:19 +0200)]
remove GHIL, Elisp, and R5RS languages
GHIL is obsolete, and it's about time we got rid of it. Elisp and R5RS
were unmodified since their import from Guile-VM, so we ditch them too.
R5RS compilation is supported via compiling Scheme within an R5RS
environment.
Elisp will be supported when we merge in Daniel's work.
Andy Wingo [Fri, 16 Oct 2009 09:59:30 +0000 (11:59 +0200)]
bitvector tweaks
* libguile/arrays.c (scm_from_contiguous_typed_array):
* libguile/bytevectors.c (scm_uniform_array_to_bytevector): Error if the
uniform element size is more than 8 bits, but not divisible by 8 --
because our math could overflow in that case.
* module/ice-9/deprecated.scm (#\y): Indeed, #* is the valid bitvector
syntax :)
Ludovic Courtès [Thu, 15 Oct 2009 21:52:00 +0000 (23:52 +0200)]
Improve TLS detection for systems with compiler support but no libc support.
* acinclude.m4 (GUILE_THREAD_LOCAL_STORAGE): Use `AC_LINK_IFELSE'
instead of `AC_COMPILE_IFELSE'.
Ludovic Courtès [Thu, 15 Oct 2009 21:31:57 +0000 (23:31 +0200)]
Bump version number for 1.9.4.
* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
Ludovic Courtès [Thu, 15 Oct 2009 21:29:50 +0000 (23:29 +0200)]
Fix compilation of literal bitvectors.
* libguile/arrays.c (scm_from_contiguous_typed_array): Fix BYTE_LEN
sanity check for bitvectors.
* test-suite/tests/unif.test ("syntax")["bitvector is self-evaluating"]:
New test.
* module/ice-9/deprecated.scm (#\y): Fix deprecation comment: `#*' is
not a read syntax.
Ludovic Courtès [Thu, 15 Oct 2009 21:24:19 +0000 (23:24 +0200)]
Fix segfault for `(uniform-array->bytevector (bitvector))'.
* libguile/bytevectors.c (scm_uniform_array_to_bytevector): Fix BYTE_LEN
computation for bitvectors.
* test-suite/tests/bytevectors.test ("uniform-array->bytevector"): New
test prefix.
Ludovic Courtès [Thu, 15 Oct 2009 19:55:54 +0000 (21:55 +0200)]
Fix `gitlog-to-changelog' on NixOS.
Ludovic Courtès [Thu, 15 Oct 2009 19:29:42 +0000 (21:29 +0200)]
Document the interaction of the "compilee" with the compiler's current module.
This is a followup to
87c595c757b7db84ffdcfda96f736ab235e674a8 ("Compile
in a fresh module by default.") and
f65e2b1ec5ae1962e57322ac3085ab4d44025694 ("Honor and confine
expansion-time side-effects to `current-reader'.").
* doc/ref/api-evaluation.texi (Loading): Explain how to change
`current-reader' in a compiler-friendly way.
* doc/ref/compiler.texi (The Scheme Compiler): Explain use of a fresh
compilation module and separate `current-reader' fluid.
* test-suite/tests/compiler.test ("current-reader")["with eval-when"]:
New test.
Ludovic Courtès [Thu, 15 Oct 2009 18:51:16 +0000 (20:51 +0200)]
Fix REPL environment for languages other than scheme.
* module/system/repl/common.scm (repl-compile): Use `#:env #f' for
languages other than scheme.
Andy Wingo [Thu, 15 Oct 2009 15:39:34 +0000 (17:39 +0200)]
signedness fix fix fix
* libguile/inline.h: Fix signedness fix fix.
Andy Wingo [Thu, 15 Oct 2009 13:48:14 +0000 (15:48 +0200)]
`load' autocompiles -- in the current module.
* module/ice-9/boot-9.scm (load): Pull `autocompiled-file-name' inside
`load', and make it autocompile in the current module. Should fix
Julian's issue noted in
http://article.gmane.org/gmane.lisp.guile.devel/9483.
Andy Wingo [Thu, 15 Oct 2009 13:45:03 +0000 (15:45 +0200)]
update NEWS for 1.9.4
Andy Wingo [Thu, 15 Oct 2009 13:44:45 +0000 (15:44 +0200)]
fix scm_array_handle_ref signedness fix
* libguile/inline.h: Fix signedness fix.
Andy Wingo [Thu, 15 Oct 2009 13:05:36 +0000 (15:05 +0200)]
add back support for #y bitvector read syntax
* module/ice-9/deprecated.scm (#\y): Add deprecated support for
#y(1 0 1 ...) bitvectors.
Ludovic Courtès [Wed, 14 Oct 2009 23:32:36 +0000 (01:32 +0200)]
Use pointer-less memory for `scm_gc_strdup ()'.
* libguile/gc-malloc.c (scm_gc_strndup): Use `GC_MALLOC_ATOMIC ()'
instead of `GC_MALLOC ()'.
Ludovic Courtès [Wed, 14 Oct 2009 23:05:32 +0000 (01:05 +0200)]
Restore signature of `scm_primitive_load_path ()' as found in 1.8.
The incompatibility was introduced by
0fb81f95b0222c5ba49efd3e36cf797df54c0863 ("add exception_on_error
optional arg to primitive-load-path").
* libguile/load.c (scm_primitive_load_path): Change to take 1 rest
argument. Interpret the argument as either a file name (C-level
backward compatibility with 1.8) or an actual argument list.
(scm_c_primitive_load_path): Update caller.
* libguile/load.h (scm_primitive_load_path): Update accordingly.
* doc/ref/api-evaluation.texi (Loading): Update documentation of
`primitive-load-path' and `scm_primitive_load_path ()'.
Ludovic Courtès [Wed, 14 Oct 2009 22:56:56 +0000 (00:56 +0200)]
Use GC-managed memory for port->encoding.
* libguile/ports.c (scm_new_port_table_entry): Use `scm_gc_strdup ()'
instead of `strdup ()' for `entry->encoding'.
(scm_i_set_port_encoding_x): Likewise. Remove free(3) call.
(scm_i_remove_port): Don't explicitly free memory.
(scm_unget_byte): Remove outdated and misleading comment.
Ludovic Courtès [Wed, 14 Oct 2009 21:20:54 +0000 (23:20 +0200)]
Fix signed/unsigned mismatch in `scm_array_handle_{ref,set} ()'.
* libguile/inline.h (scm_array_handle_ref, scm_array_handle_set): Cast
`h->base' so that it matches the signedness of `p'.
Ken Raeburn [Tue, 13 Oct 2009 15:45:34 +0000 (11:45 -0400)]
Flush output before forking, to make test output consistent and avoid
duplication.
* test-suite/tests/socket.test: Before calling primitive-fork, call
force-output on the current output and error ports.
Andy Wingo [Tue, 13 Oct 2009 09:31:02 +0000 (11:31 +0200)]
add $libir to the ltdl path, not $pkglibdir; add extensionsdir
* libguile/Makefile.am (libpath.h): Fix SCM_LIB_DIR to point to the
libdir, not pkglibdir. Add SCM_EXTENSIONS_DIR, for a dir to put in the
dynamic-link search path that's not managed by ldconfig or the like;
and put this dir in the "extensionsdir" key of %guile-build-info.
* libguile/dynl.c (sysdep_dynl_init): Rename the installed-libdir
environment var to GUILE_SYSTEM_EXTENSIONS_PATH (from
GUILE_SYSTEM_LTDL_PATH). Also add SCM_EXTENSIONS_DIR to the ltdl
search path in the default case.
* meta/uninstalled-env.in: Adapt override to match.
* meta/guile-2.0.pc.in: Add extensionsdir, so you can pkg-config
--variable=extensionsdir guile-2.0.
Michael Gran [Mon, 12 Oct 2009 13:55:25 +0000 (06:55 -0700)]
Modify regexp.test to work better with mac/darwin
* test-suite/tests/regexp.test (set-latin-1): also add .ISO8859-1 as a
possible extension for latin-1 locales. Use set-latin-1 exclusively
to set the locale for tests.
Michael Gran [Fri, 9 Oct 2009 14:06:14 +0000 (07:06 -0700)]
Revert changes that gather thread-specific local language
The method used was not portable. However, the underlying problem
still exists: the uc_locale_language used by libunistring does not
work with thread-specific locale_t locales.
* libguile/i18n.c (locale_language): avoid unpacking semi-opaque type
locale_t.
* test-suite/tests/i18n.test: set Turkish string and char locale upcase
and downcase tests to throw untested
Ludovic Courtès [Fri, 9 Oct 2009 12:42:07 +0000 (14:42 +0200)]
Adjust to match changes in libgc's CVS (pre-7.2).
In libgc CVS the `GC_do_blocking ()' declaration is now public but it
uses a slightly different signature for its first argument.
* configure.ac: Check for `GC_fn_type'.
* libguile/threads.c (GC_fn_type)[HAVE_GC_DO_BLOCKING &&
!HAVE_GC_FN_TYPE]: New typedef.
(scm_without_guile): Explicitly cast `without_guile_trampoline' to
`GC_fn_type'. This is because the upstream definition currently
looks like `typedef void * (extern *GC_fn_type)(void *);', which
isn't compatible.
Ludovic Courtès [Fri, 2 Oct 2009 14:32:34 +0000 (16:32 +0200)]
Use TLS when available for `SCM_I_CURRENT_THREAD'.
* acinclude.m4 (GUILE_THREAD_LOCAL_STORAGE): New macro.
* configure.ac: Use it.
* libguile/__scm.h (SCM_THREAD_LOCAL): New macro.
* libguile/gen-scmconfig.c (main): Define `SCM_HAVE_THREAD_STORAGE_CLASS'.
* libguile/gen-scmconfig.h.in (SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS):
New.
* libguile/threads.c
(scm_i_current_thread)[SCM_HAVE_THREAD_STORAGE_CLASS]: New.
(SET_CURRENT_THREAD): New macro.
(guilify_self_1, on_thread_exit, init_thread_key): Use it.
* libguile/threads.h
(scm_i_current_thread)[SCM_HAVE_THREAD_STORAGE_CLASS]: New
declaration.
(SCM_I_CURRENT_THREAD)[SCM_HAVE_THREAD_STORAGE_CLASS]: New macro.
(init_thread_key_once, init_thread_key): Conditionalize on
`!defined SCM_HAVE_THREAD_STORAGE_CLASS'.
(scm_i_init_thread_for_guile): Update accordingly.
Ludovic Courtès [Fri, 2 Oct 2009 13:28:29 +0000 (15:28 +0200)]
Arrange so that `SCM_I_CURRENT_THREAD' is not accessed outside of libguile.
* libguile/__scm.h (scm_async_tick): New declaration.
(SCM_ASYNC_TICK)[!BUILDING_LIBGUILE]: Use `scm_async_tick ()'.
* libguile/async.c (scm_critical_section_start,
scm_critical_section_end, scm_async_tick): New functions.
* libguile/async.h (scm_i_critical_section_mutex): Made internal.
(scm_critical_section_start, scm_critical_section_end): New
declarations.
(SCM_CRITICAL_SECTION_START,
SCM_CRITICAL_SECTION_END)[!BUILDING_LIBGUILE]: Use the same-named
function (lower-case).
* libguile/stackchk.h (SCM_STACK_OVERFLOW_P): Conditionalize on
`BUILDING_LIBGUILE'.
* libguile/threads.h (SCM_I_CURRENT_THREAD, scm_i_dynwinds,
scm_i_set_dynwinds, scm_i_last_debug_frame,
scm_i_set_last_debug_frame): Conditionalize on `BUILDING_LIBGUILE'.
Ludovic Courtès [Fri, 2 Oct 2009 13:02:52 +0000 (15:02 +0200)]
Deprecate `scm_mask_ints'.
* libguile/async.h (scm_mask_ints): Remove.
* libguile/deprecated.c (scm_i_mask_ints): New.
* libguile/deprecated.h (scm_mask_ints): New macro.
(scm_i_mask_ints): New declaration.
Neil Jerram [Wed, 7 Oct 2009 21:14:38 +0000 (22:14 +0100)]
Revert "Change dynwind flag enums to #defines, for greater portability"
This reverts commit
b25aa0b9373d2798469e0fe999cd915e8beedc4f.