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.
* 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.
* 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!
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
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.
* 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.
* 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 :)
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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 :-)
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* libguile/Makefile.am (libpath.h): Add definitions for SCM_CCACHE_DIR
and SCM_EFFECTIVE_VERSION. These are private, the header is not
installed. Add ccachedir to build-info. Rework some other build-info
definitions.
* libguile/load.c (scm_loc_load_compiled_path): New global, corresponding
to the new environment variable, GUILE_LOAD_COMPILED_PATH. Compiled
files will now be searched for in this path, and only in this path.
(scm_init_load_path): Init the load-compiled path too. We initialize it
with $pkglibdir/guile/$effective_version/ccache, and also with
$HOME/.guile-ccache/$effective_version/. This will respect the
libdir/datadir difference, and it is a preparation for automatic
compilation support.
(scm_primitive_load_path): Search only the GUILE_LOAD_COMPILED_PATH for
compiled files.
(scm_init_load): Cache scm_loc_load_compiled_path.