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.
Andy Wingo [Tue, 2 Jun 2009 20:18:02 +0000 (22:18 +0200)]
separate the load-compiled path from the load path
* 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.
Julian Graham [Tue, 2 Jun 2009 13:35:02 +0000 (09:35 -0400)]
Merge branch 'master' of git://git.savannah.gnu.org/guile
Julian Graham [Thu, 28 May 2009 22:15:05 +0000 (18:15 -0400)]
Implementation of SRFI-98 (An interface to access environment variables).
* NEWS: Add SRFI-98 to 1.8.7 features.
* doc/ref/srfi-modules.text (SRFI-98): Documentation for SRFI-98.
* module/srfi/srfi-98.scm: New file. SRFI-98 implementation.
* test-suite/tests/srfi-98.test: New file. SRFI-98 unit tests.
Andy Wingo [Fri, 29 May 2009 14:01:43 +0000 (16:01 +0200)]
Merge branch 'syncase-in-boot-9'
Conflicts:
module/Makefile.am
Ludovic Courtès [Wed, 27 May 2009 16:18:07 +0000 (18:18 +0200)]
Import R6RS bytevectors and I/O ports from Guile-R6RS-Libs 0.2.
* README: Document dependency on GNU libunistring.
* benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add
`benchmark/bytevectors.bm'.
* configure.in: Make sure we have libunistring; update $LIBS.
* libguile.h: Include "bytevectors.h" and "r6rs-ports.h".
* libguile/Makefile.am (libguile_la_SOURCES): Add `bytevectors.c' and
`r6rs-ports.c'
(DOT_X_FILES): Add `bytevectors.x' and `r6rs-ports.x'.
(DOT_DOC_FILES): Add `bytevectors.doc' and `r6rs-ports.doc'.
(noinst_HEADERS): Add `ieee-754.h'.
(modinclude_HEADERS): Add `bytevectors.h' and `r6rs-ports.h'
* libguile/validate.h (SCM_VALIDATE_BYTEVECTOR): New macro.
* module/Makefile.am (SOURCES): Add $(RNRS_SOURCES).
(RNRS_SOURCES): New variable.
* test-suite/Makefile.am (SCM_TESTS): Add `bytevectors.test' and
`r6rs-ports.test'.
Ludovic Courtès [Wed, 27 May 2009 14:50:40 +0000 (16:50 +0200)]
Use GNU libunistring and Gnulib modules needed by R6RS bytevectors and ports.
* m4/gnulib-cache.m4 (gl_MODULES): Add `byteswap', `iconv_open-utf',
`libunistring', `striconveh', and `string'.
Andy Wingo [Thu, 28 May 2009 13:01:30 +0000 (15:01 +0200)]
add tests for #' etc
* test-suite/tests/reader.test ("#'"): Add tests for the hash-syntax
reader macros.
Andy Wingo [Thu, 28 May 2009 12:59:47 +0000 (14:59 +0200)]
add reader tests for #;
* test-suite/tests/reader.test ("#;"): Add reader tests for #;.
Andy Wingo [Thu, 28 May 2009 12:49:33 +0000 (14:49 +0200)]
add reader support for #; #` #' #, and #,@. fix bug in compile-and-load.
* libguile/read.c (flush_ws, scm_read_commented_expression)
(scm_read_sharp): Add support for commenting out expressions with #;.
(scm_read_syntax, scm_read_sharp): Add support for #', #`, #, and #,@.
* module/ice-9/boot-9.scm: Remove #' read-hash extension, which actually
didn't do anything at all. It's been there since 1997, but no Guile
code I've ever seen uses it, and it conflicts with #'x => (syntax x)
from modern Scheme.
* module/system/base/compile.scm (compile-and-load): Whoops, fix a number
of bugs here.
Neil Jerram [Wed, 20 May 2009 20:55:35 +0000 (21:55 +0100)]
Remove possible deadlock in scm_join_thread_timed
* libguile/threads.c (scm_join_thread_timed): Recheck t->exited before
looping round to call block_self again, in case thread t has now
exited.
* test-suite/tests/threads.test ("don't hang when joined thread
terminates in SCM_TICK"): New test.
Neil Jerram [Sat, 23 May 2009 16:55:58 +0000 (17:55 +0100)]
Fix wait-condition-variable so that it doesn't leave asyncs blocked
* libguile/threads.c (fat_mutex_unlock): Unblock asyncs when breaking
out of loop.
* test-suite/tests/threads.test (asyncs-still-working?): New function,
to test if asyncs are working (i.e. unblocked). Use this throughout
threads.test, in particular before and after the "timed locking
succeeds if mutex unlocked within timeout" test.
Andy Wingo [Tue, 26 May 2009 20:23:44 +0000 (22:23 +0200)]
adjust VM copyright notices to LGPL, use SCM_INTERNAL/API properly
* libguile/frames.c:
* libguile/frames.h:
* libguile/instructions.c:
* libguile/instructions.h:
* libguile/objcodes.c:
* libguile/objcodes.h:
* libguile/programs.c:
* libguile/programs.h:
* libguile/vm-bootstrap.h:
* libguile/vm-engine.c:
* libguile/vm-engine.h:
* libguile/vm-expand.h:
* libguile/vm-i-scheme.c:
* libguile/vm.c:
* libguile/vm.h: Update to use SCM_API and SCM_INTERNAL correctly. Adjust
copyright to be the same as the copyright of Guile itself, which should
be fine given that the FSF holds the whole thing.
Andy Wingo [Tue, 26 May 2009 19:47:45 +0000 (21:47 +0200)]
fix backtraces with compiled boot-9
* module/ice-9/boot-9.scm (default-pre-unwind-handler): Since we were
tail-called by pre-unwind-handler-dispatch, we can't use
pre-unwind-handler-dispatch as a narrowing argument. Instead just
narrow by one frame.
(pre-unwind-handler-dispatch): Deprecate.
(error-catching-loop): Remove crack comment and code, and just use
default-pre-unwind-handler as our pre-unwind handler.
* module/ice-9/stack-catch.scm (stack-catch):
* module/system/repl/repl.scm (call-with-backtrace): Use
default-pre-unwind-handler directly.
Andy Wingo [Tue, 26 May 2009 16:06:21 +0000 (18:06 +0200)]
gnulib-tool --import environ; rely on gnulib for environ definitions
* libguile/posix.c:
* libguile/stime.c: Remove environ definition, gnulib provides it now.
Andy Wingo [Tue, 26 May 2009 15:39:58 +0000 (17:39 +0200)]
symbols are now hidden unless explicitly exported by SCM_API
* libguile/__scm.h (SCM_API, SCM_INTERNAL): Take the reverse strategy: symbols will
be hidden by default, and only exported with SCM_API. In addition to working
on Mac OS, it has the several nice efficiency benefits on Linux, and unifies
codepaths with Win32.
* libguile/Makefile.am: Define BUILDING_LIBGUILE when building Guile.
Andy Wingo [Tue, 26 May 2009 15:45:48 +0000 (17:45 +0200)]
gnulib-tool --import lib-symbol-visibility
Andy Wingo [Tue, 26 May 2009 14:03:37 +0000 (16:03 +0200)]
distcheck fix, fix (ice-9 time)
* lang/Makefile.am (elisp_sources): Add elisp/expand.scm.
* module/ice-9/time.scm (time): Fix for new macro expander. Ew.
Andy Wingo [Mon, 25 May 2009 20:45:42 +0000 (22:45 +0200)]
update docs -- sections on assembly and objcode
* doc/ref/api-procedures.texi:
* doc/ref/compiler.texi:
* doc/ref/vm.texi: Update the docs some more.
Andy Wingo [Sun, 24 May 2009 11:09:01 +0000 (13:09 +0200)]
update docs, clean up VM vestiges, macro docs, fix (/ a b c)
* doc/ref/api-procedures.texi (Compiled Procedures): Fix for API changes.
* doc/ref/compiler.texi (Compiling to the Virtual Machine): Replace GHIL
docs with Tree-IL docs. Update the bits about the Scheme compiler to
talk about Tree-IL and the expander instead of GHIL. Remove
<glil-argument>. Add placeholder sections for assembly and bytecode.
* doc/ref/vm.texi: Update examples with what currently happens. Reword
some things. Fix a couple errors.
* libguile/vm-i-system.c (externals): Remove this instruction, it's not
used.
* module/ice-9/documentation.scm (object-documentation): If the object is
a macro, try to return documentation on the macro transformer.
* module/language/assembly/disassemble.scm (disassemble-load-program):
Fix problem in which we skipped the first element of the object vector,
because of changes to procedure layouts a few months ago.
* module/language/scheme/spec.scm (read-file): Remove read-file
definition.
* module/language/tree-il.scm: Reorder exports. Remove <lexical>, it was
a compat shim to something that was never released. Fix `location'.
* module/language/tree-il/primitives.scm (/): Fix expander for more than
two args to /.
* module/system/base/compile.scm (read-file-in): Remove unused
definition.
* module/system/base/language.scm (system): Remove language-read-file.
* module/language/ecmascript/spec.scm (ecmascript): Remove read-file
definition.
Ludovic Courtès [Fri, 22 May 2009 21:44:43 +0000 (23:44 +0200)]
Rewrite SRFI-35 macros using `syntax-rules'.
* module/srfi/srfi-35.scm: Use `(ice-9 syncase)'.
(define-condition-type, condition): Rewritten using `syntax-rules'.
(compound-condition, condition-instantiation): New helper internal
macros. Thanks to Andy Wingo for his help!
Andy Wingo [Fri, 22 May 2009 19:14:48 +0000 (21:14 +0200)]
fix (oop goops) compilation for (language tree-il primitives)
* module/oop/goops.scm (compile): Whoop-dee, fix up (oop goops) for
(language tree-il primitives) change.
Andy Wingo [Fri, 22 May 2009 19:12:42 +0000 (21:12 +0200)]
source location tracking in psyntax, booya!
* module/ice-9/psyntax.scm (source-annotation): Return #f if
source-properties returns null.
(source-wrap): Rework a bit.
(syntax-type): Don't throw away source info for wrapped expressions.
Can has source location info, fools!
(chi-body): Correctly propagate source info for body subforms.
(syntax): Remove special case for map, it doesn't apply (ahem) for
Guile.
* module/ice-9/psyntax-pp.scm: Regenerate.
Andy Wingo [Fri, 22 May 2009 17:48:14 +0000 (19:48 +0200)]
remove annotations in psyntax in favor of guile's source properties
* module/ice-9/psyntax.scm: Remove references to annotation objects,
we're just going to try and use Guile's source properties now. It works
until `syntax' reconstructs output, at which point it seems we lose it.
* module/ice-9/psyntax-pp.scm: Regenerated.
Andy Wingo [Fri, 22 May 2009 17:26:58 +0000 (19:26 +0200)]
fix problem naming internal definitions
* module/ice-9/psyntax.scm (chi-body): Fix a problem introduced in
dc1eed52f71, that internal syntax definitions were included in the id
lis along with value definitions. Only showed up on a second bootstrap.
Psyntax, how I love thee.
* module/ice-9/psyntax-pp.scm
Andy Wingo [Fri, 22 May 2009 14:07:41 +0000 (16:07 +0200)]
move things to (language tree-il primitives)
* module/language/tree-il/optimize.scm:
* module/language/tree-il/primitives.scm: Move primitive-related things
to primitive.scm from inline.scm and optimize.scm.
* module/Makefile.am: Update for inventory changes.
Andy Wingo [Fri, 22 May 2009 11:00:23 +0000 (13:00 +0200)]
fix tree-il test to work if source info happens to be present
* module/language/tree-il/compile-glil.scm (flatten-lambda): Fix source
emission.
* test-suite/tests/tree-il.test (strip-source): Strip source info on
tree-il before compiling, so we don't get extraneous source info in the
glil. Make check passes!
Andy Wingo [Fri, 22 May 2009 10:48:45 +0000 (12:48 +0200)]
fix bad call to make-glil-src
* module/language/tree-il/compile-glil.scm (flatten-lambda): Fix bad call
to make-glil-src, unfortunately not hit during production because
psyntax doesn't yet understand source locations.
Andy Wingo [Fri, 22 May 2009 10:45:49 +0000 (12:45 +0200)]
fix expansion of (ice-9 threads)
* module/ice-9/threads.scm: Move syntax definitions before the procedures
that use them, and rewrite as hygienic macros since they are so much
nicer that way. Fixes the thread tests.
Andy Wingo [Fri, 22 May 2009 10:22:39 +0000 (12:22 +0200)]
syntax.test is passing, yay
* test-suite/tests/syntax.test ("top-level define"): Remove the test for
currying, as we don't do that any more by default. It should be easy
for the user to add in if she wants it, though.
("do"): Remove unmemoization tests, as sc-expand fully expands `do'.
("while"): Remove while tests in empty environments. They have been
throwing 'unresolved, and the problem they seek to test is fully
handled by hygiene anyway.
And otherwise tweak expected exception strings, and everything passes!
Andy Wingo [Fri, 22 May 2009 10:08:50 +0000 (12:08 +0200)]
residualize names into procedures. re-implement srfi-61. module naming foo.
* module/ice-9/boot-9.scm (cond): Implement srfi-61; most of the code is
from the SRFI itself. Yuk.
(%print-module, make-modules-in, %app, (%app modules))
(module-name): Syncase needs to get at the names of modules, even at
anonymous modules. So lazily assign gensyms as module names. Name %app
as (%app), but since (%app modules) is at the top of the module
hierarchy, name it ().
* module/ice-9/psyntax.scm: When building tree-il, try to name lambdas in
definitions and in lets.
(let, letrec): Give more specific errors in a couple of cases.
* module/ice-9/psyntax-pp.scm: Regenerated.
* test-suite/tests/syntax.test: More work. Many exceptions have different
messages than they used to, many more generic; we can roll this back to
be faithful to the original strings, but it doesn't seem necessary to
me.
Andy Wingo [Thu, 21 May 2009 20:43:07 +0000 (22:43 +0200)]
some work on syntax.test
* module/language/tree-il.scm (tree-il->scheme):
* module/ice-9/psyntax.scm (build-conditional): Attempt to not generate
(if #f #f) as the second arm of an if, but it doesn't seem to be
successful.
* module/ice-9/psyntax-pp.scm (syntax-rules): Regenerate.
* test-suite/tests/syntax.test (exception:unexpected-syntax): Change
capitalization.
("unquote-splicing"): Update test.
("begin"): Add in second arms on these ifs, to avoid the strange though
harmless expansion of `if'.
(matches?): New helper macro.
("lambda"): Match on lexically bound symbols, as they will be
alpha-renamed.
Andy Wingo [Thu, 21 May 2009 20:11:48 +0000 (22:11 +0200)]
catch syntax errors in unquote and unquote-splicing
* module/ice-9/psyntax.scm (quasiquote): Catch syntax errors in unquote
and unquote-splicing.
* module/ice-9/psytax-pp.scm: Regenerated.
Andy Wingo [Thu, 21 May 2009 19:39:37 +0000 (21:39 +0200)]
fix multiple values returning from srfi-18's `with-exception-handler'
* module/srfi/srfi-18.scm (with-exception-handler): Hah! Fixed a
scurrilous bug in which we assumed that the thunk returned one or more
values. Hah.
Andy Wingo [Thu, 21 May 2009 19:13:24 +0000 (21:13 +0200)]
fix apply and call/cc in drop contexts
* module/language/tree-il/compile-glil.scm (flatten): Actually apply only
needs one arg after the proc. And shit, call/cc and apply in drop
contexts also need to be able to return arbitrary numbers of values;
work it by trampolining through their applicative (non-@) definitions.
Also, simplify the single-valued drop case to avoid the
truncate-values.
* module/language/tree-il/inline.scm (call/cc):
* module/language/tree-il/optimize.scm (*interesting-primitive-names*):
Define call/cc as "interesting". Perhaps we should be hashing on value
and not on variable.
* test-suite/tests/tree-il.test ("application"): Fix up test for new,
sleeker output. (Actually the GLIL is more verbose, but the assembly is
better.)
("apply", "call/cc"): Add some more tests.
Andy Wingo [Thu, 21 May 2009 15:22:58 +0000 (17:22 +0200)]
procedures in "drop" contexts can return unspecified values
* module/language/tree-il/compile-glil.scm (flatten): For applications in
"drop" context, allow the procedure to return unspecified values
(including 0 values).
* test-suite/tests/tree-il.test ("application"): Adapt test.
* module/srfi/srfi-18.scm (wrap): Clarify.
* test-suite/tests/srfi-18.test: Fix so that the expression importing
srfi-18 is expanded before the tests. However the tests are still
failing, something about 0-valued returns...
Andy Wingo [Thu, 21 May 2009 14:04:14 +0000 (16:04 +0200)]
fix srfi-17.test
* test-suite/tests/srfi-17.test (exception:bad-quote): Change the
expected exception for (set! (quote foo) ...) errors.
Andy Wingo [Thu, 21 May 2009 13:34:29 +0000 (15:34 +0200)]
just parse method arguments once.
* module/oop/goops.scm (method): Tweak to just run through the arguments
once. Thanks to Eli Barzilay for the tip.
Andy Wingo [Thu, 21 May 2009 11:49:00 +0000 (13:49 +0200)]
rewrite `method' as a hygienic macro to re-allow lexical specializers
* module/oop/goops.scm (method): Reimplement as a hygienic macro. This
seriously took me like 6 hours to figure out. Allows for lexical
specializers: (let ((<x> ...)) (define-method (foo (arg <x>)) ...)).
* module/oop/goops/compile.scm (next-method?, compile-make-procedure):
Remove these, as `method' does it all now, hygienically.
Ludovic Courtès [Wed, 20 May 2009 23:24:01 +0000 (01:24 +0200)]
Make use of Gnulib's `flock' module.
* libguile/posix.c: Always use <sys/file.h>, which is provided by
Gnulib.
(flock)[__MINGW32__]: Remove.
(scm_flock): Compile unconditionally. Always use Gnulib's flock(2).
Ludovic Courtès [Wed, 20 May 2009 23:17:00 +0000 (01:17 +0200)]
Make use of Gnulib's `putenv' module.
* libguile/posix.c: Include <stdlib.h> since the putenv(3) declaration
is there (POSIX and Gnulib).
(scm_putenv): Rely on Gnulib's `putenv' module.
Ludovic Courtès [Wed, 20 May 2009 23:00:41 +0000 (01:00 +0200)]
Add Gnulib portability modules; update Gnulib files.
* m4/gnulib-cache.m4 (gl_MODULES): Add `flock' (provides flock(2)
declaration and implementation), `fpieee' (fixes floating point
behavior on Alpha and SH), `stdlib' (provides an unsetenv(3)
declaration, among others), `putenv' (provides a putenv(3) declaration
and implementation with the semantics we need).
Ludovic Courtès [Mon, 11 May 2009 22:12:18 +0000 (00:12 +0200)]
Update `NEWS'.
Michael Gran [Sat, 25 Apr 2009 05:23:13 +0000 (22:23 -0700)]
Symbols longer than 128 chars can cause an exception. Also, the terminating colon of long postfix keywords are not handled correctly.
* test-suite/tests/reader.test ("read-options"): Add test
for long postfix keywords.
* libguile/read.c (scm_read_mixed_case_symbol): Fix
exception on symbols are greater than 128 chars. Also,
colons are not stripped from long postfix keywords.
Ludovic Courtès [Wed, 20 May 2009 22:16:47 +0000 (00:16 +0200)]
Update `NEWS' wrt. `branch_release-1-8'.
Ludovic Courtès [Mon, 11 May 2009 20:13:29 +0000 (22:13 +0200)]
Fix compilation of `test-round.c' on BSD.
* test-suite/standalone/test-round.c (HAVE_MACHINE_FPU_H): Include
<sys/types.h> when available. This fixes compilation on NetBSD.
Reported by Greg Toxel.
Ludovic Courtès [Thu, 23 Apr 2009 22:44:43 +0000 (00:44 +0200)]
Update `NEWS'.
Ludovic Courtès [Thu, 23 Apr 2009 21:20:59 +0000 (23:20 +0200)]
Don't use raw divisions by zero in `test-conversion.c'.
* test-suite/standalone/test-conversion.c (ieee_init): New function.
(guile_Inf, guile_NaN): New variables.
(test_from_double, test_to_double): Use them. Divisions by zero made
`cc' on Tru64 5.1b ("Compaq C V6.5-011") bail out and led to a
floating point exception when compiled with GCC on the same platform.
(main): Call `ieee_init ()'.
Ludovic Courtès [Thu, 23 Apr 2009 20:51:27 +0000 (22:51 +0200)]
Use <machine/fpu.h> instead of <fenv.h> when needed (e.g., Tru64 5.1b).
* configure.in: Look for <machine/fpu.h>.
* test-suite/standalone/test-round.c: Use <machine/fpu.h> if available.
Ludovic Courtès [Thu, 23 Apr 2009 20:24:32 +0000 (22:24 +0200)]
Work around lack of cuserid(3) declaration on Tru64 5.1b.
* configure.in: Check for a cuserid(3) declaration.
* libguile/posix.c [HAVE_CUSERID][!HAVE_DECL_CUSERID]: Provide a
declaration.
Ludovic Courtès [Wed, 22 Apr 2009 22:28:32 +0000 (00:28 +0200)]
Work around the lack of hstrerror(3) declaration on Tru64.
* configure.in: Look for the declaration of hstrerror(3).
* libguile/net_db.c: Add hstrerror(3) declaration if
`HAVE_DECL_HSTRERROR' is undefined.
Ludovic Courtès [Wed, 22 Apr 2009 21:53:52 +0000 (23:53 +0200)]
Remove extraneous semicolons from `test-conversion.c'.
* test-suite/standalone/test-conversion.c: Remove extraneous semicolon
following `DEF[SU]TST' invocations since that made Compaq C
V6.5-011 (`cc' on Tru64 5.1b) bail out.
Ludovic Courtès [Tue, 21 Apr 2009 20:37:45 +0000 (22:37 +0200)]
Fix compilation of `numbers.c' on Tru64.
* libguile/numbers.c (scm_c_make_polar): Don't use sincos(3) on non-GNU
platforms. Reported by Didier Godefroy <ldg@ulysium.net>.
Ludovic Courtès [Tue, 21 Apr 2009 20:34:54 +0000 (22:34 +0200)]
Fix compilation of `gcc_os_dep.c' on Tru64.
* libguile/gc_os_dep.c [OSF1](_end): Specify the type.
(scm_get_stack_base): Suitably cast RESULT. Reported by Didier
Godefroy <ldg@ulysium.net>.
Ludovic Courtès [Tue, 21 Apr 2009 20:27:38 +0000 (22:27 +0200)]
Update `NEWS' and `THANKS'.
Neil Jerram [Sun, 7 Sep 2008 15:29:05 +0000 (16:29 +0100)]
Avoid "no duplicate" popen tests leaving zombie processes
On the one hand we want the child process in these tests to exit. On
the other, we don't want it to exit before the parent Guile code has
tested the relevant condition (EOF in the first test, broken pipe in
the second) - because these conditions would obviously be true if the
child had already exited, and that's not what we're trying to test
here. We're trying to test getting EOF and broken pipe while the
child process is still alive.
* test-suite/tests/popen.test (open-input-pipe:no duplicate): Add
another pipe from parent to child, so that the child can finish by
reading from this. Then the parent controls the child lifetime by
writing to this pipe.
* test-suite/tests/popen.test (open-output-pipe:no duplicate): Add
another pipe from child to parent, and have the child finish by
endlessly writing into this. Then the parent controls the child
lifetime by closing its end of the pipe, causing a broken pipe in
the child.
Neil Jerram [Wed, 20 May 2009 17:50:52 +0000 (18:50 +0100)]
Fix `explicitely' typos, should be `explicitly'
Andy Wingo [Wed, 20 May 2009 16:11:23 +0000 (18:11 +0200)]
fix failing macro-as-parameter tests in eval.test
* module/ice-9/psyntax.scm (chi-lambda-clause): Strip the docstring
before passing it on to the continuation.
* module/ice-9/psyntax-pp.scm: Regenerated.
* test-suite/tests/eval.test (exception:failed-match): New exception, for
syntax-case failed matches.
("evaluator"): Fix macro-as-parameter tests. They pass now :)
Andy Wingo [Wed, 20 May 2009 15:41:21 +0000 (17:41 +0200)]
remove compile-time-environment
* module/ice-9/boot-9.scm (guile-user): Move the `compile' autoload to
the guile-user module. Remove reference to compile-time-environment.
* module/language/scheme/compile-ghil.scm:
* module/language/tree-il/compile-glil.scm:
* module/language/tree-il/optimize.scm:
* module/system/base/compile.scm:
* test-suite/tests/compiler.test: Remove definition of and references to
compile-time-environment. While I do think that recompilation based on
a lexical environment can be useful, I think it needs to be implemented
differently. So for now we've lost nothing if we take it away, as it
doesn't work with syncase anyway.
Andy Wingo [Wed, 20 May 2009 15:28:59 +0000 (17:28 +0200)]
Fix a bug in the (ice-9 match) test
* testsuite/t-match.scm (matches?): Fix match invocation. As far as I can
tell, although (ice-9 match) does advertise a => form of clauses, it
requires that the end of the => be a symbol. For some reason this
works in the interpreter:
((lambda () (begin => #t)))
It's part of the expansion of matches?. It also worked in the old
compiler. Thinking that maybe toplevel references could cause side
effects, I made the new compiler actually ref =>, which brought this to
light.
Andy Wingo [Wed, 20 May 2009 11:59:42 +0000 (13:59 +0200)]
fix @slot-ref / @slot-set! compilation
* module/language/tree-il/compile-glil.scm: Add primcall compilers for
@slot-ref and @slot-set.
* module/language/tree-il/optimize.scm (add-interesting-primitive!): New
export. Creates an association between a variable in the current module
and a primitive name.
* module/oop/goops.scm: Rework compiler hooks to work with tree-il and
not ghil.
Andy Wingo [Wed, 20 May 2009 11:33:44 +0000 (13:33 +0200)]
compile `list' and `vector' to their associated opcodes
* module/language/glil/compile-assembly.scm (glil->assembly): Check the
length when emitting calls to variable-argument stack instructions.
Allow two-byte lengths -- allows e.g. calls to `list' with more than
256 arguments.
* module/language/tree-il/compile-glil.scm: Add primcall associations for
`list' and `vector', with any number of arguments. Necessary because
syncase's quasiquote expansions will produce calls to `list' with many
arguments.
* module/language/tree-il/optimize.scm (*interesting-primitive-names*):
Add `list' and `vector' to the set of primitives to resolve.
Andy Wingo [Wed, 20 May 2009 10:46:23 +0000 (12:46 +0200)]
don't allocate too many locals for expansions of `or'
* module/language/tree-il/analyze.scm (analyze-lexicals): Add in a hack
to avoid allocating more locals than necessary for expansions of `or'.
Documented in the source.
* test-suite/tests/tree-il.test: Add a test case.
Andy Wingo [Wed, 20 May 2009 09:59:41 +0000 (11:59 +0200)]
a few fixups
* module/ice-9/psyntax.scm (chi-install-global, syntax-case): Fix a
couple of cases in which bare datums were passed to output
constructors.
* module/ice-9/psyntax-pp.scm: Regenerated.
* module/language/scheme/spec.scm (scheme): Clean up the #:compilers
list.
* module/language/tree-il/compile-glil.scm (flatten): Fix call to
`length' in call/cc compiler.
Andy Wingo [Wed, 20 May 2009 09:15:22 +0000 (11:15 +0200)]
and, or, cond etc use syntax-rules, compile scheme through tree-il
* libguile/vm-i-system.c:
* libguile/vm-engine.h (ASSERT_BOUND): New assertion, that a value is
bound. Used by local-ref and external-ref in paranoid mode.
* module/ice-9/boot-9.scm (and, or, cond, case, do): Since we are
switching to use psyntax as the first pass of the compiler, and perhaps
soon of the interpreter too, we need to make sure it expands out all
forms to primitive expressions. So define expanders for these derived
syntax forms, as in the R5RS report.
* module/ice-9/psyntax-pp.scm: Regenerate, with core forms fully
expanded.
* module/ice-9/psyntax.scm (build-void): New constructor, for making
undefined values.
(build-primref): Add in a hack so that primitive refs in the boot
module expand out to toplevel refs, not module refs.
(chi-void): Use build-void.
(if): Define an expander for if that calls build-conditional.
* module/language/scheme/compile-tree-il.scm (compile-tree-il): Use let*
so as not to depend on binding order for the result of
(current-module).
* module/language/scheme/spec.scm (scheme): Switch over to tree-il as the
primary intermediate language. Not yet fully tested, but at least it
can compile psyntax-pp.scm.
* module/language/tree-il/analyze.scm (analyze-lexicals): Arguments don't
count towards a function's nlocs.
* module/language/tree-il/compile-glil.scm (*comp-module*, compile-glil):
Define a "compilation module" fluid.
(flatten-lambda): Fix a call to make-glil-argument. Fix bug in
heapifying arguments.
(flatten): Fix number of arguments passed to apply instruction. Add a
special case for `(values ...)'. If inlining primitive-refs fails,
try expanding into toplevel-refs if the comp-module's variable is the
same as the root variable.
* module/language/tree-il/optimize.scm (resolve-primitives!): Add missing
src variable for <module-ref>.
* test-suite/tests/tree-il.test ("lambda"): Fix nlocs counts. Add a
closure test case.
Andy Wingo [Mon, 18 May 2009 21:45:35 +0000 (23:45 +0200)]
add tree-il->glil compilation test suite
* module/language/tree-il.scm (parse-tree-il): Fix a number of bugs.
(unparse-tree-il): Apply takes rest args now.
* module/language/tree-il/analyze.scm (analyze-lexicals)
(analyze-lexicals): Heap vars shouldn't increment the number of locals.
* module/language/tree-il/optimize.scm (resolve-primitives!): Don't
resolve public refs to primitives, not at the moment anyway.
* test-suite/Makefile.am (SCM_TESTS): Add tree-il test.
* test-suite/lib.scm (pass-if, expect-fail, pass-if-exception)
(expect-fail-exception): Rewrite as syntax-rules macros. In a very
amusing turn of events, it turns out that bindings introduced by
hygienic macros are not visible inside expansions produced by
defmacros. This seems to be expected, so go ahead and work around the
problem.
* test-suite/tests/srfi-31.test ("rec special form"): Expand in eval.
* test-suite/tests/syntax.test ("begin"): Do some more expanding in eval,
though all is not yet well.
* test-suite/tests/tree-il.test: New test suite, for tree-il->glil
compilation.
Andy Wingo [Sun, 17 May 2009 23:08:34 +0000 (01:08 +0200)]
special cases for more types of known applications
* module/language/tree-il/compile-glil.scm (flatten): Handle a number of
interesting applications, and fix a bug for calls in `drop' contexts.
* module/language/tree-il/inline.scm: Define expanders for apply,
call-with-values, call-with-current-continuation, and values.
Andy Wingo [Sun, 17 May 2009 21:24:26 +0000 (23:24 +0200)]
inline calls to some primitives
* module/system/base/pmatch.scm: Wrap consequents in (let () ) instead of
(begin ) so that they can have local definitions.
* module/language/tree-il/compile-glil.scm: Inline some calls to
primitives.
Andy Wingo [Sun, 17 May 2009 16:04:36 +0000 (18:04 +0200)]
define `delay' in terms of make-promise
* module/ice-9/boot-9.scm (delay): Define `delay' in terms of
make-promise.
* module/ice-9/psyntax-pp.scm (compile): Regenerated with a fully
compiled Guile, so that the gensym numbers are the same.
* module/language/tree-il/compile-glil.scm: Add some notes about what
needs doing to catch up to the old compiler.
Andy Wingo [Sun, 17 May 2009 14:46:46 +0000 (16:46 +0200)]
and now, we residualize the original names into the metadata. yay!
* module/language/tree-il/compile-glil.scm (vars->bind-list)
(emit-bindings, flatten-lambda, flatten): Write the original names into
<glil-bind> structures. Yaaaaay!
Andy Wingo [Sun, 17 May 2009 14:39:55 +0000 (16:39 +0200)]
actually pass original ids on to tree-il data types
* module/ice-9/psyntax.scm (build-lambda, build-let, build-named-let)
(build-letrec): Actually pass along the original ids to tree-il
constructors.
* module/ice-9/psyntax-pp.scm: Regenerated.
* module/language/tree-il.scm: Add fields in <lambda>, <let>, and
<letrec> for the original variable names.
* module/language/tree-il/compile-glil.scm (compile-glil): Adapt for new
make-lambda arg.
Andy Wingo [Sun, 17 May 2009 14:27:18 +0000 (16:27 +0200)]
preserve original var names in lets and lambdas
* module/ice-9/psyntax.scm (build-letrec, build-let, build-lambda)
(build-named-let): Take extra args for the original names of the
gensyms. Not used yet. Callers adapted.
* module/ice-9/psyntax-pp.scm: Regenerated.
Andy Wingo [Fri, 15 May 2009 21:44:14 +0000 (23:44 +0200)]
tree-il -> glil compiler works now, at least in initial tests
* module/language/tree-il/analyze.scm: Break analyzer out into its own
file.
* module/language/tree-il/compile-glil.scm: Port the GHIL->GLIL compiler
over to work on tree-il. Works, but still misses a number of important
optimizations.
* module/language/tree-il.scm: Add <void>. Not used quite yet.
* module/language/glil.scm: Remove <glil-argument>, as it is the same as
<glil-local> (minus an offset).
* module/language/glil/compile-assembly.scm:
* module/language/glil/decompile-assembly.scm:
* module/language/ghil/compile-glil.scm: Adapt for <glil-argument>
* removal.
* module/Makefile.am (TREE_IL_LANG_SOURCES): Reorder, and add
analyze.scm.
Andy Wingo [Wed, 13 May 2009 22:11:25 +0000 (00:11 +0200)]
add lexical analyzer and allocator
* module/language/tree-il/optimize.scm: Rework to just export the
optimize! procedure.
* module/language/tree-il/compile-glil.scm (analyze-lexicals): New
function, analyzes and allocates lexical variables. Almost ready to
compile now.
(codegen): Dedent.
Andy Wingo [Tue, 12 May 2009 20:29:34 +0000 (22:29 +0200)]
add primitive expander for tree-il
* module/Makefile.am: Add inline.scm.
* module/language/tree-il.scm (pre-order!, post-order!): pre-order! is
new. post-order! existed but was not public. They do destructive tree
traversals of tree-il, and need more documentation. Also, add
predicates to tree-il's export list.
* module/language/tree-il/inline.scm: New file, which expands primitives
into more primitive primitives. In the future perhaps it will not be
necessary, as the general inlining infrastructure will handle these
cases, but for now it's useful.
* module/language/tree-il/optimize.scm: Move post-order! out to better
pastures.
Andy Wingo [Mon, 11 May 2009 21:23:34 +0000 (23:23 +0200)]
add tree-il optimizer
* module/language/tree-il/optimize.scm: New module, for optimizations.
Currently all we have is resolving some toplevel refs to primitive
refs.
* module/Makefile.am: Add new module.
* module/language/tree-il.scm: Fix exports for accessors for `src'.
* module/language/tree-il/compile-glil.scm: Tweaks, things still aren't
working yet.
Andy Wingo [Fri, 8 May 2009 10:56:18 +0000 (12:56 +0200)]
more work on tree-il compilation
* module/language/scheme/amatch.scm: Remove, this approach won't be used.
* module/Makefile.am: Adjust for additions and removals.
* module/language/scheme/compile-ghil.scm: Remove an vestigial debugging
statement.
* module/language/scheme/spec.scm:
* module/language/scheme/compile-tree-il.scm:
* module/language/scheme/decompile-tree-il.scm: Add tree-il compiler and
decompiler.
* module/language/tree-il/compile-glil.scm: Add some notes.
* module/language/tree-il/spec.scm: No need to wrap expressions in
lambdas -- GHIL needs somewhere to put its variables, we don't.
Andy Wingo [Thu, 7 May 2009 15:44:51 +0000 (17:44 +0200)]
go ahead and regenerate psyntax-pp.scm
Andy Wingo [Thu, 7 May 2009 15:38:40 +0000 (17:38 +0200)]
remove (ice-9 expand-support)
* module/ice-9/Makefile.am:
* module/ice-9/expand-support.scm: Remove module, no longer used.
* module/ice-9/psyntax.scm: Fix a comment.
Andy Wingo [Thu, 7 May 2009 11:45:03 +0000 (13:45 +0200)]
new language: tree-il. psyntax generates it when run in compile mode.
* module/Makefile.am: Add tree-il sources.
* module/ice-9/compile-psyntax.scm: Adjust for sc-expand producing
tree-il in compile mode.
* module/ice-9/psyntax.scm: Switch from expand-support to tree-il for
generating output in compile mode. Completely generate tree-il -- the
output wasn't Scheme before, but now it's completely not Scheme.
* module/ice-9/psyntax-pp.scm: Regenerated.
* module/language/scheme/compile-ghil.scm: Strip structures using
tree-il, not expand-support.
* module/language/tree-il.scm:
* module/language/tree-il/spec.scm
* module/language/tree-il/compile-glil.scm: New language. It will compile
to GLIL, though it doesn't yet.
Andy Wingo [Thu, 7 May 2009 09:02:10 +0000 (11:02 +0200)]
make expand-support structure constructors take a source argument
* module/ice-9/expand-support.scm (make-module-ref, make-lexical): Add
source arguments to these constructors.
* module/ice-9/psyntax.scm:
* module/ice-9/psyntax-pp.scm: Adapt to match, though we don't wire
everything up yet.
Andy Wingo [Thu, 7 May 2009 08:27:53 +0000 (10:27 +0200)]
fix install-global construction of `define' forms
* module/ice-9/psyntax.scm (build-global-definition): Remove mod
argument, as it does not seem we could ever define something in another
module.
(chi-install-global): Build the define as a definition, not an
application. Doesn't matter now, but it will later.
(chi-top): Fix build-global-definition call.
* module/ice-9/psyntax.scm: Regenerated.