Daniel Kraft [Sat, 27 Jun 2009 18:07:11 +0000 (20:07 +0200)]
Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp
Andy Wingo [Fri, 26 Jun 2009 10:41:34 +0000 (12:41 +0200)]
bytevector ops now compile down to low-level VM ops
* libguile/instructions.c (scm_instruction_list): Fix a longstanding bug
in this humble function.
* libguile/vm-i-scheme.c (BV_FIXABLE_INT_SET, BV_INT_SET, BV_FLOAT_SET):
Fix some bugs in these macros -- now the bytevector ops work.
* module/language/tree-il/compile-glil.scm (*primcall-ops*): Compile
bytevector calls to VM ops.
* module/language/tree-il/primitives.scm
(*interesting-primitive-names*): Resolve bytevector calls to primitive
calls.
Andy Wingo [Fri, 26 Jun 2009 09:12:37 +0000 (11:12 +0200)]
run bytevectors tests under the compiler and evaluator
* test-suite/tests/bytevectors.test: Run a number of tests under the
compiler/vm and the evaluator.
Andy Wingo [Thu, 25 Jun 2009 22:15:37 +0000 (00:15 +0200)]
vector-ref and vector-set! now have opcodes
* module/language/tree-il/primitives.scm
(*interesting-primitive-names*): Resolve vector-ref and vector-set!.
* module/language/tree-il/compile-glil.scm (*primcall-ops*): And compile
vector-ref and vector-set! to their opcodes.
* libguile/vm-i-scheme.c (vector-ref, vector-set): New opcodes, placed
before the bytevector ops. The renumbering shouldn't affect anyone,
given that the bytevector ops were not yet used. Fix a few bugs in the
bytevector ops.
Andy Wingo [Wed, 24 Jun 2009 21:49:11 +0000 (23:49 +0200)]
add bytevector ops to the vm
* libguile/instructions.h (SCM_VM_NUM_INSTRUCTIONS): Enlarge to 255. Not
sure what performance effects this will have.
* libguile/vm-engine.c: Add new error case, vm_error_not_a_bytevector.
* libguile/vm-engine.h: Don't assign specific registers for i386. Having
added the new VM vector ops, GCC 4.4 is erroring for me now.
* libguile/vm-i-scheme.c: Add bytevector-specific ops to the VM.
We don't actually use them yet, though.
Andy Wingo [Wed, 24 Jun 2009 21:46:42 +0000 (23:46 +0200)]
bytevectors provide scm_i_native_endianness to the vm
* libguile/bytevectors.h (scm_i_native_endianness): Allow the VM to use
scm_i_native_endianness, but still keep it marked as internal.
* libguile/bytevectors.c: Adjust to use scm_i_native_endianness instead
of native_endianness. Define it at bootstrap time.
Andy Wingo [Wed, 24 Jun 2009 21:44:03 +0000 (23:44 +0200)]
minor doc tweaks
* doc/ref/api-compound.texi: Generalized vector doc fixups.
* doc/ref/api-data.texi: Minor fixes to bytevector docs.
Neil Jerram [Thu, 25 Jun 2009 22:24:57 +0000 (23:24 +0100)]
Revert "* FAQ: New file."
This reverts commit
d53f85dd859fa69af8a0b67482774d2a88aaf407.
It was a confusing mistake to create an FAQ file in the Guile
repository/distribution, because there was already an FAQ page on the
Guile web site. The information that was in the FAQ file is now in
the FAQ web page.
Ludovic Courtès [Thu, 25 Jun 2009 21:32:44 +0000 (23:32 +0200)]
Add `scm_t_off' type so that `scm_t_port' has a fixed layout.
* libguile/gen-scmconfig.c (main): Produce a definition for
`scm_t_off'.
* libguile/ports.h (scm_t_port)[read_buf_size, saved_read_buf_size,
write_buf_size, seek, truncate]: Use `scm_t_off' instead of `off_t' so
that the layout and size of the structure does not depend on the
application's `_FILE_OFFSET_BITS' value. Reported by Bill
Schottstaedt, see
http://lists.gnu.org/archive/html/bug-guile/2009-06/msg00018.html.
(scm_set_port_seek, scm_set_port_truncate): Update.
* libguile/ports.c (scm_set_port_seek, scm_set_port_truncate): Use
`scm_t_off' and `off_t_or_off64_t'.
* libguile/fports.c (fport_seek, fport_truncate): Use `scm_t_off'
instead of `off_t'.
* libguile/r6rs-ports.c (bip_seek, cbp_seek, bop_seek): Use `scm_t_off'
instead of `off_t'.
* libguile/rw.c (scm_write_string_partial): Likewise.
* libguile/strports.c (st_resize_port, st_seek, st_truncate): Likewise.
* doc/ref/api-io.texi (Port Implementation): Update prototype of
`scm_set_port_seek ()' and `scm_set_port_truncate ()'.
* NEWS: Update.
Ludovic Courtès [Thu, 25 Jun 2009 20:45:12 +0000 (22:45 +0200)]
Fix `load-objcode' FD/mapping leak occurring upon failure.
* libguile/objcodes.c (make_objcode_by_mmap): Close FD and unmap ADDR
upon failure.
Andy Wingo [Wed, 24 Jun 2009 13:14:00 +0000 (15:14 +0200)]
allow primcall ops to push 0 values
* libguile/objcodes.c (OBJCODE_COOKIE): Bump the objcode cookie. We'll
be doing this on incompatible changes until 2.0.
* libguile/vm-i-scheme.c (set_car, set_cdr, slot_set): These
instructions don't have natural return values -- so declare them that
way, that they push 0 values.
* module/language/tree-il/compile-glil.scm (flatten): When compiling
primitive calls, check `(instruction-pushes op)' to see how many
values that instruction will push, and do something appropriate,
instead of just assuming that all primcall ops push 1 value.
Andy Wingo [Wed, 24 Jun 2009 11:42:59 +0000 (13:42 +0200)]
remove lambda wrap hack of brainfuck tree-il compiler
* module/language/brainfuck/compile-tree-il.scm (compile-tree-il):
Remove the hack where we wrapped the compiled code in a `lambda',
because not only should the tree-il compiler optimize that away, it
was really papering around other inefficiencies, and obtuse to boot.
Neil Jerram [Thu, 18 Jun 2009 19:35:45 +0000 (20:35 +0100)]
Remove AC_SYS_RESTARTABLE_SYSCALLS and related code
As the Autoconf documentation says, "These days portable programs
[...] should not rely on `HAVE_RESTARTABLE_SYSCALLS', since nowadays
whether a system call is restartable is a dynamic issue, not a
configuration-time issue."
In other words, if we ever rely on HAVE_RESTARTABLE_SYSCALLS, we are
at the mercy of any code that Guile happens to be linked with, because
that code could install a signal handler without the SA_RESTART flag,
and then a Guile system call could unexpectedly return EINTR.
The readline part of this goes back to this problem report:
http://sources.redhat.com/ml/guile/2000-05/msg00177.html; and is an
excellent example of the above paragraph. It was noted during the
discussion that undefining HAVE_RESTARTABLE_SYSCALLS would fix the
problem, but that solution wasn't adopted - I guess because Guile was
still using cooperative threads then (not pthreads) and so there was a
significant concern (whether founded or not) that not using
restartable syscalls (where available) could lead to a loss of
performance.
Now Guile's default mode of operation is with pthreads, where we
already don't assume that HAVE_RESTARTABLE_SYSCALLS is reliable, so
there is no possible further performance loss. And in any case we
really have no choice, if we want correct operation.
Thanks to Sylvain Beucler for reporting this and suggesting the fix.
* configure.in (AC_SYS_RESTARTABLE_SYSCALLS): Removed.
* doc/ref/posix.texi (Signals): Remove statement that Guile always
sets SA_RESTART flag.
* guile-readline/configure.in (GUILE_SIGWINCH_SA_RESTART_CLEARED):
Remove this setting, together with its test code.
(HAVE_RL_PRE_INPUT_HOOK): Remove this setting and its code, as no
longer needed.
* guile-readline/readline.c (sigwinch_enable_restart): Removed.
(scm_init_readline): Remove setting of rl_pre_input_hook.
* libguile/_scm.h (SCM_SYSCALL): Remove the definition that relies on
HAVE_RESTARTABLE_SYSCALLS.
* libguile/scmsigs.c (scm_sigaction_for_thread): Don't always set the
SA_RESTART flag if available. Update docstring accordingly.
(scm_init_scmsigs): Remove code that sets SA_RESTART flag for all
signals.
* THANKS: Add Sylvain.
Andy Wingo [Mon, 22 Jun 2009 20:57:48 +0000 (22:57 +0200)]
flush whitespace from the repl input buffer *before* evaluation
* module/system/repl/repl.scm (start-repl): Given that the input port of
the repl is line-buffered, it's likely we have #\newline in the input
that is strictly extraneous, an in-band indicator to the repl that it
should begin reading now. So flush out that newline, so that you can
(read-char) at the repl, and it actually does wait for you to type in
a char instead of just returning #\newline.
While it's not an overriding concern, this does fix some brainfuck
programs that want to input from the user.
Andy Wingo [Mon, 22 Jun 2009 20:44:34 +0000 (22:44 +0200)]
more docs to brainfuck->tree-il compiler
* module/language/brainfuck/compile-tree-il.scm (compile-tree-il): Wrap
the result in a ((lambda () ...)), so we can use toplevel-ref. Add
lots more comments.
Andy Wingo [Mon, 22 Jun 2009 18:45:01 +0000 (20:45 +0200)]
meta-commands read off their own arguments
* module/system/repl/command.scm: Update copyright.
(meta-command): Rework so that it's the various meta-commands that do
the reading for their arguments. This way you can compile forms that
span more than one line, and forms that need to be read with another
language's reader.
(define-meta-command): New helper macro. Update commands to use it.
(help): Allow ,help on commands too.
* module/system/repl/repl.scm: Update copyright.
(start-repl): Adjust to give meta-command what it wants.
Ludovic Courtès [Sun, 21 Jun 2009 22:56:00 +0000 (00:56 +0200)]
Always create the bytevector SMOB type.
* libguile/bytevectors.c (scm_tc16_bytevector, print_bytevector,
bytevector_equal_p, free_bytevector): Don't use the snarfing macros.
(scm_bootstrap_bytevectors): New.
(scm_init_bytevectors): No longer initialize SCM_NULL_BYTEVECTOR,
which is done by `scm_bootstrap_bytevectors ()'.
* libguile/bytevectors.h (scm_bootstrap_bytevectors): New declaration.
(scm_init_bytevectors): Made internal. This can be done because we
explicitly register it with `scm_c_register_extension ()' in
`scm_bootstrap_bytevectors ()'.
* libguile/init.c (scm_i_init_guile): Call `scm_bootstrap_bytevectors ()'.
This is so that expressions like "(generalized-vector-length #vu8())"
work even when `(rnrs bytevector)' hasn't been loaded.
Ludovic Courtès [Sun, 21 Jun 2009 22:51:08 +0000 (00:51 +0200)]
Make bytevectors accessible using the generalized-vector API.
As a side effect, this allows compilation of literal bytevectors
("#vu8(...)"), which gets done by the generic array handling
of the GLIL->assembly compiler.
* doc/ref/api-compound.texi (Generalized Vectors): Mention bytevectors.
(Arrays, Array Syntax): Likewise.
* doc/ref/api-data.texi (Bytevectors as Generalized Vectors): New node.
* libguile/bytevectors.c (scm_i_bytevector_generalized_set_x): New.
* libguile/bytevectors.h (scm_i_bytevector_generalized_set_x): New
declaration.
* libguile/srfi-4.c (scm_i_generalized_vector_type,
scm_array_handle_uniform_element_size,
scm_array_handle_uniform_writable_elements): Add support for
bytevectors.
* libguile/unif.c (type_creator_table): Add `vu8'.
(bytevector_ref, bytevector_set): New functions.
(memoize_ref, memoize_set): Add support for bytevectors.
* libguile/vectors.c (scm_is_generalized_vector,
scm_c_generalized_vector_length, scm_c_generalized_vector_ref,
scm_c_generalized_vector_set_x): Add support for bytevectors.
* test-suite/tests/bytevectors.test ("Generalized Vectors"): New test
set.
Ludovic Courtès [Sun, 21 Jun 2009 21:16:57 +0000 (23:16 +0200)]
bytevectors: Add a C-friendly API.
* doc/ref/api-data.texi (Bytevector Manipulation): Add
`scm_is_bytevector ()', `scm_c_bytevector_length ()',
`scm_c_bytevector_length ()', and `scm_c_bytevector_set_x ()'.
* libguile/bytevectors.c (scm_is_bytevector, scm_c_bytevector_length,
scm_c_bytevector_ref, scm_c_bytevector_set_x): New functions.
(scm_bytevector_p): Use `scm_is_bytevector ()'.
(scm_bytevector_length): Use `scm_c_bytevector_length ()'.
* libguile/bytevectors.h (scm_is_bytevector, scm_c_bytevector_length,
scm_c_bytevector_ref, scm_c_bytevector_set_x): New declarations.
Ludovic Courtès [Sun, 21 Jun 2009 14:55:58 +0000 (16:55 +0200)]
bytevectors: Use `size_t' rather than `unsigned' for sizes.
* doc/ref/api-data.texi (Bytevector Manipulation): Update.
* libguile/bytevectors.c (INTEGER_ACCESSOR_PROLOGUE,
make_bytevector_from_buffer, scm_c_make_bytevector,
scm_c_take_bytevector, scm_i_shrink_bytevector): Use `size_t' for
bytevector lengths.
Ludovic Courtès [Sun, 21 Jun 2009 21:32:19 +0000 (23:32 +0200)]
Fix documentation of `make-bytevector'.
* doc/ref/api-data.texi (Bytevector Manipulation): Fix documentation of
the FILL argument of `make-bytevector'.
Andy Wingo [Sun, 21 Jun 2009 12:53:33 +0000 (14:53 +0200)]
add brainfuck->tree-il compiler
* module/Makefile.am (BRAINFUCK_LANG_SOURCES): Compile at the end. Add
compile-tree-il.scm.
* module/language/brainfuck/compile-tree-il.scm: New compiler, compiles
to tree-il instead of scheme. I thought it would be more illustrative,
though there are some uncommented bits.
* module/language/brainfuck/parse.scm: Modify not to put a header on the
scheme representation. After all, we don't put <scheme> before scheme
code, do we? :)
* module/language/brainfuck/spec.scm: Add tree-il compiler.
* module/language/tree-il.scm: Understand (set! (lexical foo) ...).
* module/system/base/language.scm: Update license. Actually, updates
licenses on all these.
Andy Wingo [Sun, 21 Jun 2009 11:36:39 +0000 (13:36 +0200)]
formatting changes to (language brainfuck compile-scheme)
* module/language/brainfuck/compile-scheme.scm: Standalone comments
should have more than one semicolon, and update copyright to LGPLv3+.
Andy Wingo [Sun, 21 Jun 2009 11:10:56 +0000 (13:10 +0200)]
link to brainfuck wikipedia page
* doc/ref/compiler.texi: Point to more info on Brainfuck. Patch by
Daniel Kraft.
Daniel Kraft [Sat, 23 May 2009 07:58:54 +0000 (09:58 +0200)]
added documenting comments to the brainfuck compiler and mention it in the VM documentation.
* doc/ref/compiler.texi: Mention the new brainfuck compiler as an example.
* module/language/brainfuck/compile-scheme.scm: Add a lot of documentation comments.
* module/language/brainfuck/parse.scm: Ditto.
* module/language/brainfuck/spec.scm: Ditto.
Daniel Kraft [Sat, 23 May 2009 07:58:54 +0000 (09:58 +0200)]
basic brainfuck -> scheme example compiler.
* module/Makefile.am: Install the brainfuck compiler modules.
* module/language/brainfuck/spec.scm: New file.
* module/language/brainfuck/parse.scm: New file.
* module/language/brainfuck/compile-scheme.scm: New file.
Andy Wingo [Sun, 21 Jun 2009 10:57:55 +0000 (12:57 +0200)]
remove obsolete guile-vm.texi
* doc/guile-vm.texi: Remove, has been folded into the Guile manual for a
while now.
* doc/Makefile.am: Remove guile-vm.texi.
Andy Wingo [Sun, 21 Jun 2009 10:51:16 +0000 (12:51 +0200)]
update .gitignore
* .gitignore: Update.
Neil Jerram [Sun, 21 Jun 2009 12:31:20 +0000 (13:31 +0100)]
Deterministic test for the r6rs-ports.test segmentation fault
* test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports"): Add (gc), to
test the (ex-)bug in cbp_mark () when marking a closed port.
Andy Wingo [Sun, 21 Jun 2009 10:41:46 +0000 (12:41 +0200)]
Fix crash when marking closed custom bytevector port
* libguile/r6rs-ports.c (cbp_mark): A closed port will have had its
stream destroyed, so don't dereference the stream in that case. Patch by
Mike Gran.
Andy Wingo [Sat, 20 Jun 2009 12:26:54 +0000 (14:26 +0200)]
put autocompiled files into ~/.cache or $XDG_CACHE_HOME
* module/system/base/compile.scm (compiled-file-name): Remove unneeded
path separator.
* libguile/load.c (scm_init_load_path): Change so the default cache path
is ~/.cache/guile/ccache/1.9, and respect $XDG_CACHE_HOME.
Andy Wingo [Sat, 20 Jun 2009 10:41:11 +0000 (12:41 +0200)]
fix source information lossage for (define (foo) ...) lambda sugar
* module/ice-9/psyntax.scm (source-wrap): Use decorate-source, for
clarity.
(syntax-type): When turning the RHS of (define (foo) ...) into a
lambda, decorate the resulting lambda expression with source
information, as the RHS later goes to chi-expr, which receives no
source information. Perhaps that is a bug. In any case, fixes some
source location lossage, reported by Jao.
* module/ice-9/psyntax-pp.scm: Regenerated.
Andy Wingo [Sat, 20 Jun 2009 09:41:50 +0000 (11:41 +0200)]
better error in make_objcode_by_mmap
* libguile/objcodes.c (make_objcode_by_mmap): Better error when the
object header is incorrect.
Andy Wingo [Sat, 20 Jun 2009 08:47:37 +0000 (10:47 +0200)]
source information for the interpreter
* module/ice-9/psyntax.scm: Try to propagate source information when
generating output for the interpreter.
* module/ice-9/psyntax-pp.scm: Regenerate.
Ludovic Courtès [Fri, 19 Jun 2009 20:46:07 +0000 (22:46 +0200)]
Make `cond-expand' compilable.
* module/ice-9/boot-9.scm (cond-expand): Changed into a `define-macro'
macro.
Ludovic Courtès [Fri, 19 Jun 2009 20:01:56 +0000 (22:01 +0200)]
Fix copyright year and authorship of `guile-tools'.
Ludovic Courtès [Fri, 19 Jun 2009 19:55:53 +0000 (21:55 +0200)]
Slightly improve `NEWS'.
Ludovic Courtès [Fri, 19 Jun 2009 19:54:51 +0000 (21:54 +0200)]
Fix "guile-tools disassemble".
* module/scripts/disassemble.scm (disassemble): Accept a variable number
of arguments. Invoke the right `disassemble' procedure.
Andy Wingo [Fri, 19 Jun 2009 12:27:56 +0000 (14:27 +0200)]
don't autocompile at installcheck
* examples/Makefile.am: Don't autocompile our tests at installcheck
time.
Andy Wingo [Fri, 19 Jun 2009 12:26:47 +0000 (14:26 +0200)]
new function: canonicalize-path. use when autocompiling
* libguile/filesys.h:
* libguile/filesys.c (scm_canonicalize_path): New function,
canonicalize-path.
* module/system/base/compile.scm (compiled-file-name): Canonicalize the
filename so that compiling e.g. ../foo.scm doesn't compile to
~/.guile-ccache/1.9/../foo.scm.
Andy Wingo [Fri, 19 Jun 2009 11:01:11 +0000 (13:01 +0200)]
gnulib-tool --import canonicalize-lgpl
Andy Wingo [Fri, 19 Jun 2009 10:32:01 +0000 (12:32 +0200)]
generate changelogs at dist time
* Makefile.am: Add rule to make a ChangeLog at dist-time. The rule comes
from coreutils.
* build-aux/gitlog-to-changelog: New helper script, from gnulib.
Andy Wingo [Fri, 19 Jun 2009 09:20:34 +0000 (11:20 +0200)]
rename SCM_SNAME to SCM_SUBR_NAME
* libguile/procs.h: Rename SCM_SNAME to SCM_SUBR_NAME.
* libguile/debug.c:
* libguile/eval.c:
* libguile/eval.i.c:
* libguile/goops.c:
* libguile/gsubr.c:
* libguile/print.c:
* libguile/procs.c: Update callers.
Andy Wingo [Fri, 19 Jun 2009 09:19:34 +0000 (11:19 +0200)]
another draft of NEWS
* NEWS: Another draft.
Ludovic Courtès [Fri, 19 Jun 2009 00:35:57 +0000 (02:35 +0200)]
Fix decompilation of the `load-array' instruction.
This allows, e.g., ",c #u8(1 2 3)" at the REPL to actually work instead
of failing to decode `load-array'.
* module/language/assembly/decompile-bytecode.scm (decode-bytecode):
Account for the `load-array' instruction, which is followed by a
bytevector instead of a string. We should find a more elegant way to
do that.
Ludovic Courtès [Fri, 19 Jun 2009 00:14:22 +0000 (02:14 +0200)]
Fix the REPL's `,compile' command.
* module/system/repl/command.scm (compile): Use `guile:disassemble'
instead of the former `disassemble-objcode'.
Ludovic Courtès [Thu, 18 Jun 2009 22:47:11 +0000 (00:47 +0200)]
Implement R6RS bytevector read syntax.
* libguile/read.c (scm_read_bytevector): New function.
(scm_read_sharp): Add `v' case for bytevectors.
* test-suite/lib.scm (exception:read-error): New variable.
* test-suite/tests/bytevectors.test ("Datum Syntax"): New test set.
Ludovic Courtès [Thu, 18 Jun 2009 22:10:21 +0000 (00:10 +0200)]
Fix `equal?' on bytevectors.
* libguile/bytevectors.c (bytevector_equal_p): New function.
* test-suite/tests/bytevectors.test ("2.3 Operations on Bytes and
Octets")["equal?"]: New test.
Ludovic Courtès [Thu, 28 May 2009 21:57:31 +0000 (23:57 +0200)]
Import documentation for the R6RS bytevector and port APIs.
* doc/ref/api-compound.texi (Uniform Numeric Vectors): Add xref to the
bytevector API.
* doc/ref/api-data.texi (Bytevectors): New node.
* doc/ref/api-io.texi (R6RS I/O Ports): New node.
Andy Wingo [Thu, 18 Jun 2009 21:02:51 +0000 (23:02 +0200)]
update NEWS, THANKS
* NEWS: Update, but only partially. I wanted to push out this
incomplete, not yet organized draft for review, if anyone had
comments. I'll pick it up tomorrow morning.
* THANKS: Add Juhani, whose last name changed?
Neil Jerram [Wed, 17 Jun 2009 21:35:30 +0000 (22:35 +0100)]
Change guile-readline license to GPLv3+
Neil Jerram [Wed, 17 Jun 2009 21:30:26 +0000 (22:30 +0100)]
Complete changing license to LGPLv3+
(Still guile-readline to do, but that will all be GPLv3+.)
Neil Jerram [Wed, 17 Jun 2009 20:34:38 +0000 (21:34 +0100)]
Reinstate lines removed by mistake from chars.test
Neil Jerram [Tue, 16 Jun 2009 23:22:09 +0000 (00:22 +0100)]
Change Guile license to LGPLv3+
(Not quite finished, the following will be done tomorrow.
module/srfi/*.scm
module/rnrs/*.scm
module/scripts/*.scm
testsuite/*.scm
guile-readline/*
)
Neil Jerram [Sun, 14 Jun 2009 17:41:50 +0000 (18:41 +0100)]
Update README on using libraries in non-standard locations
* README: Update instructions on using libraries in non-standard
locations. Also change expected next stable release number from
1.10.0 to 2.0.0.
Neil Jerram [Sun, 14 Jun 2009 17:07:01 +0000 (18:07 +0100)]
Add Tex and texinfo output and auxiliary suffixes to .gitignore
Neil Jerram [Sun, 14 Jun 2009 16:58:15 +0000 (17:58 +0100)]
Provide easier configure options for GMP and readline
This patch uses the AC_LIB_LINKFLAGS macro, provided by Gnulib's
havelib module, to provide --with-gmp-prefix and
--with-readline-prefix configure options. Many thanks to Bruno Haible
for suggesting and explaining this to me.
* configure.in (top level): Add AC_LIB_LINKFLAGS(gmp).
* guile-readline/configure.in (AC_CONFIG_AUX_DIR): Change to
../build-aux, to share the main build-aux directory and so avoid
having to distribute multiple copies of config.rpath.
(top level): Add AC_LIB_LINKFLAGS(readline).
* lib/Makefile.am, m4/gnulib-cache.m4: Regenerated by gnulib-tool for
new import of the `havelib' module.
Neil Jerram [Sat, 13 Jun 2009 09:45:45 +0000 (10:45 +0100)]
Fix for make distcheck
* examples/Makefile.am (AM_CFLAGS, AM_LIBS): Set PATH so that
guile-config can find guile.
Neil Jerram [Fri, 12 Jun 2009 22:04:48 +0000 (23:04 +0100)]
Fix `make distcheck'
* libguile/r6rs-ports.c (scm_init_r6rs_ports): Add libguile/ to
included .x file name.
Neil Jerram [Thu, 11 Jun 2009 22:24:34 +0000 (23:24 +0100)]
Note Andy as a contributor
Andy Wingo [Wed, 10 Jun 2009 08:53:00 +0000 (10:53 +0200)]
fix defmacro*, defmacro*-public
* module/ice-9/boot-9.scm (define-private): Remove apocyphal comment. The
FIXME would really be to remove `define-private', though...
* module/ice-9/optargs.scm (defmacro*, defmacro*-public): Fix these
macros. Thanks to Dale Smith for the report.
Andy Wingo [Wed, 10 Jun 2009 08:51:02 +0000 (10:51 +0200)]
bump default stack limit to 160000 words
* libguile/eval.c (scm_debug_opts): Up the default stack limit by a
factor of 4. Psyntax expansions currently bounce back and forth between
the VM and the interpreter, due to `map'. (Hopefully that won't be the
case in the future, when have map in scheme, and we get an inliner.)
Anyway when expanding a big nested expression, as for example in
(language ecmascript compile-ghil) -- the pmatch code ends up being
super-nested -- we can consume loads o stack.
So given that on desktop machines, where rlimit is likely to be unset,
default rlimits are around 8 or 10 MB or so, let's bump up our default
limit to 640KB (on 32-bit). Should be enough for anyone.
See http://thread.gmane.org/gmane.lisp.guile.devel/8599/focus=8662 for
more info. Thanks to Mark H. Weaver for the diagnosis!
Andy Wingo [Tue, 9 Jun 2009 22:03:52 +0000 (00:03 +0200)]
fix debug-options
* module/ice-9/boot-9.scm (define-option-interface): Fix (debug-options
'full), along with other options. Thanks to Mark Weaver for the tip.
* THANKS: Update, though many more names need to be added.
Andy Wingo [Tue, 9 Jun 2009 21:42:05 +0000 (23:42 +0200)]
some attempts to solve the ecmascript stack overflow problem
* module/language/ecmascript/compile-ghil.scm (comp): Just use pmatch,
not ormatch. Now with syncase running over everything, it doesn't
matter.
* module/ice-9/boot-9.scm (false-if-exception): Avoid saving stacks
inside false-if-exception. There's probably a more general solution to
this, though. Fixes getting bogus backtraces sometimes.
* module/Makefile.am (ECMASCRIPT_LANG_SOURCES): Reorder things so that
spec comes last.
Daniel Kraft [Tue, 9 Jun 2009 19:37:13 +0000 (21:37 +0200)]
First code for elisp compilation, handling a very limited set of operations (but not really usable yet).
* module/language/elisp/README: New file containing some notes.
* module/language/elisp/compile-tree-il.scm: New file with compilation code.
* module/language/elisp/spec.scm: Updated language definition.
Andy Wingo [Mon, 8 Jun 2009 20:43:28 +0000 (22:43 +0200)]
a start to changing VM scheme copyrights
* module/language/tree-il/primitives.scm: Change copyright to LGPLv2.1.
Others will follow.
Andy Wingo [Mon, 8 Jun 2009 20:24:15 +0000 (22:24 +0200)]
pretty-print psyntax-pp.scm
* module/ice-9/compile-psyntax.scm: Pretty-print psyntax-pp.scm, given
that we are going to compile it anyway.
* module/ice-9/psyntax-pp.scm: Regenerated.
Andy Wingo [Mon, 8 Jun 2009 09:44:51 +0000 (11:44 +0200)]
don't autocompile snarfing m4 docs
* doc/ref/Makefile.am (autoconf-macros.texi): Yet another place we
shouldn't autocompile.
Andy Wingo [Sun, 7 Jun 2009 23:04:16 +0000 (01:04 +0200)]
fix bootstrapping after last night's psyntax patch
* module/Makefile.am (ice-9/psyntax-pp.scm): Don't try autocompiling when
making psyntax-pp.scm.
* module/ice-9/psyntax-pp.scm: Regenerated.
* module/ice-9/psyntax.scm (chi-top): Only affect the compile-time
environment if modules have booted.
Andy Wingo [Sun, 7 Jun 2009 22:38:49 +0000 (00:38 +0200)]
call-with-values can make fewer closures
* module/language/tree-il.scm: Rename let-exp and letrec-exp to let-body
and letrec-body. Add <let-values>, a one-expression let-values that
should avoid the needless creation of two closures in many common
multiple-value cases. We'll need to add an optimization pass to the
compiler to produce this form, though, as well as rewriting lambdas
into lets, etc.
I added this form instead of adding more special cases to the
call-with-values compile code because it's a useful intermediate form
-- it will allow the optimizer to perform constant folding across more
code.
* module/language/tree-il.scm (parse-tree-il, unparse-tree-il)
(tree-il->scheme, post-order!, pre-order!): Adapt to let/letrec body
renaming, and let-values.
* module/language/tree-il/analyze.scm (analyze-lexicals): Adapt for
renaming, and add cases for let-values.
* module/language/tree-il/compile-glil.scm (flatten): Add a new context,
`vals', used by let-values code for the values producer. Code that
produces multiple values can then jump to the let-values MV return
address directly, instead of trampolining into a procedure. Add code to
compile let-values.
Andy Wingo [Sat, 6 Jun 2009 22:53:31 +0000 (00:53 +0200)]
fix incorrect inlining of + when + is locally redefined
* libguile/vm-i-scheme.c (FUNC2): Use a signed value for the intermediate
result here. Not sure what the effect is, though.
* module/ice-9/psyntax.scm (chi-top): Toplevel definitions ensure that
variables are defined in the current module. Fixes the specific case of
guile-lib's md5.scm, which redefines + -- this code is needed so that
we don't incorrectly open-code +.
* module/language/tree-il/primitives.scm (resolve-primitives!): I think
there were some cases in which vars and names would not resolve
properly here. Fix those.
Andy Wingo [Sat, 6 Jun 2009 13:45:00 +0000 (15:45 +0200)]
new instructions: make-int64, make-uint64
* doc/ref/vm.texi (Loading Instructions): Remove references to
load-integer and load-unsigned-integer -- they're still in the VM but
will be removed at some point.
(Data Control Instructions): Add make-int64 and make-uint64.
* libguile/vm-i-loader.c (load-unsigned-integer): Allow 8-byte values.
But this instruction is on its way out, yo.
* libguile/vm-i-system.c (make-int64, make-uint64): New instructions.
* module/language/assembly.scm (object->assembly): Write out make-int64
and make-uint64 instructions, using bytevectors to do the endianness
conversion.
(assembly->object): And pretty-print them back, for disassembly.
* module/language/glil/compile-assembly.scm: Don't generate load-integer
/ load-unsigned-integer instructions.
Andy Wingo [Sat, 6 Jun 2009 12:07:29 +0000 (14:07 +0200)]
fix bug in goops' method cache with rest args
* module/oop/goops/compile.scm (code-table-lookup): Fix a tricky little
bug!
* test-suite/tests/goops.test ("the method cache"): Add a wee test.
Neil Jerram [Fri, 5 Jun 2009 23:08:30 +0000 (00:08 +0100)]
Fix popen.test on NetBSD and Ubuntu Jaunty, where sh is not Bash
Thanks to Greg Troxel for reporting, and Barry Fishman for the
explanation and fix.
* test-suite/tests/popen.test ("open-input-pipe"): Use shell function
`read' with an explicit argument, as apparently not all shells
support read with no argument.
Andy Wingo [Fri, 5 Jun 2009 22:29:05 +0000 (00:29 +0200)]
support ((@ ...) ...) where the car is a macro
* module/ice-9/psyntax.scm (syntax-type): Remove `external-macro', not
used any more. Take an extra arg, `for-car?', indicating that we're
checking on the type of a form in the car position. In the case that
the expression is a pair, do a full recursion on the car, which allows
us to catch the fact that the car of the following form is a macro:
((@ (ice-9 optargs) let-optional) ...)
and thus the form itself should be macroexpanded.
But, since we want to distingush `lambda' from `(lambda ...)', just as
we have global and global-call, we have core to the new `core-form'.
(chi-top, chi, chi-expr, chi-body, set!): Adapt to changes to
syntax-type.
Neil Jerram [Thu, 4 Jun 2009 23:06:16 +0000 (00:06 +0100)]
State and explain dependency on libtool 2.2
* HACKING: Updated to recommend libtool 2.2 and anti-recommend libtool
1.5.26.
Neil Jerram [Fri, 5 Jun 2009 21:54:45 +0000 (22:54 +0100)]
Fix `Mismatching FUNC_NAME' warning from guile-func-name-check
* libguile/bytevectors.c (FUNC_NAME): Change to match function name.
Andy Wingo [Fri, 5 Jun 2009 14:31:38 +0000 (16:31 +0200)]
add ability to compile uniform arrays
* module/rnrs/bytevector.scm (rnrs):
* libguile/bytevectors.h:
* libguile/bytevectors.c (scm_uniform_array_to_bytevector): New function.
* libguile/unif.h:
* libguile/unif.c (scm_from_contiguous_typed_array): New function.
* libguile/vm-i-loader.c (load-array): New instruction, for loading byte
data into uniform vectors. Currently it copies out the data, though in
the future we could avoid that.
* module/language/assembly.scm (align-code): New exported function,
aligns code on some boundary.
(align-program): Use align-code.
* module/language/assembly/compile-bytecode.scm (write-bytecode): Support
the load-array instruction.
* module/language/glil/compile-assembly.scm (dump-object): Dump uniform
arrays. Neat :)
Andy Wingo [Fri, 5 Jun 2009 10:08:02 +0000 (12:08 +0200)]
add long-object-ref, long-toplevel-ref, long-toplevel-set
* libguile/vm-i-system.c (long-object-ref, long-toplevel-ref)
(long-toplevel-set): Add new instructions, for accessing the object
table with a 16-bit offset. HTMLprag defines a test program that has
more than 256 constants, necessitating this addition.
* doc/ref/vm.texi: Mention the new instructions.
* module/language/glil/compile-assembly.scm: Emit long refs for object
tables bigger than 256 entries.
Andy Wingo [Fri, 5 Jun 2009 09:47:34 +0000 (11:47 +0200)]
disable autocompilation when running guile-tools compile
* module/scripts/compile.scm (compile): Disable autocompilation when
running guile-tools compile.
Andy Wingo [Fri, 5 Jun 2009 09:47:19 +0000 (11:47 +0200)]
refactoring for toplevel-ref, toplevel-set, link-now
* libguile/vm-i-system.c (toplevel-ref, toplevel-set)
* libguile/vm-i-loader.c (link-now):
* libguile/vm.c (resolve_variable): Factor out common code to a static
method. The compiler can still inline it, so it shouldn't have a
significant performance effect.
* libguile/vm-engine.c (vm_error_no_such_module): Remove now-unused
label.
Andy Wingo [Fri, 5 Jun 2009 08:56:34 +0000 (10:56 +0200)]
add gperf-generated files to git
* lib/iconv_open-osf.h:
* lib/iconv_open-aix.h:
* lib/iconv_open-hpux.h:
* lib/iconv_open-irix.h: Add to git. Should remove build-time dep on
gperf; we'll see if this causes problems.
Andy Wingo [Fri, 5 Jun 2009 08:51:21 +0000 (10:51 +0200)]
stamp .go with timestamp of .scm; a fresh go has same mtime of .scm
* libguile/load.c (compiled_is_fresh): Rename from compiled_is_newer.
Check that the mtines of the .go and .scm match exactly, so we don't
get fooled by rsync-like modifications of the filesystem.
* module/system/base/compile.scm (call-with-output-file/atomic): Add
optional arg, a reference file. If present we utime the output file to
match the source file, before the rename.
(compile-file): Stamp the .go file with the timestamp of the .scm.
Andy Wingo [Fri, 5 Jun 2009 08:32:52 +0000 (10:32 +0200)]
compile and install srfi-98.
* module/Makefile.am (SRFI_SOURCES): Add SRFI-98.
Andy Wingo [Fri, 5 Jun 2009 08:24:35 +0000 (10:24 +0200)]
final (?) tweaks to the autocompile code
* libguile/load.c (do_try_autocompile): Use module_variable, not
module_lookup, when resolving compile-file, so we get #f instead of an
exception if the compiler is in the process of being loaded.
(scm_primitive_load_path): In what I hope is the last patch to this
code, recheck the fallback path if we found a stale installed .go file.
Andy Wingo [Fri, 5 Jun 2009 08:06:39 +0000 (10:06 +0200)]
simplify autocompilation some more
* libguile/load.c (scm_init_load_path): Set the fallback path even if
GUILE_SYSTEM_COMPILED_PATH is set. Now that we store full paths in the
autocompiled files, and the path contains the effective Guile version,
there's no danger of accidental collisions.
(do_try_autocompile, autocompile_catch_handler, scm_try_autocompile):
Simplify again -- since there's only one place we put autocompiled
files, and compile-file finds it itself, there's no need to pass along
the compiled file path.
(scm_primitive_load_path): Don't call out to compiled-file-name to get
the fallback path, as we might not be autocompiling, and besides that
we need to check if the file exists at all.
* module/system/base/compile.scm (compiled-file-name): Simplify again.
The auto-compiled path is just fallback path + full source path + .go.
Andy Wingo [Thu, 4 Jun 2009 23:20:19 +0000 (01:20 +0200)]
further autocompilation tweaks
* module/system/base/compile.scm (compiled-file-name):
* libguile/load.c (scm_init_load_path, scm_try_autocompile)
(scm_primitive_load_path): Rework so that we search for .go files in
the load-compiled path and in the fallback path, but we only
autocompile to the fallback path. Should produce a more desirable experience.
Andy Wingo [Thu, 4 Jun 2009 21:11:55 +0000 (23:11 +0200)]
propagate timestamps to installed .scm and .go files
* am/guilec: Propagate timestamps of .scm and .go files on to their
installed variants. Helps the is-the-.go-file-stale? code do its job.
Andy Wingo [Thu, 4 Jun 2009 10:53:34 +0000 (12:53 +0200)]
fix .go installation
* am/guilec (nobase_ccache_DATA): Fix .go installation.
Andy Wingo [Thu, 4 Jun 2009 10:47:47 +0000 (12:47 +0200)]
turn off autocompilation when snarfing
* libguile/Makefile.am (snarf2checkedtexi): Turn off autocompilation when
snarfing.
Andy Wingo [Wed, 3 Jun 2009 21:59:58 +0000 (23:59 +0200)]
fix error autocompiling parts of the compiler; make check works
* libguile/load.c (scm_try_autocompile): Punt if compiled-file-name does
not resolve, which would indicate that the file in question is part of
the compiler itself.
* test-suite/tests/elisp.test: Today I was an evil one -- disable
autocompilation for the elisp tests, as they are meant only for the
memoizer's eyes. Hopefully Daniel will fix this :-)
Andy Wingo [Wed, 3 Jun 2009 21:20:44 +0000 (23:20 +0200)]
tweaks to autocompile code
* libguile/load.c (compiled_is_newer): Tweak diagnostic output.
(do_try_autocompile, autocompile_catch_handler, scm_try_autocompile):
Rework to compute the name of the compiled file in advance. If the
computed name is different from the found .go file and is fresh, use it
directly.
Fixes the case where /usr/lib/.../foo.go is out of date but the user
doesn't have permissions to recompile, so we use the user's local
compile cache instead if it's fresh.
(scm_primitive_load): Pass the found .go file as well to
scm_try_autocompile.
Andy Wingo [Wed, 3 Jun 2009 16:22:39 +0000 (18:22 +0200)]
implement autocompilation
* am/guilec (.scm.go): Set GUILE_AUTO_COMPILE=0 when compiling individual
files, and remove the mkdir -p as compile-file takes care of that now.
* libguile/load.c (do_try_autocompile, autocompile_catch_handler)
(scm_try_autocompile, scm_init_load): Implement autocompilation.
* libguile/script.c (scm_shell_usage, scm_compile_shell_switches): Add
--autocompile / --no-autocompile command-line options, and support for
the GUILE_AUTO_COMPILE environment variable, defaulting to
autocompilation enabled.
Andy Wingo [Wed, 3 Jun 2009 07:48:16 +0000 (09:48 +0200)]
add exception_on_error optional arg to primitive-load-path
* libguile/init.c (scm_load_startup_files): Use
scm_c_primitive_load_path.
* libguile/load.c (scm_primitive_load_path): Add an optional arg,
exception_on_error, which if #f will cause primitive-load-path to just
return #f if no file is found. This is to help out the semantics of
try-module-autoload. We can't just catch misc-error, because loading
the file could raise any exception.
(scm_c_primitive_load_path): Add the extra arg to
scm_primitive_load_path.
* libguile/load.h: Adapt scm_primitive_load_path prototype.
* module/ice-9/boot-9.scm (try-module-autoload): Refactor slightly to be
clearer.
Andy Wingo [Wed, 3 Jun 2009 07:24:35 +0000 (09:24 +0200)]
refactors to load.c to support auto-compilation
* libguile/load.c (compiled_is_newer): Factored out of
scm_primitive_load_path.
(scm_try_autocompile): New stub, for autocompiling. Currently just
returns false.
(scm_primitive_load_path): Refactor, and call out to
scm_try_autocompile if the .go is missing or not fresh.
Andy Wingo [Wed, 3 Jun 2009 07:02:48 +0000 (09:02 +0200)]
compiled-file-name tries to put the .go in the %load-compiled-path
* module/system/base/compile.scm (ensure-writable-dir): Rename from
ensure-directory.
(dsu-sort): Helper, does a decorate / sort / undecorate.
(compiled-file-name): Refactor to only return a writable filename. The
readable case is handled by load.c now, and the other case was silly.
Hopefully it will do the right thing.
(load-ensuring-compiled): Remove, load.c will call out to compile-file
if necessary.
(ensure-fallback-path): Remove, load.c will add the ~/.guile-ccache dir
to the load-compiled path, which will prompt its creation if necessary.
Andy Wingo [Tue, 2 Jun 2009 20:49:39 +0000 (22:49 +0200)]
install .go files under $libdir, not $datadir
* am/guilec: Install .go files to
$(pkglibdir)/$GUILE_EFFECTIVE_VERSION/ccache.
Andy Wingo [Tue, 2 Jun 2009 20:39:30 +0000 (22:39 +0200)]
file-exists? doesn't cause a throw, simpler try-module-autoload
* module/ice-9/boot-9.scm (file-exists?): Change to use the stat
interface that doesn't throw exceptions.
(try-module-autoload): Simplify to take advantage of the fact that
primitive-load-path does the right thing with regards to loading
compiled files if they are available.
Andy Wingo [Tue, 2 Jun 2009 20:37:24 +0000 (22:37 +0200)]
update uninstalled-env.in for load-compiled path separation
* meta/uninstalled-env.in: Update to set GUILE_LOAD_COMPILED_PATH and
GUILE_SYSTEM_COMPILED_PATH.
Andy Wingo [Tue, 2 Jun 2009 20:20:21 +0000 (22:20 +0200)]
add exception-on-error optional arg to `stat' in scheme
* libguile/filesys.h:
* libguile/filesys.c (scm_stat): Add optional arg, exception-on-error,
which if #f (not the default) will just return #f instead of raising an
exception if the stat fails.