summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2009-06-03tweaks to autocompile codeAndy Wingo1-13/+36
* 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.
2009-06-03implement autocompilationAndy Wingo3-3/+92
* 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.
2009-06-03add exception_on_error optional arg to primitive-load-pathAndy Wingo4-13/+23
* 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.
2009-06-03refactors to load.c to support auto-compilationAndy Wingo1-32/+45
* 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.
2009-06-03compiled-file-name tries to put the .go in the %load-compiled-pathAndy Wingo1-98/+57
* 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.
2009-06-03install .go files under $libdir, not $datadirAndy Wingo2-12/+96
* am/guilec: Install .go files to $(pkglibdir)/$GUILE_EFFECTIVE_VERSION/ccache.
2009-06-03file-exists? doesn't cause a throw, simpler try-module-autoloadAndy Wingo1-18/+5
* 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.
2009-06-03update uninstalled-env.in for load-compiled path separationAndy Wingo1-2/+19
* meta/uninstalled-env.in: Update to set GUILE_LOAD_COMPILED_PATH and GUILE_SYSTEM_COMPILED_PATH.
2009-06-03add exception-on-error optional arg to `stat' in schemeAndy Wingo2-12/+22
* 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.
2009-06-03separate the load-compiled path from the load pathAndy Wingo2-5/+52
* 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.
2009-06-02Merge branch 'master' of git://git.savannah.gnu.org/guileJulian Graham158-3450/+17420
2009-05-30Implementation of SRFI-98 (An interface to access environment variables).Julian Graham4-0/+106
* 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.
2009-05-29Merge branch 'syncase-in-boot-9'Andy Wingo92-3375/+4567
Conflicts: module/Makefile.am
2009-05-28Import R6RS bytevectors and I/O ports from Guile-R6RS-Libs 0.2.Ludovic Courtès18-12/+4688
* 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'.
2009-05-28Use GNU libunistring and Gnulib modules needed by R6RS bytevectors and ports.Ludovic Courtès42-12/+7947
* m4/gnulib-cache.m4 (gl_MODULES): Add `byteswap', `iconv_open-utf', `libunistring', `striconveh', and `string'.
2009-05-28add tests for #' etcAndy Wingo1-0/+12
* test-suite/tests/reader.test ("#'"): Add tests for the hash-syntax reader macros.
2009-05-28add reader tests for #;Andy Wingo1-0/+23
* test-suite/tests/reader.test ("#;"): Add reader tests for #;.
2009-05-28add reader support for #; #` #' #, and #,@. fix bug in compile-and-load.Andy Wingo3-6/+86
* 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.
2009-05-27Remove possible deadlock in scm_join_thread_timedNeil Jerram2-1/+35
* 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.
2009-05-27Fix wait-condition-variable so that it doesn't leave asyncs blockedNeil Jerram2-2/+42
* 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.
2009-05-26adjust VM copyright notices to LGPL, use SCM_INTERNAL/API properlyAndy Wingo15-627/+273
* 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.
2009-05-26fix backtraces with compiled boot-9Andy Wingo3-14/+7
* 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.
2009-05-26gnulib-tool --import environ; rely on gnulib for environ definitionsAndy Wingo6-28/+42
* libguile/posix.c: * libguile/stime.c: Remove environ definition, gnulib provides it now.
2009-05-26symbols are now hidden unless explicitly exported by SCM_APIAndy Wingo2-16/+14
* 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.
2009-05-26gnulib-tool --import lib-symbol-visibilityAndy Wingo5-10/+91
2009-05-26distcheck fix, fix (ice-9 time)Andy Wingo2-1/+2
* lang/Makefile.am (elisp_sources): Add elisp/expand.scm. * module/ice-9/time.scm (time): Fix for new macro expander. Ew.
2009-05-25update docs -- sections on assembly and objcodeAndy Wingo3-38/+160
* doc/ref/api-procedures.texi: * doc/ref/compiler.texi: * doc/ref/vm.texi: Update the docs some more.
2009-05-24update docs, clean up VM vestiges, macro docs, fix (/ a b c)Andy Wingo12-485/+347
* 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.
2009-05-22Rewrite SRFI-35 macros using `syntax-rules'.Ludovic Courtès1-32/+35
* 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!
2009-05-22fix (oop goops) compilation for (language tree-il primitives)Andy Wingo1-1/+1
* module/oop/goops.scm (compile): Whoop-dee, fix up (oop goops) for (language tree-il primitives) change.
2009-05-22source location tracking in psyntax, booya!Andy Wingo2-30/+20
* 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.
2009-05-22remove annotations in psyntax in favor of guile's source propertiesAndy Wingo2-136/+86
* 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.
2009-05-22fix problem naming internal definitionsAndy Wingo2-16/+18
* 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
2009-05-22move things to (language tree-il primitives)Andy Wingo3-55/+58
* 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.
2009-05-22fix tree-il test to work if source info happens to be presentAndy Wingo2-5/+13
* 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!
2009-05-22fix bad call to make-glil-srcAndy Wingo1-1/+1
* 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.
2009-05-22fix expansion of (ice-9 threads)Andy Wingo1-56/+58
* 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.
2009-05-22syntax.test is passing, yayAndy Wingo1-84/+27
* 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!
2009-05-22residualize names into procedures. re-implement srfi-61. module naming foo.Andy Wingo4-164/+208
* 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.
2009-05-21some work on syntax.testAndy Wingo4-19/+37
* 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.
2009-05-21catch syntax errors in unquote and unquote-splicingAndy Wingo3-14/+29
* module/ice-9/psyntax.scm (quasiquote): Catch syntax errors in unquote and unquote-splicing. * module/ice-9/psytax-pp.scm: Regenerated.
2009-05-21fix multiple values returning from srfi-18's `with-exception-handler'Andy Wingo1-2/+4
* 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.
2009-05-21fix apply and call/cc in drop contextsAndy Wingo4-17/+82
* 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.
2009-05-21procedures in "drop" contexts can return unspecified valuesAndy Wingo4-9/+21
* 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...
2009-05-21fix srfi-17.testAndy Wingo1-2/+5
* test-suite/tests/srfi-17.test (exception:bad-quote): Change the expected exception for (set! (quote foo) ...) errors.
2009-05-21just parse method arguments once.Andy Wingo1-18/+20
* module/oop/goops.scm (method): Tweak to just run through the arguments once. Thanks to Eli Barzilay for the tip.
2009-05-21rewrite `method' as a hygienic macro to re-allow lexical specializersAndy Wingo2-65/+101
* 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.
2009-05-21Make use of Gnulib's `flock' module.Ludovic Courtès1-71/+1
* 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).
2009-05-21Make use of Gnulib's `putenv' module.Ludovic Courtès1-90/+6
* libguile/posix.c: Include <stdlib.h> since the putenv(3) declaration is there (POSIX and Gnulib). (scm_putenv): Rely on Gnulib's `putenv' module.
2009-05-21Add Gnulib portability modules; update Gnulib files.Ludovic Courtès44-283/+3047
* 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).